1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 14:28:07 +00:00
trezor-firmware/legacy/firmware/ethereum_tokens.c.mako
2019-04-15 19:14:58 +02:00

25 lines
702 B
Mako

// 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
};
const TokenType *UnknownToken = (const TokenType *)1;
const TokenType *tokenByChainAddress(uint32_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, 20) == 0) {
return &(tokens[i]);
}
}
return UnknownToken;
}