pub trait StakingInterface {
    type Balance;
    type AccountId;

    fn minimum_bond() -> Self::Balance;
    fn bonding_duration() -> EraIndex;
    fn current_era() -> EraIndex;
    fn active_stake(stash: &Self::AccountId) -> Option<Self::Balance>;
    fn total_stake(stash: &Self::AccountId) -> Option<Self::Balance>;
    fn bond(
        stash: Self::AccountId,
        controller: Self::AccountId,
        value: Self::Balance,
        payee: Self::AccountId
    ) -> DispatchResult; fn nominate(
        controller: Self::AccountId,
        validators: Vec<Self::AccountId>
    ) -> DispatchResult; fn chill(controller: Self::AccountId) -> DispatchResult; fn bond_extra(stash: Self::AccountId, extra: Self::Balance) -> DispatchResult; fn unbond(stash: Self::AccountId, value: Self::Balance) -> DispatchResult; fn withdraw_unbonded(
        stash: Self::AccountId,
        num_slashing_spans: u32
    ) -> Result<bool, DispatchError>; fn nominations(who: Self::AccountId) -> Option<Vec<Self::AccountId>>; }
Expand description

Trait for communication with the staking pallet.

Required Associated Types§

Balance type used by the staking system.

AccountId type used by the staking system

Required Methods§

The minimum amount required to bond in order to be a nominator. This does not necessarily mean the nomination will be counted in an election, but instead just enough to be stored as a nominator. In other words, this is the minimum amount to register the intention to nominate.

Number of eras that staked funds must remain bonded for.

Note

This must be strictly greater than the staking systems slash deffer duration.

The current era index.

This should be the latest planned era that the staking system knows about.

The amount of active stake that stash has in the staking system.

The total stake that stash has in the staking system. This includes the Self::active_stake, and any funds currently in the process of unbonding via Self::unbond.

Note

This is only guaranteed to reflect the amount locked by the staking system. If there are non-staking locks on the bonded pair’s balance this may not be accurate.

Bond (lock) value of stash’s balance. controller will be set as the account controlling stash. This creates what is referred to as “bonded pair”.

Have controller nominate validators.

Chill stash.

Bond some extra amount in the Stash’s free balance against the active bonded balance of the account. The amount extra actually bonded will never be more than the Stash’s free balance.

Schedule a portion of the active bonded balance to be unlocked at era Self::current_era + Self::bonding_duration.

Once the unlock era has been reached, Self::withdraw_unbonded can be called to unlock the funds.

The amount of times this can be successfully called is limited based on how many distinct eras funds are schedule to unlock in. Calling Self::withdraw_unbonded after some unlock schedules have reached their unlocking era should allow more calls to this function.

Unlock any funds schedule to unlock before or at the current era.

Returns whether the stash was killed because of this withdraw or not.

Get the nominations of a stash, if they are a nominator, None otherwise.

Implementors§