-
Notifications
You must be signed in to change notification settings - Fork 101
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
ELO-335 -- lowering claim tokenAddresses to optional; using distribution to only query claimable tokens. #223
Conversation
e367f44
to
e6086ae
Compare
pkg/rewards/claim.go
Outdated
) | ||
|
||
const zero_address = "0x0000000000000000000000000000000000000000" |
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.
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.
also just for future. Go variables should never have _
- idiomatic is CamelCase
c467b0c
to
1594d0e
Compare
pkg/rewards/claim.go
Outdated
@@ -121,10 +123,15 @@ func Claim(cCtx *cli.Context, p utils.Prompter) error { | |||
return eigenSdkUtils.WrapError("failed to fetch claim amounts for date", err) | |||
} | |||
|
|||
claimableTokens, present := proofData.Distribution.GetTokensForEarner(config.EarnerAddress) | |||
if !present { | |||
return eigenSdkUtils.WrapError("no tokens claimable by earner", nil) |
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.
nit: you can just do errors.New
since you are anyway passing nil and there' no need to wrap errors.
…ry tokens which have pending rewards.
ab28791
to
7881374
Compare
Motivation
#220
Prior to this change, users trying to claim rewards needed to know the token addresses they intend to claim rewards for. When no rewards are present, they receive errors and logs indicating the issue. They must iteratively remove token addresses from their input until they've reduced the set to addresses with claimable rewards. Also, they are required to know the token address of the rewards they want to claim. Users need a mechanism in the CLI to address these pain points.
What Changed?
This change brings two behavioral changes to the API.
tokenAddresses
is provided, or it's empty, the CLI uses the public rewards distribution to claim all available rewards.tokenAddresses
are provided, the CLI uses the public rewards distribution to claim rewards only for the token addresses with claimable rewards.Testing
Added unit test coverage.