uint256 winningProposalID
the id of the proposal which obtained the maximal number of votes
struct Voter {
bool isRegistered;
bool hasVoted;
uint256 votedProposalId;
}
struct Proposal {
string description;
uint256 voteCount;
}
enum WorkflowStatus {
RegisteringVoters,
ProposalsRegistrationStarted,
ProposalsRegistrationEnded,
VotingSessionStarted,
VotingSessionEnded,
VotesTallied
}
enum Voting.WorkflowStatus workflowStatus
struct Voting.Proposal[] proposalsArray
mapping(address => struct Voting.Voter) voters
event VoterRegistered(address voterAddress)
event WorkflowStatusChange(enum Voting.WorkflowStatus previousStatus, enum Voting.WorkflowStatus newStatus)
event ProposalRegistered(uint256 proposalId)
event Voted(address voter, uint256 proposalId)
modifier onlyVoters()
function getVoter(address _addr) external view returns (struct Voting.Voter)
Get a voter from its address.
function getOneProposal(uint256 _id) external view returns (struct Voting.Proposal)
Get a proposal from its id.
function addVoter(address _addr) external
Allow an address to participate to the vote.
function addProposal(string _desc) external
Proposals must have a non empty description and be submitted in the ProposalsRegistrationStarted status.
function setVote(uint256 _id) external
Vote for a proposition with its id. Require to be in the status VotingSessionStarted and can be done only once by voter.
function startProposalsRegistering() external
update the workflow status from RegisteringVoters to ProposalsRegistrationStarted
function endProposalsRegistering() external
update the workflow status from ProposalsRegistrationStarted to ProposalsRegistrationEnded
function startVotingSession() external
update the workflow status from ProposalsRegistrationEnded to VotingSessionStarted
function endVotingSession() external
update the workflow status from VotingSessionStarted to VotingSessionEnded
function tallyVotes() external
update the winningProposalID with the most voted proposition and update the workflow status from VotingSessionEnded to VotesTallied