2018-07-30 15:40:07 +00:00
|
|
|
// This file is automatically generated from ethereum_tokens.c.mako
|
|
|
|
// DO NOT EDIT
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include "ethereum_tokens.h"
|
|
|
|
|
|
|
|
const TokenType tokens[TOKENS_COUNT] = {
|
|
|
|
% for t in supported_on("trezor1", erc20):
|
|
|
|
{${"{:>2}".format(t.chain_id)}, ${c_str(t.address_bytes)}, " ${ascii(t.symbol)}", ${t.decimals}}, // ${t.chain} / ${t.name}
|
|
|
|
% endfor
|
|
|
|
};
|
|
|
|
|
2020-01-04 16:02:48 +00:00
|
|
|
static const TokenType _UnknownToken = { 0, "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", " UNKN", 0 };
|
2020-11-11 13:43:09 +00:00
|
|
|
const TokenType *UnknownToken = &_UnknownToken;
|
2018-07-30 15:40:07 +00:00
|
|
|
|
2021-08-31 09:29:30 +00:00
|
|
|
const TokenType *tokenByChainAddress(uint64_t chain_id, const uint8_t *address)
|
2018-07-30 15:40:07 +00:00
|
|
|
{
|
|
|
|
if (!address) return 0;
|
|
|
|
for (int i = 0; i < TOKENS_COUNT; i++) {
|
|
|
|
if (chain_id == tokens[i].chain_id && memcmp(address, tokens[i].address, 20) == 0) {
|
|
|
|
return &(tokens[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return UnknownToken;
|
|
|
|
}
|