Skip to content

Commit

Permalink
Merge pull request #21 from blooo-io/docs/LDG-412-add-documentation
Browse files Browse the repository at this point in the history
docs: add documentation
  • Loading branch information
Z4karia authored Jan 22, 2024
2 parents a0a628d + 74c7081 commit ed43245
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/handle_provide_parameter.c
Original file line number Diff line number Diff line change
@@ -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--) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 6 additions & 0 deletions src/handle_query_contract_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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) {
Expand All @@ -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))) {
Expand Down

0 comments on commit ed43245

Please sign in to comment.