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

ELO-335 -- lowering claim tokenAddresses to optional; using distribution to only query claimable tokens. #223

Conversation

bdchatham
Copy link
Contributor

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.

  1. When no tokenAddresses is provided, or it's empty, the CLI uses the public rewards distribution to claim all available rewards.
  2. When 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.

@bdchatham bdchatham self-assigned this Oct 11, 2024
pkg/rewards/claim.go Outdated Show resolved Hide resolved
pkg/rewards/claim.go Outdated Show resolved Hide resolved
@bdchatham bdchatham force-pushed the FromTheRain-elo-335-optional-claim-token-addresses branch 2 times, most recently from e367f44 to e6086ae Compare October 11, 2024 22:18
)

const zero_address = "0x0000000000000000000000000000000000000000"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

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

@bdchatham bdchatham force-pushed the FromTheRain-elo-335-optional-claim-token-addresses branch from c467b0c to 1594d0e Compare October 11, 2024 22:37
@@ -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)
Copy link
Collaborator

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.

@bdchatham bdchatham force-pushed the FromTheRain-elo-335-optional-claim-token-addresses branch from ab28791 to 7881374 Compare October 11, 2024 22:52
@shrimalmadhur shrimalmadhur merged commit 297b1af into Layr-Labs:master Oct 12, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants