1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 06:48:16 +00:00
trezor-firmware/legacy/firmware/ethereum_tokens.c.mako

26 lines
838 B
Plaintext
Raw Normal View History

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 };
const TokenType *UnknownToken = &_UnknownToken;
2018-07-30 15:40:07 +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;
}