Struct StakingCallApi

Source
pub struct StakingCallApi<'api> { /* private fields */ }

Implementations§

Source§

impl<'api> StakingCallApi<'api>

Source

pub fn bond( &self, controller: MultiAddress<AccountId, u32>, value: u128, payee: RewardDestination<AccountId>, ) -> Result<WrappedCall>

Take the origin account as a stash and lock up value of its balance. controller will be the account that controls it.

value must be more than the minimum_balance specified by T::Currency.

The dispatch origin for this call must be Signed by the stash account.

Emits Bonded.

§Complexity
  • Independent of the arguments. Moderate complexity.
  • O(1).
  • Three extra DB entries.

NOTE: Two of the storage writes (Self::bonded, Self::payee) are never cleaned unless the origin falls below existential deposit and gets removed as dust.

Source

pub fn bond_extra(&self, max_additional: u128) -> Result<WrappedCall>

Add some extra amount that have appeared in the stash free_balance into the balance up for staking.

The dispatch origin for this call must be Signed by the stash, not the controller.

Use this if there are additional funds in your stash account that you wish to bond. Unlike bond or unbond this function does not impose any limitation on the amount that can be added.

Emits Bonded.

§Complexity
  • Independent of the arguments. Insignificant complexity.
  • O(1).
Source

pub fn unbond(&self, value: u128) -> Result<WrappedCall>

Schedule a portion of the stash to be unlocked ready for transfer out after the bond period ends. If this leaves an amount actively bonded less than T::Currency::minimum_balance(), then it is increased to the full amount.

The dispatch origin for this call must be Signed by the controller, not the stash.

Once the unlock period is done, you can call withdraw_unbonded to actually move the funds out of management ready for transfer.

No more than a limited number of unlocking chunks (see MaxUnlockingChunks) can co-exists at the same time. If there are no unlocking chunks slots available [Call::withdraw_unbonded] is called to remove some of the chunks (if possible).

If a user encounters the InsufficientBond error when calling this extrinsic, they should call chill first in order to free up their bonded funds.

Emits Unbonded.

See also [Call::withdraw_unbonded].

Source

pub fn withdraw_unbonded(&self, num_slashing_spans: u32) -> Result<WrappedCall>

Remove any unlocked chunks from the unlocking queue from our management.

This essentially frees up that balance to be used by the stash account to do whatever it wants.

The dispatch origin for this call must be Signed by the controller.

Emits Withdrawn.

See also [Call::unbond].

§Complexity

O(S) where S is the number of slashing spans to remove NOTE: Weight annotation is the kill scenario, we refund otherwise.

Source

pub fn validate(&self, prefs: ValidatorPrefs) -> Result<WrappedCall>

Declare the desire to validate for the origin controller.

Effects will be felt at the beginning of the next era.

The dispatch origin for this call must be Signed by the controller, not the stash.

Source

pub fn nominate( &self, targets: Vec<MultiAddress<AccountId, u32>>, ) -> Result<WrappedCall>

Declare the desire to nominate targets for the origin controller.

Effects will be felt at the beginning of the next era.

The dispatch origin for this call must be Signed by the controller, not the stash.

§Complexity
  • The transaction’s complexity is proportional to the size of targets (N) which is capped at CompactAssignments::LIMIT (T::MaxNominations).
  • Both the reads and writes follow a similar pattern.
Source

pub fn chill(&self) -> Result<WrappedCall>

Declare no desire to either validate or nominate.

Effects will be felt at the beginning of the next era.

The dispatch origin for this call must be Signed by the controller, not the stash.

§Complexity
  • Independent of the arguments. Insignificant complexity.
  • Contains one read.
  • Writes are limited to the origin account key.
Source

pub fn set_payee( &self, payee: RewardDestination<AccountId>, ) -> Result<WrappedCall>

(Re-)set the payment target for a controller.

Effects will be felt instantly (as soon as this function is completed successfully).

The dispatch origin for this call must be Signed by the controller, not the stash.

§Complexity
  • O(1)
  • Independent of the arguments. Insignificant complexity.
  • Contains a limited number of reads.
  • Writes are limited to the origin account key.

Source

pub fn set_controller( &self, controller: MultiAddress<AccountId, u32>, ) -> Result<WrappedCall>

(Re-)set the controller of a stash.

Effects will be felt instantly (as soon as this function is completed successfully).

The dispatch origin for this call must be Signed by the stash, not the controller.

§Complexity

O(1)

  • Independent of the arguments. Insignificant complexity.
  • Contains a limited number of reads.
  • Writes are limited to the origin account key.
Source

pub fn set_validator_count(&self, new: u32) -> Result<WrappedCall>

Sets the ideal number of validators.

The dispatch origin must be Root.

§Complexity

O(1)

Source

pub fn increase_validator_count(&self, additional: u32) -> Result<WrappedCall>

Increments the ideal number of validators upto maximum of ElectionProviderBase::MaxWinners.

The dispatch origin must be Root.

§Complexity

Same as Self::set_validator_count.

