diff --git a/ethereum-plugin-sdk b/ethereum-plugin-sdk index 93cd7f1c3..ccea8f412 160000 --- a/ethereum-plugin-sdk +++ b/ethereum-plugin-sdk @@ -1 +1 @@ -Subproject commit 93cd7f1c3b41e1feeadf1cfc58bfa500e0eeb6cd +Subproject commit ccea8f412b4900098d93fcc6285d1aa627967511 diff --git a/src/eth_plugin_handler.c b/src/eth_plugin_handler.c index 475a2a40f..5eb1751b2 100644 --- a/src/eth_plugin_handler.c +++ b/src/eth_plugin_handler.c @@ -179,14 +179,9 @@ eth_plugin_result_t eth_plugin_perform_init(uint8_t *contractAddress, } eth_plugin_result_t eth_plugin_call(int method, void *parameter) { - ethPluginSharedRW_t pluginRW; - ethPluginSharedRO_t pluginRO; char *alias; uint8_t i; - pluginRW.sha3 = &global_sha3; - pluginRO.txContent = &tmpContent.txContent; - if (dataContext.tokenContext.pluginStatus <= ETH_PLUGIN_RESULT_UNSUCCESSFUL) { PRINTF("Cached plugin call but no plugin available\n"); return dataContext.tokenContext.pluginStatus; @@ -201,8 +196,7 @@ eth_plugin_result_t eth_plugin_call(int method, void *parameter) { ((ethPluginInitContract_t *) parameter)->interfaceVersion = ETH_PLUGIN_INTERFACE_VERSION_LATEST; ((ethPluginInitContract_t *) parameter)->result = ETH_PLUGIN_RESULT_UNAVAILABLE; - ((ethPluginInitContract_t *) parameter)->pluginSharedRW = &pluginRW; - ((ethPluginInitContract_t *) parameter)->pluginSharedRO = &pluginRO; + ((ethPluginInitContract_t *) parameter)->txContent = &tmpContent.txContent; ((ethPluginInitContract_t *) parameter)->pluginContext = (uint8_t *) &dataContext.tokenContext.pluginContext; ((ethPluginInitContract_t *) parameter)->pluginContextLength = @@ -211,39 +205,34 @@ eth_plugin_result_t eth_plugin_call(int method, void *parameter) { case ETH_PLUGIN_PROVIDE_PARAMETER: PRINTF("-- PLUGIN PROVIDE PARAMETER --\n"); ((ethPluginProvideParameter_t *) parameter)->result = ETH_PLUGIN_RESULT_UNAVAILABLE; - ((ethPluginProvideParameter_t *) parameter)->pluginSharedRW = &pluginRW; - ((ethPluginProvideParameter_t *) parameter)->pluginSharedRO = &pluginRO; + ((ethPluginProvideParameter_t *) parameter)->txContent = &tmpContent.txContent; ((ethPluginProvideParameter_t *) parameter)->pluginContext = (uint8_t *) &dataContext.tokenContext.pluginContext; break; case ETH_PLUGIN_FINALIZE: PRINTF("-- PLUGIN FINALIZE --\n"); ((ethPluginFinalize_t *) parameter)->result = ETH_PLUGIN_RESULT_UNAVAILABLE; - ((ethPluginFinalize_t *) parameter)->pluginSharedRW = &pluginRW; - ((ethPluginFinalize_t *) parameter)->pluginSharedRO = &pluginRO; + ((ethPluginFinalize_t *) parameter)->txContent = &tmpContent.txContent; ((ethPluginFinalize_t *) parameter)->pluginContext = (uint8_t *) &dataContext.tokenContext.pluginContext; break; case ETH_PLUGIN_PROVIDE_INFO: PRINTF("-- PLUGIN PROVIDE INFO --\n"); ((ethPluginProvideInfo_t *) parameter)->result = ETH_PLUGIN_RESULT_UNAVAILABLE; - ((ethPluginProvideInfo_t *) parameter)->pluginSharedRW = &pluginRW; - ((ethPluginProvideInfo_t *) parameter)->pluginSharedRO = &pluginRO; + ((ethPluginProvideInfo_t *) parameter)->txContent = &tmpContent.txContent; ((ethPluginProvideInfo_t *) parameter)->pluginContext = (uint8_t *) &dataContext.tokenContext.pluginContext; break; case ETH_PLUGIN_QUERY_CONTRACT_ID: PRINTF("-- PLUGIN QUERY CONTRACT ID --\n"); ((ethQueryContractID_t *) parameter)->result = ETH_PLUGIN_RESULT_UNAVAILABLE; - ((ethQueryContractID_t *) parameter)->pluginSharedRW = &pluginRW; - ((ethQueryContractID_t *) parameter)->pluginSharedRO = &pluginRO; + ((ethQueryContractID_t *) parameter)->txContent = &tmpContent.txContent; ((ethQueryContractID_t *) parameter)->pluginContext = (uint8_t *) &dataContext.tokenContext.pluginContext; break; case ETH_PLUGIN_QUERY_CONTRACT_UI: PRINTF("-- PLUGIN QUERY CONTRACT UI --\n"); - ((ethQueryContractUI_t *) parameter)->pluginSharedRW = &pluginRW; - ((ethQueryContractUI_t *) parameter)->pluginSharedRO = &pluginRO; + ((ethQueryContractUI_t *) parameter)->txContent = &tmpContent.txContent; ((ethQueryContractUI_t *) parameter)->pluginContext = (uint8_t *) &dataContext.tokenContext.pluginContext; break; diff --git a/src_plugins/erc1155/erc1155_plugin.c b/src_plugins/erc1155/erc1155_plugin.c index b1704ca2a..576690db4 100644 --- a/src_plugins/erc1155/erc1155_plugin.c +++ b/src_plugins/erc1155/erc1155_plugin.c @@ -61,7 +61,7 @@ static void handle_finalize(void *parameters) { erc1155_context_t *context = (erc1155_context_t *) msg->pluginContext; if (context->selectorIndex != SAFE_BATCH_TRANSFER) { - msg->tokenLookup1 = msg->pluginSharedRO->txContent->destination; + msg->tokenLookup1 = msg->txContent->destination; } else { msg->tokenLookup1 = NULL; } @@ -82,8 +82,7 @@ static void handle_finalize(void *parameters) { return; } // Check if some ETH is attached to this tx - if (!allzeroes((void *) &msg->pluginSharedRO->txContent->value, - sizeof(msg->pluginSharedRO->txContent->value))) { + if (!allzeroes((void *) &msg->txContent->value, sizeof(msg->txContent->value))) { // Those functions are not payable so return an error. msg->result = ETH_PLUGIN_RESULT_ERROR; return; diff --git a/src_plugins/erc20/erc20_plugin.c b/src_plugins/erc20/erc20_plugin.c index 009336f61..59aff4040 100644 --- a/src_plugins/erc20/erc20_plugin.c +++ b/src_plugins/erc20/erc20_plugin.c @@ -79,7 +79,7 @@ void erc20_plugin_call(int message, void *parameters) { ethPluginInitContract_t *msg = (ethPluginInitContract_t *) parameters; erc20_parameters_t *context = (erc20_parameters_t *) msg->pluginContext; // enforce that ETH amount should be 0 - if (!allzeroes(msg->pluginSharedRO->txContent->value.value, 32)) { + if (!allzeroes(msg->txContent->value.value, 32)) { PRINTF("Err: Transaction amount is not 0\n"); msg->result = ETH_PLUGIN_RESULT_ERROR; } else { @@ -129,13 +129,13 @@ void erc20_plugin_call(int message, void *parameters) { erc20_parameters_t *context = (erc20_parameters_t *) msg->pluginContext; PRINTF("erc20 plugin finalize\n"); if (context->selectorIndex == ERC20_TRANSFER) { - msg->tokenLookup1 = msg->pluginSharedRO->txContent->destination; + msg->tokenLookup1 = msg->txContent->destination; msg->amount = context->amount; msg->address = context->destinationAddress; msg->uiType = ETH_UI_TYPE_AMOUNT_ADDRESS; msg->result = ETH_PLUGIN_RESULT_OK; } else if (context->selectorIndex == ERC20_APPROVE) { - msg->tokenLookup1 = msg->pluginSharedRO->txContent->destination; + msg->tokenLookup1 = msg->txContent->destination; msg->numScreens = 2; msg->uiType = ETH_UI_TYPE_GENERIC; msg->result = ETH_PLUGIN_RESULT_OK; diff --git a/src_plugins/erc721/erc721_plugin.c b/src_plugins/erc721/erc721_plugin.c index 07ba0c7a6..19ebab343 100644 --- a/src_plugins/erc721/erc721_plugin.c +++ b/src_plugins/erc721/erc721_plugin.c @@ -67,7 +67,7 @@ static void handle_finalize(void *parameters) { ethPluginFinalize_t *msg = (ethPluginFinalize_t *) parameters; erc721_context_t *context = (erc721_context_t *) msg->pluginContext; - msg->tokenLookup1 = msg->pluginSharedRO->txContent->destination; + msg->tokenLookup1 = msg->txContent->destination; msg->tokenLookup2 = NULL; switch (context->selectorIndex) { case TRANSFER: @@ -84,8 +84,7 @@ static void handle_finalize(void *parameters) { return; } // Check if some ETH is attached to this tx - if (!allzeroes((void *) &msg->pluginSharedRO->txContent->value, - sizeof(msg->pluginSharedRO->txContent->value))) { + if (!allzeroes((void *) &msg->txContent->value, sizeof(msg->txContent->value))) { // Set Approval for All is not payable if (context->selectorIndex == SET_APPROVAL_FOR_ALL) { msg->result = ETH_PLUGIN_RESULT_ERROR; diff --git a/src_plugins/eth2/eth2_plugin.c b/src_plugins/eth2/eth2_plugin.c index 9c42e3134..1d2a97dbd 100644 --- a/src_plugins/eth2/eth2_plugin.c +++ b/src_plugins/eth2/eth2_plugin.c @@ -37,7 +37,7 @@ void eth2_plugin_call(int message, void *parameters) { ethPluginInitContract_t *msg = (ethPluginInitContract_t *) parameters; eth2_deposit_parameters_t *context = (eth2_deposit_parameters_t *) msg->pluginContext; if (memcmp(deposit_contract_address, - msg->pluginSharedRO->txContent->destination, + msg->txContent->destination, sizeof(deposit_contract_address)) != 0) { PRINTF("eth2plugin: failed to check deposit contract\n"); context->valid = 0;