mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-23 14:58:09 +00:00
f051225730
* Changes from original PR * Now that we are rejecting chain_ids of 0, we need to have the tests set the chain_ids to at least 1. * Ran 'make gen' and uploaded changed files. * Ran make style_check and fixed reported errors * Added changelog files * Reverted changes concerning chain_id 0 being rejected. * Adds tests for MAX_CHAIN_ID and MAX_CHAIN_ID+1. Also reverts MAX_CHAIN_ID to the previous value. * Added missing whitespace around arithmetic operator. Co-authored-by: Michael Hatton <michaelhatton@Michaels-Mini.fios-router.home>
26 lines
838 B
Mako
26 lines
838 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
|
|
};
|
|
|
|
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;
|
|
|
|
const TokenType *tokenByChainAddress(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, 20) == 0) {
|
|
return &(tokens[i]);
|
|
}
|
|
}
|
|
return UnknownToken;
|
|
}
|
|
|