Skip to content

Commit

Permalink
add RewardsCoordinatorAddr to the ContractAddresses struct and use it…
Browse files Browse the repository at this point in the history
… in the test
  • Loading branch information
ricomateo committed Jan 8, 2025
1 parent 17ab69b commit b036a6d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 1 addition & 2 deletions chainio/clients/elcontracts/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 9 additions & 0 deletions testutils/anvil.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit b036a6d

Please sign in to comment.