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

Fix Claims handling in cw20-staking #110

Closed
ethanfrey opened this issue Oct 8, 2020 · 0 comments · Fixed by #114
Closed

Fix Claims handling in cw20-staking #110

ethanfrey opened this issue Oct 8, 2020 · 0 comments · Fixed by #114

Comments

@ethanfrey
Copy link
Member

ethanfrey commented Oct 8, 2020

Part of #59 - pulled out for needed UI

Note: should be done on the v0.2.x branch and released as v0.2.3, before merging into master.

We currently just store how many tokens the person has unbonded and allow anyone with claims to grab the money. This is unfair as if I start unbonding 3 weeks ago and forget to check right at time, you may have unbonded yesterday and snap up the claims as soon as my unbonding made it to the contract account, making me wait 3 more weeks for your period.

The solution here is to store information on the native staking unbonding period inside the contract as a Duration - this contact value should equal the actual unbonding period of the chain for best effect.

Further Claims are no longer Uint128, but rather Vec<Claim>

pub struct Claim {
  pub mature Expiration,
  pub amount Uint128
}

These should be stored as one Vec per client. And sorted from first expiration to last expiration. This info must be displayed on a query.

On a handling a claim msg, we remove all mature claims from the list, and take the sum of their totals, releasing these native tokens to the claimee.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Blockchain Development
  
Awaiting triage
Development

Successfully merging a pull request may close this issue.

1 participant