Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
palango committed Nov 29, 2024
1 parent fa63745 commit 7623843
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
4 changes: 0 additions & 4 deletions contracts/celo_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,3 @@ func (b *CeloBackend) NewEVM(feeCurrencyContext *common.FeeCurrencyContext) *vm.
vmConfig := vm.Config{}
return vm.NewEVM(blockCtx, txCtx, b.State, b.ChainConfig, vmConfig)
}

func (b *CeloBackend) Config() *params.ChainConfig {
return b.ChainConfig
}
15 changes: 5 additions & 10 deletions contracts/fee_currencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ var feeCurrencyABI *abi.ABI

var ErrFeeCurrencyEVMCall = errors.New("fee-currency contract error during internal EVM call")

type CeloContractCaller interface {
bind.ContractCaller

Config() *params.ChainConfig
}

func init() {
var err error
feeCurrencyABI, err = abigen.FeeCurrencyMetaData.GetAbi()
Expand All @@ -37,6 +31,7 @@ func init() {
}

func getDirectoryAddress(chainId *big.Int) common.Address {
// ChainId can be uninitialized in some tests
if chainId == nil {
return addresses.FeeCurrencyDirectoryAddress
}
Expand Down Expand Up @@ -210,8 +205,8 @@ func GetRegisteredCurrencies(caller *abigen.FeeCurrencyDirectoryCaller) ([]commo
}

// GetExchangeRates returns the exchange rates for the provided gas currencies
func GetExchangeRates(caller CeloContractCaller) (common.ExchangeRates, error) {
directory, err := abigen.NewFeeCurrencyDirectoryCaller(getDirectoryAddress(caller.Config().ChainID), caller)
func GetExchangeRates(caller *CeloBackend) (common.ExchangeRates, error) {
directory, err := abigen.NewFeeCurrencyDirectoryCaller(getDirectoryAddress(caller.ChainConfig.ChainID), caller)
if err != nil {
return common.ExchangeRates{}, fmt.Errorf("failed to access FeeCurrencyDirectory: %w", err)
}
Expand All @@ -223,9 +218,9 @@ func GetExchangeRates(caller CeloContractCaller) (common.ExchangeRates, error) {
}

// GetFeeCurrencyContext returns the fee currency block context for all registered gas currencies from CELO
func GetFeeCurrencyContext(caller CeloContractCaller) (common.FeeCurrencyContext, error) {
func GetFeeCurrencyContext(caller *CeloBackend) (common.FeeCurrencyContext, error) {
var feeContext common.FeeCurrencyContext
directory, err := abigen.NewFeeCurrencyDirectoryCaller(getDirectoryAddress(caller.Config().ChainID), caller)
directory, err := abigen.NewFeeCurrencyDirectoryCaller(getDirectoryAddress(caller.ChainConfig.ChainID), caller)
if err != nil {
return feeContext, fmt.Errorf("failed to access FeeCurrencyDirectory: %w", err)
}
Expand Down

0 comments on commit 7623843

Please sign in to comment.