Add Polygon as a variant (#207)

This commit is contained in:
Jean P
2021-10-28 18:17:05 +02:00
committed by GitHub
parent 3eeec97efa
commit 3a47291fb1
7 changed files with 18 additions and 3 deletions

View File

@@ -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

BIN
icons/nanos_app_polygon.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 B

BIN
icons/nanox_app_polygon.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 B

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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

View File

@@ -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 */