Skip to content

Commit

Permalink
rebase and new changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shrimalmadhur committed Dec 4, 2024
1 parent 985fa2f commit e7333a7
Show file tree
Hide file tree
Showing 12 changed files with 3,232 additions and 648 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ lint: ## runs all linters

___BINDINGS___: ##

core_default := "DelegationManager IRewardsCoordinator StrategyManager EigenPod EigenPodManager IStrategy AVSDirectory AllocationManager"
core_default := "DelegationManager IRewardsCoordinator StrategyManager EigenPod EigenPodManager IStrategy AVSDirectory AllocationManager PermissionController"
core_location := "./lib/eigenlayer-middleware/lib/eigenlayer-contracts"
core_bindings_location := "../../../../bindings"

Expand Down
7 changes: 4 additions & 3 deletions chainio/clients/elcontracts/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ type DeregistrationRequest struct {
}

type RegistrationRequest struct {
AVSAddress common.Address
OperatorSetIds []uint32
WaitForReceipt bool
OperatorAddress common.Address
AVSAddress common.Address
OperatorSetIds []uint32
WaitForReceipt bool
}
43 changes: 18 additions & 25 deletions chainio/clients/elcontracts/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,23 +164,14 @@ func (w *ChainWriter) RegisterAsOperator(
}

w.logger.Infof("registering operator %s to EigenLayer", operator.Address)
opDetails := delegationmanager.IDelegationManagerTypesOperatorDetails{
// Earning receiver has been deprecated, so we just use the operator address as a dummy value
// Any reward related setup is via RewardsCoordinator contract
DeprecatedEarningsReceiver: gethcommon.HexToAddress(operator.Address),
// DeprecatedStakerOptOutWindowBlocks has been deprecated, so we just use the operator's
// StakerOptOutWindowBlocks
DeprecatedStakerOptOutWindowBlocks: operator.StakerOptOutWindowBlocks,
DelegationApprover: gethcommon.HexToAddress(operator.DelegationApproverAddress),
}

noSendTxOpts, err := w.txMgr.GetNoSendTxOpts()
if err != nil {
return nil, err
}
tx, err := w.delegationManager.RegisterAsOperator(
noSendTxOpts,
opDetails,
gethcommon.HexToAddress(operator.DelegationApproverAddress),
operator.AllocationDelay,
operator.MetadataUrl,
)
Expand All @@ -206,22 +197,17 @@ func (w *ChainWriter) UpdateOperatorDetails(
}

w.logger.Infof("updating operator details of operator %s to EigenLayer", operator.Address)
opDetails := delegationmanager.IDelegationManagerTypesOperatorDetails{
// Earning receiver has been deprecated, so we just use the operator address as a dummy value
// Any reward related setup is via RewardsCoordinator contract
DeprecatedEarningsReceiver: gethcommon.HexToAddress(operator.Address),
DelegationApprover: gethcommon.HexToAddress(operator.DelegationApproverAddress),
// DeprecatedStakerOptOutWindowBlocks has been deprecated, so we just use the operator's
// StakerOptOutWindowBlocks
DeprecatedStakerOptOutWindowBlocks: operator.StakerOptOutWindowBlocks,
}

noSendTxOpts, err := w.txMgr.GetNoSendTxOpts()
if err != nil {
return nil, err
}

tx, err := w.delegationManager.ModifyOperatorDetails(noSendTxOpts, opDetails)
tx, err := w.delegationManager.ModifyOperatorDetails(
noSendTxOpts,
gethcommon.HexToAddress(operator.Address),
gethcommon.HexToAddress(operator.DelegationApproverAddress),
)
if err != nil {
return nil, err
}
Expand All @@ -240,7 +226,11 @@ func (w *ChainWriter) UpdateOperatorDetails(
return receipt, nil
}

