pub struct StakingCallApi<'api> { /* private fields */ }
Implementations§
Source§impl<'api> StakingCallApi<'api>
impl<'api> StakingCallApi<'api>
Sourcepub fn bond(
&self,
controller: MultiAddress<AccountId, u32>,
value: u128,
payee: RewardDestination<AccountId>,
) -> Result<WrappedCall>
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.
Sourcepub fn bond_extra(&self, max_additional: u128) -> Result<WrappedCall>
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).
Sourcepub fn unbond(&self, value: u128) -> Result<WrappedCall>
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
].
Sourcepub fn withdraw_unbonded(&self, num_slashing_spans: u32) -> Result<WrappedCall>
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.
Sourcepub fn validate(&self, prefs: ValidatorPrefs) -> Result<WrappedCall>
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.
Sourcepub fn nominate(
&self,
targets: Vec<MultiAddress<AccountId, u32>>,
) -> Result<WrappedCall>
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.
Sourcepub fn chill(&self) -> Result<WrappedCall>
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.
Sourcepub fn set_payee(
&self,
payee: RewardDestination<AccountId>,
) -> Result<WrappedCall>
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.
Sourcepub fn set_controller(
&self,
controller: MultiAddress<AccountId, u32>,
) -> Result<WrappedCall>
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.
Sourcepub fn set_validator_count(&self, new: u32) -> Result<WrappedCall>
pub fn set_validator_count(&self, new: u32) -> Result<WrappedCall>
Sourcepub fn increase_validator_count(&self, additional: u32) -> Result<WrappedCall>
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
.
Sourcepub fn scale_validator_count(&self, factor: Percent) -> Result<WrappedCall>
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
.
Sourcepub fn force_no_eras(&self) -> Result<WrappedCall>
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)
Sourcepub fn force_new_era(&self) -> Result<WrappedCall>
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)
Sourcepub fn set_invulnerables(
&self,
invulnerables: Vec<AccountId>,
) -> Result<WrappedCall>
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.
Sourcepub fn force_unstake(
&self,
stash: AccountId,
num_slashing_spans: u32,
) -> Result<WrappedCall>
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.
Sourcepub fn force_new_era_always(&self) -> Result<WrappedCall>
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.
Sourcepub fn cancel_deferred_slash(
&self,
era: u32,
slash_indices: Vec<u32>,
) -> Result<WrappedCall>
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.
Sourcepub fn payout_stakers(
&self,
validator_stash: AccountId,
era: u32,
) -> Result<WrappedCall>
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 toT::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).
Sourcepub fn rebond(&self, value: u128) -> Result<WrappedCall>
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
.
Sourcepub fn reap_stash(
&self,
stash: AccountId,
num_slashing_spans: u32,
) -> Result<WrappedCall>
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:
- the
total_balance
of the stash is below existential deposit. - 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.
Sourcepub fn kick(
&self,
who: Vec<MultiAddress<AccountId, u32>>,
) -> Result<WrappedCall>
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.
Sourcepub 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>
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 toNone
, no limit is enforced.max_validator_count
: The max number of users who can be a validator at once. When set toNone
, no limit is enforced.chill_threshold
: The ratio ofmax_nominator_count
ormax_validator_count
which should be filled in order for thechill_other
transaction to work.min_commission
: The minimum amount of commission that each validators must maintain. This is checked only upon callingvalidate
. 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.
Sourcepub fn chill_other(&self, controller: AccountId) -> Result<WrappedCall>
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
andMaxValidatorCount
must be set which is used to determine how close we are to the threshold. - A
MinNominatorBond
andMinValidatorBond
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.
Sourcepub fn force_apply_min_commission(
&self,
validator_stash: AccountId,
) -> Result<WrappedCall>
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.
Sourcepub fn set_min_commission(&self, new: Perbill) -> Result<WrappedCall>
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.
Sourcepub fn add_permissioned_validator(
&self,
identity: IdentityId,
intended_count: Option<u32>,
) -> Result<WrappedCall>
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.
Sourcepub fn remove_permissioned_validator(
&self,
identity: IdentityId,
) -> Result<WrappedCall>
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.
Sourcepub fn validate_cdd_expiry_nominators(
&self,
targets: Vec<AccountId>,
) -> Result<WrappedCall>
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.
pub fn payout_stakers_by_system( &self, validator_stash: AccountId, era: u32, ) -> Result<WrappedCall>
Sourcepub fn change_slashing_allowed_for(
&self,
slashing_switch: SlashingSwitch,
) -> Result<WrappedCall>
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.
Sourcepub fn update_permissioned_validator_intended_count(
&self,
identity: IdentityId,
new_intended_count: u32,
) -> Result<WrappedCall>
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
.
Sourcepub fn chill_from_governance(
&self,
identity: IdentityId,
stash_keys: Vec<AccountId>,
) -> Result<WrappedCall>
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.
Sourcepub fn set_commission_cap(&self, new_cap: Perbill) -> Result<WrappedCall>
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>
impl<'api> Clone for StakingCallApi<'api>
Source§fn clone(&self) -> StakingCallApi<'api>
fn clone(&self) -> StakingCallApi<'api>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto 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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
fn into_tuple(self) -> Dest
Source§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read moreSource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.