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

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