Skip to content

Commit

Permalink
read owner from registry (#10984)
Browse files Browse the repository at this point in the history
  • Loading branch information
shileiwill authored Oct 17, 2023
1 parent d5aadc1 commit f468fa6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions integration-tests/contracts/ethereum_keeper_contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
goabi "github.com/umbracle/ethgo/abi"

"github.com/smartcontractkit/chainlink-testing-framework/blockchain"

cltypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/automation_consumer_benchmark"
registrar21 "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/automation_registrar_wrapper2_1"
Expand Down Expand Up @@ -240,6 +241,7 @@ func (rcs *KeeperRegistrySettings) EncodeOnChainConfig(registrar string, registr
Registrars: []common.Address{common.HexToAddress(registrar)},
UpkeepPrivilegeManager: registryOwnerAddress,
}

encodedOnchainConfig, err := utilsABI.Methods["_onChainConfig"].Inputs.Pack(&onchainConfigStruct)

return encodedOnchainConfig, err
Expand All @@ -265,6 +267,19 @@ func (rcs *KeeperRegistrySettings) EncodeOnChainConfig(registrar string, registr
}

func (v *EthereumKeeperRegistry) RegistryOwnerAddress() common.Address {
callOpts := &bind.CallOpts{
Pending: false,
}

switch v.version {
case ethereum.RegistryVersion_2_1:
ownerAddress, _ := v.registry2_1.Owner(callOpts)
return ownerAddress
case ethereum.RegistryVersion_2_0:
ownerAddress, _ := v.registry2_0.Owner(callOpts)
return ownerAddress
}

return common.HexToAddress(v.client.GetDefaultWallet().Address())
}

Expand Down

0 comments on commit f468fa6

Please sign in to comment.