diff --git a/Makefile b/Makefile index 7c4e149..41c43aa 100755 --- a/Makefile +++ b/Makefile @@ -230,9 +230,13 @@ else ifeq ($(CHAIN),songbird) APP_LOAD_PARAMS += --path "44'/554'" --path "44'/60'" DEFINES += CHAINID_UPCASE=\"SONGBIRD\" CHAINID_COINNAME=\"SGB\" CHAIN_KIND=CHAIN_KIND_SONGBIRD CHAIN_ID=19 APPNAME = "Songbird" +else ifeq ($(CHAIN),polygon) +APP_LOAD_PARAMS += --path "44'/60'" +DEFINES += CHAINID_UPCASE=\"POLYGON\" CHAINID_COINNAME=\"MATIC\" CHAIN_KIND=CHAIN_KIND_POLYGON CHAIN_ID=137 +APPNAME = "Polygon" else ifeq ($(filter clean,$(MAKECMDGOALS)),) -$(error Unsupported CHAIN - use ethereum, ropsten, goerli, moonriver, ethereum_classic, expanse, poa, artis_sigma1, artis_tau1, rsk, rsk_testnet, ubiq, wanchain, kusd, musicoin, pirl, akroma, atheios, callisto, ethersocial, ellaism, ether1, ethergem, gochain, mix, reosc, hpb, tomochain, tobalaba, dexon, volta, ewc, webchain, thundercore, bsc, songbird) +$(error Unsupported CHAIN - use ethereum, ropsten, goerli, moonriver, ethereum_classic, expanse, poa, artis_sigma1, artis_tau1, rsk, rsk_testnet, ubiq, wanchain, kusd, musicoin, pirl, akroma, atheios, callisto, ethersocial, ellaism, ether1, ethergem, gochain, mix, reosc, hpb, tomochain, tobalaba, dexon, volta, ewc, webchain, thundercore, bsc, songbird, polygon) endif endif @@ -403,4 +407,4 @@ include $(BOLOS_SDK)/Makefile.rules dep/%.d: %.c Makefile listvariants: - @echo VARIANTS CHAIN ethereum ropsten goerli moonriver ethereum_classic expanse poa rsk rsk_testnet ubiq wanchain pirl akroma atheios callisto ethersocial ether1 gochain musicoin ethergem mix ellaism reosc hpb tomochain dexon volta ewc thundercore bsc songbird + @echo VARIANTS CHAIN ethereum ropsten goerli moonriver ethereum_classic expanse poa rsk rsk_testnet ubiq wanchain pirl akroma atheios callisto ethersocial ether1 gochain musicoin ethergem mix ellaism reosc hpb tomochain dexon volta ewc thundercore bsc songbird polygon diff --git a/icons/nanos_app_polygon.gif b/icons/nanos_app_polygon.gif new file mode 100644 index 0000000..bf660ac Binary files /dev/null and b/icons/nanos_app_polygon.gif differ diff --git a/icons/nanox_app_polygon.gif b/icons/nanox_app_polygon.gif new file mode 100644 index 0000000..3769ce7 Binary files /dev/null and b/icons/nanox_app_polygon.gif differ diff --git a/src/chainConfig.h b/src/chainConfig.h index 28a0759..3a174a1 100644 --- a/src/chainConfig.h +++ b/src/chainConfig.h @@ -56,7 +56,8 @@ typedef enum chain_kind_e { CHAIN_KIND_THUNDERCORE, CHAIN_KIND_FLARE, CHAIN_KIND_BSC, - CHAIN_KIND_SONGBIRD + CHAIN_KIND_SONGBIRD, + CHAIN_KIND_POLYGON } chain_kind_t; typedef struct chain_config_s { diff --git a/src/main.c b/src/main.c index 1f93ce2..11358e7 100644 --- a/src/main.c +++ b/src/main.c @@ -263,6 +263,9 @@ tokenDefinition_t *getKnownToken(uint8_t *contractAddress) { case CHAIN_KIND_SONGBIRD: numTokens = NUM_TOKENS_SONGBIRD; break; + case CHAIN_KIND_POLYGON: + numTokens = NUM_TOKENS_POLYGON; + break; } for (i = 0; i < numTokens; i++) { switch (chainConfig->kind) { @@ -368,6 +371,9 @@ tokenDefinition_t *getKnownToken(uint8_t *contractAddress) { case CHAIN_KIND_SONGBIRD: currentToken = (tokenDefinition_t *) PIC(&TOKENS_SONGBIRD[i]); break; + case CHAIN_KIND_POLYGON: + currentToken = (tokenDefinition_t *) PIC(&TOKENS_POLYGON[i]); + break; } if (memcmp(currentToken->address, tmpContent.txContent.destination, ADDRESS_LENGTH) == 0) { return currentToken; diff --git a/src/tokens.c b/src/tokens.c index 4819ff2..b6a9181 100644 --- a/src/tokens.c +++ b/src/tokens.c @@ -190,4 +190,6 @@ const tokenDefinition_t const TOKENS_SONGBIRD[NUM_TOKENS_SONGBIRD] = {}; const tokenDefinition_t const TOKENS_MOONRIVER[NUM_TOKENS_MOONRIVER] = {}; +const tokenDefinition_t const TOKENS_POLYGON[NUM_TOKENS_POLYGON] = {}; + #endif diff --git a/src/tokens.h b/src/tokens.h index 5592d99..45c7460 100644 --- a/src/tokens.h +++ b/src/tokens.h @@ -100,6 +100,7 @@ static const uint8_t LEDGER_SIGNATURE_PUBLIC_KEY[] = { #define NUM_TOKENS_BSC 0 #define NUM_TOKENS_SONGBIRD 0 #define NUM_TOKENS_MOONRIVER 0 +#define NUM_TOKENS_POLYGON 0 extern tokenDefinition_t const TOKENS_AKROMA[NUM_TOKENS_AKROMA]; extern tokenDefinition_t const TOKENS_ELLAISM[NUM_TOKENS_ELLAISM]; @@ -135,6 +136,7 @@ extern tokenDefinition_t const TOKENS_FLARE[NUM_TOKENS_FLARE]; extern tokenDefinition_t const TOKENS_BSC[NUM_TOKENS_BSC]; extern tokenDefinition_t const TOKENS_SONGBIRD[NUM_TOKENS_SONGBIRD]; extern tokenDefinition_t const TOKENS_MOONRIVER[NUM_TOKENS_MOONRIVER]; +extern tokenDefinition_t const TOKENS_POLYGON[NUM_TOKENS_POLYGON]; #endif /* HAVE_TOKENS_LIST */