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

NFT Voting Module #260

Closed
wants to merge 5 commits into from
Closed

NFT Voting Module #260

wants to merge 5 commits into from

Conversation

cypherape
Copy link
Contributor

Add a simple NFT voting module which determines voting power based on the NFT token balance of specific addresses.

match msg.token_info {
TokenInfo::Existing { address } => {
let address = deps.api.addr_validate(&address)?;
TOKEN.save(deps.storage, &address)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

"TOKEN" is supposed to be the address of the NFT contract this voting module is going to use, right? we should name it accordingly

also need to handle the new NFT contract case

Copy link
Contributor

@0xekez 0xekez left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! NFT voting is definitely something that would be great to have.

For this contract we do need staking to prevent double votes. For example:

  1. I have 2 NFTs.
  2. I vote on a proposal with 2 voting power.
  3. I send my NFTs to another wallet.
  4. That wallet votes on a proposal with 2 voting power.

Now we've double voted. I think the way forward here would be to write a modified stake-cw20 contract which lets you stake NFTs. Then, we could modify this contract to query that contract so that it can have voting power at height information and prevent that double voting.

@@ -0,0 +1,14 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like we need to regenerate these schema files. :) Should be able to run cargo schema in the root for that.

@JakeHartnell
Copy link
Member

Thanks for the contribution! NFT voting is definitely something that would be great to have.

For this contract we do need staking to prevent double votes. For example:

  1. I have 2 NFTs.
  2. I vote on a proposal with 2 voting power.
  3. I send my NFTs to another wallet.
  4. That wallet votes on a proposal with 2 voting power.

Now we've double voted. I think the way forward here would be to write a modified stake-cw20 contract which lets you stake NFTs. Then, we could modify this contract to query that contract so that it can have voting power at height information and prevent that double voting.

So all of this is true and we now have #309!

However, this contract would work GREAT with non-transferable NFTs. Have a ticket to implement "soul bound" NFTs which we can use for things like titles. See: #311

tl;dr this contract might still be useful.

@0xekez
Copy link
Contributor

0xekez commented Jul 13, 2022

Closing as I've merged the voting power queries into the staking contract after some discussion with @Callum-A .

@0xekez 0xekez closed this Jul 13, 2022
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.

4 participants