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

Non-Fungible Votes - assign NFTs with different voting weight #3755

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

toledoroy
Copy link

👋

As a follow-up on a forum thread regarding the assignment of different voting power for different ERC721 tokens.
https://forum.openzeppelin.com/t/erc721-voting-power-based-on-some-property/24550/22

Problems

  • The current version of Votes has an opt-out mechanism that requires all tokens to be of equal weight (so the getBalance() function would return a current voting power)
  • Since ERC1155 doesn't support a function for getting the total number of tokens per account it's incompatible with the current Votes architecture.

Solution

Remove the opt-out option and track all voting power movements for all accounts at all time.

  • Allowing to assign different power to different tokens
  • Paves the way to ERC1155 compatibility

Drawbacks:

  • Using this contract will make all token transfers more expensive.

However, in some cases, post merge, and on L2s this increase in transaction fees might be worth it.

Description

This PR includes a new version of Votes, dubbed VotesForced, with a new integration for ERC721 that uses an arbitrary token power function to determine the voting power for each token.

PR Checklist

  • Tests
  • Documentation
  • Changelog entry

@toledoroy toledoroy changed the title ERC721VotesForced - give tokens different voting weight Non-Fungible Votes - assign NFTs with different voting weight Oct 9, 2022
@toledoroy
Copy link
Author

toledoroy commented Oct 9, 2022

Removed the forced opt-in to make things more compatible with the existing Votes extension.

Everything's much simpler and more elegant now.

Still wondering what to do about the behaviour tests. It passes only if the voting power for each token is worth 1 vote.
What would be the right way to address this?
Maybe make changes to the behaviour tests / write another behaviour test / use 1 as token power on the Mock contract?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants