Skip to content

Commit

Permalink
feat: add SELL_VOUCHER_NEW_POL support across contract handling
Browse files Browse the repository at this point in the history
- Introduced new selector STAKEKIT_SELL_VOUCHER_NEW_POL in contract.c.
- Updated handle_finalize, handle_init_contract, handle_provide_parameter, handle_query_contract_id, and handle_query_contract_ui to support SELL_VOUCHER_NEW_POL case.
- Incremented NUM_STAKEKIT_SELECTORS to 60 in stakekit_plugin.h.
  • Loading branch information
keiff3r committed Jan 23, 2025
1 parent 8fa0304 commit 790888e
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/contract.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ static const uint8_t STAKEKIT_CLAIM_TOKENS_SELECTOR[SELECTOR_SIZE] = {0x46, 0xe0
static const uint8_t STAKEKIT_BUY_VOUCHER_SELECTOR[SELECTOR_SIZE] = {0x6a, 0xb1, 0x50, 0x71};
static const uint8_t STAKEKIT_BUY_VOUCHER_POL_SELECTOR[SELECTOR_SIZE] = {0xe4, 0x45, 0x7a, 0x8a};
static const uint8_t STAKEKIT_SELL_VOUCHER_NEW_SELECTOR[SELECTOR_SIZE] = {0xc8, 0x3e, 0xc0, 0x4d};
static const uint8_t STAKEKIT_SELL_VOUCHER_NEW_POL_SELECTOR[SELECTOR_SIZE] = {0xe5,
0x70,
0xb7,
0x8b};
static const uint8_t STAKEKIT_MORPHO_SUPPLY_1_SELECTOR[SELECTOR_SIZE] = {0x0c, 0x0a, 0x76, 0x9b};
static const uint8_t STAKEKIT_MORPHO_SUPPLY_2_SELECTOR[SELECTOR_SIZE] = {0xf2, 0xb9, 0xfd, 0xb8};
static const uint8_t STAKEKIT_MORPHO_SUPPLY_3_SELECTOR[SELECTOR_SIZE] = {0xf6, 0x22, 0x56, 0xc7};
Expand Down Expand Up @@ -122,6 +126,7 @@ const uint8_t *const STAKEKIT_SELECTORS[NUM_STAKEKIT_SELECTORS] = {
STAKEKIT_BUY_VOUCHER_SELECTOR,
STAKEKIT_BUY_VOUCHER_POL_SELECTOR,
STAKEKIT_SELL_VOUCHER_NEW_SELECTOR,
STAKEKIT_SELL_VOUCHER_NEW_POL_SELECTOR,
STAKEKIT_MORPHO_SUPPLY_1_SELECTOR,
STAKEKIT_MORPHO_SUPPLY_2_SELECTOR,
STAKEKIT_MORPHO_SUPPLY_3_SELECTOR,
Expand Down
1 change: 1 addition & 0 deletions src/handle_finalize.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ void handle_finalize(ethPluginFinalize_t *msg) {
break;
case CLAIM_TOKENS:
case SELL_VOUCHER_NEW:
case SELL_VOUCHER_NEW_POL:
case AVALANCHE_REDEEM_2:
case AVALANCHE_REDEEM_OVERDUE_SHARES_2:
msg->numScreens = 1;
Expand Down
1 change: 1 addition & 0 deletions src/handle_init_contract.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ void handle_init_contract(ethPluginInitContract_t *msg) {
case BUY_VOUCHER:
case BUY_VOUCHER_POL:
case SELL_VOUCHER_NEW:
case SELL_VOUCHER_NEW_POL:
case ENTER:
case LEAVE:
case UNLOCK:
Expand Down
1 change: 1 addition & 0 deletions src/handle_provide_parameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ void handle_provide_parameter(ethPluginProvideParameter_t *msg) {
break;
case BUY_VOUCHER:
case SELL_VOUCHER_NEW:
case SELL_VOUCHER_NEW_POL:
case BUY_VOUCHER_POL:
// Save the amount sent to the context and skip.
copy_parameter(context->amount_sent, msg->parameter, INT256_LENGTH);
Expand Down
3 changes: 3 additions & 0 deletions src/handle_query_contract_id.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ void handle_query_contract_id(ethQueryContractID_t *msg) {
case SELL_VOUCHER_NEW:
strlcpy(msg->version, "Sell Voucher New", msg->versionLength);
break;
case SELL_VOUCHER_NEW_POL:
strlcpy(msg->version, "Sell Voucher New POL", msg->versionLength);
break;
case MORPHO_SUPPLY_1:
case MORPHO_SUPPLY_2:
case MORPHO_SUPPLY_3:
Expand Down
2 changes: 2 additions & 0 deletions src/handle_query_contract_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ static bool set_send_ui(ethQueryContractUI_t *msg, plugin_parameters_t *context)
case BUY_VOUCHER:
case BUY_VOUCHER_POL:
case SELL_VOUCHER_NEW:
case SELL_VOUCHER_NEW_POL:
case MORPHO_SUPPLY_1:
case MORPHO_SUPPLY_2:
case MORPHO_SUPPLY_3:
Expand Down Expand Up @@ -650,6 +651,7 @@ static screens_t get_screen(ethQueryContractUI_t *msg,
case BUY_VOUCHER:
case BUY_VOUCHER_POL:
case SELL_VOUCHER_NEW:
case SELL_VOUCHER_NEW_POL:
case ENTER:
case LEAVE:
case UNLOCK:
Expand Down
2 changes: 1 addition & 1 deletion src/stakekit_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#define PLUGIN_NAME "StakeKit"

#define NUM_STAKEKIT_SELECTORS 59u
#define NUM_STAKEKIT_SELECTORS 60u

#define TICKER_LEN 30u

Expand Down

0 comments on commit 790888e

Please sign in to comment.