[][src]Enum pallet_elections::Call

pub enum Call<T: Trait> {
    set_approvals(Vec<bool>, VoteIndexu32, <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::Balance),
    reap_inactive_voter(u32, <T::Lookup as StaticLookup>::Sourceu32VoteIndex),
    retract_voter(u32),
    submit_candidacy(u32),
    present_winner(<T::Lookup as StaticLookup>::Source, <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::BalanceVoteIndex),
    set_desired_seats(u32),
    remove_member(<T::Lookup as StaticLookup>::Source),
    set_presentation_duration(T::BlockNumber),
    set_term_duration(T::BlockNumber),
    // some variants omitted
}

Dispatchable calls.

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

Variants

set_approvals(Vec<bool>, VoteIndexu32, <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::Balance)

Set candidate approvals. Approval slots stay valid as long as candidates in those slots are registered.

Locks value from the balance of origin indefinitely. Only [retract_voter] or [reap_inactive_voter] can unlock the balance.

hint argument is interpreted differently based on:

  • if origin is setting approvals for the first time: The index will be checked for being a valid hole in the voter list.
    • if the hint is correctly pointing to a hole, no fee is deducted from origin.
    • Otherwise, the call will succeed but the index is ignored and simply a push to the last chunk with free space happens. If the new push causes a new chunk to be created, a fee indicated by [VotingFee] is deducted.
  • if origin is already a voter: the index must be valid and point to the correct position of the origin in the current voters list.

Note that any trailing false votes in votes is ignored; In approval voting, not voting for a candidate and voting false, are equal.

  • O(1).
  • Two extra DB entries, one DB change.
  • Argument votes is limited in length to number of candidates.

reap_inactive_voter(u32, <T::Lookup as StaticLookup>::Sourceu32VoteIndex)

Remove a voter. For it not to be a bond-consuming no-op, all approved candidate indices must now be either unregistered or registered to a candidate that registered the slot after the voter gave their last approval set.

Both indices must be provided as explained in [voter_at] function.

May be called by anyone. Returns the voter deposit to signed.

  • O(1).
  • Two fewer DB entries, one DB change.

retract_voter(u32)

Remove a voter. All votes are cancelled and the voter deposit is returned.

The index must be provided as explained in [voter_at] function.

Also removes the lock on the balance of the voter. See [do_set_approvals()].

  • O(1).
  • Two fewer DB entries, one DB change.

submit_candidacy(u32)

Submit oneself for candidacy.

Account must have enough transferrable funds in it to pay the bond.

NOTE: if origin has already assigned approvals via [set_approvals], it will NOT have any usable funds to pass candidacy bond and must first retract. Note that setting approvals will lock the entire balance of the voter until retraction or being reported.

  • Independent of input.
  • Three DB changes.

present_winner(<T::Lookup as StaticLookup>::Source, <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::BalanceVoteIndex)

Claim that candidate is one of the top carry_count + desired_seats candidates. Only works iff the presentation period is active. candidate should have at least collected some non-zero total votes and origin must have enough funds to pay for a potential slash.

  • O(voters) compute.
  • One DB change.

set_desired_seats(u32)

Set the desired member count; if lower than the current count, then seats will not be up election when they expire. If more, then a new vote will be started if one is not already in progress.

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

Remove a particular member from the set. This is effective immediately.

Note: A tally should happen instantly (if not already in a presentation period) to fill the seat if removal means that the desired members are not met.

set_presentation_duration(T::BlockNumber)

Set the presentation duration. If there is currently a vote being presented for, will invoke finalize_vote.

set_term_duration(T::BlockNumber)

Set the presentation duration. If there is current a vote being presented for, will invoke finalize_vote.

Trait Implementations

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

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

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

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

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

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

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

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

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

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

type Origin = T::Origin

The origin type of the runtime, (i.e. frame_system::Trait::Origin).

Auto Trait Implementations

impl<T> RefUnwindSafe for Call<T> where
    T: RefUnwindSafe,
    <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::Balance: RefUnwindSafe,
    <T as Trait>::BlockNumber: RefUnwindSafe,
    <<T as Trait>::Lookup as StaticLookup>::Source: RefUnwindSafe
[src]

impl<T> Send for Call<T> where
    T: Send,
    <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::Balance: Send,
    <T as Trait>::BlockNumber: Send,
    <<T as Trait>::Lookup as StaticLookup>::Source: Send
[src]

impl<T> Sync for Call<T> where
    T: Sync,
    <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::Balance: Sync,
    <T as Trait>::BlockNumber: Sync,
    <<T as Trait>::Lookup as StaticLookup>::Source: Sync
[src]

impl<T> Unpin for Call<T> where
    T: Unpin,
    <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::Balance: Unpin,
    <T as Trait>::BlockNumber: Unpin,
    <<T as Trait>::Lookup as StaticLookup>::Source: Unpin
[src]

impl<T> UnwindSafe for Call<T> where
    T: UnwindSafe,
    <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::Balance: UnwindSafe,
    <T as Trait>::BlockNumber: UnwindSafe,
    <<T as Trait>::Lookup as StaticLookup>::Source: UnwindSafe
[src]

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: Encode + Decode
[src]

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

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

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: Encode + ToOwned
[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>, 
[src]

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

Get a reference to the inner from the outer.

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

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 + Clone + PartialEq<T> + Eq + Send + Sync + Debug
[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>, 
[src]

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

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