make swap handle functions return a value
This commit is contained in:
@@ -6,21 +6,20 @@
|
||||
#include "string.h"
|
||||
#include <stdint.h>
|
||||
|
||||
void handle_get_printable_amount(get_printable_amount_parameters_t* params,
|
||||
chain_config_t* config) {
|
||||
int handle_get_printable_amount(get_printable_amount_parameters_t* params, chain_config_t* config) {
|
||||
uint8_t decimals;
|
||||
char ticker[MAX_TICKER_LEN];
|
||||
memset(params->printable_amount, 0, sizeof(params->printable_amount));
|
||||
if (params->amount_length > 32) {
|
||||
PRINTF("Amount is too big, 32 bytes max but buffer has %u bytes", params->amount_length);
|
||||
os_lib_end();
|
||||
return 0;
|
||||
}
|
||||
if (!parse_swap_config(params->coin_configuration,
|
||||
params->coin_configuration_length,
|
||||
ticker,
|
||||
&decimals)) {
|
||||
PRINTF("Error while parsing config\n");
|
||||
os_lib_end();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// If the amount is a fee, its value is nominated in ETH even if we're doing an ERC20 swap
|
||||
@@ -38,4 +37,5 @@ void handle_get_printable_amount(get_printable_amount_parameters_t* params,
|
||||
ticker,
|
||||
params->printable_amount,
|
||||
sizeof(params->printable_amount));
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user