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

Add token-weighted group #142

Closed
ethanfrey opened this issue Nov 13, 2020 · 0 comments · Fixed by #167
Closed

Add token-weighted group #142

ethanfrey opened this issue Nov 13, 2020 · 0 comments · Fixed by #167
Assignees
Labels
multisig Related to a multisig epic

Comments

@ethanfrey
Copy link
Member

Create another implementation of cw4 (besides cw4-group) called cw4-stake.

This contract will implement all the same cw4 queries, both smart and raw. It will error on UpdateMembers message, but will send the same "on update" events as defined in #140 (Maybe we should remove HandleMsg::UpdateMembers from cw4 and leave that only in cw4-group?).

It works as follows:

  • Init defines a native denom, as well as a ratio (tokens to votes - eg. if we want to normalize to 1 ATOM = 1 vote, not 1 uatom, we make this ratio 1.000.000). It also defines an unbonding period (cw0::Duration)
  • I can bond tokens, sending them with the message. This will update the "bonded tokens" in my account and update my votes based on the ratio
  • I can unbond tokens, specifying how many and removing that many "bonded tokens" from my account, placing them as "unbonding tokens" with an expiration time equal to current block plus "unbonding period".
  • I can claim any previously unbonding tokens that have now hit their expiration time, by destroying those claims and releasing the relevant native tokens to my address.

Note: Much of this bonding/unbonding logic has been implemented as bond/unbond/claim in cw20-staking. That is a bit different as the ratio per share is dynamic and it does something with the bonded tokens, but you can use a slightly simplified version of that logic.

Bonus: If you pull this whole bonding/unbonding logic and state into one file that could be easily reused by other contracts

Test this group by itself, as well as backing a cw3-flex-multisig (before #141 we just test case where membership is static during open proposals)

@ethanfrey ethanfrey added the multisig Related to a multisig epic label Nov 13, 2020
@ethanfrey ethanfrey self-assigned this Dec 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multisig Related to a multisig epic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant