Skip to content

Commit

Permalink
fix: removed duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven2505 committed Jan 21, 2025
1 parent 8678ecd commit 8f4c159
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions src/handle_provide_parameter.c
Original file line number Diff line number Diff line change
@@ -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));
Expand All @@ -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);
Expand Down

0 comments on commit 8f4c159

Please sign in to comment.