Skip to content

Commit

Permalink
Improve rate conversion error message
Browse files Browse the repository at this point in the history
It wasn't wrong, but the to/from switch compared to `ConvertCeloToCurrency` is a bit hard to spot.
Also remove the redundant `if` .
  • Loading branch information
karlb committed Jul 19, 2024
1 parent 184b30a commit b3b3cf7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion common/exchange/rates.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func ConvertCurrencyToCelo(exchangeRates common.ExchangeRates, currencyAmount *b
exchangeRate, ok := exchangeRates[*feeCurrency]
if !ok {
if !ok {
return nil, fmt.Errorf("could not convert to native from fee currency (fee-currency=%s): %w ", feeCurrency, ErrNonWhitelistedFeeCurrency)
return nil, fmt.Errorf("could not convert from fee currency to native (fee-currency=%s): %w ", feeCurrency, ErrNonWhitelistedFeeCurrency)
}
}
return new(big.Int).Div(new(big.Int).Mul(currencyAmount, exchangeRate.Denom()), exchangeRate.Num()), nil
Expand Down

0 comments on commit b3b3cf7

Please sign in to comment.