Tracking Proposal Feature
For tracking the development of proposals, the contract implements a number of events. There are four different events: "ProposalSubmitted," "ProposalVoted," "ProposalPassed," and "ProposalFailed." These events are connected to an index and a data type and are declared using the keyword "event." The events are then released throughout the contract's numerous operations.
The "submitProposal" function emits the "ProposalSubmitted" event. When a proposal is submitted, this event is generated and provides the proposal's ID.
The "vote" function emits the "ProposalVoted" event. This event is generated whenever a vote is cast, and it includes the vote as well as the proposal's ID (either true or false).
When a proposal receives enough votes to pass—defined as the quorum percentage multiplied by the number of members on the member list—the "ProposalPassed" event is generated in the "vote" function. The proposal is deemed to have received enough votes to pass if the vote total exceeds this cutoff, and the "ProposalPassed" event is sent out along with the passed proposal's ID.
With the "vote" function, the "ProposalFailed" event is also emitted. It is sent out when the number of votes cast in favour of a proposal falls below the threshold determined by multiplying the quorum percentage by the number of members on the member list. The proposal is deemed to have failed if the vote total falls below this mark, and the "ProposalFailed" event is emitted along with the failed proposal's ID.
Last updated