Add ETH 2 deposit handling

This commit is contained in:
BTChip github
2020-10-27 11:16:50 +01:00
committed by TamtamHero
parent 832294334f
commit 7e53de8897
17 changed files with 544 additions and 14 deletions

View File

@@ -2,7 +2,12 @@
void erc20_plugin_call(int message, void *parameters);
void compound_plugin_call(int message, void *parameters);
#ifdef HAVE_STARKWARE
void starkware_plugin_call(int message, void *parameters);
#endif
#ifdef HAVE_ETH2
void eth2_plugin_call(int message, void *parameters);
#endif
static const uint8_t const ERC20_TRANSFER_SELECTOR[SELECTOR_SIZE] = { 0xa9, 0x05, 0x9c, 0xbb };
static const uint8_t const ERC20_APPROVE_SELECTOR[SELECTOR_SIZE] = { 0x09, 0x5e, 0xa7, 0xb3 };
@@ -21,6 +26,16 @@ const uint8_t* const COMPOUND_SELECTORS[NUM_COMPOUND_SELECTORS] = {
COMPOUND_MINT_SELECTOR, CETH_MINT_SELECTOR
};
#ifdef HAVE_ETH2
static const uint8_t const ETH2_DEPOSIT_SELECTOR[SELECTOR_SIZE] = { 0x22, 0x89, 0x51, 0x18 };
const uint8_t* const ETH2_SELECTORS[NUM_ETH2_SELECTORS] = {
ETH2_DEPOSIT_SELECTOR
};
#endif
#ifdef HAVE_STARKWARE
static const uint8_t const STARKWARE_REGISTER_ID[SELECTOR_SIZE] = { 0x76, 0x57, 0x18, 0xd7 };
@@ -45,21 +60,32 @@ const uint8_t* const STARKWARE_SELECTORS[NUM_STARKWARE_SELECTORS] = {
// All internal alias names start with 'minus'
const internalEthPlugin_t const INTERNAL_ETH_PLUGINS[NUM_INTERNAL_PLUGINS] = {
const internalEthPlugin_t const INTERNAL_ETH_PLUGINS[] = {
{
ERC20_SELECTORS,
2,
NUM_ERC20_SELECTORS,
"-erc20",
erc20_plugin_call
},
{
COMPOUND_SELECTORS,
4,
NUM_COMPOUND_SELECTORS,
"-cmpd",
compound_plugin_call
},
#ifdef HAVE_ETH2
{
ETH2_SELECTORS,
NUM_ETH2_SELECTORS,
"-eth2",
eth2_plugin_call
},
#endif
#ifdef HAVE_STARKWARE
{
@@ -70,4 +96,11 @@ const internalEthPlugin_t const INTERNAL_ETH_PLUGINS[NUM_INTERNAL_PLUGINS] = {
},
#endif
{
NULL,
0,
"",
NULL
}
};