ERC-1417 ERC-1417 Poll Voting Standard (Poll Standard)
Stagnant · Other · created 2018-09-16
On Ethereum, voting eligibility, vote weight calculation, result processing, and tallying are split into four independent modules, allowing various kinds of voting contracts to be implemented and queried through a single standard interface.
Why it is needed
Until now, whenever consensus or opinion gathering was needed on a blockchain, someone would deploy an arbitrary voting contract, but there was no standard way to query or verify that contract. As a result, even though voting data remained transparently on-chain, it felt completely opaque to non-developer end users. Abyss, the first DAICO, also suffered from poor user experience and transparency. In addition, eligibility to vote was often limited to token holdings alone, making flexible governance design difficult, and there was no standard event log to audit after the fact whether an admin had secretly added or removed voters, making manipulation hard to trace.
What to implement
event TriedToVote(address indexed _from, uint8 indexed _to, uint voteWeight);: An event emitted when someone attempts to vote without eligibility, recorded for audit purposes.event CastVote(address indexed _from, uint8 indexed _to, uint voteWeight);: An event emitted when a vote has been successfully recorded.event RevokedVote(address indexed _from, uint8 indexed _to, uint voteWeight);: An event emitted when a voter revokes their own vote.function vote(uint8 _proposalId) external;: Votes for the specified proposal and, to allow later revocation, stores that proposal ID linked to the voter.function revokeVote() external;: Revokes a previously cast vote.function getProposals() external view returns (bytes32[]);: Returns the list of names of all proposals registered in the poll.function canVote(address _to) external view returns (bool);: Returns whether the given address is eligible to vote.function getVoteTally(uint _proposalId) external view returns (uint);: Returns the total voting power accumulated for a specific proposal.function getVoterCount(uint _proposalId) external view returns (uint);: Returns the number of voters (NoV) who voted for a specific proposal.function calculateVoteWeight(address _to) external view returns (uint);: Calculates and returns the vote weight held by the given address.function winningProposal() external view returns (uint8);: Returns the index of the proposal currently holding the most votes.function getName() external view returns (bytes32);: Returns the name of the poll.function getPollType() external view returns (bytes32);: Returns the type of the poll (for example, token-weighted voting).function getVoterBaseLogic() external view returns (bytes32);: Returns a description of the voter-base logic used to determine voting eligibility.function getStartTime() external view returns (uint);: Returns the start time of the poll as Unix time.function getEndTime() external view returns (uint);: Returns the end time of the poll as Unix time.function getProtocolAddresses() external view returns (address[]);: Returns the list of addresses of EIP-1261 entity contracts used in determining voting eligibility.function getVoteTallies() external view returns (uint[]);: Returns the list of accumulated voting power for all proposals.function getVoterCounts() external view returns (uint[]);: Returns the list of voter counts for all proposals.function getVoterBaseDenominator() external view returns (uint);: For single-proposal polls, returns the total number of voters; for multi-proposal polls, returns the total sum of voting power, used for ratio calculations.
In depth
Four-module structure
ERC-1417 splits a poll into four modules: determining voter eligibility (voterbase), calculating vote weight (vote weight), processing the side effects of voting (consequence), and tallying votes (tally). Each module can be swapped independently, allowing different voting methods such as one person one vote, token-proportional voting, capped token-proportional voting, liquid democracy, reputation-based voting, and quadratic voting to be implemented on top of the same interface.
Voting and revocation
vote(_proposalId) takes the index of the proposal to vote for from the proposals array, records the vote, and stores that proposal ID together with the voter's address to allow later revocation. revokeVote() takes no arguments and revokes the previous vote. Since the proposal index is uint8 and, for practical reasons in implementations such as getProposals and winningProposal, it is recommended to limit the number of proposals to 32, for/while loops should be avoided if more proposals are needed.
Voting eligibility checks and the TriedToVote event
canVote(_to) determines whether the given address can vote, and in an EIP-1261 based implementation, logic can be added to check attributes using the entity addresses returned by getProtocolAddresses and the IERC1261 interface. If someone without eligibility attempts to vote, only a TriedToVote event is recorded instead of CastVote, allowing an admin's later unjust addition or removal of voters to be audited off-chain.
Vote weight calculation
calculateVoteWeight(_to) calculates and returns the vote weight held by the given address. Depending on the implementation, this can be one person one vote (weight 1), weight proportional to ERC-20/ERC-777 token holdings, weight proportional only up to a certain cap, weight that sums delegated votes, weight that sums reputation received from other voters, or quadratic weight corresponding to the square root of the fee paid when voting, among other methods.
Tally query functions
getVoteTally and getVoterCount return the accumulated voting power and the number of voters (NoV) for a specific proposal respectively, while getVoteTallies and getVoterCounts return the lists for all proposals. winningProposal returns the index of the currently leading proposal, and getVoterBaseDenominator returns the total number of voters for single-proposal polls or the total sum of voting power for multi-proposal polls, used for ratio calculations. Recording NoV separately from total voting power is designed to reveal the extent to which a small number of voters monopolize voting power in weighted voting.
Querying poll metadata
getName, getPollType, and getVoterBaseLogic return the poll's name, type, and description of the voter eligibility logic as set in the constructor. getStartTime and getEndTime return the poll's start and end times as Unix time, and getProtocolAddresses returns the list of entity contract addresses used in EIP-1261 based eligibility determination.
No end trigger, indefinite polls allowed
ERC-1417 does not include in the standard any logic that automatically executes when a poll ends. This is because such behavior fits the modularity intent better as a separate contract that reads the poll result, and because it cannot be applied when combining results from multiple polls or to polls with no end time. For the same reason, ERC-1417 also allows indefinite polls with no end time, so they can be used together with an action contract that reacts whenever a certain threshold is reached.
Proposal status: Stagnant
This proposal is currently in Stagnant status, meaning it is no longer being actively discussed or progressed and has stalled.