diff --git a/src/handle_provide_parameter.c b/src/handle_provide_parameter.c index 900f325..6c33cd3 100644 --- a/src/handle_provide_parameter.c +++ b/src/handle_provide_parameter.c @@ -1,6 +1,7 @@ #include "stakekit_plugin.h" -// Add two hex numbers and save the result in the first number. +// Adds two 256-bit numbers represented as arrays of uint8_t, 'a' and 'b'. +// The result of the addition is stored in 'a'. static void hex_addition(uint8_t a[INT256_LENGTH], const uint8_t b[INT256_LENGTH]) { uint16_t carry = 0; for (int i = INT256_LENGTH - 1; i >= 0; i--) { @@ -286,6 +287,12 @@ static void handle_aave_supply(ethPluginProvideParameter_t *msg, plugin_paramete } } +// Saves the sum of multiple amounts and 1 recipient in the context. +// The first param is the owner saved in recipient. +// The second param is the number of amounts in the amounts[] array +// The third param is the first amount requested saved in amount_sent. +// The fourth param is for all the following amounts in the amounts[] array, each time added to +// amount_sent. static void handle_lido_request_withdrawal(ethPluginProvideParameter_t *msg, plugin_parameters_t *context) { switch (context->next_param) { @@ -331,6 +338,13 @@ static void handle_lido_request_withdrawal(ethPluginProvideParameter_t *msg, } } +// Saves between 1 and 2 requestIds and hint pairs in the context. +// The first param is the offset of the _hints[] array saved temporarly in unbound_nonce. +// The second param is the number of elements in _hints[] array saved in nb_requests. +// The third param is the first requestId saved in amount_sent. +// The fourth param is the second requestId saved in contract_address (if any) +// The fifth param is the first hint saved in amount_received. +// The sixth param is the second hint saved in recipient (if any) static void handle_lido_claim_withdrawal(ethPluginProvideParameter_t *msg, plugin_parameters_t *context) { switch (context->next_param) { diff --git a/src/handle_query_contract_ui.c b/src/handle_query_contract_ui.c index b4866b5..42d6a5f 100644 --- a/src/handle_query_contract_ui.c +++ b/src/handle_query_contract_ui.c @@ -99,6 +99,8 @@ static void set_send_value_ui(ethQueryContractUI_t *msg, plugin_parameters_t *co PRINTF("AMOUNT SENT: %s\n", msg->msg); } +// Set UI for "Send 2" screen. +// Each methods sets the title and the message to be displayed on the screen. static void set_send_2_ui(ethQueryContractUI_t *msg, plugin_parameters_t *context) { switch (context->selectorIndex) { case LIDO_CLAIM_WITHDRAWALS: @@ -152,6 +154,8 @@ static void set_receive_ui(ethQueryContractUI_t *msg, plugin_parameters_t *conte PRINTF("AMOUNT RECEIVED: %s\n", msg->msg); } +// Set UI for "Receive 2" screen. +// Each methods sets the title and the message to be displayed on the screen. static void set_receive_2_ui(ethQueryContractUI_t *msg, plugin_parameters_t *context) { switch (context->selectorIndex) { case LIDO_CLAIM_WITHDRAWALS: @@ -521,6 +525,7 @@ static screens_t get_screen_unstake_claim(ethQueryContractUI_t *msg, } } +// Set UI for the Angle Protocol Withdraw method. static screens_t get_screen_angle_withdraw(ethQueryContractUI_t *msg, plugin_parameters_t *context __attribute__((unused))) { switch (msg->screenIndex) { @@ -535,6 +540,7 @@ static screens_t get_screen_angle_withdraw(ethQueryContractUI_t *msg, } } +// Set UI for the Lido ClaimWithdrawals method. static screens_t get_screen_lido_claim_withdrawal(ethQueryContractUI_t *msg, plugin_parameters_t *context __attribute__((unused))) {