Revert "[clean] Removing compound-related plugin code"

This commit is contained in:
apaillier-ledger
2022-09-12 14:42:57 +02:00
committed by GitHub
parent 384c16c3d0
commit 95a0c8896b
3 changed files with 264 additions and 0 deletions

View File

@@ -4,6 +4,7 @@
bool erc20_plugin_available_check(void);
void erc20_plugin_call(int message, void* parameters);
void compound_plugin_call(int message, void* parameters);
void copy_address(uint8_t* dst, const uint8_t* parameter, uint8_t dst_size) {
uint8_t copy_size = MIN(dst_size, ADDRESS_LENGTH);
@@ -28,6 +29,17 @@ static const uint8_t ERC20_APPROVE_SELECTOR[SELECTOR_SIZE] = {0x09, 0x5e, 0xa7,
const uint8_t* const ERC20_SELECTORS[NUM_ERC20_SELECTORS] = {ERC20_TRANSFER_SELECTOR,
ERC20_APPROVE_SELECTOR};
static const uint8_t COMPOUND_REDEEM_UNDERLYING_SELECTOR[SELECTOR_SIZE] = {0x85, 0x2a, 0x12, 0xe3};
static const uint8_t COMPOUND_REDEEM_SELECTOR[SELECTOR_SIZE] = {0xdb, 0x00, 0x6a, 0x75};
static const uint8_t COMPOUND_MINT_SELECTOR[SELECTOR_SIZE] = {0xa0, 0x71, 0x2d, 0x68};
static const uint8_t CETH_MINT_SELECTOR[SELECTOR_SIZE] = {0x12, 0x49, 0xc5, 0x8b};
const uint8_t* const COMPOUND_SELECTORS[NUM_COMPOUND_SELECTORS] = {
COMPOUND_REDEEM_UNDERLYING_SELECTOR,
COMPOUND_REDEEM_SELECTOR,
COMPOUND_MINT_SELECTOR,
CETH_MINT_SELECTOR};
#ifdef HAVE_ETH2
static const uint8_t ETH2_DEPOSIT_SELECTOR[SELECTOR_SIZE] = {0x22, 0x89, 0x51, 0x18};
@@ -99,6 +111,12 @@ const internalEthPlugin_t INTERNAL_ETH_PLUGINS[] = {
"-erc20",
erc20_plugin_call},
{NULL,
(const uint8_t**) COMPOUND_SELECTORS,
NUM_COMPOUND_SELECTORS,
"-cmpd",
compound_plugin_call},
#ifdef HAVE_ETH2
{NULL, (const uint8_t**) ETH2_SELECTORS, NUM_ETH2_SELECTORS, "-eth2", eth2_plugin_call},