Skip to content

Commit

Permalink
update: eigensdk bindings for operator set (#305)
Browse files Browse the repository at this point in the history
* update: eigensdk bindings to opset
  • Loading branch information
shrimalmadhur authored Aug 6, 2024
1 parent 67787e9 commit 66c0054
Show file tree
Hide file tree
Showing 19 changed files with 2,330 additions and 1,951 deletions.
10 changes: 5 additions & 5 deletions chainio/clients/elcontracts/bindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
gethcommon "github.com/ethereum/go-ethereum/common"

"github.com/Layr-Labs/eigensdk-go/chainio/clients/eth"
avsdirectory "github.com/Layr-Labs/eigensdk-go/contracts/bindings/AVSDirectory"
delegationmanager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/DelegationManager"
avsdirectory "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IAVSDirectory"
rewardscoordinator "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IRewardsCoordinator"
slasher "github.com/Layr-Labs/eigensdk-go/contracts/bindings/ISlasher"
strategymanager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/StrategyManager"
Expand All @@ -29,7 +29,7 @@ type ContractBindings struct {
Slasher *slasher.ContractISlasher
DelegationManager *delegationmanager.ContractDelegationManager
StrategyManager *strategymanager.ContractStrategyManager
AvsDirectory *avsdirectory.ContractAVSDirectory
AvsDirectory *avsdirectory.ContractIAVSDirectory
RewardsCoordinator *rewardscoordinator.ContractIRewardsCoordinator
}

Expand All @@ -46,7 +46,7 @@ func NewBindingsFromConfig(
contractStrategyManager *strategymanager.ContractStrategyManager
slasherAddr gethcommon.Address
strategyManagerAddr gethcommon.Address
avsDirectory *avsdirectory.ContractAVSDirectory
avsDirectory *avsdirectory.ContractIAVSDirectory
rewardsCoordinator *rewardscoordinator.ContractIRewardsCoordinator
)

Expand Down Expand Up @@ -80,7 +80,7 @@ func NewBindingsFromConfig(
if isZeroAddress(cfg.AvsDirectoryAddress) {
logger.Debug("AVSDirectory address not provided, the calls to the contract will not work")
} else {
avsDirectory, err = avsdirectory.NewContractAVSDirectory(cfg.AvsDirectoryAddress, client)
avsDirectory, err = avsdirectory.NewContractIAVSDirectory(cfg.AvsDirectoryAddress, client)
if err != nil {
return nil, utils.WrapError("Failed to fetch AVSDirectory contract", err)
}
Expand Down Expand Up @@ -143,7 +143,7 @@ func NewEigenlayerContractBindings(
return nil, utils.WrapError("Failed to fetch StrategyManager contract", err)
}

avsDirectory, err := avsdirectory.NewContractAVSDirectory(avsDirectoryAddr, ethclient)
avsDirectory, err := avsdirectory.NewContractIAVSDirectory(avsDirectoryAddr, ethclient)
if err != nil {
return nil, utils.WrapError("Failed to fetch AVSDirectory contract", err)
}
Expand Down
6 changes: 3 additions & 3 deletions chainio/clients/elcontracts/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
gethcommon "github.com/ethereum/go-ethereum/common"

"github.com/Layr-Labs/eigensdk-go/chainio/clients/eth"
avsdirectory "github.com/Layr-Labs/eigensdk-go/contracts/bindings/AVSDirectory"
delegationmanager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/DelegationManager"
avsdirectory "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IAVSDirectory"
erc20 "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IERC20"
rewardscoordinator "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IRewardsCoordinator"
slasher "github.com/Layr-Labs/eigensdk-go/contracts/bindings/ISlasher"
Expand All @@ -33,7 +33,7 @@ type ChainReader struct {
slasher slasher.ContractISlasherCalls
delegationManager *delegationmanager.ContractDelegationManager
strategyManager *strategymanager.ContractStrategyManager
avsDirectory *avsdirectory.ContractAVSDirectory
avsDirectory *avsdirectory.ContractIAVSDirectory
rewardsCoordinator *rewardscoordinator.ContractIRewardsCoordinator
ethClient eth.HttpBackend
}
Expand All @@ -42,7 +42,7 @@ func NewChainReader(
slasher slasher.ContractISlasherCalls,
delegationManager *delegationmanager.ContractDelegationManager,
strategyManager *strategymanager.ContractStrategyManager,
avsDirectory *avsdirectory.ContractAVSDirectory,
avsDirectory *avsdirectory.ContractIAVSDirectory,
rewardsCoordinator *rewardscoordinator.ContractIRewardsCoordinator,
logger logging.Logger,
ethClient eth.HttpBackend,
Expand Down
41 changes: 39 additions & 2 deletions chainio/clients/elcontracts/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"context"
"errors"

"github.com/Layr-Labs/eigensdk-go/utils"

"math/big"

"github.com/ethereum/go-ethereum/accounts/abi/bind"
Expand All @@ -15,6 +13,7 @@ import (
"github.com/Layr-Labs/eigensdk-go/chainio/clients/eth"
"github.com/Layr-Labs/eigensdk-go/chainio/txmgr"
delegationmanager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/DelegationManager"
avsdirectory "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IAVSDirectory"
erc20 "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IERC20"
rewardscoordinator "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IRewardsCoordinator"
slasher "github.com/Layr-Labs/eigensdk-go/contracts/bindings/ISlasher"
Expand All @@ -23,6 +22,7 @@ import (
"github.com/Layr-Labs/eigensdk-go/logging"
"github.com/Layr-Labs/eigensdk-go/metrics"
"github.com/Layr-Labs/eigensdk-go/types"
"github.com/Layr-Labs/eigensdk-go/utils"
)

type Reader interface {
Expand All @@ -36,6 +36,7 @@ type ChainWriter struct {
delegationManager *delegationmanager.ContractDelegationManager
strategyManager *strategymanager.ContractStrategyManager
rewardsCoordinator *rewardscoordinator.ContractIRewardsCoordinator
avsDirectory *avsdirectory.ContractIAVSDirectory
strategyManagerAddr gethcommon.Address
elChainReader Reader
ethClient eth.HttpBackend
Expand Down Expand Up @@ -339,3 +340,39 @@ func (w *ChainWriter) ProcessClaim(

return receipt, nil
}

func (w *ChainWriter) ForceDeregisterFromOperatorSets(
ctx context.Context,
operator gethcommon.Address,
avs gethcommon.Address,
operatorSetIds []uint32,
operatorSignature avsdirectory.ISignatureUtilsSignatureWithSaltAndExpiry,
) (*gethtypes.Receipt, error) {
if w.avsDirectory == nil {
return nil, errors.New("AVSDirectory contract not provided")
}

noSendTxOpts, err := w.txMgr.GetNoSendTxOpts()
if err != nil {
return nil, utils.WrapError("failed to get no send tx opts", err)
}

tx, err := w.avsDirectory.ForceDeregisterFromOperatorSets(
noSendTxOpts,
operator,
avs,
operatorSetIds,
operatorSignature,
)

if err != nil {
return nil, utils.WrapError("failed to create ForceDeregisterFromOperatorSets tx", err)
}

receipt, err := w.txMgr.Send(ctx, tx)
if err != nil {
return nil, utils.WrapError("failed to send tx", err)
}

return receipt, nil
}
1,893 changes: 0 additions & 1,893 deletions contracts/bindings/AVSDirectory/binding.go

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/bindings/BLSApkRegistry/binding.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/bindings/ContractsRegistry/binding.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion contracts/bindings/DelegationManager/binding.go

Large diffs are not rendered by default.

Loading

0 comments on commit 66c0054

Please sign in to comment.