diff --git a/src/handle_finalize.c b/src/handle_finalize.c index ff2f0e0..667100f 100644 --- a/src/handle_finalize.c +++ b/src/handle_finalize.c @@ -6,7 +6,9 @@ void handle_finalize(void *parameters) { switch (context->selectorIndex) { case ETHX_DEPOSIT: + case ETHX_DEPOSIT_LEGACY: case ETHX_REQUEST_WITHDRAW: + case ETHX_REQUEST_WITHDRAW_LEGACY: msg->numScreens = 2; break; diff --git a/src/handle_init_contract.c b/src/handle_init_contract.c index 8ee3a86..9e5bf5d 100644 --- a/src/handle_init_contract.c +++ b/src/handle_init_contract.c @@ -45,11 +45,13 @@ void handle_init_contract(void *parameters) { // EDIT THIS: Adapt the `cases`, and set the `next_param` to be the first parameter you expect // to parse. switch (context->selectorIndex) { + case ETHX_DEPOSIT_LEGACY: case ETHX_DEPOSIT: context->next_param = ACCOUNT_ADDR; context->ticker = "ETH"; break; + case ETHX_REQUEST_WITHDRAW_LEGACY: case ETHX_REQUEST_WITHDRAW: context->next_param = UNSTAKE_AMOUNT; context->ticker = "ETHX"; diff --git a/src/handle_provide_parameter.c b/src/handle_provide_parameter.c index b0c66f8..a5ca5f9 100644 --- a/src/handle_provide_parameter.c +++ b/src/handle_provide_parameter.c @@ -98,10 +98,12 @@ void handle_provide_parameter(void *parameters) { // EDIT THIS: adapt the cases and the names of the functions. switch (context->selectorIndex) { + case ETHX_DEPOSIT_LEGACY: case ETHX_DEPOSIT: handle_ethx_deposit(msg, context); break; + case ETHX_REQUEST_WITHDRAW_LEGACY: case ETHX_REQUEST_WITHDRAW: handle_ethx_request_withdraw(msg, context); break; diff --git a/src/handle_query_contract_id.c b/src/handle_query_contract_id.c index 0bb30a7..7b435ad 100644 --- a/src/handle_query_contract_id.c +++ b/src/handle_query_contract_id.c @@ -14,6 +14,7 @@ void handle_query_contract_id(void *parameters) { // EDIT THIS: Adapt the cases by modifying the strings you pass to `strlcpy`. switch (context->selectorIndex) { case ETHX_DEPOSIT: + case ETHX_DEPOSIT_LEGACY: case ETH_MATICX_SUBMIT: case POLYGON_CHILDPOOL_SWAP_MATIC_FOR_MATICX_VIA_INSTANT_POOL: case BSC_STAKEMANAGER_DEPOSIT: @@ -22,6 +23,7 @@ void handle_query_contract_id(void *parameters) { break; case ETHX_REQUEST_WITHDRAW: + case ETHX_REQUEST_WITHDRAW_LEGACY: case ETH_MATICX_REQUEST_WITHDRAW: case POLYGON_CHILDPOOL_REQUEST_MATICX_SWAP: case BSC_STAKEMANAGER_REQUEST_WITHDRAW: diff --git a/src/handle_query_contract_ui.c b/src/handle_query_contract_ui.c index 6f3760c..ea8a8ec 100644 --- a/src/handle_query_contract_ui.c +++ b/src/handle_query_contract_ui.c @@ -150,10 +150,12 @@ void handle_query_contract_ui(void *parameters) { break; case ETHX_DEPOSIT: + case ETHX_DEPOSIT_LEGACY: handle_ethx_deposit(msg, context); break; case ETHX_REQUEST_WITHDRAW: + case ETHX_REQUEST_WITHDRAW_LEGACY: handle_ethx_request_withdraw(msg, context); break; diff --git a/src/main.c b/src/main.c index a26575c..6906a18 100644 --- a/src/main.c +++ b/src/main.c @@ -118,6 +118,18 @@ static const uint32_t ETHX_REQUEST_WITHDRAW_SELECTOR = 0x1f7ec122; // Selector: 0x379607f5 static const uint32_t ETHX_CLAIM_SELECTOR = 0x379607f5; +// Network: Ethereum +// Contract: StaderStakePoolsManager +// Method: function deposit(address _receiver) +// Selector: 0xf340fa01 +static const uint32_t ETHX_DEPOSIT_LEGACY_SELECTOR = 0xf340fa01; + +// Network: Ethereum +// Contract: UserWithdrawalManager +// Method: function requestWithdraw(uint256 _ethXAmount, address _owner) +// Selector: 0xccc143b8 +static const uint32_t ETHX_REQUEST_WITHDRAW_LEGACY_SELECTOR = 0xccc143b8; + // Array of all the different staderlabs selectors. Make sure this follows the same order as the // enum defined in `staderlabs_plugin.h` const uint32_t STADERLABS_SELECTORS[NUM_SELECTORS] = { @@ -136,6 +148,8 @@ const uint32_t STADERLABS_SELECTORS[NUM_SELECTORS] = { ETHX_DEPOSIT_SELECTOR, ETHX_REQUEST_WITHDRAW_SELECTOR, ETHX_CLAIM_SELECTOR, + ETHX_DEPOSIT_LEGACY_SELECTOR, + ETHX_REQUEST_WITHDRAW_LEGACY_SELECTOR, }; // Function to dispatch calls from the ethereum app. diff --git a/src/staderlabs_plugin.h b/src/staderlabs_plugin.h index f51c0d6..45e81b1 100644 --- a/src/staderlabs_plugin.h +++ b/src/staderlabs_plugin.h @@ -5,7 +5,7 @@ #include // Number of selectors defined in this plugin. Should match the enum `selector_t`. -#define NUM_SELECTORS 15 +#define NUM_SELECTORS 17 // Name of the plugin. #define PLUGIN_NAME "Staderlabs" @@ -28,6 +28,8 @@ typedef enum { ETHX_DEPOSIT, ETHX_REQUEST_WITHDRAW, ETHX_CLAIM, + ETHX_DEPOSIT_LEGACY, + ETHX_REQUEST_WITHDRAW_LEGACY, } selector_t; // Enumeration used to parse the smart contract data. diff --git a/tests/networks/ethereum/staderlabs/b2c.json b/tests/networks/ethereum/staderlabs/b2c.json index 2f90bf7..0cad120 100644 --- a/tests/networks/ethereum/staderlabs/b2c.json +++ b/tests/networks/ethereum/staderlabs/b2c.json @@ -26,6 +26,11 @@ "address": "0xcf5ea1b38380f6af39068375516daf40ed70d299", "contractName": "StaderStakePoolsManager", "selectors": { + "0xf340fa01": { + "erc20OfInterest": [], + "method": "deposit", + "plugin": "Staderlabs" + }, "0xb7482509": { "erc20OfInterest": [], "method": "deposit", @@ -37,6 +42,11 @@ "address": "0x9f0491b32dbce587c50c4c43ab303b06478193a7", "contractName": "UserWithdrawalManager", "selectors": { + "0xccc143b8": { + "erc20OfInterest": [], + "method": "requestWithdraw", + "plugin": "Staderlabs" + }, "0x1f7ec122": { "erc20OfInterest": [], "method": "requestWithdraw", diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00000.png b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00000.png new file mode 100644 index 0000000..8d84cc7 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00000.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00001.png b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00001.png new file mode 100644 index 0000000..1d263aa Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00001.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00002.png b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00002.png new file mode 100644 index 0000000..4c24343 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00002.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00003.png b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00003.png new file mode 100644 index 0000000..b9738b4 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00003.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00004.png b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00004.png new file mode 100644 index 0000000..62517e8 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00004.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00005.png b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00005.png new file mode 100644 index 0000000..d00ffb9 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00005.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00006.png b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00006.png new file mode 100644 index 0000000..1595331 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00006.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00007.png b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00007.png new file mode 100644 index 0000000..07b4b29 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00007.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00008.png b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00008.png new file mode 100644 index 0000000..095bef4 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00008.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00009.png b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00009.png new file mode 100644 index 0000000..1c9156c Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00009.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00010.png b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00010.png new file mode 100644 index 0000000..ce795f3 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_request_withdraw_eth/00010.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00000.png b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00000.png new file mode 100644 index 0000000..8d84cc7 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00000.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00001.png b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00001.png new file mode 100644 index 0000000..f8d7ed1 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00001.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00002.png b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00002.png new file mode 100644 index 0000000..2322ff5 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00002.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00003.png b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00003.png new file mode 100644 index 0000000..3d2dc64 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00003.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00004.png b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00004.png new file mode 100644 index 0000000..b7e3cac Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00004.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00005.png b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00005.png new file mode 100644 index 0000000..e2cb9fa Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00005.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00006.png b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00006.png new file mode 100644 index 0000000..1595331 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00006.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00007.png b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00007.png new file mode 100644 index 0000000..c135a4b Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00007.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00008.png b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00008.png new file mode 100644 index 0000000..7b71a4d Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00008.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00009.png b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00009.png new file mode 100644 index 0000000..1c9156c Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00009.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00010.png b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00010.png new file mode 100644 index 0000000..ce795f3 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_legacy_stake_eth/00010.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00000.png b/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00000.png new file mode 100644 index 0000000..487ea10 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00000.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00001.png b/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00001.png new file mode 100644 index 0000000..ccdcd19 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00001.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00002.png b/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00002.png new file mode 100644 index 0000000..d89b812 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00002.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00003.png b/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00003.png new file mode 100644 index 0000000..79dcca1 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00003.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00004.png b/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00004.png new file mode 100644 index 0000000..e8276dd Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00004.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00005.png b/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00005.png new file mode 100644 index 0000000..570ce28 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00005.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00006.png b/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00006.png new file mode 100644 index 0000000..a58590b Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_legacy_request_withdraw_eth/00006.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00000.png b/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00000.png new file mode 100644 index 0000000..487ea10 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00000.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00001.png b/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00001.png new file mode 100644 index 0000000..6767056 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00001.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00002.png b/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00002.png new file mode 100644 index 0000000..2438285 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00002.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00003.png b/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00003.png new file mode 100644 index 0000000..1d2f308 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00003.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00004.png b/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00004.png new file mode 100644 index 0000000..e5979a2 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00004.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00005.png b/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00005.png new file mode 100644 index 0000000..570ce28 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00005.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00006.png b/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00006.png new file mode 100644 index 0000000..a58590b Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_legacy_stake_eth/00006.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00000.png b/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00000.png new file mode 100644 index 0000000..487ea10 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00000.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00001.png b/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00001.png new file mode 100644 index 0000000..911e699 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00001.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00002.png b/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00002.png new file mode 100644 index 0000000..30f0cec Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00002.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00003.png b/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00003.png new file mode 100644 index 0000000..79dcca1 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00003.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00004.png b/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00004.png new file mode 100644 index 0000000..f30afe2 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00004.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00005.png b/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00005.png new file mode 100644 index 0000000..570ce28 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00005.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00006.png b/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00006.png new file mode 100644 index 0000000..6578872 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_legacy_request_withdraw_eth/00006.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00000.png b/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00000.png new file mode 100644 index 0000000..487ea10 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00000.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00001.png b/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00001.png new file mode 100644 index 0000000..fff06c7 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00001.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00002.png b/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00002.png new file mode 100644 index 0000000..41f278c Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00002.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00003.png b/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00003.png new file mode 100644 index 0000000..1d2f308 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00003.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00004.png b/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00004.png new file mode 100644 index 0000000..e4e5c5d Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00004.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00005.png b/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00005.png new file mode 100644 index 0000000..570ce28 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00005.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00006.png b/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00006.png new file mode 100644 index 0000000..6578872 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_legacy_stake_eth/00006.png differ diff --git a/tests/src/eth/ethx/deposit_legacy.test.js b/tests/src/eth/ethx/deposit_legacy.test.js new file mode 100644 index 0000000..e00487d --- /dev/null +++ b/tests/src/eth/ethx/deposit_legacy.test.js @@ -0,0 +1,42 @@ +import "core-js/stable"; +import "regenerator-runtime"; +import { + waitForAppScreen, + zemu, + nano_models, + serializeTx, + txFromEtherscan, +} from "../../test.fixture"; + +const contractAddr = "0xcf5ea1b38380f6af39068375516daf40ed70d299"; +const pluginName = "staderlabs"; +const testNetwork = "ethereum"; +const chainID = 1; +// Test from replayed transaction: https://etherscan.io/tx/0x4e771017864ff34176c8c9fa62fe1950852933345f921dc5316c63554c9bc453 +const inputData = + "0x02f8980113850550de54dd850550de54dd8301c88a94cf5ea1b38380f6af39068375516daf40ed70d29987038d7ea4c68000a4f340fa01000000000000000000000000ad345b348bd84a4b42a5fde63feb7a29ef2af4e9c080a0a3adf22f4ce9fead664befb0ca33730f3bb8edb1a1d65a7f5275ac9a8622d29ea01a99e171740d723ee61049d7f0465f4e219fca86aaddf06bab02d3400f554242"; + +nano_models.forEach(function (model) { + test( + "[Nano " + model.letter + "] Legacy Deposit ETH", + zemu(model, async (sim, eth) => { + const serializedTx = txFromEtherscan(inputData); + + const tx = eth.signTransaction("44'/60'/0'/0", serializedTx); + + const right_clicks = model.letter === "S" ? 9 : 5; + + // Wait for the application to actually load and parse the transaction + await waitForAppScreen(sim); + // Navigate the display by pressing the right button `right_clicks` times, then pressing both buttons to accept the transaction. + await sim.navigateAndCompareSnapshots( + ".", + testNetwork + "_ethx_" + model.name + "_legacy_stake_eth", + [right_clicks, 0] + ); + + await tx; + }), + 50000 + ); +}); diff --git a/tests/src/eth/ethx/withdraw_legacy.test.js b/tests/src/eth/ethx/withdraw_legacy.test.js new file mode 100644 index 0000000..48ded2f --- /dev/null +++ b/tests/src/eth/ethx/withdraw_legacy.test.js @@ -0,0 +1,42 @@ +import "core-js/stable"; +import "regenerator-runtime"; +import { + waitForAppScreen, + zemu, + nano_models, + serializeTx, + txFromEtherscan, +} from "../../test.fixture"; + +const contractAddr = "0xcf5ea1b38380f6af39068375516daf40ed70d299"; +const pluginName = "staderlabs"; +const testNetwork = "ethereum"; +const chainID = 1; +// Test from replayed transaction: https://etherscan.io/tx/0xa7b2f78c84bc5528629d37b56856d47601c42f4d7f1505fa6767bcd090fb5044 +const inputData = + "0x02f8b30182059585053f837bd185053f837bd18304d7be949f0491b32dbce587c50c4c43ab303b06478193a780b844ccc143b80000000000000000000000000000000000000000000000056a30e2758fb0a40000000000000000000000000087bc2f2ba8c83f412fed5c3151de0ffbdc959984c080a01bf62d962c7e2d888df40f0a61dd9eb6c60ed01e1291ce15b9acbad154e0cf619fc470d4477df1e52cb4030e2f976dc13856d09010d164dd97a5532d59b9d413"; + +nano_models.forEach(function (model) { + test( + "[Nano " + model.letter + "] Legacy Request Withdraw ETH", + zemu(model, async (sim, eth) => { + const serializedTx = txFromEtherscan(inputData); + + const tx = eth.signTransaction("44'/60'/0'/0", serializedTx); + + const right_clicks = model.letter === "S" ? 9 : 5; + + // Wait for the application to actually load and parse the transaction + await waitForAppScreen(sim); + // Navigate the display by pressing the right button `right_clicks` times, then pressing both buttons to accept the transaction. + await sim.navigateAndCompareSnapshots( + ".", + testNetwork + "_ethx_" + model.name + "_legacy_request_withdraw_eth", + [right_clicks, 0] + ); + + await tx; + }), + 50000 + ); +});