From 8f4c1594f7b6842e1633bb498898460a46c975f0 Mon Sep 17 00:00:00 2001 From: Steven Lin Date: Tue, 21 Jan 2025 12:44:27 +0100 Subject: [PATCH 1/2] fix: removed duplicate code --- src/handle_provide_parameter.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/src/handle_provide_parameter.c b/src/handle_provide_parameter.c index d635d72c..26a81052 100644 --- a/src/handle_provide_parameter.c +++ b/src/handle_provide_parameter.c @@ -1,21 +1,6 @@ #include "plugin.h" -static void handle_delegate(ethPluginProvideParameter_t *msg, context_t *context) { - switch (context->next_param) { - case BENEFICIARY: - copy_address(context->beneficiary, msg->parameter, sizeof(context->beneficiary)); - context->next_param = NONE; - break; - case NONE: - break; - default: - PRINTF("Param not supported: %d\n", context->next_param); - msg->result = ETH_PLUGIN_RESULT_ERROR; - break; - } -} - -static void handle_create_reward_vault(ethPluginProvideParameter_t *msg, context_t *context) { +static void handle_beneficiary(ethPluginProvideParameter_t *msg, context_t *context) { switch (context->next_param) { case BENEFICIARY: copy_address(context->beneficiary, msg->parameter, sizeof(context->beneficiary)); @@ -39,16 +24,15 @@ void handle_provide_parameter(ethPluginProvideParameter_t *msg) { msg->parameterOffset, PARAMETER_LENGTH, msg->parameter); - msg->result = ETH_PLUGIN_RESULT_OK; // EDIT THIS: adapt the cases and the names of the functions. switch (context->selectorIndex) { case CREATE_REWARD_VAULT: - handle_create_reward_vault(msg, context); + handle_beneficiary(msg, context); break; case DELEGATE: - handle_delegate(msg, context); + handle_beneficiary(msg, context); break; default: PRINTF("Selector Index not supported: %d\n", context->selectorIndex); From 90450673a80520d991eab3aa0ba9cbbbce13073e Mon Sep 17 00:00:00 2001 From: Steven Lin Date: Tue, 21 Jan 2025 12:46:21 +0100 Subject: [PATCH 2/2] fix: removed unecessary code --- src/handle_provide_parameter.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/handle_provide_parameter.c b/src/handle_provide_parameter.c index 26a81052..54c6989f 100644 --- a/src/handle_provide_parameter.c +++ b/src/handle_provide_parameter.c @@ -29,8 +29,6 @@ void handle_provide_parameter(ethPluginProvideParameter_t *msg) { // EDIT THIS: adapt the cases and the names of the functions. switch (context->selectorIndex) { case CREATE_REWARD_VAULT: - handle_beneficiary(msg, context); - break; case DELEGATE: handle_beneficiary(msg, context); break;