Fix swap fees ticker fallback

This commit is contained in:
Alexandre Paillier
2024-02-13 14:25:51 +01:00
parent 729214f239
commit 83d3b5b644
2 changed files with 8 additions and 0 deletions

View File

@@ -31,6 +31,10 @@ void handle_get_printable_amount(get_printable_amount_parameters_t* params,
}
// If the amount is a fee, the ticker should be the chain's native currency
if (params->is_fee) {
// fallback mechanism in the absence of chain ID in swap config
if (chain_id == 0) {
chain_id = config->chainId;
}
strlcpy(ticker, get_displayable_ticker(&chain_id, config), sizeof(ticker));
decimals = WEI_TO_ETHER;
}

View File

@@ -49,6 +49,10 @@ bool copy_transaction_parameters(create_transaction_parameters_t* sign_transacti
return false;
}
// fallback mechanism in the absence of chain ID in swap config
if (chain_id == 0) {
chain_id = config->chainId;
}
// If the amount is a fee, its value is nominated in ETH even if we're doing an ERC20 swap
strlcpy(ticker, get_displayable_ticker(&chain_id, config), sizeof(ticker));
decimals = WEI_TO_ETHER;