kit2-blockchain
└── /prototypePrototype directory contains foundry project with source code.
The prototype implements an abstract VoteContract class, which enables users to implement their own voting mechanism. The VoteContract contains following parameters: array proposals of Proposal structs that contains history of introduced proposals, along with proposalCount to hold length of this array. Further, it is assumed that voters must register before performing vote and for this reason mapping registeredVoters holds all registered voters, based on address. It is also assumed voters can participate a single time in voting for each proposal so mapping participatedVoters is also introduced.
VSEVoteContract implements VoteContract class and provides unique implementations of virtual methods submitProposal, executeProposal, vote, registerVoter. This contract allows any address to submit/execute proposals, but only registered voters to vote. Submitted proposals have a set deadline, until when voter are tallied. It is not possible to vote after this deadline and every participating voter can vote on a given proposal only once. Execution of the proposal then depends on proposal owner, who can execute the proposal at any point after the deadline (assuming that the proposal passed). A sample event is emitted upon successful proposal execution. Each proposal can be executed a single time.