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: add set operatorset split convenience method #541

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
10 changes: 10 additions & 0 deletions chainio/clients/elcontracts/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,16 @@ func (r *ChainReader) GetOperatorPISplit(

return r.rewardsCoordinator.GetOperatorPISplit(&bind.CallOpts{Context: ctx}, operator)
}
func (r *ChainReader) GetOperatorSetSplit(
ctx context.Context,
operator gethcommon.Address,
operatorSet rewardscoordinator.OperatorSet,
) (uint16, error) {
if r.rewardsCoordinator == nil {
return 0, errors.New("RewardsCoordinator contract not provided")
}
return r.rewardsCoordinator.GetOperatorSetSplit(&bind.CallOpts{Context: ctx}, operator, operatorSet)
}

func (r *ChainReader) GetAllocatableMagnitude(
ctx context.Context,
Expand Down
32 changes: 32 additions & 0 deletions chainio/clients/elcontracts/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,38 @@ func (w *ChainWriter) SetOperatorPISplit(
return receipt, nil
}

// Sets the split for an operator in an operator set.
// The caller must be a registered operator.
// The split has to be between 0 and 10000 bips (inclusive).
// The split will be activated after activation delay.
Comment on lines +408 to +411
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be moved to the already implemented method, though

func (w *ChainWriter) SetOperatorSetSplit(
ctx context.Context,
operator gethcommon.Address,
operatorSet rewardscoordinator.OperatorSet,
split uint16,
waitForReceipt bool,
) (*gethtypes.Receipt, error) {
if w.rewardsCoordinator == nil {
return nil, errors.New("RewardsCoordinator 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.rewardsCoordinator.SetOperatorSetSplit(noSendTxOpts, operator, operatorSet, split)
if err != nil {
return nil, utils.WrapError("failed to create SetOperatorSetSplit tx", err)
}
receipt, err := w.txMgr.Send(ctx, tx, waitForReceipt)
if err != nil {
return nil, utils.WrapError("failed to send tx", err)
}

return receipt, nil
}

// Processes the claims given by `claims`.
// The rewards are transferred to the given `recipientAddress`.
func (w *ChainWriter) ProcessClaims(
Expand Down
2 changes: 1 addition & 1 deletion contracts/bindings/AVSDirectory/binding.go

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

408 changes: 407 additions & 1 deletion contracts/bindings/IRewardsCoordinator/binding.go

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions contracts/bindings/StrategyManager/binding.go

Large diffs are not rendered by default.

Loading