Trait governance_os_support::traits::StandardizedVoting[][src]

pub trait StandardizedVoting {
    type ProposalId;
    type Parameters;
    type VoteData;
    type AccountId;
    fn initiate(
        proposal: Self::ProposalId,
        parameters: Self::Parameters
    ) -> DispatchResult;
fn veto(proposal: Self::ProposalId) -> DispatchResult;
fn vote(
        proposal: Self::ProposalId,
        voter: &Self::AccountId,
        data: Self::VoteData
    ) -> DispatchResult;
fn close(
        proposal: Self::ProposalId
    ) -> Result<ProposalResult, DispatchError>; }

A common trait accross all voting implementations to make it easy to change between voting models or implementations. A pallet implementing this trait is not necessarily in charge of storing proposals but could stick to only to support the actual decison making code while proposal storage is delegated to another pallet.

Associated Types

type ProposalId[src]

How we represent the a proposal as passed to the underlying functions. This can be used to fetch any state associated to the proposal.

type Parameters[src]

How the parameters of a voting system are represented and set at the organization level.

type VoteData[src]

How voting data is passed to the underlying pallet.

type AccountId[src]

How accounts are represented, used to identify voters.

Loading content...

Required methods

fn initiate(
    proposal: Self::ProposalId,
    parameters: Self::Parameters
) -> DispatchResult
[src]

A proposal is being created. Handle any eventual registration and trigger an error if any preconditions are not met. Shall be called before any other state changes so that it is safe to fail here. It is the caller’s responsibility to try and prevent overwrites or duplicated proposals.

fn veto(proposal: Self::ProposalId) -> DispatchResult[src]

Special function to handle the case when a proposal is being vetoed. This should clean any storage or state associated to the given proposal.

fn vote(
    proposal: Self::ProposalId,
    voter: &Self::AccountId,
    data: Self::VoteData
) -> DispatchResult
[src]

Handle the reception of a new vote for the given proposal. This should mutate any state linked to the proposal accordingly.

fn close(proposal: Self::ProposalId) -> Result<ProposalResult, DispatchError>[src]

Handle the closure of a proposal or return an error if it cannot be closed because some conditions are not met. Shall return an indicator on wether the proposal is passing (should be executed) or not (should be discarded).

Loading content...

Implementors

Loading content...