Skip to content

Commit

Permalink
Fix I4
Browse files Browse the repository at this point in the history
  • Loading branch information
shahthepro committed Jan 23, 2024
1 parent 9b52060 commit 216fef5
Show file tree
Hide file tree
Showing 21 changed files with 36 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/handle_provide_parameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,19 +249,25 @@ static void handle_curve_router_exchange(ethPluginProvideParameter_t *msg, conte
context->next_param = TOKEN_RECEIVED;
break;
case TOKEN_RECEIVED:
PRINTF("Counter: %d\n", context->counter);
context->counter += 1;
if (memcmp(&msg->parameter[PARAMETER_LENGTH - ADDRESS_LENGTH],
if (context->counter % 2 == 0) {
handle_token_received(msg, context);
if (context->counter == 8) {
context->skip += 20 - context->counter;
context->counter = 0;
context->next_param = AMOUNT_SENT;
} else {
context->next_param = TOKEN_RECEIVED;
}
} else if (memcmp(&msg->parameter[PARAMETER_LENGTH - ADDRESS_LENGTH],
NULL_ETH_ADDRESS,
ADDRESS_LENGTH) == 0) {
context->skip += 20 - context->counter;
context->counter = 0;
context->next_param = AMOUNT_SENT;
} else {
handle_token_received(msg, context);
context->next_param = TOKEN_RECEIVED;
}
break;

case AMOUNT_SENT:
handle_amount_sent(msg, context);
context->next_param = MIN_AMOUNT_RECEIVED;
Expand Down
25 changes: 25 additions & 0 deletions tests/oeth/test_oeth_curve_swap.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,29 @@ def test_oeth_curve_swap_multiple_oeth_to_eth(backend, firmware, navigator, test
Web3.to_wei(0.941, "ether"),
])

run_test(contract_curve_router, data, backend, firmware, navigator, test_name)

def test_oeth_curve_swap_multiple_eth_to_oeth_diff_route(backend, firmware, navigator, test_name):
data = contract_curve_router.encodeABI("exchange_multiple", [
[
bytes.fromhex("eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"),
bytes.fromhex("94b17476a93b3262d87b9a326965d1e91f9c13e7"),
bytes.fromhex("94b17476a93b3262d87b9a326965d1e91f9c13e7"),
bytes.fromhex("94b17476a93b3262d87b9a326965d1e91f9c13e7"),
bytes.fromhex("94b17476a93b3262d87b9a326965d1e91f9c13e7"),
bytes.fromhex("94b17476a93b3262d87b9a326965d1e91f9c13e7"),
bytes.fromhex("94b17476a93b3262d87b9a326965d1e91f9c13e7"),
bytes.fromhex("94b17476a93b3262d87b9a326965d1e91f9c13e7"),
bytes.fromhex("856c4Efb76C1D1AE02e20CEB03A2A6a08b0b8dC3"),
],
[
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
],
Web3.to_wei(1, "ether"),
Web3.to_wei(0.941, "ether"),
])

run_test(contract_curve_router, data, backend, firmware, navigator, test_name)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 216fef5

Please sign in to comment.