Trait pallet_inv4::voting::CustomPolling

source ·
pub trait CustomPolling<Tally> {
    type Index: Ord + PartialOrd + Copy + MaxEncodedLen;
    type Votes: Parameter + Ord + PartialOrd + Copy + HasCompact + MaxEncodedLen;
    type Class: Parameter + Member + Ord + PartialOrd + MaxEncodedLen;
    type Moment;

    // Required methods
    fn classes() -> Vec<Self::Class>;
    fn as_ongoing(
        class: Self::Class,
        index: Self::Index,
    ) -> Option<(Tally, Self::Class)>;
    fn access_poll<R>(
        class: Self::Class,
        index: Self::Index,
        f: impl FnOnce(PollStatus<&mut Tally, Self::Moment, Self::Class>) -> R,
    ) -> R;
    fn try_access_poll<R>(
        class: Self::Class,
        index: Self::Index,
        f: impl FnOnce(PollStatus<&mut Tally, Self::Moment, Self::Class>) -> Result<R, DispatchError>,
    ) -> Result<R, DispatchError>;
}

Required Associated Types§

source

type Index: Ord + PartialOrd + Copy + MaxEncodedLen

source

type Votes: Parameter + Ord + PartialOrd + Copy + HasCompact + MaxEncodedLen

source

type Class: Parameter + Member + Ord + PartialOrd + MaxEncodedLen

source

type Moment

Required Methods§

source

fn classes() -> Vec<Self::Class>

source

fn as_ongoing( class: Self::Class, index: Self::Index, ) -> Option<(Tally, Self::Class)>

Some if the referendum index can be voted on, along with the tally and class of referendum.

Don’t use this if you might mutate - use try_access_poll instead.

source

fn access_poll<R>( class: Self::Class, index: Self::Index, f: impl FnOnce(PollStatus<&mut Tally, Self::Moment, Self::Class>) -> R, ) -> R

source

fn try_access_poll<R>( class: Self::Class, index: Self::Index, f: impl FnOnce(PollStatus<&mut Tally, Self::Moment, Self::Class>) -> Result<R, DispatchError>, ) -> Result<R, DispatchError>

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T: Config> CustomPolling<Tally<T>> for Pallet<T>

§

type Index = <T as Config>::Hash

§

type Votes = <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance

§

type Moment = <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number

§

type Class = <T as Config>::CoreId