Skip to content

Commit

Permalink
app: fix swap tests
Browse files Browse the repository at this point in the history
  • Loading branch information
emturner committed Jan 5, 2024
1 parent 972fe55 commit 4a492ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/swap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
uses: functori/app-exchange/.github/workflows/reusable_swap_functional_tests.yml@ebc5932d939e2bad5eaf3d5e316626169da6ff23
with:
repo_for_exchange: 'functori/app-exchange'
branch_for_exchange: 'ajinkyaraj-23@display-source-field'
branch_for_exchange: 'develop'
branch_for_tezos: ${{ github.ref }}
run_for_devices: '["nanos", "nanosp", "stax"]'
test_filter: '"tezos_new"'
17 changes: 5 additions & 12 deletions app/src/handle_swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
#include "parser/num_parser.h"

// based on app-exchange
#define TICKER_MAX_SIZE 9
#define TICKER "XTZ"
#define ADDRESS_MAX_SIZE 63
/* the smallest unit is microtez */
#define DECIMALS 6

/* Check check_address_parameters_t.address_to_check against specified
* parameters.
Expand Down Expand Up @@ -102,15 +104,6 @@ swap_handle_get_printable_amount(get_printable_amount_parameters_t *params)
FUNC_ENTER(("params=%p", params));

uint64_t amount;
uint8_t decimals;
char ticker[TICKER_MAX_SIZE];

if (!swap_parse_config(params->coin_configuration,
params->coin_configuration_length, ticker,
sizeof(ticker), &decimals)) {
PRINTF("[ERROR] Fail to parse config\n");
goto error;
}

if (!swap_str_to_u64(params->amount, params->amount_length, &amount)) {
PRINTF("[ERROR] Fail to parse amount\n");
Expand All @@ -119,13 +112,13 @@ swap_handle_get_printable_amount(get_printable_amount_parameters_t *params)

if (!format_fpu64_trimmed(params->printable_amount,
sizeof(params->printable_amount), amount,
decimals)) {
DECIMALS)) {
PRINTF("[ERROR] Fail to print amount\n");
goto error;
}

strlcat(params->printable_amount, " ", sizeof(params->printable_amount));
strlcat(params->printable_amount, ticker,
strlcat(params->printable_amount, TICKER,
sizeof(params->printable_amount));

FUNC_LEAVE();
Expand Down

0 comments on commit 4a492ca

Please sign in to comment.