Skip to content

Commit

Permalink
Improve naming
Browse files Browse the repository at this point in the history
  • Loading branch information
palango committed Nov 29, 2024
1 parent 7623843 commit b00c072
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions contracts/fee_currencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ func init() {
}
}

func getDirectoryAddress(chainId *big.Int) common.Address {
// Returns the address of the FeeCurrencyDirectory contract for the given chainId
func getFeeCurrencyDirectoryAddress(chainId *big.Int) common.Address {
// ChainId can be uninitialized in some tests
if chainId == nil {
return addresses.FeeCurrencyDirectoryAddress
Expand Down Expand Up @@ -206,7 +207,7 @@ func GetRegisteredCurrencies(caller *abigen.FeeCurrencyDirectoryCaller) ([]commo

// GetExchangeRates returns the exchange rates for the provided gas currencies
func GetExchangeRates(caller *CeloBackend) (common.ExchangeRates, error) {
directory, err := abigen.NewFeeCurrencyDirectoryCaller(getDirectoryAddress(caller.ChainConfig.ChainID), caller)
directory, err := abigen.NewFeeCurrencyDirectoryCaller(getFeeCurrencyDirectoryAddress(caller.ChainConfig.ChainID), caller)
if err != nil {
return common.ExchangeRates{}, fmt.Errorf("failed to access FeeCurrencyDirectory: %w", err)
}
Expand All @@ -220,7 +221,7 @@ func GetExchangeRates(caller *CeloBackend) (common.ExchangeRates, error) {
// GetFeeCurrencyContext returns the fee currency block context for all registered gas currencies from CELO
func GetFeeCurrencyContext(caller *CeloBackend) (common.FeeCurrencyContext, error) {
var feeContext common.FeeCurrencyContext
directory, err := abigen.NewFeeCurrencyDirectoryCaller(getDirectoryAddress(caller.ChainConfig.ChainID), caller)
directory, err := abigen.NewFeeCurrencyDirectoryCaller(getFeeCurrencyDirectoryAddress(caller.ChainConfig.ChainID), caller)
if err != nil {
return feeContext, fmt.Errorf("failed to access FeeCurrencyDirectory: %w", err)
}
Expand Down

0 comments on commit b00c072

Please sign in to comment.