mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 22:38:08 +00:00
ethereum: don't show unrecognized ERC-20 tokens as sending message
This commit is contained in:
parent
ba2b2f24da
commit
2ecc36cd89
@ -203,6 +203,10 @@ static void ethereumFormatAmount(const bignum256 *amnt, const TokenType *token,
|
||||
bn_read_uint32(1000000000, &bn1e9);
|
||||
const char *suffix = NULL;
|
||||
int decimals = 18;
|
||||
if (token == UnknownToken) {
|
||||
strlcpy(buf, "Unrecognized Token", buflen);
|
||||
return;
|
||||
} else
|
||||
if (token != NULL) {
|
||||
suffix = token->ticker;
|
||||
decimals = token->decimals;
|
||||
|
@ -84,6 +84,8 @@ const TokenType tokens[TOKENS_COUNT] = {
|
||||
{61, "\x08\x5f\xb4\xf2\x40\x31\xea\xed\xbc\x2b\x61\x1a\xa5\x28\xf2\x23\x43\xeb\x52\xdb", " BEC", 8},
|
||||
};
|
||||
|
||||
const TokenType *UnknownToken = (const TokenType *)1;
|
||||
|
||||
const TokenType *tokenByChainAddress(uint8_t chain_id, const uint8_t *address)
|
||||
{
|
||||
if (!address) return 0;
|
||||
@ -92,5 +94,5 @@ const TokenType *tokenByChainAddress(uint8_t chain_id, const uint8_t *address)
|
||||
return &(tokens[i]);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return UnknownToken;
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ typedef struct {
|
||||
|
||||
extern const TokenType tokens[TOKENS_COUNT];
|
||||
|
||||
extern const TokenType *UnknownToken;
|
||||
|
||||
const TokenType *tokenByChainAddress(uint8_t chain_id, const uint8_t *address);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user