Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make SDK compatible with mainnet contracts #464

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions chainio/clients/avsregistry/bindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,17 @@ func NewBindingsFromConfig(
return nil, utils.WrapError("Failed to get AvsDirectory address", err)
}

delegationManager, err := contractDelegationManager.NewContractDelegationManager(
delegationManagerAddr,
client)
if err != nil {
return nil, utils.WrapError("Failed to get DelegationManager contract", err)
}
allocationManagerAddr, err = delegationManager.AllocationManager(&bind.CallOpts{})
if err != nil {
return nil, utils.WrapError("Failed to get AllocationManager address", err)
if !cfg.DontUseAllocationManager {
delegationManager, err := contractDelegationManager.NewContractDelegationManager(
delegationManagerAddr,
client)
if err != nil {
return nil, utils.WrapError("Failed to get DelegationManager contract", err)
}
allocationManagerAddr, err = delegationManager.AllocationManager(&bind.CallOpts{})
if err != nil {
return nil, utils.WrapError("Failed to get AllocationManager address", err)
}
}
}

Expand Down
1 change: 1 addition & 0 deletions chainio/clients/avsregistry/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var DefaultQueryBlockRange = big.NewInt(10_000)
type Config struct {
RegistryCoordinatorAddress common.Address
OperatorStateRetrieverAddress common.Address
DontUseAllocationManager bool
}

type ChainReader struct {
Expand Down
16 changes: 9 additions & 7 deletions chainio/clients/elcontracts/bindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ func NewBindingsFromConfig(
return nil, utils.WrapError("Failed to fetch StrategyManager contract", err)
}

allocationManagerAddr, err = contractDelegationManager.AllocationManager(&bind.CallOpts{})
if err != nil {
return nil, utils.WrapError("Failed to fetch AllocationManager address", err)
}
contractAllocationManager, err = allocationmanager.NewContractAllocationManager(allocationManagerAddr, client)
if err != nil {
return nil, utils.WrapError("Failed to fetch AllocationManager contract", err)
if !cfg.DontUseAllocationManager {
allocationManagerAddr, err = contractDelegationManager.AllocationManager(&bind.CallOpts{})
if err != nil {
return nil, utils.WrapError("Failed to fetch AllocationManager address", err)
}
contractAllocationManager, err = allocationmanager.NewContractAllocationManager(allocationManagerAddr, client)
if err != nil {
return nil, utils.WrapError("Failed to fetch AllocationManager contract", err)
}
}
}

Expand Down
1 change: 1 addition & 0 deletions chainio/clients/elcontracts/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type Config struct {
AvsDirectoryAddress gethcommon.Address
RewardsCoordinatorAddress gethcommon.Address
PermissionsControllerAddress gethcommon.Address
DontUseAllocationManager bool
}

type ChainReader struct {
Expand Down
Loading