The Voter, Proposal, and Election structs organize voting data within a smart contract. The Voter struct tracks voter participation and voting weight, while the Proposal struct records proposal names and vote totals. The Election struct encapsulates election-specific data. Global variables include a list of elections and the chairperson's address, serving as the super admin. Events are employed to log significant actions, enhancing transparency in the voting process by recording events such as election creation and voter authentication.
The Voter struct stores the voter data, including whether they have voted, the index of the proposal they voted for, and their voting weight.
The Proposal struct stores the name of the proposal and the total number of votes it has received.
The Election struct contains the data for a single election.
Events log important actions such as when an election is created, a voter is granted voting rights, a voter casts a vote, and a voter changes their vote.
Collection
[
|
...
]