mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-30 18:10:56 +00:00
76c6e9cd9d
WIP - change trezor{1,2} to their internal names, add support for model R WIP - add EOS and NEM features Capability only for TT WIP - not include EOS and NEM into TR WIP - choose between device models when generating coininfo WIP - regenerate coininfo.py WIP - skip NEM, EOS, Dash, BGold and Decred device tests for TR WIP - fix python support WIP - fix unit tests WIP - import bitcoin-like code only when needed WIP - remove ignored coins for TR in fixtures.json WIP - make all the external references to models UPPERCASE WIP - do the model separation in mako script also for tokens and networks WIP - hot-fixing non-supporting RELEASES_URL for new model names WIP - support.py releases CLI command takes a list of -r key-value pairs DEVICE=VERSION WIP - run `python support.py release` WIP - use utils.MODEL_IS_T2B1 to ignore NEM and EOS WIP - change all the docs and commands to have UPPERCASE model names [no changelog]
52 lines
1.3 KiB
Mako
52 lines
1.3 KiB
Mako
// This file is automatically generated from ethereum_tokens.c.mako
|
|
// DO NOT EDIT
|
|
|
|
#include <string.h>
|
|
#include "ethereum.h"
|
|
#include "ethereum_tokens.h"
|
|
|
|
<% erc20_list = list(supported_on("T1B1", erc20)) %>\
|
|
#define TOKENS_COUNT ${len(erc20_list)}
|
|
|
|
static const EthereumTokenInfo tokens[TOKENS_COUNT] = {
|
|
% for t in sorted(erc20_list, key=lambda token: (token.chain_id, token.name)):
|
|
{
|
|
.symbol = "${ascii(t.symbol)}",
|
|
.decimals = ${t.decimals},
|
|
.address = {
|
|
.size = 20,
|
|
.bytes = ${c_str(t.address_bytes)}
|
|
},
|
|
.chain_id = ${t.chain_id},
|
|
## .name = "${t.name}"
|
|
.name = "",
|
|
},
|
|
% endfor
|
|
};
|
|
|
|
const EthereumTokenInfo UNKNOWN_TOKEN = {
|
|
.symbol = "Wei UNKN",
|
|
.decimals = 0,
|
|
.address = {
|
|
.size = 20,
|
|
.bytes = "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff",
|
|
},
|
|
.chain_id = CHAIN_ID_UNKNOWN,
|
|
.name = "",
|
|
};
|
|
|
|
const EthereumTokenInfo *ethereum_token_by_address(uint64_t chain_id, const uint8_t *address)
|
|
{
|
|
if (!address) return 0;
|
|
for (int i = 0; i < TOKENS_COUNT; i++) {
|
|
if (chain_id == tokens[i].chain_id && memcmp(address, tokens[i].address.bytes, sizeof(tokens[i].address.bytes)) == 0) {
|
|
return &(tokens[i]);
|
|
}
|
|
}
|
|
return &UNKNOWN_TOKEN;
|
|
}
|
|
|
|
bool is_unknown_token(const EthereumTokenInfo *token) {
|
|
return token->chain_id == CHAIN_ID_UNKNOWN;
|
|
}
|
|
|