-
Notifications
You must be signed in to change notification settings - Fork 53
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
add rewards methods for claim generation #287
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,12 @@ type ELWriter interface { | |
ctx context.Context, | ||
claimer gethcommon.Address, | ||
) (*gethtypes.Receipt, error) | ||
|
||
ProcessClaim( | ||
ctx context.Context, | ||
claim rewardscoordinator.IRewardsCoordinatorRewardsMerkleClaim, | ||
earnerAddress gethcommon.Address, | ||
) (*gethtypes.Receipt, error) | ||
} | ||
|
||
type ELChainWriter struct { | ||
|
@@ -112,14 +118,15 @@ func BuildELChainWriter( | |
elContractBindings.DelegationManager, | ||
elContractBindings.StrategyManager, | ||
elContractBindings.AvsDirectory, | ||
elContractBindings.RewardsCoordinator, | ||
logger, | ||
ethClient, | ||
) | ||
return NewELChainWriter( | ||
elContractBindings.Slasher, | ||
elContractBindings.DelegationManager, | ||
elContractBindings.StrategyManager, | ||
nil, | ||
elContractBindings.RewardsCoordinator, | ||
elContractBindings.StrategyManagerAddr, | ||
elChainReader, | ||
ethClient, | ||
|
@@ -149,6 +156,7 @@ func NewWriterFromConfig( | |
elContractBindings.DelegationManager, | ||
elContractBindings.StrategyManager, | ||
elContractBindings.AvsDirectory, | ||
elContractBindings.RewardsCoordinator, | ||
logger, | ||
ethClient, | ||
) | ||
|
@@ -329,3 +337,29 @@ func (w *ELChainWriter) SetClaimerFor( | |
|
||
return receipt, nil | ||
} | ||
|
||
func (w *ELChainWriter) ProcessClaim( | ||
ctx context.Context, | ||
claim rewardscoordinator.IRewardsCoordinatorRewardsMerkleClaim, | ||
earnerAddress gethcommon.Address, | ||
) (*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, err | ||
} | ||
|
||
tx, err := w.rewardsCoordinator.ProcessClaim(noSendTxOpts, claim, earnerAddress) | ||
if err != nil { | ||
return nil, err | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wrap error There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
receipt, err := w.txMgr.Send(ctx, tx) | ||
if err != nil { | ||
return nil, utils.WrapError("failed to send tx", err) | ||
} | ||
|
||
return receipt, nil | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrap error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
9ae2d87