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

Nonmember can still "cast" a vote #28

Open
oslfmt opened this issue Jul 4, 2022 · 1 comment
Open

Nonmember can still "cast" a vote #28

oslfmt opened this issue Jul 4, 2022 · 1 comment

Comments

@oslfmt
Copy link
Contributor

oslfmt commented Jul 4, 2022

While writing the tests for Governance.sol, I came upon something unexpected. I expected that when a non-member casts a vote, the function would throw an error, saying that this person is not a member. But it does not, and the reason is because the way the OZ contracts are designed, is that there is no concept of membership, technically. Rather it's voting power that allows someone to vote, and voting power is obtained by owning ERC20/ERC721 tokens.

When a non-member votes, the transaction will still complete successfully, but the vote will have no weight. This is because non-members have no NFT, and thus no voting power, and so their weight == 0. The vote is "cast", but it does not count for anything. As far as I can tell, the design is still safe for our purposes.

However, we'll probably want to have some function to check if a person is logged-in/a member on the frontend, and if not, don't even give them the option to vote, or have some message specifying why they can't. Otherwise, they could still "vote" successfully, but it just doesn't make too much sense from a UX pov @CptAstro @jagger-harris

@jagger-harris
Copy link
Member

We should be able to check if that wallet has an ERC721 token. On the backend, a function implementation should suffice. In the frontend, there can be a function call extracting information on whether an address has the NFT, displaying an appropriate message.

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

No branches or pull requests

2 participants