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: methods to set and read operator avs split #401

Merged
merged 3 commits into from
Dec 11, 2024
Merged
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
18 changes: 18 additions & 0 deletions chainio/clients/elcontracts/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,3 +336,21 @@ func (r *ChainReader) CheckClaim(

return r.rewardsCoordinator.CheckClaim(&bind.CallOpts{Context: ctx}, claim)
}

func (r *ChainReader) GetOperatorAVSSplit(
ctx context.Context,
operator gethcommon.Address,
avs gethcommon.Address,
) (uint16, error) {
if r.rewardsCoordinator == nil {
return 0, errors.New("RewardsCoordinator contract not provided")
}

split, err := r.rewardsCoordinator.GetOperatorAVSSplit(&bind.CallOpts{Context: ctx}, operator, avs)

if err != nil {
return 0, err
}

return split, nil
}
28 changes: 28 additions & 0 deletions chainio/clients/elcontracts/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,34 @@ func (w *ChainWriter) ProcessClaim(
return receipt, nil
}

func (w *ChainWriter) SetOperatorAVSSplit(
ctx context.Context,
operator gethcommon.Address,
avs gethcommon.Address,
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.SetOperatorAVSSplit(noSendTxOpts, operator, avs, split)
if err != nil {
return nil, utils.WrapError("failed to create SetOperatorAVSSplit 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
}

func (w *ChainWriter) ProcessClaims(
ctx context.Context,
claims []rewardscoordinator.IRewardsCoordinatorRewardsMerkleClaim,
Expand Down
Loading