abstract_std::objects

Module voting

Source
Expand description

§Simple voting

Simple voting is a state object to enable voting mechanism on a contract

§Setting up

§Creating a new proposal

To create a new proposal use SimpleVoting::new_proposal method, it will return ProposalId

§Whitelisting voters

Initial whitelist passed during SimpleVoting::new_proposal method and currently has no way to edit this

§Voting

To cast a vote use SimpleVoting::cast_vote method

§Count voting

To count votes use SimpleVoting::count_votes method during ProposalStatus::WaitingForCount

§Veto

In case your VoteConfig has veto duration set-up, after proposal.end_timestamp veto period will start

§Cancel proposal

During active voting:

§Queries

  • Single-item queries methods allowed by load_ prefix
  • List of items queries allowed by query_ prefix

§Details

All methods that modify proposal will return ProposalInfo to allow logging or checking current status of proposal.

Each proposal goes through the following stages:

  1. Active: proposal is active and can be voted on. It can also be canceled during this period.
  2. VetoPeriod (optional): voting is counted and veto period is active.
  3. WaitingForCount: voting period is finished and awaiting counting.
  4. Finished: proposal is finished and count is done. The proposal then has one of the following end states:
    • Passed: proposal passed
    • Failed: proposal failed
    • Canceled: proposal was canceled
    • Vetoed: proposal was vetoed

Structs§

Enums§

Constants§

Type Aliases§