From b036a6d18b07584f2a36c8b75f7ad6d2af287fc9 Mon Sep 17 00:00:00 2001 From: ricomateo Date: Wed, 8 Jan 2025 15:15:36 -0300 Subject: [PATCH] add RewardsCoordinatorAddr to the ContractAddresses struct and use it in the test --- chainio/clients/elcontracts/writer_test.go | 3 +-- testutils/anvil.go | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/chainio/clients/elcontracts/writer_test.go b/chainio/clients/elcontracts/writer_test.go index a5798c19..7f4fefa4 100644 --- a/chainio/clients/elcontracts/writer_test.go +++ b/chainio/clients/elcontracts/writer_test.go @@ -172,9 +172,8 @@ func TestSetClaimerFor(t *testing.T) { privateKeyHex := "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" contractAddrs := testutils.GetContractAddressesFromContractRegistry(anvilHttpEndpoint) - // TODO: fetch this address from ContractRegistry (currently returns zero address) - rewardsCoordinatorAddr := common.HexToAddress("0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6") + rewardsCoordinatorAddr := contractAddrs.RewardsCoordinator config := elcontracts.Config{ DelegationManagerAddress: contractAddrs.DelegationManager, RewardsCoordinatorAddress: rewardsCoordinatorAddr, diff --git a/testutils/anvil.go b/testutils/anvil.go index bb3a8c41..cdaef69f 100644 --- a/testutils/anvil.go +++ b/testutils/anvil.go @@ -65,6 +65,7 @@ type ContractAddresses struct { OperatorStateRetriever common.Address DelegationManager common.Address Erc20MockStrategy common.Address + RewardsCoordinator common.Address } func GetContractAddressesFromContractRegistry(ethHttpUrl string) (mockAvsContracts ContractAddresses) { @@ -121,12 +122,20 @@ func GetContractAddressesFromContractRegistry(ethHttpUrl string) (mockAvsContrac if erc20MockStrategyAddr == (common.Address{}) { panic("erc20MockStrategyAddr is empty") } + rewardsCoordinatorAddr, err := contractsRegistry.Contracts(&bind.CallOpts{}, "rewardsCoordinator") + if err != nil { + panic(err) + } + if rewardsCoordinatorAddr == (common.Address{}) { + panic("rewardsCoordinatorAddr is empty") + } mockAvsContracts = ContractAddresses{ ServiceManager: mockAvsServiceManagerAddr, RegistryCoordinator: mockAvsRegistryCoordinatorAddr, OperatorStateRetriever: mockAvsOperatorStateRetrieverAddr, DelegationManager: delegationManagerAddr, Erc20MockStrategy: erc20MockStrategyAddr, + RewardsCoordinator: rewardsCoordinatorAddr, } return mockAvsContracts }