diff --git a/.github/workflows/check_sdk.yml b/.github/workflows/check_sdk.yml new file mode 100644 index 0000000..2f9f754 --- /dev/null +++ b/.github/workflows/check_sdk.yml @@ -0,0 +1,40 @@ +name: Check SDK submodule version + +on: + workflow_dispatch: + push: + branches: + - master + - develop + pull_request: + +jobs: + job_check_SDK: + name: Check Ethereum plugin SDK submodule is up-to-date + runs-on: ubuntu-latest + steps: + - name: Clone plugin + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Clone SDK + uses: actions/checkout@v3 + with: + repository: LedgerHQ/ethereum-plugin-sdk + path: plugin-sdk + ref: ${{ github.base_ref || github.ref_name }} + - name: Comparing the SDK hash values + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + REPO_SDK_HASH=$(git submodule status | grep sdk | cut -d ' ' -f2) + echo "SDK submodule hash: ${REPO_SDK_HASH} (checked out from '${{ github.base_ref || github.ref_name }}')" + CURRENT_SDK_HASH=$(cd ./plugin-sdk/ && git rev-parse HEAD) + echo "SDK submodule hash: ${CURRENT_SDK_HASH}" + if [ ${REPO_SDK_HASH} = ${CURRENT_SDK_HASH} ] + then + echo "SDK versions match!" + exit 0 + else + echo "SDK versions mismatch!" + exit 1 + fi diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 1b82da9..bae98db 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -38,6 +38,27 @@ jobs: run: | make BOLOS_SDK=${{ matrix.sdk }} -j + job_scan_build: + name: Clang Static Analyzer + runs-on: ubuntu-latest + container: + image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Build with Clang Static Analyzer + run: | + scan-build --use-cc=clang -analyze-headers -enable-checker security -enable-checker unix -enable-checker valist -o scan-build --status-bugs make default + + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: scan-build + path: scan-build + job_build_debug_plugin: name: Build debug plugin strategy: diff --git a/.github/workflows/guidelines_enforcer.yml b/.github/workflows/guidelines_enforcer.yml new file mode 100644 index 0000000..fdaf9f2 --- /dev/null +++ b/.github/workflows/guidelines_enforcer.yml @@ -0,0 +1,23 @@ +name: Ensure compliance with Ledger guidelines + +# This workflow is mandatory in all applications +# It calls a reusable workflow guidelines_enforcer developed by Ledger's internal developer team. +# The successful completion of the reusable workflow is a mandatory step for an app to be available on the Ledger +# application store. +# +# More information on the guidelines can be found in the repository: +# LedgerHQ/ledger-app-workflows/ + +on: + workflow_dispatch: + push: + branches: + - master + - main + - develop + pull_request: + +jobs: + guidelines_enforcer: + name: Call Ledger guidelines_enforcer + uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_guidelines_enforcer.yml@v1 diff --git a/Makefile b/Makefile index 4c0af6d..f0d0e64 100755 --- a/Makefile +++ b/Makefile @@ -1,19 +1,19 @@ -#******************************************************************************* -# Ledger App -# (c) 2017 Ledger +# **************************************************************************** +# Ledger App +# (c) 2023 Ledger SAS. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#******************************************************************************* +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# **************************************************************************** ifeq ($(BOLOS_SDK),) $(error Environment variable BOLOS_SDK is not set) @@ -21,150 +21,110 @@ endif include $(BOLOS_SDK)/Makefile.defines +######################################## +# Mandatory configuration # +######################################## +# Application name APPNAME = "Staderlabs" -ifeq ($(ETHEREUM_PLUGIN_SDK),) -ETHEREUM_PLUGIN_SDK=ethereum-plugin-sdk -endif - -APP_LOAD_PARAMS += --appFlags 0x800 --path "44'/60'" --curve secp256k1 - -APP_LOAD_PARAMS += $(COMMON_LOAD_PARAMS) - -APPVERSION_M = 1 -APPVERSION_N = 0 -APPVERSION_P = 1 -APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)" - -ifeq ($(TARGET_NAME), TARGET_NANOS) -ICONNAME=icons/nanos_app_staderlabs.gif -else ifeq ($(TARGET_NAME), TARGET_STAX) -ICONNAME=icons/stax_app_staderlabs.gif -DEFINES += ICONGLYPH=C_stax_staderlabs_64px -DEFINES += ICONBITMAP=C_stax_staderlabs_64px_bitmap -GLYPH_FILES += $(ICONNAME) -else -ICONNAME=icons/nanox_app_staderlabs.gif -endif - -################ -# Default rule # -################ -all: default - -############ -# Platform # -############ - -DEFINES += OS_IO_SEPROXYHAL -DEFINES += HAVE_SPRINTF -DEFINES += LEDGER_MAJOR_VERSION=$(APPVERSION_M) LEDGER_MINOR_VERSION=$(APPVERSION_N) LEDGER_PATCH_VERSION=$(APPVERSION_P) -DEFINES += IO_HID_EP_LENGTH=64 - -DEFINES += UNUSED\(x\)=\(void\)x -DEFINES += APPVERSION=\"$(APPVERSION)\" -CFLAGS += -DAPPNAME=\"$(APPNAME)\" - -ifneq (,$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX)) -DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000 -DEFINES += HAVE_BLE_APDU # basic ledger apdu transport over BLE -endif - -ifeq ($(TARGET_NAME),TARGET_NANOS) -DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128 -else -DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300 -endif - -ifneq ($(TARGET_NAME),TARGET_STAX) -DEFINES += HAVE_BAGL -ifneq ($(TARGET_NAME),TARGET_NANOS) -DEFINES += HAVE_GLO096 -DEFINES += HAVE_BAGL BAGL_WIDTH=128 BAGL_HEIGHT=64 -DEFINES += HAVE_BAGL_ELLIPSIS # long label truncation feature -DEFINES += HAVE_BAGL_FONT_OPEN_SANS_REGULAR_11PX -DEFINES += HAVE_BAGL_FONT_OPEN_SANS_EXTRABOLD_11PX -DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX -DEFINES += HAVE_UX_FLOW -endif -endif +# Application version +APPVERSION_M = 1 +APPVERSION_N = 1 +APPVERSION_P = 0 +APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)" -# Enabling debug PRINTF -ifneq ($(DEBUG),0) - DEFINES += HAVE_STACK_OVERFLOW_CHECK - SDK_SOURCE_PATH += lib_stusb lib_stusb_impl - DEFINES += HAVE_IO_USB HAVE_L4_USBLIB IO_USB_MAX_ENDPOINTS=4 IO_HID_EP_LENGTH=64 HAVE_USB_APDU - - ifeq ($(DEBUG),10) - $(warning Using semihosted PRINTF. Only run with speculos!) - CFLAGS += -include src/dbg/debug.h - DEFINES += HAVE_PRINTF PRINTF=semihosted_printf - else - ifeq ($(TARGET_NAME),TARGET_NANOS) - DEFINES += HAVE_PRINTF PRINTF=screen_printf - else - DEFINES += HAVE_PRINTF PRINTF=mcu_usb_printf - endif - - endif -else - DEFINES += PRINTF\(...\)= -endif - -############## -# Compiler # -############## -ifneq ($(BOLOS_ENV),) -$(info BOLOS_ENV=$(BOLOS_ENV)) -CLANGPATH := $(BOLOS_ENV)/clang-arm-fropi/bin/ -GCCPATH := $(BOLOS_ENV)/gcc-arm-none-eabi-5_3-2016q1/bin/ -else -$(info BOLOS_ENV is not set: falling back to CLANGPATH and GCCPATH) -endif -ifeq ($(CLANGPATH),) -$(info CLANGPATH is not set: clang will be used from PATH) -endif -ifeq ($(GCCPATH),) -$(info GCCPATH is not set: arm-none-eabi-* will be used from PATH) -endif - -CC := $(CLANGPATH)clang - -AS := $(GCCPATH)arm-none-eabi-gcc - -LD := $(GCCPATH)arm-none-eabi-gcc -LDLIBS += -lm -lgcc -lc - -# import rules to compile glyphs(/pone) -include $(BOLOS_SDK)/Makefile.glyphs - -### variables processed by the common makefile.rules of the SDK to grab source files and include dirs -APP_SOURCE_PATH += src $(ETHEREUM_PLUGIN_SDK) -ifneq ($(TARGET_NAME), TARGET_STAX) -SDK_SOURCE_PATH += lib_ux -endif -ifneq (,$(findstring HAVE_BLE,$(DEFINES))) -SDK_SOURCE_PATH += lib_blewbxx lib_blewbxx_impl -endif - -### initialize plugin SDK submodule if needed +# Initialize plugin SDK submodule if needed ifneq ($(shell git submodule status | grep '^[-+]'),) $(info INFO: Need to reinitialize git submodules) $(shell git submodule update --init) endif -load: all - python3 -m ledgerblue.loadApp $(APP_LOAD_PARAMS) - -delete: - python3 -m ledgerblue.deleteApp $(COMMON_DELETE_PARAMS) +ifeq ($(ETHEREUM_PLUGIN_SDK),) +ETHEREUM_PLUGIN_SDK=ethereum-plugin-sdk +endif -# import generic rules from the sdk -include $(BOLOS_SDK)/Makefile.rules +# Application source files +APP_SOURCE_PATH += src $(ETHEREUM_PLUGIN_SDK) +# Application icons following guidelines: +# https://developers.ledger.com/docs/embedded-app/design-requirements/#device-icon +ICON_ID = $(shell echo -n "$(APPNAME)" | tr " " "_" | tr "[:upper:]" "[:lower:]") +ICON_NANOS = icons/nanos_app_$(ICON_ID).gif +ICON_NANOX = icons/nanox_app_$(ICON_ID).gif +ICON_NANOSP = $(ICON_NANOX) +ICON_STAX = icons/stax_app_$(ICON_ID).gif -#add dependency on custom makefile filename -dep/%.d: %.c Makefile +ifeq ($(TARGET_NAME),TARGET_STAX) + DEFINES += ICONGLYPH=C_stax_$(ICON_ID)_64px + DEFINES += ICONBITMAP=C_stax_$(ICON_ID)_64px_bitmap +endif -listvariants: - @echo VARIANTS NONE staderlabs +# Application allowed derivation curves. +# Possibles curves are: secp256k1, secp256r1, ed25519 and bls12381g1 +# If your app needs it, you can specify multiple curves by using: +# `CURVE_APP_LOAD_PARAMS = ` +CURVE_APP_LOAD_PARAMS = secp256k1 + +# Application allowed derivation paths. +# You should request a specific path for your app. +# This serve as an isolation mechanism. +# Most application will have to request a path according to the BIP-0044 +# and SLIP-0044 standards. +# If your app needs it, you can specify multiple path by using: +# `PATH_APP_LOAD_PARAMS = "44'/1'" "45'/1'"` +PATH_APP_LOAD_PARAMS = "44'/60'" # purpose=coin(44) / coin_type=Testnet(1) + +# Setting to allow building variant applications +# - is the name of the parameter which should be set +# to specify the variant that should be build. +# - a list of variant that can be build using this app code. +# * It must at least contains one value. +# * Values can be the app ticker or anything else but should be unique. +VARIANT_PARAM = COIN +VARIANT_VALUES = staderlabs + +# Enabling DEBUG flag will enable PRINTF and disable optimizations +#DEBUG = 1 + +######################################## +# Application custom permissions # +######################################## +# See SDK `include/appflags.h` for the purpose of each permission +#HAVE_APPLICATION_FLAG_DERIVE_MASTER = 1 +#HAVE_APPLICATION_FLAG_GLOBAL_PIN = 1 +#HAVE_APPLICATION_FLAG_BOLOS_SETTINGS = 1 +HAVE_APPLICATION_FLAG_LIBRARY = 1 + +######################################## +# Application communication interfaces # +######################################## +#ENABLE_BLUETOOTH = 1 +#ENABLE_NFC = 1 + +######################################## +# NBGL custom features # +######################################## +#ENABLE_NBGL_QRCODE = 1 +#ENABLE_NBGL_KEYBOARD = 1 +#ENABLE_NBGL_KEYPAD = 1 + +######################################## +# Features disablers # +######################################## +# These advanced settings allow to disable some feature that are by +# default enabled in the SDK `Makefile.standard_app`. + +DISABLE_STANDARD_APP_FILES = 1 + +# To allow custom size declaration +#DISABLE_DEFAULT_IO_SEPROXY_BUFFER_SIZE = 1 + +# Will set all the following disablers +#DISABLE_STANDARD_APP_DEFINES = 1 + +DISABLE_STANDARD_SNPRINTF = 1 +#DISABLE_STANDARD_USB = 1 +DISABLE_STANDARD_WEBUSB = 1 +DISABLE_STANDARD_BAGL_UX_FLOW = 1 + +include $(BOLOS_SDK)/Makefile.standard_app diff --git a/README.md b/README.md index 24f01d8..f5b1264 100644 --- a/README.md +++ b/README.md @@ -25,12 +25,14 @@ Need more information about the interface, the architecture, or general stuff ab Smart contracts covered by this plugin are: -| Network | Contract Name | Smart Contract | -| -------- | ------------- | -------------------------------------------- | -| Ethereum | MaticX | `0xf03a7eb46d01d9ecaa104558c732cf82f6b6b645` | -| Polygon | ChildPool | `0xfd225c9e6601c9d38d8f98d8731bf59efcf8c0e3` | -| BSC | StakeManager | `0x7276241a669489E4BBB76f63d2A43Bfe63080F2F` | -| Fantom | FTMStaking | `0xb458bfc855ab504a8a327720fcef98886065529b` | +| Network | Contract Name | Smart Contract | +| -------- | ----------------------- | -------------------------------------------- | +| Ethereum | MaticX | `0xf03a7eb46d01d9ecaa104558c732cf82f6b6b645` | +| Polygon | ChildPool | `0xfd225c9e6601c9d38d8f98d8731bf59efcf8c0e3` | +| BSC | StakeManager | `0x7276241a669489E4BBB76f63d2A43Bfe63080F2F` | +| Fantom | FTMStaking | `0xb458bfc855ab504a8a327720fcef98886065529b` | +| Ethereum | StaderStakePoolsManager | `0xcf5ea1b38380f6af39068375516daf40ed70d299` | +| Ethereum | UserWithdrawalManager | `0x9f0491b32dbce587c50c4c43ab303b06478193a7` | ## Build diff --git a/icons/nanos_app_staderlabs.gif b/icons/nanos_app_staderlabs.gif index 34ea6c6..db8b785 100644 Binary files a/icons/nanos_app_staderlabs.gif and b/icons/nanos_app_staderlabs.gif differ diff --git a/icons/nanox_app_staderlabs.gif b/icons/nanox_app_staderlabs.gif index 5e6d644..73f2f32 100644 Binary files a/icons/nanox_app_staderlabs.gif and b/icons/nanox_app_staderlabs.gif differ diff --git a/icons/stax_app_staderlabs.gif b/icons/stax_app_staderlabs.gif index 11a2f1d..e6195bf 100644 Binary files a/icons/stax_app_staderlabs.gif and b/icons/stax_app_staderlabs.gif differ diff --git a/icons/stax_app_staderlabs_64px.gif b/icons/stax_app_staderlabs_64px.gif new file mode 100644 index 0000000..5d012d0 Binary files /dev/null and b/icons/stax_app_staderlabs_64px.gif differ diff --git a/src/handle_finalize.c b/src/handle_finalize.c index cb65fd9..ff2f0e0 100644 --- a/src/handle_finalize.c +++ b/src/handle_finalize.c @@ -2,8 +2,19 @@ void handle_finalize(void *parameters) { ethPluginFinalize_t *msg = (ethPluginFinalize_t *) parameters; + context_t *context = (context_t *) msg->pluginContext; + switch (context->selectorIndex) { + case ETHX_DEPOSIT: + case ETHX_REQUEST_WITHDRAW: + msg->numScreens = 2; + break; + + default: + msg->numScreens = 1; + break; + } msg->uiType = ETH_UI_TYPE_GENERIC; - msg->numScreens = 1; + msg->result = ETH_PLUGIN_RESULT_OK; } diff --git a/src/handle_init_contract.c b/src/handle_init_contract.c index 7113870..8ee3a86 100644 --- a/src/handle_init_contract.c +++ b/src/handle_init_contract.c @@ -45,6 +45,21 @@ 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: + context->next_param = ACCOUNT_ADDR; + context->ticker = "ETH"; + break; + + case ETHX_REQUEST_WITHDRAW: + context->next_param = UNSTAKE_AMOUNT; + context->ticker = "ETHX"; + break; + + case ETHX_CLAIM: + context->next_param = UNEXPECTED_PARAMETER; + context->ticker = "ETH"; + break; + case ETH_MATICX_SUBMIT: context->next_param = STAKE_AMOUNT; context->ticker = "MATIC"; diff --git a/src/handle_provide_parameter.c b/src/handle_provide_parameter.c index 1f2a7d7..f9b526b 100644 --- a/src/handle_provide_parameter.c +++ b/src/handle_provide_parameter.c @@ -42,6 +42,39 @@ static void handle_unstake(ethPluginProvideParameter_t *msg, context_t *context) } } +static void handle_ethx_deposit(ethPluginProvideParameter_t *msg, context_t *context) { + switch (context->next_param) { + case ACCOUNT_ADDR: + copy_address(context->account_addr, msg->parameter, sizeof(context->account_addr)); + context->next_param = UNEXPECTED_PARAMETER; + break; + + // Keep this + default: + handle_unsupported_param(msg, context); + break; + } +} + +static void handle_ethx_request_withdraw(ethPluginProvideParameter_t *msg, context_t *context) { + switch (context->next_param) { + case UNSTAKE_AMOUNT: + handle_amount_received(msg, context); + context->next_param = ACCOUNT_ADDR; + break; + + case ACCOUNT_ADDR: + copy_address(context->account_addr, msg->parameter, sizeof(context->account_addr)); + context->next_param = UNEXPECTED_PARAMETER; + break; + + // Keep this + default: + handle_unsupported_param(msg, context); + break; + } +} + void handle_provide_parameter(void *parameters) { ethPluginProvideParameter_t *msg = (ethPluginProvideParameter_t *) parameters; context_t *context = (context_t *) msg->pluginContext; @@ -57,6 +90,14 @@ void handle_provide_parameter(void *parameters) { // EDIT THIS: adapt the cases and the names of the functions. switch (context->selectorIndex) { + case ETHX_DEPOSIT: + handle_ethx_deposit(msg, context); + break; + + case ETHX_REQUEST_WITHDRAW: + handle_ethx_request_withdraw(msg, context); + break; + case ETH_MATICX_SUBMIT: handle_stake(msg, context); break; @@ -68,6 +109,7 @@ void handle_provide_parameter(void *parameters) { handle_unstake(msg, context); break; + case ETHX_CLAIM: case ETH_MATICX_CLAIM_WITHDRAWAL: case POLYGON_CHILDPOOL_SWAP_MATIC_FOR_MATICX_VIA_INSTANT_POOL: case POLYGON_CHILDPOOL_CLAIM_MATICX_SWAP: diff --git a/src/handle_query_contract_id.c b/src/handle_query_contract_id.c index e8b6c34..0bb30a7 100644 --- a/src/handle_query_contract_id.c +++ b/src/handle_query_contract_id.c @@ -9,10 +9,11 @@ void handle_query_contract_id(void *parameters) { // For the first screen, display the plugin name. strlcpy(msg->name, PLUGIN_NAME, msg->nameLength); - char *msgVersion; + const char *msgVersion; // EDIT THIS: Adapt the cases by modifying the strings you pass to `strlcpy`. switch (context->selectorIndex) { + case ETHX_DEPOSIT: case ETH_MATICX_SUBMIT: case POLYGON_CHILDPOOL_SWAP_MATIC_FOR_MATICX_VIA_INSTANT_POOL: case BSC_STAKEMANAGER_DEPOSIT: @@ -20,6 +21,7 @@ void handle_query_contract_id(void *parameters) { msgVersion = "Stake"; break; + case ETHX_REQUEST_WITHDRAW: case ETH_MATICX_REQUEST_WITHDRAW: case POLYGON_CHILDPOOL_REQUEST_MATICX_SWAP: case BSC_STAKEMANAGER_REQUEST_WITHDRAW: @@ -27,6 +29,7 @@ void handle_query_contract_id(void *parameters) { msgVersion = "Unstake"; break; + case ETHX_CLAIM: case ETH_MATICX_CLAIM_WITHDRAWAL: case POLYGON_CHILDPOOL_CLAIM_MATICX_SWAP: case BSC_STAKEMANAGER_CLAIM_WITHDRAW: diff --git a/src/handle_query_contract_ui.c b/src/handle_query_contract_ui.c index 9173003..6f3760c 100644 --- a/src/handle_query_contract_ui.c +++ b/src/handle_query_contract_ui.c @@ -53,6 +53,63 @@ static void set_claim_ui(ethQueryContractUI_t *msg, const context_t *context) { strlcpy(msg->msg, context->ticker, msg->msgLength); } +static void set_account_addr_ui(ethQueryContractUI_t *msg, context_t *context) { + // Prefix the address with `0x`. + msg->msg[0] = '0'; + msg->msg[1] = 'x'; + + // We need a random chainID for legacy reasons with `getEthAddressStringFromBinary`. + // Setting it to `0` means it works with any chainID :) + uint64_t chainid = 0; + + // Get the string format of the address stored in `context->beneficiary`. Store it in + // `msg->msg`. + getEthAddressStringFromBinary( + context->account_addr, + (char *) msg->msg + 2, // +2 because we've already prefixed with '0x'. + msg->pluginSharedRW->sha3, // Used by the function to calculate the hash + chainid); +} + +static void handle_ethx_deposit(ethQueryContractUI_t *msg, context_t *context) { + memset(msg->title, 0, msg->titleLength); + memset(msg->msg, 0, msg->msgLength); + + switch (msg->screenIndex) { + case 0: + set_native_token_stake_ui(msg, context); + break; + case 1: + strlcpy(msg->title, "Receiver", msg->titleLength); + set_account_addr_ui(msg, context); + break; + + default: + PRINTF("Received an invalid screenIndex\n"); + msg->result = ETH_PLUGIN_RESULT_ERROR; + return; + } +} + +static void handle_ethx_request_withdraw(ethQueryContractUI_t *msg, context_t *context) { + memset(msg->title, 0, msg->titleLength); + memset(msg->msg, 0, msg->msgLength); + switch (msg->screenIndex) { + case 0: + set_unstake_ui(msg, context); + break; + case 1: + strlcpy(msg->title, "Receiver", msg->titleLength); + set_account_addr_ui(msg, context); + break; + + default: + PRINTF("Received an invalid screenIndex\n"); + msg->result = ETH_PLUGIN_RESULT_ERROR; + return; + } +} + void handle_query_contract_ui(void *parameters) { ethQueryContractUI_t *msg = (ethQueryContractUI_t *) parameters; context_t *context = (context_t *) msg->pluginContext; @@ -64,13 +121,7 @@ void handle_query_contract_ui(void *parameters) { memset(msg->title, 0, msg->titleLength); memset(msg->msg, 0, msg->msgLength); - // if value of screenIndex is not 0, then it is invalid as we require only one screen in all - // methods - if (msg->screenIndex) { - PRINTF("Received an invalid screenIndex\n"); - msg->result = ETH_PLUGIN_RESULT_ERROR; - return; - } + msg->result = ETH_PLUGIN_RESULT_OK; switch (context->selectorIndex) { case ETH_MATICX_SUBMIT: @@ -84,6 +135,7 @@ void handle_query_contract_ui(void *parameters) { set_unstake_ui(msg, context); break; + case ETHX_CLAIM: case ETH_MATICX_CLAIM_WITHDRAWAL: case POLYGON_CHILDPOOL_CLAIM_MATICX_SWAP: case BSC_STAKEMANAGER_CLAIM_WITHDRAW: @@ -97,10 +149,17 @@ void handle_query_contract_ui(void *parameters) { set_native_token_stake_ui(msg, context); break; + case ETHX_DEPOSIT: + handle_ethx_deposit(msg, context); + break; + + case ETHX_REQUEST_WITHDRAW: + handle_ethx_request_withdraw(msg, context); + break; + default: PRINTF("Selector index: %d not supported\n", context->selectorIndex); msg->result = ETH_PLUGIN_RESULT_ERROR; return; } - msg->result = ETH_PLUGIN_RESULT_OK; } diff --git a/src/main.c b/src/main.c index 47fa4fc..9bd736b 100644 --- a/src/main.c +++ b/src/main.c @@ -100,6 +100,24 @@ static const uint32_t FTM_UNDELEGATE_SELECTOR = 0x4f864df4; // Selector: 0x441a3e70 static const uint32_t FTM_WITHDRAW_SELECTOR = 0x441a3e70; +// Network: Ethereum +// Contract: StaderStakePoolsManager +// Method: function deposit(address _receiver) +// Selector: 0xf340fa01 +static const uint32_t ETHX_DEPOSIT_SELECTOR = 0xf340fa01; + +// Network: Ethereum +// Contract: UserWithdrawalManager +// Method: function requestWithdraw(uint256 _ethXAmount, address _owner) +// Selector: 0xccc143b8 +static const uint32_t ETHX_REQUEST_WITHDRAW_SELECTOR = 0xccc143b8; + +// Network: Ethereum +// Contract: UserWithdrawalManager +// Method: function claim(uint256 _requestId) +// Selector: 0x379607f5 +static const uint32_t ETHX_CLAIM_SELECTOR = 0x379607f5; + // 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] = { @@ -115,6 +133,9 @@ const uint32_t STADERLABS_SELECTORS[NUM_SELECTORS] = { FTM_DEPOSIT_SELECTOR, FTM_UNDELEGATE_SELECTOR, FTM_WITHDRAW_SELECTOR, + ETHX_DEPOSIT_SELECTOR, + ETHX_REQUEST_WITHDRAW_SELECTOR, + ETHX_CLAIM_SELECTOR, }; // Function to dispatch calls from the ethereum app. diff --git a/src/staderlabs_plugin.h b/src/staderlabs_plugin.h index 532fbca..f51c0d6 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 12 +#define NUM_SELECTORS 15 // Name of the plugin. #define PLUGIN_NAME "Staderlabs" @@ -24,13 +24,17 @@ typedef enum { BSC_STAKEMANAGER_CLAIM_WITHDRAW, FTM_DEPOSIT, FTM_UNDELEGATE, - FTM_WITHDRAW + FTM_WITHDRAW, + ETHX_DEPOSIT, + ETHX_REQUEST_WITHDRAW, + ETHX_CLAIM, } selector_t; // Enumeration used to parse the smart contract data. typedef enum { STAKE_AMOUNT = 0, UNSTAKE_AMOUNT, + ACCOUNT_ADDR, UNEXPECTED_PARAMETER, } parameter; @@ -40,7 +44,8 @@ extern const uint32_t STADERLABS_SELECTORS[NUM_SELECTORS]; typedef struct context_t { // For display. uint8_t amount_received[INT256_LENGTH]; - char *ticker; + const char *ticker; + uint8_t account_addr[ADDRESS_LENGTH]; // For parsing data. uint8_t next_param; // Set to be the next param we expect to parse. diff --git a/tests/networks/ethereum/staderlabs/abis/0x9f0491b32dbce587c50c4c43ab303b06478193a7.json b/tests/networks/ethereum/staderlabs/abis/0x9f0491b32dbce587c50c4c43ab303b06478193a7.json new file mode 100644 index 0000000..f1d3761 --- /dev/null +++ b/tests/networks/ethereum/staderlabs/abis/0x9f0491b32dbce587c50c4c43ab303b06478193a7.json @@ -0,0 +1,518 @@ +[ + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, + { "inputs": [], "name": "CallerNotAuthorizedToRedeem", "type": "error" }, + { "inputs": [], "name": "CallerNotManager", "type": "error" }, + { "inputs": [], "name": "CannotFindRequestId", "type": "error" }, + { "inputs": [], "name": "ETHTransferFailed", "type": "error" }, + { "inputs": [], "name": "InSufficientBalance", "type": "error" }, + { "inputs": [], "name": "InvalidWithdrawAmount", "type": "error" }, + { + "inputs": [], + "name": "MaxLimitOnWithdrawRequestCountReached", + "type": "error" + }, + { "inputs": [], "name": "ProtocolNotHealthy", "type": "error" }, + { + "inputs": [ + { "internalType": "uint256", "name": "_requestId", "type": "uint256" } + ], + "name": "RequestAlreadyRedeemed", + "type": "error" + }, + { "inputs": [], "name": "UnsupportedOperationInSafeMode", "type": "error" }, + { "inputs": [], "name": "ZeroAddress", "type": "error" }, + { "inputs": [], "name": "ZeroAddressReceived", "type": "error" }, + { + "inputs": [ + { "internalType": "uint256", "name": "_requestId", "type": "uint256" } + ], + "name": "requestIdNotFinalized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + } + ], + "name": "FinalizedWithdrawRequest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "ReceivedETH", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_requestId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_oldRecipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_newRecipient", + "type": "address" + } + ], + "name": "RecipientAddressUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ethTransferred", + "type": "uint256" + } + ], + "name": "RequestRedeemed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "paginationLimit", + "type": "uint256" + } + ], + "name": "UpdatedFinalizationBatchLimit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staderConfig", + "type": "address" + } + ], + "name": "UpdatedStaderConfig", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_msgSender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_requestId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_sharesAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_etherAmount", + "type": "uint256" + } + ], + "name": "WithdrawRequestReceived", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_requestId", "type": "uint256" } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ethRequestedForWithdraw", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "finalizationBatchLimit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "finalizeUserWithdrawalRequest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_owner", "type": "address" } + ], + "name": "getRequestIdsByUser", + "outputs": [ + { "internalType": "uint256[]", "name": "", "type": "uint256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" } + ], + "name": "getRoleAdmin", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "hasRole", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_admin", "type": "address" }, + { "internalType": "address", "name": "_staderConfig", "type": "address" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "maxNonRedeemedUserRequestCount", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextRequestId", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextRequestIdToFinalize", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "requestIdsByUserAddress", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_ethXAmount", "type": "uint256" }, + { "internalType": "address", "name": "_owner", "type": "address" } + ], + "name": "requestWithdraw", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "staderConfig", + "outputs": [ + { + "internalType": "contract IStaderConfig", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" } + ], + "name": "supportsInterface", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_finalizationBatchLimit", + "type": "uint256" + } + ], + "name": "updateFinalizationBatchLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_staderConfig", "type": "address" } + ], + "name": "updateStaderConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "userWithdrawRequests", + "outputs": [ + { "internalType": "address payable", "name": "owner", "type": "address" }, + { "internalType": "uint256", "name": "ethXAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "ethExpected", "type": "uint256" }, + { "internalType": "uint256", "name": "ethFinalized", "type": "uint256" }, + { "internalType": "uint256", "name": "requestBlock", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { "stateMutability": "payable", "type": "receive" } +] diff --git a/tests/networks/ethereum/staderlabs/abis/0xcf5ea1b38380f6af39068375516daf40ed70d299.json b/tests/networks/ethereum/staderlabs/abis/0xcf5ea1b38380f6af39068375516daf40ed70d299.json new file mode 100644 index 0000000..612f2aa --- /dev/null +++ b/tests/networks/ethereum/staderlabs/abis/0xcf5ea1b38380f6af39068375516daf40ed70d299.json @@ -0,0 +1,552 @@ +[ + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, + { "inputs": [], "name": "CallerNotManager", "type": "error" }, + { "inputs": [], "name": "CallerNotStaderContract", "type": "error" }, + { "inputs": [], "name": "CooldownNotComplete", "type": "error" }, + { "inputs": [], "name": "InsufficientBalance", "type": "error" }, + { "inputs": [], "name": "InvalidDepositAmount", "type": "error" }, + { "inputs": [], "name": "PoolIdDoesNotExit", "type": "error" }, + { "inputs": [], "name": "TransferFailed", "type": "error" }, + { "inputs": [], "name": "UnsupportedOperation", "type": "error" }, + { "inputs": [], "name": "UnsupportedOperationInSafeMode", "type": "error" }, + { "inputs": [], "name": "ZeroAddress", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "AuctionedEthReceived", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "Deposited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "poolId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "poolAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "validatorCount", + "type": "uint256" + } + ], + "name": "ETHTransferredToPool", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ExecutionLayerRewardsReceived", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint8", + "name": "poolId", + "type": "uint8" + } + ], + "name": "ReceivedExcessEthFromPool", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "TransferredETHToUserWithdrawManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "excessETHDepositCoolDown", + "type": "uint256" + } + ], + "name": "UpdatedExcessETHDepositCoolDown", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staderConfig", + "type": "address" + } + ], + "name": "UpdatedStaderConfig", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WithdrawVaultUserShareReceived", + "type": "event" + }, + { "stateMutability": "payable", "type": "fallback" }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_shares", "type": "uint256" } + ], + "name": "convertToAssets", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_assets", "type": "uint256" } + ], + "name": "convertToShares", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_receiver", "type": "address" } + ], + "name": "deposit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "depositETHOverTargetWeight", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "excessETHDepositCoolDown", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getExchangeRate", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" } + ], + "name": "getRoleAdmin", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "hasRole", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_admin", "type": "address" }, + { "internalType": "address", "name": "_staderConfig", "type": "address" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "isVaultHealthy", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastExcessETHDepositBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxDeposit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minDeposit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_assets", "type": "uint256" } + ], + "name": "previewDeposit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_shares", "type": "uint256" } + ], + "name": "previewWithdraw", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "receiveEthFromAuction", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint8", "name": "_poolId", "type": "uint8" }], + "name": "receiveExcessEthFromPool", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "receiveExecutionLayerRewards", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "receiveWithdrawVaultUserShare", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "staderConfig", + "outputs": [ + { + "internalType": "contract IStaderConfig", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" } + ], + "name": "supportsInterface", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalAssets", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "transferETHToUserWithdrawManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_excessETHDepositCoolDown", + "type": "uint256" + } + ], + "name": "updateExcessETHDepositCoolDown", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_staderConfig", "type": "address" } + ], + "name": "updateStaderConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint8", "name": "_poolId", "type": "uint8" }], + "name": "validatorBatchDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "stateMutability": "payable", "type": "receive" } +] diff --git a/tests/networks/ethereum/staderlabs/b2c.json b/tests/networks/ethereum/staderlabs/b2c.json index 15fe0f8..cc7e506 100644 --- a/tests/networks/ethereum/staderlabs/b2c.json +++ b/tests/networks/ethereum/staderlabs/b2c.json @@ -21,6 +21,33 @@ "plugin": "Staderlabs" } } + }, + { + "address": "0xcf5ea1b38380f6af39068375516daf40ed70d299", + "contractName": "StaderStakePoolsManager", + "selectors": { + "0xf340fa01": { + "erc20OfInterest": [], + "method": "deposit", + "plugin": "Staderlabs" + } + } + }, + { + "address": "0x9f0491b32dbce587c50c4c43ab303b06478193a7", + "contractName": "UserWithdrawalManager", + "selectors": { + "0xccc143b8": { + "erc20OfInterest": [], + "method": "requestWithdraw", + "plugin": "Staderlabs" + }, + "0x379607f5": { + "erc20OfInterest": [], + "method": "claim", + "plugin": "Staderlabs" + } + } } ], "name": "Staderlabs" diff --git a/tests/package.json b/tests/package.json index 4eb78c0..803b72f 100644 --- a/tests/package.json +++ b/tests/package.json @@ -11,30 +11,30 @@ "author": "", "license": "ISC", "dependencies": { - "@babel/plugin-proposal-class-properties": "^7.12.1", - "@ledgerhq/hw-app-eth": "^6.18.0", - "@ledgerhq/hw-transport-http": "^6.15.0", - "@ledgerhq/logs": "^5.50.0", - "@zondax/zemu": "^0.32.0", + "@babel/plugin-proposal-class-properties": "^7.14.5", + "@ledgerhq/hw-app-eth": "^6.33.7", + "@ledgerhq/hw-transport-http": "^6.28.0", + "@ledgerhq/logs": "^6.2.0", + "@zondax/zemu": "^0.43.1", "bip32-path": "^0.4.2", - "core-js": "^3.7.0", + "core-js": "^3.31.1", "ethereum-tx-decoder": "^3.0.0", - "ethers": "^5.4.7", + "ethers": "^5.6.3", "fs-extra": "^10.0.0", "google-protobuf": "^3.11.0", - "jest-serial-runner": "^1.1.0", + "jest-serial-runner": "^1.2.1", "js-sha256": "^0.9.0", - "regenerator-runtime": "^0.13.7", + "regenerator-runtime": "^0.13.9", "secp256k1": "^3.7.1" }, "devDependencies": { - "@babel/cli": "^7.7.0", - "@babel/core": "^7.7.2", - "@babel/preset-env": "^7.7.1", - "@babel/preset-flow": "^7.0.0", + "@babel/cli": "^7.22.6", + "@babel/core": "^7.22.8", + "@babel/preset-env": "^7.22.7", + "@babel/preset-flow": "^7.22.5", "@babel/preset-stage-0": "^7.0.0", - "@babel/register": "^7.7.0", + "@babel/register": "^7.22.5", "flow-bin": "^0.112.0", - "jest": "^26.6.3" + "jest": "29.6.1" } } diff --git a/tests/snapshots/bsc_bnbx_nanox_claim_withdraw/00001.png b/tests/snapshots/bsc_bnbx_nanox_claim_withdraw/00001.png index 8d2714a..b9c5003 100644 Binary files a/tests/snapshots/bsc_bnbx_nanox_claim_withdraw/00001.png and b/tests/snapshots/bsc_bnbx_nanox_claim_withdraw/00001.png differ diff --git a/tests/snapshots/bsc_bnbx_nanox_claim_withdraw/00004.png b/tests/snapshots/bsc_bnbx_nanox_claim_withdraw/00004.png index 3af6333..02dee0e 100644 Binary files a/tests/snapshots/bsc_bnbx_nanox_claim_withdraw/00004.png and b/tests/snapshots/bsc_bnbx_nanox_claim_withdraw/00004.png differ diff --git a/tests/snapshots/bsc_bnbx_nanox_claim_withdraw/00006.png b/tests/snapshots/bsc_bnbx_nanox_claim_withdraw/00006.png index a58590b..6578872 100644 Binary files a/tests/snapshots/bsc_bnbx_nanox_claim_withdraw/00006.png and b/tests/snapshots/bsc_bnbx_nanox_claim_withdraw/00006.png differ diff --git a/tests/snapshots/bsc_bnbx_nanox_deposit/00001.png b/tests/snapshots/bsc_bnbx_nanox_deposit/00001.png index 6767056..fff06c7 100644 Binary files a/tests/snapshots/bsc_bnbx_nanox_deposit/00001.png and b/tests/snapshots/bsc_bnbx_nanox_deposit/00001.png differ diff --git a/tests/snapshots/bsc_bnbx_nanox_deposit/00002.png b/tests/snapshots/bsc_bnbx_nanox_deposit/00002.png index 971be23..b7cb101 100644 Binary files a/tests/snapshots/bsc_bnbx_nanox_deposit/00002.png and b/tests/snapshots/bsc_bnbx_nanox_deposit/00002.png differ diff --git a/tests/snapshots/bsc_bnbx_nanox_deposit/00004.png b/tests/snapshots/bsc_bnbx_nanox_deposit/00004.png index 3af6333..02dee0e 100644 Binary files a/tests/snapshots/bsc_bnbx_nanox_deposit/00004.png and b/tests/snapshots/bsc_bnbx_nanox_deposit/00004.png differ diff --git a/tests/snapshots/bsc_bnbx_nanox_deposit/00006.png b/tests/snapshots/bsc_bnbx_nanox_deposit/00006.png index a58590b..6578872 100644 Binary files a/tests/snapshots/bsc_bnbx_nanox_deposit/00006.png and b/tests/snapshots/bsc_bnbx_nanox_deposit/00006.png differ diff --git a/tests/snapshots/bsc_bnbx_nanox_request_withdraw/00001.png b/tests/snapshots/bsc_bnbx_nanox_request_withdraw/00001.png index ccdcd19..911e699 100644 Binary files a/tests/snapshots/bsc_bnbx_nanox_request_withdraw/00001.png and b/tests/snapshots/bsc_bnbx_nanox_request_withdraw/00001.png differ diff --git a/tests/snapshots/bsc_bnbx_nanox_request_withdraw/00002.png b/tests/snapshots/bsc_bnbx_nanox_request_withdraw/00002.png index b0635ea..b1c2853 100644 Binary files a/tests/snapshots/bsc_bnbx_nanox_request_withdraw/00002.png and b/tests/snapshots/bsc_bnbx_nanox_request_withdraw/00002.png differ diff --git a/tests/snapshots/bsc_bnbx_nanox_request_withdraw/00004.png b/tests/snapshots/bsc_bnbx_nanox_request_withdraw/00004.png index 3af6333..02dee0e 100644 Binary files a/tests/snapshots/bsc_bnbx_nanox_request_withdraw/00004.png and b/tests/snapshots/bsc_bnbx_nanox_request_withdraw/00004.png differ diff --git a/tests/snapshots/bsc_bnbx_nanox_request_withdraw/00006.png b/tests/snapshots/bsc_bnbx_nanox_request_withdraw/00006.png index a58590b..6578872 100644 Binary files a/tests/snapshots/bsc_bnbx_nanox_request_withdraw/00006.png and b/tests/snapshots/bsc_bnbx_nanox_request_withdraw/00006.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_claim_eth/00000.png b/tests/snapshots/ethereum_ethx_nanos_claim_eth/00000.png new file mode 100644 index 0000000..8d84cc7 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_claim_eth/00000.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_claim_eth/00001.png b/tests/snapshots/ethereum_ethx_nanos_claim_eth/00001.png new file mode 100644 index 0000000..9a2b3d0 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_claim_eth/00001.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_claim_eth/00002.png b/tests/snapshots/ethereum_ethx_nanos_claim_eth/00002.png new file mode 100644 index 0000000..48d0f86 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_claim_eth/00002.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_claim_eth/00003.png b/tests/snapshots/ethereum_ethx_nanos_claim_eth/00003.png new file mode 100644 index 0000000..1595331 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_claim_eth/00003.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_claim_eth/00004.png b/tests/snapshots/ethereum_ethx_nanos_claim_eth/00004.png new file mode 100644 index 0000000..80184e0 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_claim_eth/00004.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_claim_eth/00005.png b/tests/snapshots/ethereum_ethx_nanos_claim_eth/00005.png new file mode 100644 index 0000000..b35237d Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_claim_eth/00005.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_claim_eth/00006.png b/tests/snapshots/ethereum_ethx_nanos_claim_eth/00006.png new file mode 100644 index 0000000..1c9156c Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_claim_eth/00006.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_claim_eth/00007.png b/tests/snapshots/ethereum_ethx_nanos_claim_eth/00007.png new file mode 100644 index 0000000..ce795f3 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_claim_eth/00007.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00000.png b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00000.png new file mode 100644 index 0000000..8d84cc7 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00000.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00001.png b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00001.png new file mode 100644 index 0000000..1d263aa Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00001.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00002.png b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00002.png new file mode 100644 index 0000000..4c24343 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00002.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00003.png b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00003.png new file mode 100644 index 0000000..b9738b4 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00003.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00004.png b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00004.png new file mode 100644 index 0000000..62517e8 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00004.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00005.png b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00005.png new file mode 100644 index 0000000..d00ffb9 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00005.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00006.png b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00006.png new file mode 100644 index 0000000..1595331 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00006.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00007.png b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00007.png new file mode 100644 index 0000000..07b4b29 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00007.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00008.png b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00008.png new file mode 100644 index 0000000..095bef4 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00008.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00009.png b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00009.png new file mode 100644 index 0000000..1c9156c Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00009.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00010.png b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00010.png new file mode 100644 index 0000000..ce795f3 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_request_withdraw_eth/00010.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_stake_eth/00000.png b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00000.png new file mode 100644 index 0000000..8d84cc7 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00000.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_stake_eth/00001.png b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00001.png new file mode 100644 index 0000000..f8d7ed1 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00001.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_stake_eth/00002.png b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00002.png new file mode 100644 index 0000000..2322ff5 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00002.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_stake_eth/00003.png b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00003.png new file mode 100644 index 0000000..3d2dc64 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00003.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_stake_eth/00004.png b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00004.png new file mode 100644 index 0000000..b7e3cac Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00004.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_stake_eth/00005.png b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00005.png new file mode 100644 index 0000000..e2cb9fa Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00005.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_stake_eth/00006.png b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00006.png new file mode 100644 index 0000000..1595331 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00006.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_stake_eth/00007.png b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00007.png new file mode 100644 index 0000000..c135a4b Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00007.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_stake_eth/00008.png b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00008.png new file mode 100644 index 0000000..7b71a4d Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00008.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_stake_eth/00009.png b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00009.png new file mode 100644 index 0000000..1c9156c Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00009.png differ diff --git a/tests/snapshots/ethereum_ethx_nanos_stake_eth/00010.png b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00010.png new file mode 100644 index 0000000..ce795f3 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanos_stake_eth/00010.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00000.png b/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00000.png new file mode 100644 index 0000000..487ea10 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00000.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00001.png b/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00001.png new file mode 100644 index 0000000..8d2714a Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00001.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00002.png b/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00002.png new file mode 100644 index 0000000..62fd4e7 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00002.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00003.png b/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00003.png new file mode 100644 index 0000000..d989a81 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00003.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00004.png b/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00004.png new file mode 100644 index 0000000..570ce28 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00004.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00005.png b/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00005.png new file mode 100644 index 0000000..a58590b Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_claim_eth/00005.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00000.png b/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00000.png new file mode 100644 index 0000000..487ea10 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00000.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00001.png b/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00001.png new file mode 100644 index 0000000..ccdcd19 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00001.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00002.png b/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00002.png new file mode 100644 index 0000000..d89b812 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00002.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00003.png b/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00003.png new file mode 100644 index 0000000..79dcca1 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00003.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00004.png b/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00004.png new file mode 100644 index 0000000..e8276dd Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00004.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00005.png b/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00005.png new file mode 100644 index 0000000..570ce28 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00005.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00006.png b/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00006.png new file mode 100644 index 0000000..a58590b Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_request_withdraw_eth/00006.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00000.png b/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00000.png new file mode 100644 index 0000000..487ea10 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00000.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00001.png b/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00001.png new file mode 100644 index 0000000..6767056 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00001.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00002.png b/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00002.png new file mode 100644 index 0000000..2438285 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00002.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00003.png b/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00003.png new file mode 100644 index 0000000..1d2f308 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00003.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00004.png b/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00004.png new file mode 100644 index 0000000..e5979a2 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00004.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00005.png b/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00005.png new file mode 100644 index 0000000..570ce28 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00005.png differ diff --git a/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00006.png b/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00006.png new file mode 100644 index 0000000..a58590b Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanosp_stake_eth/00006.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_claim_eth/00000.png b/tests/snapshots/ethereum_ethx_nanox_claim_eth/00000.png new file mode 100644 index 0000000..487ea10 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_claim_eth/00000.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_claim_eth/00001.png b/tests/snapshots/ethereum_ethx_nanox_claim_eth/00001.png new file mode 100644 index 0000000..b9c5003 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_claim_eth/00001.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_claim_eth/00002.png b/tests/snapshots/ethereum_ethx_nanox_claim_eth/00002.png new file mode 100644 index 0000000..62fd4e7 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_claim_eth/00002.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_claim_eth/00003.png b/tests/snapshots/ethereum_ethx_nanox_claim_eth/00003.png new file mode 100644 index 0000000..1ab0e92 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_claim_eth/00003.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_claim_eth/00004.png b/tests/snapshots/ethereum_ethx_nanox_claim_eth/00004.png new file mode 100644 index 0000000..570ce28 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_claim_eth/00004.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_claim_eth/00005.png b/tests/snapshots/ethereum_ethx_nanox_claim_eth/00005.png new file mode 100644 index 0000000..6578872 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_claim_eth/00005.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00000.png b/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00000.png new file mode 100644 index 0000000..487ea10 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00000.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00001.png b/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00001.png new file mode 100644 index 0000000..911e699 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00001.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00002.png b/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00002.png new file mode 100644 index 0000000..30f0cec Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00002.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00003.png b/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00003.png new file mode 100644 index 0000000..79dcca1 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00003.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00004.png b/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00004.png new file mode 100644 index 0000000..f30afe2 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00004.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00005.png b/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00005.png new file mode 100644 index 0000000..570ce28 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00005.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00006.png b/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00006.png new file mode 100644 index 0000000..6578872 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_request_withdraw_eth/00006.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_stake_eth/00000.png b/tests/snapshots/ethereum_ethx_nanox_stake_eth/00000.png new file mode 100644 index 0000000..487ea10 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_stake_eth/00000.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_stake_eth/00001.png b/tests/snapshots/ethereum_ethx_nanox_stake_eth/00001.png new file mode 100644 index 0000000..fff06c7 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_stake_eth/00001.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_stake_eth/00002.png b/tests/snapshots/ethereum_ethx_nanox_stake_eth/00002.png new file mode 100644 index 0000000..41f278c Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_stake_eth/00002.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_stake_eth/00003.png b/tests/snapshots/ethereum_ethx_nanox_stake_eth/00003.png new file mode 100644 index 0000000..1d2f308 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_stake_eth/00003.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_stake_eth/00004.png b/tests/snapshots/ethereum_ethx_nanox_stake_eth/00004.png new file mode 100644 index 0000000..e4e5c5d Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_stake_eth/00004.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_stake_eth/00005.png b/tests/snapshots/ethereum_ethx_nanox_stake_eth/00005.png new file mode 100644 index 0000000..570ce28 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_stake_eth/00005.png differ diff --git a/tests/snapshots/ethereum_ethx_nanox_stake_eth/00006.png b/tests/snapshots/ethereum_ethx_nanox_stake_eth/00006.png new file mode 100644 index 0000000..6578872 Binary files /dev/null and b/tests/snapshots/ethereum_ethx_nanox_stake_eth/00006.png differ diff --git a/tests/snapshots/ethereum_maticx_nanox_claim_matic/00001.png b/tests/snapshots/ethereum_maticx_nanox_claim_matic/00001.png index 8d2714a..b9c5003 100644 Binary files a/tests/snapshots/ethereum_maticx_nanox_claim_matic/00001.png and b/tests/snapshots/ethereum_maticx_nanox_claim_matic/00001.png differ diff --git a/tests/snapshots/ethereum_maticx_nanox_claim_matic/00003.png b/tests/snapshots/ethereum_maticx_nanox_claim_matic/00003.png index 8a5e3f0..da9e1b2 100644 Binary files a/tests/snapshots/ethereum_maticx_nanox_claim_matic/00003.png and b/tests/snapshots/ethereum_maticx_nanox_claim_matic/00003.png differ diff --git a/tests/snapshots/ethereum_maticx_nanox_claim_matic/00005.png b/tests/snapshots/ethereum_maticx_nanox_claim_matic/00005.png index a58590b..6578872 100644 Binary files a/tests/snapshots/ethereum_maticx_nanox_claim_matic/00005.png and b/tests/snapshots/ethereum_maticx_nanox_claim_matic/00005.png differ diff --git a/tests/snapshots/ethereum_maticx_nanox_stake_matic/00001.png b/tests/snapshots/ethereum_maticx_nanox_stake_matic/00001.png index 6767056..fff06c7 100644 Binary files a/tests/snapshots/ethereum_maticx_nanox_stake_matic/00001.png and b/tests/snapshots/ethereum_maticx_nanox_stake_matic/00001.png differ diff --git a/tests/snapshots/ethereum_maticx_nanox_stake_matic/00002.png b/tests/snapshots/ethereum_maticx_nanox_stake_matic/00002.png index 10d9774..82a8739 100644 Binary files a/tests/snapshots/ethereum_maticx_nanox_stake_matic/00002.png and b/tests/snapshots/ethereum_maticx_nanox_stake_matic/00002.png differ diff --git a/tests/snapshots/ethereum_maticx_nanox_stake_matic/00003.png b/tests/snapshots/ethereum_maticx_nanox_stake_matic/00003.png index 3d80533..a4d0243 100644 Binary files a/tests/snapshots/ethereum_maticx_nanox_stake_matic/00003.png and b/tests/snapshots/ethereum_maticx_nanox_stake_matic/00003.png differ diff --git a/tests/snapshots/ethereum_maticx_nanox_stake_matic/00005.png b/tests/snapshots/ethereum_maticx_nanox_stake_matic/00005.png index a58590b..6578872 100644 Binary files a/tests/snapshots/ethereum_maticx_nanox_stake_matic/00005.png and b/tests/snapshots/ethereum_maticx_nanox_stake_matic/00005.png differ diff --git a/tests/snapshots/ethereum_maticx_nanox_unstake_maticx/00001.png b/tests/snapshots/ethereum_maticx_nanox_unstake_maticx/00001.png index ccdcd19..911e699 100644 Binary files a/tests/snapshots/ethereum_maticx_nanox_unstake_maticx/00001.png and b/tests/snapshots/ethereum_maticx_nanox_unstake_maticx/00001.png differ diff --git a/tests/snapshots/ethereum_maticx_nanox_unstake_maticx/00002.png b/tests/snapshots/ethereum_maticx_nanox_unstake_maticx/00002.png index 5329e55..838a184 100644 Binary files a/tests/snapshots/ethereum_maticx_nanox_unstake_maticx/00002.png and b/tests/snapshots/ethereum_maticx_nanox_unstake_maticx/00002.png differ diff --git a/tests/snapshots/ethereum_maticx_nanox_unstake_maticx/00003.png b/tests/snapshots/ethereum_maticx_nanox_unstake_maticx/00003.png index 386c820..f9d64d1 100644 Binary files a/tests/snapshots/ethereum_maticx_nanox_unstake_maticx/00003.png and b/tests/snapshots/ethereum_maticx_nanox_unstake_maticx/00003.png differ diff --git a/tests/snapshots/ethereum_maticx_nanox_unstake_maticx/00005.png b/tests/snapshots/ethereum_maticx_nanox_unstake_maticx/00005.png index a58590b..6578872 100644 Binary files a/tests/snapshots/ethereum_maticx_nanox_unstake_maticx/00005.png and b/tests/snapshots/ethereum_maticx_nanox_unstake_maticx/00005.png differ diff --git a/tests/snapshots/fantom_ftmx_nanox_deposit/00001.png b/tests/snapshots/fantom_ftmx_nanox_deposit/00001.png index 6767056..fff06c7 100644 Binary files a/tests/snapshots/fantom_ftmx_nanox_deposit/00001.png and b/tests/snapshots/fantom_ftmx_nanox_deposit/00001.png differ diff --git a/tests/snapshots/fantom_ftmx_nanox_deposit/00002.png b/tests/snapshots/fantom_ftmx_nanox_deposit/00002.png index ff6bebb..c9c70b1 100644 Binary files a/tests/snapshots/fantom_ftmx_nanox_deposit/00002.png and b/tests/snapshots/fantom_ftmx_nanox_deposit/00002.png differ diff --git a/tests/snapshots/fantom_ftmx_nanox_deposit/00004.png b/tests/snapshots/fantom_ftmx_nanox_deposit/00004.png index 764e442..7c6b3b5 100644 Binary files a/tests/snapshots/fantom_ftmx_nanox_deposit/00004.png and b/tests/snapshots/fantom_ftmx_nanox_deposit/00004.png differ diff --git a/tests/snapshots/fantom_ftmx_nanox_deposit/00006.png b/tests/snapshots/fantom_ftmx_nanox_deposit/00006.png index a58590b..6578872 100644 Binary files a/tests/snapshots/fantom_ftmx_nanox_deposit/00006.png and b/tests/snapshots/fantom_ftmx_nanox_deposit/00006.png differ diff --git a/tests/snapshots/fantom_ftmx_nanox_undelegate/00001.png b/tests/snapshots/fantom_ftmx_nanox_undelegate/00001.png index ccdcd19..911e699 100644 Binary files a/tests/snapshots/fantom_ftmx_nanox_undelegate/00001.png and b/tests/snapshots/fantom_ftmx_nanox_undelegate/00001.png differ diff --git a/tests/snapshots/fantom_ftmx_nanox_undelegate/00002.png b/tests/snapshots/fantom_ftmx_nanox_undelegate/00002.png index 0baca1f..ed970e3 100644 Binary files a/tests/snapshots/fantom_ftmx_nanox_undelegate/00002.png and b/tests/snapshots/fantom_ftmx_nanox_undelegate/00002.png differ diff --git a/tests/snapshots/fantom_ftmx_nanox_undelegate/00004.png b/tests/snapshots/fantom_ftmx_nanox_undelegate/00004.png index 764e442..7c6b3b5 100644 Binary files a/tests/snapshots/fantom_ftmx_nanox_undelegate/00004.png and b/tests/snapshots/fantom_ftmx_nanox_undelegate/00004.png differ diff --git a/tests/snapshots/fantom_ftmx_nanox_undelegate/00006.png b/tests/snapshots/fantom_ftmx_nanox_undelegate/00006.png index a58590b..6578872 100644 Binary files a/tests/snapshots/fantom_ftmx_nanox_undelegate/00006.png and b/tests/snapshots/fantom_ftmx_nanox_undelegate/00006.png differ diff --git a/tests/snapshots/fantom_ftmx_nanox_withdraw/00001.png b/tests/snapshots/fantom_ftmx_nanox_withdraw/00001.png index 8d2714a..b9c5003 100644 Binary files a/tests/snapshots/fantom_ftmx_nanox_withdraw/00001.png and b/tests/snapshots/fantom_ftmx_nanox_withdraw/00001.png differ diff --git a/tests/snapshots/fantom_ftmx_nanox_withdraw/00004.png b/tests/snapshots/fantom_ftmx_nanox_withdraw/00004.png index 764e442..7c6b3b5 100644 Binary files a/tests/snapshots/fantom_ftmx_nanox_withdraw/00004.png and b/tests/snapshots/fantom_ftmx_nanox_withdraw/00004.png differ diff --git a/tests/snapshots/fantom_ftmx_nanox_withdraw/00006.png b/tests/snapshots/fantom_ftmx_nanox_withdraw/00006.png index a58590b..6578872 100644 Binary files a/tests/snapshots/fantom_ftmx_nanox_withdraw/00006.png and b/tests/snapshots/fantom_ftmx_nanox_withdraw/00006.png differ diff --git a/tests/snapshots/polygon_maticx_nanox_claim_maticx_swap/00001.png b/tests/snapshots/polygon_maticx_nanox_claim_maticx_swap/00001.png index 8d2714a..b9c5003 100644 Binary files a/tests/snapshots/polygon_maticx_nanox_claim_maticx_swap/00001.png and b/tests/snapshots/polygon_maticx_nanox_claim_maticx_swap/00001.png differ diff --git a/tests/snapshots/polygon_maticx_nanox_claim_maticx_swap/00004.png b/tests/snapshots/polygon_maticx_nanox_claim_maticx_swap/00004.png index ca6fa96..8677395 100644 Binary files a/tests/snapshots/polygon_maticx_nanox_claim_maticx_swap/00004.png and b/tests/snapshots/polygon_maticx_nanox_claim_maticx_swap/00004.png differ diff --git a/tests/snapshots/polygon_maticx_nanox_claim_maticx_swap/00006.png b/tests/snapshots/polygon_maticx_nanox_claim_maticx_swap/00006.png index a58590b..6578872 100644 Binary files a/tests/snapshots/polygon_maticx_nanox_claim_maticx_swap/00006.png and b/tests/snapshots/polygon_maticx_nanox_claim_maticx_swap/00006.png differ diff --git a/tests/snapshots/polygon_maticx_nanox_request_maticx_swap/00001.png b/tests/snapshots/polygon_maticx_nanox_request_maticx_swap/00001.png index ccdcd19..911e699 100644 Binary files a/tests/snapshots/polygon_maticx_nanox_request_maticx_swap/00001.png and b/tests/snapshots/polygon_maticx_nanox_request_maticx_swap/00001.png differ diff --git a/tests/snapshots/polygon_maticx_nanox_request_maticx_swap/00002.png b/tests/snapshots/polygon_maticx_nanox_request_maticx_swap/00002.png index d40fa8d..bc4c68d 100644 Binary files a/tests/snapshots/polygon_maticx_nanox_request_maticx_swap/00002.png and b/tests/snapshots/polygon_maticx_nanox_request_maticx_swap/00002.png differ diff --git a/tests/snapshots/polygon_maticx_nanox_request_maticx_swap/00004.png b/tests/snapshots/polygon_maticx_nanox_request_maticx_swap/00004.png index ca6fa96..8677395 100644 Binary files a/tests/snapshots/polygon_maticx_nanox_request_maticx_swap/00004.png and b/tests/snapshots/polygon_maticx_nanox_request_maticx_swap/00004.png differ diff --git a/tests/snapshots/polygon_maticx_nanox_request_maticx_swap/00006.png b/tests/snapshots/polygon_maticx_nanox_request_maticx_swap/00006.png index a58590b..6578872 100644 Binary files a/tests/snapshots/polygon_maticx_nanox_request_maticx_swap/00006.png and b/tests/snapshots/polygon_maticx_nanox_request_maticx_swap/00006.png differ diff --git a/tests/snapshots/polygon_maticx_nanox_swap_matic_via_ipool/00001.png b/tests/snapshots/polygon_maticx_nanox_swap_matic_via_ipool/00001.png index 6767056..fff06c7 100644 Binary files a/tests/snapshots/polygon_maticx_nanox_swap_matic_via_ipool/00001.png and b/tests/snapshots/polygon_maticx_nanox_swap_matic_via_ipool/00001.png differ diff --git a/tests/snapshots/polygon_maticx_nanox_swap_matic_via_ipool/00002.png b/tests/snapshots/polygon_maticx_nanox_swap_matic_via_ipool/00002.png index f1d49f5..974000a 100644 Binary files a/tests/snapshots/polygon_maticx_nanox_swap_matic_via_ipool/00002.png and b/tests/snapshots/polygon_maticx_nanox_swap_matic_via_ipool/00002.png differ diff --git a/tests/snapshots/polygon_maticx_nanox_swap_matic_via_ipool/00004.png b/tests/snapshots/polygon_maticx_nanox_swap_matic_via_ipool/00004.png index ca6fa96..8677395 100644 Binary files a/tests/snapshots/polygon_maticx_nanox_swap_matic_via_ipool/00004.png and b/tests/snapshots/polygon_maticx_nanox_swap_matic_via_ipool/00004.png differ diff --git a/tests/snapshots/polygon_maticx_nanox_swap_matic_via_ipool/00006.png b/tests/snapshots/polygon_maticx_nanox_swap_matic_via_ipool/00006.png index a58590b..6578872 100644 Binary files a/tests/snapshots/polygon_maticx_nanox_swap_matic_via_ipool/00006.png and b/tests/snapshots/polygon_maticx_nanox_swap_matic_via_ipool/00006.png differ diff --git a/tests/src/bsc/claim_withdraw.test.js b/tests/src/bsc/claim_withdraw.test.js index d6b740e..f6365bd 100644 --- a/tests/src/bsc/claim_withdraw.test.js +++ b/tests/src/bsc/claim_withdraw.test.js @@ -41,6 +41,7 @@ nano_models.forEach(function (model) { }, signedPlugin, testNetwork - ) + ), + 20000 ); }); diff --git a/tests/src/bsc/deposit.test.js b/tests/src/bsc/deposit.test.js index 89a7f70..986d952 100644 --- a/tests/src/bsc/deposit.test.js +++ b/tests/src/bsc/deposit.test.js @@ -40,6 +40,7 @@ nano_models.forEach(function (model) { }, signedPlugin, testNetwork - ) + ), + 20000 ); }); diff --git a/tests/src/bsc/request_withdraw.test.js b/tests/src/bsc/request_withdraw.test.js index 87bcda2..f120974 100644 --- a/tests/src/bsc/request_withdraw.test.js +++ b/tests/src/bsc/request_withdraw.test.js @@ -41,6 +41,7 @@ nano_models.forEach(function (model) { }, signedPlugin, testNetwork - ) + ), + 20000 ); }); diff --git a/tests/src/eth/ethx/claim.test.js b/tests/src/eth/ethx/claim.test.js new file mode 100644 index 0000000..e6a49e7 --- /dev/null +++ b/tests/src/eth/ethx/claim.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/0x6a9c6ec076057ece2cd2201376e889fd58aed440ced33b769e78f86d0043a9a5 +const inputData = + "0x02f8910156850680edd7ec850680edd7ec83015d09949f0491b32dbce587c50c4c43ab303b06478193a780a4379607f50000000000000000000000000000000000000000000000000000000000000042c080a0ef4bce4226c5f12be27b95257456c6f51268d46a4d34c5eee583dbe41266fb51a02ca1ee59d5ddfd731edeccc0599e6f76a9012420412c98008cd05bdc3bf52668"; + +nano_models.forEach(function (model) { + test( + "[Nano " + model.letter + "] Claim 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" ? 6 : 4; + + // 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 + "_claim_eth", + [right_clicks, 0] + ); + + await tx; + }), + 20000 + ); +}); diff --git a/tests/src/eth/ethx/deposit.test.js b/tests/src/eth/ethx/deposit.test.js new file mode 100644 index 0000000..6c49e5e --- /dev/null +++ b/tests/src/eth/ethx/deposit.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 + "] 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 + "_stake_eth", + [right_clicks, 0] + ); + + await tx; + }), + 50000 + ); +}); diff --git a/tests/src/eth/ethx/withdraw.test.js b/tests/src/eth/ethx/withdraw.test.js new file mode 100644 index 0000000..c75c8b1 --- /dev/null +++ b/tests/src/eth/ethx/withdraw.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 + "] 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 + "_request_withdraw_eth", + [right_clicks, 0] + ); + + await tx; + }), + 50000 + ); +}); diff --git a/tests/src/eth/maticx/claim_withdrawal.test.js b/tests/src/eth/maticx/claim_withdrawal.test.js index 40e192c..90bfce5 100644 --- a/tests/src/eth/maticx/claim_withdrawal.test.js +++ b/tests/src/eth/maticx/claim_withdrawal.test.js @@ -35,6 +35,7 @@ nano_models.forEach(function (model) { ); await tx; - }) + }), + 20000 ); }); diff --git a/tests/src/eth/maticx/request_withdraw.test.js b/tests/src/eth/maticx/request_withdraw.test.js index ffd5dc3..edefce9 100644 --- a/tests/src/eth/maticx/request_withdraw.test.js +++ b/tests/src/eth/maticx/request_withdraw.test.js @@ -36,6 +36,7 @@ nano_models.forEach(function (model) { ); await tx; - }) + }), + 20000 ); }); diff --git a/tests/src/eth/maticx/submit.test.js b/tests/src/eth/maticx/submit.test.js index 01fc72d..fe9e36d 100644 --- a/tests/src/eth/maticx/submit.test.js +++ b/tests/src/eth/maticx/submit.test.js @@ -36,6 +36,7 @@ nano_models.forEach(function (model) { ); await tx; - }) + }), + 20000 ); }); diff --git a/tests/src/fantom/deposit.test.js b/tests/src/fantom/deposit.test.js index 95f09ac..760ae86 100644 --- a/tests/src/fantom/deposit.test.js +++ b/tests/src/fantom/deposit.test.js @@ -41,6 +41,7 @@ nano_models.forEach(function (model) { }, signedPlugin, testNetwork - ) + ), + 20000 ); }); diff --git a/tests/src/fantom/undelegate.test.js b/tests/src/fantom/undelegate.test.js index 0525bf0..337e2bb 100644 --- a/tests/src/fantom/undelegate.test.js +++ b/tests/src/fantom/undelegate.test.js @@ -41,6 +41,7 @@ nano_models.forEach(function (model) { }, signedPlugin, testNetwork - ) + ), + 20000 ); }); diff --git a/tests/src/fantom/withdraw.test.js b/tests/src/fantom/withdraw.test.js index 0b64b5b..447f6f0 100644 --- a/tests/src/fantom/withdraw.test.js +++ b/tests/src/fantom/withdraw.test.js @@ -41,6 +41,7 @@ nano_models.forEach(function (model) { }, signedPlugin, testNetwork - ) + ), + 20000 ); }); diff --git a/tests/src/polygon/claim_maticx_swap.test.js b/tests/src/polygon/claim_maticx_swap.test.js index 0f6d962..db2b9c0 100644 --- a/tests/src/polygon/claim_maticx_swap.test.js +++ b/tests/src/polygon/claim_maticx_swap.test.js @@ -41,6 +41,7 @@ nano_models.forEach(function (model) { }, signedPlugin, testNetwork - ) + ), + 20000 ); }); diff --git a/tests/src/polygon/request_maticx_swap.test.js b/tests/src/polygon/request_maticx_swap.test.js index 88d94f3..32db9ae 100644 --- a/tests/src/polygon/request_maticx_swap.test.js +++ b/tests/src/polygon/request_maticx_swap.test.js @@ -41,6 +41,7 @@ nano_models.forEach(function (model) { }, signedPlugin, testNetwork - ) + ), + 20000 ); }); diff --git a/tests/src/polygon/swap_matic_for_maticx_via_instantpool.test.js b/tests/src/polygon/swap_matic_for_maticx_via_instantpool.test.js index 5eec12f..f0f792b 100644 --- a/tests/src/polygon/swap_matic_for_maticx_via_instantpool.test.js +++ b/tests/src/polygon/swap_matic_for_maticx_via_instantpool.test.js @@ -40,6 +40,7 @@ nano_models.forEach(function (model) { }, signedPlugin, testNetwork - ) + ), + 20000 ); });