Source

pub fn scale_validator_count(&self, factor: Percent) -> Result<WrappedCall>

Scale up the ideal number of validators by a factor upto maximum of ElectionProviderBase::MaxWinners.

The dispatch origin must be Root.

§Complexity

Same as Self::set_validator_count.

Source

pub fn force_no_eras(&self) -> Result<WrappedCall>

Force there to be no new eras indefinitely.

The dispatch origin must be Root.

§Warning

The election process starts multiple blocks before the end of the era. Thus the election process may be ongoing when this is called. In this case the election will continue until the next era is triggered.

§Complexity
  • No arguments.
  • Weight: O(1)
Source

pub fn force_new_era(&self) -> Result<WrappedCall>

Force there to be a new era at the end of the next session. After this, it will be reset to normal (non-forced) behaviour.

The dispatch origin must be Root.

§Warning

The election process starts multiple blocks before the end of the era. If this is called just before a new era is triggered, the election process may not have enough blocks to get a result.

§Complexity
  • No arguments.
  • Weight: O(1)
Source

pub fn set_invulnerables( &self, invulnerables: Vec<AccountId>, ) -> Result<WrappedCall>

Set the validators who cannot be slashed (if any).

The dispatch origin must be Root.

Source

pub fn force_unstake( &self, stash: AccountId, num_slashing_spans: u32, ) -> Result<WrappedCall>

Force a current staker to become completely unstaked, immediately.

The dispatch origin must be Root.

Source

pub fn force_new_era_always(&self) -> Result<WrappedCall>

Force there to be a new era at the end of sessions indefinitely.

The dispatch origin must be Root.

§Warning

The election process starts multiple blocks before the end of the era. If this is called just before a new era is triggered, the election process may not have enough blocks to get a result.

Source

pub fn cancel_deferred_slash( &self, era: u32, slash_indices: Vec<u32>, ) -> Result<WrappedCall>

Cancel enactment of a deferred slash.

Can be called by the T::AdminOrigin.

Parameters: era and indices of the slashes for that era to kill.

Source

pub fn payout_stakers( &self, validator_stash: AccountId, era: u32, ) -> Result<WrappedCall>

Pay out all the stakers behind a single validator for a single era.

  • validator_stash is the stash account of the validator. Their nominators, up to T::MaxNominatorRewardedPerValidator, will also receive their rewards.
  • era may be any era between [current_era - history_depth; current_era].

The origin of this call must be Signed. Any account can call this function, even if it is not one of the stakers.

§Complexity
  • At most O(MaxNominatorRewardedPerValidator).
Source

pub fn rebond(&self, value: u128) -> Result<WrappedCall>

Rebond a portion of the stash scheduled to be unlocked.

The dispatch origin must be signed by the controller.

§Complexity
  • Time complexity: O(L), where L is unlocking chunks
  • Bounded by MaxUnlockingChunks.
Source

pub fn reap_stash( &self, stash: AccountId, num_slashing_spans: u32, ) -> Result<WrappedCall>

Remove all data structures concerning a staker/stash once it is at a state where it can be considered dust in the staking system. The requirements are:

  1. the total_balance of the stash is below existential deposit.
  2. or, the ledger.total of the stash is below existential deposit.

The former can happen in cases like a slash; the latter when a fully unbonded account is still receiving staking rewards in RewardDestination::Staked.

It can be called by anyone, as long as stash meets the above requirements.

Refunds the transaction fees upon successful execution.

Source

pub fn kick( &self, who: Vec<MultiAddress<AccountId, u32>>, ) -> Result<WrappedCall>

Remove the given nominations from the calling validator.

Effects will be felt at the beginning of the next era.

The dispatch origin for this call must be Signed by the controller, not the stash.

  • who: A list of nominator stash accounts who are nominating this validator which should no longer be nominating this validator.

Note: Making this call only makes sense if you first set the validator preferences to block any further nominations.

Source

pub fn set_staking_configs( &self, min_nominator_bond: ConfigOp<u128>, min_validator_bond: ConfigOp<u128>, max_nominator_count: ConfigOp<u32>, max_validator_count: ConfigOp<u32>, chill_threshold: ConfigOp<Percent>, min_commission: ConfigOp<Perbill>, ) -> Result<WrappedCall>

Update the various staking configurations .

  • min_nominator_bond: The minimum active bond needed to be a nominator.
  • min_validator_bond: The minimum active bond needed to be a validator.
  • max_nominator_count: The max number of users who can be a nominator at once. When set to None, no limit is enforced.
  • max_validator_count: The max number of users who can be a validator at once. When set to None, no limit is enforced.
  • chill_threshold: The ratio of max_nominator_count or max_validator_count which should be filled in order for the chill_other transaction to work.
  • min_commission: The minimum amount of commission that each validators must maintain. This is checked only upon calling validate. Existing validators are not affected.

RuntimeOrigin must be Root to call this function.

NOTE: Existing nominators and validators will not be affected by this update. to kick people under the new limits, chill_other should be called.

Source

