forked from kilnfi/app-plugin-kiln
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
117 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/******************************************************************************* | ||
* | ||
* ██╗ ██╗██╗██╗ ███╗ ██╗ | ||
* ██║ ██╔╝██║██║ ████╗ ██║ | ||
* █████╔╝ ██║██║ ██╔██╗ ██║ | ||
* ██╔═██╗ ██║██║ ██║╚██╗██║ | ||
* ██║ ██╗██║███████╗██║ ╚████║ | ||
* ╚═╝ ╚═╝╚═╝╚══════╝╚═╝ ╚═══╝ | ||
* | ||
* Kiln Ethereum Ledger App | ||
* (c) 2022-2024 Kiln | ||
* | ||
* [email protected] | ||
********************************************************************************/ | ||
|
||
#include "provide_parameter.h" | ||
|
||
void handle_v1_withdraw_funcs(ethPluginProvideParameter_t *msg, context_t *context) { | ||
// ************************************************************************** | ||
// FUNCTION TO PARSE | ||
// ************************************************************************** | ||
// | ||
// function f( | ||
// bytes | ||
// ) | ||
// | ||
// ************************************************************************** | ||
// example: | ||
// | ||
// function withdrawEL( | ||
// bytes validatorPubkey | ||
// ) external | ||
// | ||
// [ 0] selector | ||
// [ 4] validatorPubkeyoffset | ||
// [ 36] validatorPubkeylength | ||
// [ 68] validatorPubkey_chunk_0 | ||
// [ 100] validatorPubkey_chunk_1 | ||
// | ||
|
||
v1_withdraw_funcs_t *params = &context->param_data.v1_withdraw_funcs; | ||
|
||
switch (context->next_param) { | ||
case V1_WFUNCS_BYTES_OFFSET: | ||
context->next_param = V1_WFUNCS_BYTES_LENGTH; | ||
break; | ||
case V1_WFUNCS_BYTES_LENGTH: | ||
U2BE_from_parameter(msg->parameter, ¶ms->current_item_count); | ||
context->next_param = V1_WFUNCS_BYTES__ITEMS; | ||
break; | ||
case V1_WFUNCS_BYTES__ITEMS: | ||
params->current_item_count -= 1; | ||
if (params->current_item_count == 0) { | ||
context->next_param = V1_WFUNCS_UNEXPECTED_PARAMETER; | ||
} | ||
break; | ||
default: | ||
PRINTF("Param not supported: %d\n", context->next_param); | ||
msg->result = ETH_PLUGIN_RESULT_ERROR; | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters