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

@@ -54,6 +54,9 @@ bool called_from_swap;
#ifdef HAVE_STARKWARE
bool quantumSet;
#endif
#ifdef HAVE_ETH2
uint32_t eth2WithdrawalIndex;
#endif
#include "ux.h"
ux_state_t G_ux;
@@ -70,6 +73,9 @@ void reset_app_context() {
called_from_swap = false;
#ifdef HAVE_STARKWARE
quantumSet = false;
#endif
#ifdef HAVE_ETH2
eth2WithdrawalIndex = 0;
#endif
os_memset((uint8_t*)&txContext, 0, sizeof(txContext));
os_memset((uint8_t*)&tmpContent, 0, sizeof(tmpContent));
@@ -426,6 +432,19 @@ void handleApdu(unsigned int *flags, unsigned int *tx) {
handleSignEIP712Message(G_io_apdu_buffer[OFFSET_P1], G_io_apdu_buffer[OFFSET_P2], G_io_apdu_buffer + OFFSET_CDATA, G_io_apdu_buffer[OFFSET_LC], flags, tx);
break;
#ifdef HAVE_ETH2
case INS_GET_ETH2_PUBLIC_KEY:
os_memset(tmpCtx.transactionContext.tokenSet, 0, MAX_TOKEN);
handleGetEth2PublicKey(G_io_apdu_buffer[OFFSET_P1], G_io_apdu_buffer[OFFSET_P2], G_io_apdu_buffer + OFFSET_CDATA, G_io_apdu_buffer[OFFSET_LC], flags, tx);
break;
case INS_SET_ETH2_WITHDRAWAL_INDEX:
handleSetEth2WithdrawalIndex(G_io_apdu_buffer[OFFSET_P1], G_io_apdu_buffer[OFFSET_P2], G_io_apdu_buffer + OFFSET_CDATA, G_io_apdu_buffer[OFFSET_LC], flags, tx);
break;
#endif
#if 0
case 0xFF: // return to dashboard
goto return_to_dashboard;