diff --git a/src/handle_finalize.c b/src/handle_finalize.c index 906025d..6652128 100644 --- a/src/handle_finalize.c +++ b/src/handle_finalize.c @@ -2,16 +2,9 @@ void handle_finalize(void *parameters) { ethPluginFinalize_t *msg = (ethPluginFinalize_t *) parameters; - context_t *context = (context_t *) msg->pluginContext; - msg->uiType = ETH_UI_TYPE_GENERIC; // 2 additional screens are required to display the `token and `beneficiary` fields msg->numScreens = 2; msg->result = ETH_PLUGIN_RESULT_OK; - - if (context->selectorIndex == SAFE_TRANSFER) { - // An additional screen is required to display the `token` field for safe_transfer method. - msg->numScreens += 1; - } } diff --git a/src/handle_init_contract.c b/src/handle_init_contract.c index f08ab67..5f7bd26 100644 --- a/src/handle_init_contract.c +++ b/src/handle_init_contract.c @@ -35,9 +35,6 @@ void handle_init_contract(void *parameters) { case MINT_TOKEN: context->next_param = EVENT_ID; break; - case SAFE_TRANSFER: - context->next_param = FROM_ADDRESS; - break; default: PRINTF("Missing selectorIndex: %d\n", context->selectorIndex); msg->result = ETH_PLUGIN_RESULT_ERROR; diff --git a/src/handle_provide_parameter.c b/src/handle_provide_parameter.c index eba4837..56171f8 100644 --- a/src/handle_provide_parameter.c +++ b/src/handle_provide_parameter.c @@ -13,13 +13,6 @@ static void handle_beneficiary(const ethPluginProvideParameter_t *msg, context_t PRINTF("BENEFICIARY: %.*H\n", ADDRESS_LENGTH, context->beneficiary); } -static void handle_from_address(const ethPluginProvideParameter_t *msg, context_t *context) { - memset(context->from_address, 0, sizeof(context->from_address)); - memcpy(context->from_address, - &msg->parameter[PARAMETER_LENGTH - ADDRESS_LENGTH], - sizeof(context->from_address)); - PRINTF("FROM_ADDRESS: %.*H\n", ADDRESS_LENGTH, context->from_address); -} static void handle_mint_token(ethPluginProvideParameter_t *msg, context_t *context) { switch (context->next_param) { case EVENT_ID: @@ -41,28 +34,6 @@ static void handle_mint_token(ethPluginProvideParameter_t *msg, context_t *conte break; } } -static void handle_safe_transfer(ethPluginProvideParameter_t *msg, context_t *context) { - switch (context->next_param) { - case FROM_ADDRESS: // from_address - handle_from_address(msg, context); - context->next_param = BENEFICIARY; - break; - case BENEFICIARY: // to - handle_beneficiary(msg, context); - context->next_param = TOKEN; - break; - case TOKEN: // id of the token received - handle_token(msg, context); - context->next_param = NONE; - break; - case NONE: - break; - default: - PRINTF("Param not supported\n"); - msg->result = ETH_PLUGIN_RESULT_ERROR; - break; - } -} void handle_provide_parameter(void *parameters) { ethPluginProvideParameter_t *msg = (ethPluginProvideParameter_t *) parameters; @@ -86,9 +57,6 @@ void handle_provide_parameter(void *parameters) { case MINT_TOKEN: handle_mint_token(msg, context); break; - case SAFE_TRANSFER: - handle_safe_transfer(msg, context); - break; default: PRINTF("Selector Index not supported: %d\n", context->selectorIndex); msg->result = ETH_PLUGIN_RESULT_ERROR; diff --git a/src/handle_query_contract_id.c b/src/handle_query_contract_id.c index 4faf664..ec538c7 100644 --- a/src/handle_query_contract_id.c +++ b/src/handle_query_contract_id.c @@ -7,9 +7,6 @@ void handle_query_contract_id(void *parameters) { strlcpy(msg->name, PLUGIN_NAME, msg->nameLength); switch (context->selectorIndex) { - case SAFE_TRANSFER: - strlcpy(msg->version, "Safe Transfer", msg->versionLength); - break; case MINT_TOKEN: strlcpy(msg->version, "Mint", msg->versionLength); break; diff --git a/src/handle_query_contract_ui.c b/src/handle_query_contract_ui.c index 8cab37b..1942f50 100644 --- a/src/handle_query_contract_ui.c +++ b/src/handle_query_contract_ui.c @@ -17,19 +17,6 @@ static void set_beneficiary_ui(ethQueryContractUI_t *msg, context_t *context) { getEthAddressStringFromBinary(context->beneficiary, msg->msg + 2, msg->pluginSharedRW->sha3, 0); } -// Set UI for "From Address" screen. -static void set_from_address_ui(ethQueryContractUI_t *msg, context_t *context) { - strlcpy(msg->title, "From Address", msg->titleLength); - - msg->msg[0] = '0'; - msg->msg[1] = 'x'; - - getEthAddressStringFromBinary(context->from_address, - msg->msg + 2, - msg->pluginSharedRW->sha3, - 0); -} - // Set UI for "Warning" screen. static void set_warning_ui(ethQueryContractUI_t *msg, const context_t *context __attribute__((unused))) { @@ -82,9 +69,6 @@ void handle_query_contract_ui(void *parameters) { screens_t screen = get_screen(msg, context); switch (screen) { - case FROM_ADDRESS_SCREEN: - set_from_address_ui(msg, context); - break; case TOKEN_SCREEN: set_token_ui(msg, context); break; diff --git a/src/main.c b/src/main.c index 906447a..7710d47 100644 --- a/src/main.c +++ b/src/main.c @@ -24,13 +24,13 @@ #include "poap_plugin.h" -// Function: mintToken(uint256 eventId, uint256 tokenId, address receiver, bytes signedMessage) -// Selector: 0x3da5b8f0 -static const uint8_t MINT_TOKEN_SELECTOR[SELECTOR_SIZE] = {0x3d, 0xa5, 0xb8, 0xf0}; -static const uint8_t SAFE_TRANSFER_SELECTOR[SELECTOR_SIZE] = {0x42, 0x84, 0x2e, 0x0e}; +// Function: mintToken(uint256 eventId, uint256 tokenId, address receiver, uint256 expirationTime, +// bytes signature) +// Selector: 0xaf68b302 +static const uint8_t MINT_TOKEN_SELECTOR[SELECTOR_SIZE] = {0xaf, 0x68, 0xb3, 0x02}; // Array of all the different poap selectors. -const uint8_t *const POAP_SELECTORS[NUM_SELECTORS] = {MINT_TOKEN_SELECTOR, SAFE_TRANSFER_SELECTOR}; +const uint8_t *const POAP_SELECTORS[NUM_SELECTORS] = {MINT_TOKEN_SELECTOR}; // Function to dispatch calls from the ethereum app. void dispatch_plugin_calls(int message, void *parameters) { diff --git a/src/poap_plugin.h b/src/poap_plugin.h index 407bf08..3b6b1c2 100644 --- a/src/poap_plugin.h +++ b/src/poap_plugin.h @@ -4,7 +4,7 @@ #include "eth_plugin_interface.h" #include -#define NUM_SELECTORS 2 +#define NUM_SELECTORS 1 #define PLUGIN_NAME "Poap" #define TOKEN_FOUND 1 << 1 #define SELECTOR_SIZE 4 @@ -13,7 +13,6 @@ typedef enum { MINT_TOKEN, - SAFE_TRANSFER, } selector_t; // Enumeration used to parse the smart contract data. @@ -39,7 +38,6 @@ extern const uint8_t *const POAP_SELECTORS[NUM_SELECTORS]; typedef struct context_t { // For display. uint8_t beneficiary[ADDRESS_LENGTH]; - uint8_t from_address[ADDRESS_LENGTH]; uint8_t token_id[PARAMETER_LENGTH]; // not crypto token dedicated poap token value int number char ticker[MAX_TICKER_LEN]; diff --git a/tests/elfs/poap_nanos.elf b/tests/elfs/poap_nanos.elf index f843a56..27b5c04 100755 Binary files a/tests/elfs/poap_nanos.elf and b/tests/elfs/poap_nanos.elf differ diff --git a/tests/elfs/poap_nanox.elf b/tests/elfs/poap_nanox.elf index 1b69a82..d749a5d 100755 Binary files a/tests/elfs/poap_nanox.elf and b/tests/elfs/poap_nanox.elf differ diff --git a/tests/yarn.lock b/tests/yarn.lock index 1375774..a21fc3d 100644 --- a/tests/yarn.lock +++ b/tests/yarn.lock @@ -5123,11 +5123,6 @@ ms@2.1.2: resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -n@^8.0.2: - version "8.0.2" - resolved "https://registry.npmjs.org/n/-/n-8.0.2.tgz" - integrity sha512-IvKMeWenkEntHnktypexqIi1BCTQc0Po1+zBanui+flF4dwHtsV+B2WNkx6KAMCqlTHyIisSddj1Y7EbnKRgXQ== - nan@^2.12.1: version "2.15.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.15.0.tgz#3f34a473ff18e15c1b5626b62903b5ad6e665fee"