Skip to content

Commit

Permalink
Fix swap fees ticker fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
apaillier-ledger committed Feb 13, 2024
1 parent 729214f commit 83d3b5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/handle_get_printable_amount.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions src/handle_swap_sign_transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 83d3b5b

Please sign in to comment.