pub fn chill_other(&self, controller: AccountId) -> Result<WrappedCall>

Declare a controller to stop participating as either a validator or nominator.

Effects will be felt at the beginning of the next era.

The dispatch origin for this call must be Signed, but can be called by anyone.

If the caller is the same as the controller being targeted, then no further checks are enforced, and this function behaves just like chill.

If the caller is different than the controller being targeted, the following conditions must be met:

  • controller must belong to a nominator who has become non-decodable,

Or:

  • A ChillThreshold must be set and checked which defines how close to the max nominators or validators we must reach before users can start chilling one-another.
  • A MaxNominatorCount and MaxValidatorCount must be set which is used to determine how close we are to the threshold.
  • A MinNominatorBond and MinValidatorBond must be set and checked, which determines if this is a person that should be chilled because they have not met the threshold bond required.

This can be helpful if bond requirements are updated, and we need to remove old users who do not satisfy these requirements.

Source

pub fn force_apply_min_commission( &self, validator_stash: AccountId, ) -> Result<WrappedCall>

Force a validator to have at least the minimum commission. This will not affect a validator who already has a commission greater than or equal to the minimum. Any account can call this.

Source

pub fn set_min_commission(&self, new: Perbill) -> Result<WrappedCall>

Sets the minimum amount of commission that each validators must maintain.

This call has lower privilege requirements than set_staking_config and can be called by the T::AdminOrigin. Root can always call this.

Source

pub fn add_permissioned_validator( &self, identity: IdentityId, intended_count: Option<u32>, ) -> Result<WrappedCall>

Adds a permissioned identity and sets its preferences.

The dispatch origin must be Root.

Source

pub fn remove_permissioned_validator( &self, identity: IdentityId, ) -> Result<WrappedCall>

Remove an identity from the pool of (wannabe) validator identities. Effects are known in the next session.

The dispatch origin must be Root.

§Arguments
  • origin Required origin for removing a potential validator.
  • identity Validator’s IdentityId.
Source

pub fn validate_cdd_expiry_nominators( &self, targets: Vec<AccountId>, ) -> Result<WrappedCall>

Validate the nominators CDD expiry time.

If an account from a given set of address is nominating then check the CDD expiry time of it and if it is expired then the account should be unbonded and removed from the nominating process.

Source

pub fn payout_stakers_by_system( &self, validator_stash: AccountId, era: u32, ) -> Result<WrappedCall>

Source

pub fn change_slashing_allowed_for( &self, slashing_switch: SlashingSwitch, ) -> Result<WrappedCall>

Switch slashing status on the basis of given slashing_switch. Can only be called by root.

Source

pub fn update_permissioned_validator_intended_count( &self, identity: IdentityId, new_intended_count: u32, ) -> Result<WrappedCall>

Sets the intended count to new_intended_count for the given identity.

Source

pub fn chill_from_governance( &self, identity: IdentityId, stash_keys: Vec<AccountId>, ) -> Result<WrappedCall>

Governance council forcefully chills a validator. Effects will be felt at the beginning of the next era.

Source

pub fn set_commission_cap(&self, new_cap: Perbill) -> Result<WrappedCall>

Changes commission rate which applies to all validators. Only Governance committee is allowed to change this value.

§Arguments
  • new_cap the new commission cap.

Trait Implementations§

Source§

impl<'api> Clone for StakingCallApi<'api>

Source§

fn clone(&self) -> StakingCallApi<'api>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'api> From<&'api Api> for StakingCallApi<'api>

Source§

fn from(api: &'api Api) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'api> Freeze for StakingCallApi<'api>

§

impl<'api> !RefUnwindSafe for StakingCallApi<'api>

§

impl<'api> Send for StakingCallApi<'api>

§

impl<'api> Sync for StakingCallApi<'api>

§

impl<'api> Unpin for StakingCallApi<'api>

§

impl<'api> !UnwindSafe for StakingCallApi<'api>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CheckedConversion for T

Source§

fn checked_from<T>(t: T) -> Option<Self>
where Self: TryFrom<T>,

Convert from a value of T into an equivalent instance of Option<Self>. Read more
Source§

fn checked_into<T>(self) -> Option<T>
where Self: TryInto<T>,

Consume self to return Some equivalent value of Option<T>. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Src, Dest> IntoTuple<Dest> for Src
where Dest: FromTuple<Src>,

Source§

fn into_tuple(self) -> Dest

Source§

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

Source§

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

Get a reference to the inner from the outer.

Source§

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

Get a mutable reference to the inner from the outer.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatedConversion for T

Source§

fn saturated_from<T>(t: T) -> Self
where Self: UniqueSaturatedFrom<T>,

Convert from a value of T into an equivalent instance of Self. Read more
Source§

fn saturated_into<T>(self) -> T
where Self: UniqueSaturatedInto<T>,

Consume self to return an equivalent value of T. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
Source§

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

Source§

fn unique_saturated_into(self) -> T

Consume self to return an equivalent value of T.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> JsonSchemaMaybe for T

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSendSync for T