Skip to content

Commit

Permalink
Align currency conversion APIs (#243)
Browse files Browse the repository at this point in the history
Parameters were ordered differently, this commit aligns them.
  • Loading branch information
palango authored Sep 27, 2024
1 parent ea21749 commit 573364d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions common/exchange/rates.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (

// ConvertCurrency does an exchange conversion from currencyFrom to currencyTo of the value given.
func ConvertCurrency(exchangeRates common.ExchangeRates, val1 *big.Int, currencyFrom *common.Address, currencyTo *common.Address) *big.Int {
celoAmount, err := ConvertCurrencyToCelo(exchangeRates, val1, currencyFrom)
celoAmount, err := ConvertCurrencyToCelo(exchangeRates, currencyFrom, val1)
if err != nil {
log.Error("Error trying to convert from currency to CELO.", "value", val1, "fromCurrency", currencyFrom.Hex())
}
Expand All @@ -29,7 +29,7 @@ func ConvertCurrency(exchangeRates common.ExchangeRates, val1 *big.Int, currency
return toAmount
}

func ConvertCurrencyToCelo(exchangeRates common.ExchangeRates, currencyAmount *big.Int, feeCurrency *common.Address) (*big.Int, error) {
func ConvertCurrencyToCelo(exchangeRates common.ExchangeRates, feeCurrency *common.Address, currencyAmount *big.Int) (*big.Int, error) {
if feeCurrency == nil {
return currencyAmount, nil
}
Expand Down
2 changes: 1 addition & 1 deletion internal/celoapi/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ func (b *CeloAPIBackend) ConvertToCelo(ctx context.Context, blockNumOrHash rpc.B
if err != nil {
return nil, err
}
return exchange.ConvertCurrencyToCelo(er, currencyAmount, fromFeeCurrency)
return exchange.ConvertCurrencyToCelo(er, fromFeeCurrency, currencyAmount)
}

0 comments on commit 573364d

Please sign in to comment.