Skip to content

Commit

Permalink
feat: methods to set and read operator avs split (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
gpabst authored Dec 11, 2024
1 parent 7d2cd16 commit 79336bf
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
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

0 comments on commit 79336bf

Please sign in to comment.