func (w *ChainWriter) UpdateMetadataURI(ctx context.Context, uri string, waitForReceipt bool,
func (w *ChainWriter) UpdateMetadataURI(
ctx context.Context,
operatorAddress gethcommon.Address,
uri string,
waitForReceipt bool,
) (*gethtypes.Receipt, error) {
if w.delegationManager == nil {
return nil, errors.New("DelegationManager contract not provided")
Expand All @@ -251,7 +241,7 @@ func (w *ChainWriter) UpdateMetadataURI(ctx context.Context, uri string, waitFor
return nil, err
}

tx, err := w.delegationManager.UpdateOperatorMetadataURI(noSendTxOpts, uri)
tx, err := w.delegationManager.UpdateOperatorMetadataURI(noSendTxOpts, operatorAddress, uri)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -368,7 +358,7 @@ func (w *ChainWriter) ProcessClaim(

func (w *ChainWriter) ProcessClaims(
ctx context.Context,
claims []rewardscoordinator.IRewardsCoordinatorRewardsMerkleClaim,
claims []rewardscoordinator.IRewardsCoordinatorTypesRewardsMerkleClaim,
earnerAddress gethcommon.Address,
waitForReceipt bool,
) (*gethtypes.Receipt, error) {
Expand Down Expand Up @@ -436,6 +426,7 @@ func (w *ChainWriter) ForceDeregisterFromOperatorSets(

func (w *ChainWriter) ModifyAllocations(
ctx context.Context,
operatorAddress gethcommon.Address,
allocations []allocationmanager.IAllocationManagerTypesAllocateParams,
waitForReceipt bool,
) (*gethtypes.Receipt, error) {
Expand All @@ -448,7 +439,7 @@ func (w *ChainWriter) ModifyAllocations(
return nil, utils.WrapError("failed to get no send tx opts", err)
}

tx, err := w.allocationManager.ModifyAllocations(noSendTxOpts, allocations)
tx, err := w.allocationManager.ModifyAllocations(noSendTxOpts, operatorAddress, allocations)
if err != nil {
return nil, utils.WrapError("failed to create ModifyAllocations tx", err)
}
Expand All @@ -463,6 +454,7 @@ func (w *ChainWriter) ModifyAllocations(

func (w *ChainWriter) SetAllocationDelay(
ctx context.Context,
operatorAddress gethcommon.Address,
delay uint32,
waitForReceipt bool,
) (*gethtypes.Receipt, error) {
Expand All @@ -475,7 +467,7 @@ func (w *ChainWriter) SetAllocationDelay(
return nil, utils.WrapError("failed to get no send tx opts", err)
}

tx, err := w.allocationManager.SetAllocationDelay0(noSendTxOpts, delay)
tx, err := w.allocationManager.SetAllocationDelay(noSendTxOpts, operatorAddress, delay)
if err != nil {
return nil, utils.WrapError("failed to create InitializeAllocationDelay tx", err)
}
Expand Down Expand Up @@ -535,6 +527,7 @@ func (w *ChainWriter) RegisterForOperatorSets(

tx, err := w.allocationManager.RegisterForOperatorSets(
noSendTxOpts,
request.OperatorAddress,
allocationmanager.IAllocationManagerTypesRegisterParams{
Avs: request.AVSAddress,
OperatorSetIds: request.OperatorSetIds,
Expand Down
2 changes: 1 addition & 1 deletion contracts/bindings/AVSDirectory/binding.go

Large diffs are not rendered by default.

305 changes: 174 additions & 131 deletions contracts/bindings/AllocationManager/binding.go

Large diffs are not rendered by default.

683 changes: 332 additions & 351 deletions contracts/bindings/DelegationManager/binding.go

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions contracts/bindings/EigenPod/binding.go

Large diffs are not rendered by default.

203 changes: 188 additions & 15 deletions contracts/bindings/EigenPodManager/binding.go

Large diffs are not rendered by default.

883 changes: 772 additions & 111 deletions contracts/bindings/IRewardsCoordinator/binding.go

Large diffs are not rendered by default.

1,676 changes: 1,676 additions & 0 deletions contracts/bindings/PermissionController/binding.go

Large diffs are not rendered by default.

60 changes: 58 additions & 2 deletions contracts/bindings/StrategyManager/binding.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/lib/eigenlayer-middleware

0 comments on commit e7333a7

Please sign in to comment.