Skip to content

Commit

Permalink
Drive by changes
Browse files Browse the repository at this point in the history
- Fix some capitalized error messages
- Remove variable
- Rename a variable
  • Loading branch information
palango committed Nov 29, 2024
1 parent f8e026a commit 621f6cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions contracts/fee_currencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,16 @@ func CreditFees(
func GetRegisteredCurrencies(caller *abigen.FeeCurrencyDirectoryCaller) ([]common.Address, error) {
currencies, err := caller.GetCurrencies(&bind.CallOpts{})
if err != nil {
return currencies, fmt.Errorf("Failed to get registered tokens: %w", err)
return currencies, fmt.Errorf("failed to get registered tokens: %w", err)
}
return currencies, nil
}

// GetExchangeRates returns the exchange rates for the provided gas currencies
exchangeRates := map[common.Address]*big.Rat{}
func GetExchangeRates(caller bind.ContractCaller, chainId *big.Int) (common.ExchangeRates, error) {
directory, err := abigen.NewFeeCurrencyDirectoryCaller(getDirectoryAddress(chainId), caller)
if err != nil {
return exchangeRates, fmt.Errorf("Failed to access FeeCurrencyDirectory: %w", err)
return common.ExchangeRates{}, fmt.Errorf("failed to access FeeCurrencyDirectory: %w", err)
}
currencies, err := GetRegisteredCurrencies(directory)
if err != nil {
Expand All @@ -222,7 +221,7 @@ func GetFeeCurrencyContext(caller bind.ContractCaller, chainId *big.Int) (common
var feeContext common.FeeCurrencyContext
directory, err := abigen.NewFeeCurrencyDirectoryCaller(getDirectoryAddress(chainId), caller)
if err != nil {
return feeContext, fmt.Errorf("Failed to access FeeCurrencyDirectory: %w", err)
return feeContext, fmt.Errorf("failed to access FeeCurrencyDirectory: %w", err)
}

currencies, err := GetRegisteredCurrencies(directory)
Expand Down
4 changes: 2 additions & 2 deletions internal/celoapi/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ func (b *CeloAPIBackend) GetExchangeRates(ctx context.Context, blockNumOrHash rp
if err != nil {
return nil, err
}
er, err := contracts.GetExchangeRates(contractBackend, b.ChainConfig().ChainID)
exchangeRates, err := contracts.GetExchangeRates(contractBackend)
if err != nil {
return nil, err
}
return er, nil
return exchangeRates, nil
}

func (b *CeloAPIBackend) ConvertToCurrency(ctx context.Context, blockNumOrHash rpc.BlockNumberOrHash, celoAmount *big.Int, toFeeCurrency *common.Address) (*big.Int, error) {
Expand Down

0 comments on commit 621f6cf

Please sign in to comment.