ethereum: add new networks

pull/25/head
Pavol Rusnak 6 years ago
parent 156fab867b
commit a1379371a0
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -241,23 +241,29 @@ static void ethereumFormatAmount(const bignum256 *amnt, const TokenType *token,
suffix = " Wei";
decimals = 0;
} else {
if (tx_type == 1 || tx_type == 6) {
suffix = " WAN";
} else {
switch (chain_id) {
case 1: suffix = " ETH"; break; // Ethereum Mainnet
case 61: suffix = " ETC"; break; // Ethereum Classic Mainnet
case 62: suffix = " tETC"; break; // Ethereum Classic Testnet
case 30: suffix = " RSK"; break; // Rootstock Mainnet
case 31: suffix = " tRSK"; break; // Rootstock Testnet
case 3: suffix = " tETH"; break; // Ethereum Testnet: Ropsten
case 4: suffix = " tETH"; break; // Ethereum Testnet: Rinkeby
case 42: suffix = " tETH"; break; // Ethereum Testnet: Kovan
case 2: suffix = " EXP"; break; // Expanse
case 8: suffix = " UBQ"; break; // UBIQ
default: suffix = " UNKN"; break; // unknown chain
}
}
if (tx_type == 1 || tx_type == 6) {
suffix = " WAN";
} else {
// constants from trezor-common/defs/ethereum/networks.json
switch (chain_id) {
case 1: suffix = " ETH"; break; // Ethereum
case 2: suffix = " EXP"; break; // Expanse
case 3: suffix = " tETH"; break; // Ethereum Testnet Ropsten
case 4: suffix = " tETH"; break; // Ethereum Testnet Rinkeby
case 8: suffix = " UBQ"; break; // UBIQ
case 20: suffix = " EOSC"; break; // EOS Classic
case 28: suffix = " ETSC"; break; // Ethereum Social
case 30: suffix = " RSK"; break; // RSK
case 31: suffix = " tRSK"; break; // RSK Testnet
case 42: suffix = " tETH"; break; // Ethereum Testnet Kovan
case 61: suffix = " ETC"; break; // Ethereum Classic
case 62: suffix = " tETC"; break; // Ethereum Classic Testnet
case 64: suffix = " ELLA"; break; // Ellaism
case 820: suffix = " CLO"; break; // Callisto
case 1987: suffix = " EGEM"; break; // EtherGem
default : suffix = " UNKN"; break; // unknown chain
}
}
}
bn_format(amnt, NULL, suffix, decimals, 0, false, buf, buflen);
}
@ -455,10 +461,10 @@ void ethereum_signing_init(EthereumSignTx *msg, const HDNode *node)
chain_id = 0;
}
/* Wanchain txtype */
/* Wanchain txtype */
if (msg->has_tx_type) {
if (msg->tx_type == 1 || msg->tx_type == 6) {
tx_type = msg->tx_type;
tx_type = msg->tx_type;
} else {
fsm_sendFailure(FailureType_Failure_DataError, _("Txtype out of bounds"));
ethereum_signing_abort();
@ -548,9 +554,9 @@ void ethereum_signing_init(EthereumSignTx *msg, const HDNode *node)
rlp_length += rlp_calculate_length(msg->to.size, msg->to.bytes[0]);
rlp_length += rlp_calculate_length(msg->value.size, msg->value.bytes[0]);
rlp_length += rlp_calculate_length(data_total, msg->data_initial_chunk.bytes[0]);
if (tx_type) {
rlp_length += rlp_calculate_length(1, tx_type);
}
if (tx_type) {
rlp_length += rlp_calculate_length(1, tx_type);
}
if (chain_id) {
rlp_length += rlp_calculate_length(1, chain_id);
rlp_length += rlp_calculate_length(0, 0);
@ -562,9 +568,9 @@ void ethereum_signing_init(EthereumSignTx *msg, const HDNode *node)
layoutProgress(_("Signing"), 100);
if (tx_type) {
hash_rlp_number(tx_type);
}
if (tx_type) {
hash_rlp_number(tx_type);
}
hash_rlp_field(msg->nonce.bytes, msg->nonce.size);
hash_rlp_field(msg->gas_price.bytes, msg->gas_price.size);
hash_rlp_field(msg->gas_limit.bytes, msg->gas_limit.size);

Loading…
Cancel
Save