Enum noble_elections_phragmen::Call[][src]

pub enum Call<T: Config> {
    vote(Vec<T::AccountId>, <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance),
    remove_voter(),
    submit_candidacy(u32),
    renounce_candidacy(Renouncing),
    remove_member(<T::Lookup as StaticLookup>::Sourcebool),
    clean_defunct_voters(u32u32),
    // some variants omitted
}

Dispatchable calls.

Each variant of this enum maps to a dispatchable function from the associated module.

Variants

vote(Vec<T::AccountId>, <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance)

Vote for a set of candidates for the upcoming round of election. This can be called to set the initial votes, or update already existing votes.

Upon initial voting, value units of who’s balance is locked and a deposit amount is reserved. The deposit is based on the number of votes and can be updated over time.

The votes should:

  • not be empty.
  • be less than the number of possible candidates. Note that all current members and runners-up are also automatically candidates for the next round.

If value is more than who’s total balance, then the maximum of the two is used.

The dispatch origin of this call must be signed.

Warning

It is the responsibility of the caller to NOT place all of their balance into the lock and keep some for further operations.

We assume the maximum weight among all 3 cases: vote_equal, vote_more and vote_less.

remove_voter()

Remove origin as a voter.

This removes the lock and returns the deposit.

The dispatch origin of this call must be signed and be a voter.

submit_candidacy(u32)

Submit oneself for candidacy. A fixed amount of deposit is recorded.

All candidates are wiped at the end of the term. They either become a member/runner-up, or leave the system while their deposit is slashed.

The dispatch origin of this call must be signed.

Warning

Even if a candidate ends up being a member, they must call Call::renounce_candidacy to get their deposit back. Losing the spot in an election will always lead to a slash.

The number of current candidates must be provided as witness data.

renounce_candidacy(Renouncing)

Renounce one’s intention to be a candidate for the next election round. 3 potential outcomes exist:

  • origin is a candidate and not elected in any set. In this case, the deposit is unreserved, returned and origin is removed as a candidate.
  • origin is a current runner-up. In this case, the deposit is unreserved, returned and origin is removed as a runner-up.
  • origin is a current member. In this case, the deposit is unreserved and origin is removed as a member, consequently not being a candidate for the next round anymore. Similar to [remove_members], if replacement runners exists, they are immediately used. If the prime is renouncing, then no prime will exist until the next round.

The dispatch origin of this call must be signed, and have one of the above roles.

The type of renouncing must be provided as witness data.

remove_member(<T::Lookup as StaticLookup>::Sourcebool)

Remove a particular member from the set. This is effective immediately and the bond of the outgoing member is slashed.

If a runner-up is available, then the best runner-up will be removed and replaces the outgoing member. Otherwise, a new phragmen election is started.

The dispatch origin of this call must be root.

Note that this does not affect the designated block number of the next election.

If we have a replacement, we use a small weight. Else, since this is a root call and will go into phragmen, we assume full block for now.

clean_defunct_voters(u32u32)

Clean all voters who are defunct (i.e. they do not serve any purpose at all). The deposit of the removed voters are returned.

This is an root function to be used only for cleaning the state.

The dispatch origin of this call must be root.

The total number of voters and those that are defunct must be provided as witness data.

Trait Implementations

impl<T: Config> Clone for Call<T>[src]

impl<T: Config> Debug for Call<T>[src]

impl<T: Config> Decode for Call<T> where
    Vec<T::AccountId>: Decode,
    Vec<T::AccountId>: Decode,
    <T::Lookup as StaticLookup>::Source: Decode,
    <T::Lookup as StaticLookup>::Source: Decode,
    <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance: HasCompact
[src]

impl<T: Config> Encode for Call<T> where
    Vec<T::AccountId>: Encode,
    Vec<T::AccountId>: Encode,
    <T::Lookup as StaticLookup>::Source: Encode,
    <T::Lookup as StaticLookup>::Source: Encode,
    <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance: HasCompact
[src]

impl<T: Config> EncodeLike<Call<T>> for Call<T> where
    Vec<T::AccountId>: Encode,
    Vec<T::AccountId>: Encode,
    <T::Lookup as StaticLookup>::Source: Encode,
    <T::Lookup as StaticLookup>::Source: Encode,
    <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance: HasCompact
[src]

impl<T: Config> Eq for Call<T>[src]

impl<T: Config> GetCallName for Call<T>[src]

impl<T: Config> GetDispatchInfo for Call<T>[src]

impl<T: Config> PartialEq<Call<T>> for Call<T>[src]

impl<T: Config> UnfilteredDispatchable for Call<T>[src]

type Origin = T::Origin

The origin type of the runtime, (i.e. fabric_system::Config::Origin).

Auto Trait Implementations

impl<T> RefUnwindSafe for Call<T> where
    T: RefUnwindSafe,
    <T as Config>::AccountId: RefUnwindSafe,
    <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance: RefUnwindSafe,
    <<T as Config>::Lookup as StaticLookup>::Source: RefUnwindSafe

impl<T> Send for Call<T> where
    T: Send,
    <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance: Send,
    <<T as Config>::Lookup as StaticLookup>::Source: Send

impl<T> Sync for Call<T> where
    T: Sync,
    <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance: Sync,
    <<T as Config>::Lookup as StaticLookup>::Source: Sync

impl<T> Unpin for Call<T> where
    T: Unpin,
    <T as Config>::AccountId: Unpin,
    <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance: Unpin,
    <<T as Config>::Lookup as StaticLookup>::Source: Unpin

impl<T> UnwindSafe for Call<T> where
    T: UnwindSafe,
    <T as Config>::AccountId: UnwindSafe,
    <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance: UnwindSafe,
    <<T as Config>::Lookup as StaticLookup>::Source: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedConversion for T[src]

impl<S> Codec for S where
    S: Decode + Encode
[src]

impl<T> DecodeAll for T where
    T: Decode
[src]

impl<T> DecodeLimit for T where
    T: Decode
[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Any + Send + Sync

impl<T> DynClone for T where
    T: Clone
[src]

impl<'_, '_, T> EncodeLike<&'_ &'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ mut T> for T where
    T: Encode
[src]

impl<T> EncodeLike<Arc<T>> for T where
    T: Encode
[src]

impl<T> EncodeLike<Box<T, Global>> for T where
    T: Encode
[src]

impl<'a, T> EncodeLike<Cow<'a, T>> for T where
    T: ToOwned + Encode
[src]

impl<T> EncodeLike<Rc<T>> for T where
    T: Encode
[src]

impl<T> From<T> for T[src]

impl<S> FullCodec for S where
    S: Decode + FullEncode
[src]

impl<S> FullEncode for S where
    S: Encode + EncodeLike<S>, 
[src]

impl<T> Hashable for T where
    T: Codec
[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IsType<T> for T[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    T: From<Outer>,
    Outer: AsRef<T> + AsMut<T> + From<T>, 

pub fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

pub fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

impl<T> KeyedVec for T where
    T: Codec
[src]

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeRefUnwindSafe for T where
    T: RefUnwindSafe

impl<T> Member for T where
    T: 'static + Send + Sync + Debug + Eq + PartialEq<T> + Clone
[src]

impl<T> Parameter for T where
    T: Codec + EncodeLike<T> + Clone + Eq + Debug
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SaturatedConversion for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 

impl<T, S> UniqueSaturatedInto<T> for S where
    T: Bounded,
    S: TryInto<T>, 

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,