diff --git a/src/eth_plugin_handler.c b/src/eth_plugin_handler.c index 9f08888..67cab66 100644 --- a/src/eth_plugin_handler.c +++ b/src/eth_plugin_handler.c @@ -62,7 +62,7 @@ eth_plugin_result_t eth_plugin_perform_init(uint8_t *contractAddress, dataContext.tokenContext.pluginStatus = ETH_PLUGIN_RESULT_UNAVAILABLE; PRINTF("Selector %.*H\n", 4, init->selector); - if (tmpCtx.transactionContext.externalPluginIsSet) { + if (externalPluginIsSet) { // check if the registered external plugin matches the TX contract address / method selector if (memcmp(contractAddress, dataContext.tokenContext.contract_address, diff --git a/src/main.c b/src/main.c index b3cb266..9559f7e 100644 --- a/src/main.c +++ b/src/main.c @@ -51,6 +51,7 @@ cx_sha3_t global_sha3; uint8_t appState; bool dataPresent; bool called_from_swap; +bool externalPluginIsSet; #ifdef HAVE_STARKWARE bool quantumSet; #endif @@ -72,6 +73,7 @@ void reset_app_context() { // PRINTF("!!RESET_APP_CONTEXT\n"); appState = APP_STATE_IDLE; called_from_swap = false; + externalPluginIsSet = false; #ifdef HAVE_STARKWARE quantumSet = false; #endif diff --git a/src/shared_context.h b/src/shared_context.h index 3117984..f36c131 100644 --- a/src/shared_context.h +++ b/src/shared_context.h @@ -91,7 +91,6 @@ typedef struct transactionContext_t { tokenDefinition_t tokens[MAX_TOKEN]; uint8_t tokenSet[MAX_TOKEN]; uint8_t currentTokenIndex; - bool externalPluginIsSet; } transactionContext_t; typedef struct messageSigningContext_t { @@ -197,6 +196,7 @@ extern const internalStorage_t N_storage_real; extern bool called_from_swap; extern bool dataPresent; +extern bool externalPluginIsSet; extern uint8_t appState; #ifdef HAVE_STARKWARE extern bool quantumSet; diff --git a/src_features/setExternalPlugin/cmd_setExternalPlugin.c b/src_features/setExternalPlugin/cmd_setExternalPlugin.c index ae0dde5..494915b 100644 --- a/src_features/setExternalPlugin/cmd_setExternalPlugin.c +++ b/src_features/setExternalPlugin/cmd_setExternalPlugin.c @@ -15,6 +15,7 @@ void handleSetExternalPlugin(uint8_t p1, UNUSED(p1); UNUSED(p2); UNUSED(flags); + PRINTF("Handling set External Plugin\n"); uint8_t hash[32]; cx_ecfp_public_key_t tokenKey; uint8_t pluginNameLength = *workBuffer; @@ -78,7 +79,7 @@ void handleSetExternalPlugin(uint8_t p1, memmove(dataContext.tokenContext.contract_address, workBuffer, CONTRACT_ADDR_SIZE); workBuffer += 20; memmove(dataContext.tokenContext.method_selector, workBuffer, SELECTOR_SIZE); - tmpCtx.transactionContext.externalPluginIsSet = true; + externalPluginIsSet = true; G_io_apdu_buffer[(*tx)++] = 0x90; G_io_apdu_buffer[(*tx)++] = 0x00;