Giter VIP home page Giter VIP logo

Comments (3)

davidlaprade avatar davidlaprade commented on June 12, 2024

I just looked through sourcegraph and I'm not seeing a ton of usage of this function in solidity contracts. Mostly it's just used in tests. Here's an example that looks for a false hasVoted to determine if an account can vote or not. Returning false when partial votes have been cast would sort of break this, i.e. the user could still vote again with partial weight. But in context this is fine, since projects like this one vote with full weight anyway.

I still need to look for usage in JS/frontend code

from flexible-voting.

davidlaprade avatar davidlaprade commented on June 12, 2024

Alright, here's a sourcegraph query for frontend usage. Some notes:

  • nearly a third of all matches (56 of 157) are in tests
  • no really big/popular Web3 projects are using this (there are some popular-ish web2 projects, but the hasVoted they are using isn't the governance function we care about)
  • the biggest web3 project that seems to use it is Unlock, but even they only use it in a one-off utility script which could be easily updated

So it really feels like we can kind of do what we want here. There's not much usage of this function either in existing contracts or in existing frontends.

Additionally, the approach we are currently taking (returning true if any amount of votes have been cast by the user on the proposal) should be backwards compatible with most uses of hasVoted, since presumably those contexts would also be using the nominal castVote function, which votes with full weight. If your protocol always votes with full weight, then a hasVoted implementation that returns true when any weight is cast will still behave the way you expect.

from flexible-voting.

davidlaprade avatar davidlaprade commented on June 12, 2024

We should create a getter function to expose the currently private _proposalVotersWeightCast[proposalId][user] mapping. This way users who do care about partial votes can identify when a partial voter has used all of his/her weight

from flexible-voting.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.