Merge pull request #231 from LedgerHQ/fix/printable_fees
[fix] Get printable amount handle should not parse configuration for ticker and decimal if the amount is a fee
This commit is contained in:
@@ -15,13 +15,6 @@ int handle_get_printable_amount(get_printable_amount_parameters_t* params, chain
|
|||||||
PRINTF("Amount is too big, 32 bytes max but buffer has %u bytes", params->amount_length);
|
PRINTF("Amount is too big, 32 bytes max but buffer has %u bytes", params->amount_length);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!parse_swap_config(params->coin_configuration,
|
|
||||||
params->coin_configuration_length,
|
|
||||||
ticker,
|
|
||||||
&decimals)) {
|
|
||||||
PRINTF("Error while parsing config\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the amount is a fee, its value is nominated in ETH even if we're doing an ERC20 swap
|
// If the amount is a fee, its value is nominated in ETH even if we're doing an ERC20 swap
|
||||||
if (params->is_fee) {
|
if (params->is_fee) {
|
||||||
@@ -30,6 +23,15 @@ int handle_get_printable_amount(get_printable_amount_parameters_t* params, chain
|
|||||||
ticker[ticker_len] = ' ';
|
ticker[ticker_len] = ' ';
|
||||||
ticker[ticker_len + 1] = '\0';
|
ticker[ticker_len + 1] = '\0';
|
||||||
decimals = WEI_TO_ETHER;
|
decimals = WEI_TO_ETHER;
|
||||||
|
} else {
|
||||||
|
// If the amount is *not* a fee, decimals and ticker are built from the given config
|
||||||
|
if (!parse_swap_config(params->coin_configuration,
|
||||||
|
params->coin_configuration_length,
|
||||||
|
ticker,
|
||||||
|
&decimals)) {
|
||||||
|
PRINTF("Error while parsing config\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
amountToString(params->amount,
|
amountToString(params->amount,
|
||||||
|
|||||||
Reference in New Issue
Block a user