> ## Documentation Index
> Fetch the complete documentation index at: https://docs.therootnetwork.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Staking

## Calls

### bond

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`.

**Namespace**

```
api.tx.staking.bond
```

**Type**

```
function bond(
  controller: SeedPrimitivesSignatureAccountId20,
  value: Compact<u128>,
  payee: PalletStakingRewardDestination
)
```

### bondExtra

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`](Self::bond) or [`unbond`](Self::unbond) this function does not impose any limitation on the amount that can be added.

Emits `Bonded`.

**Namespace**

```
api.tx.staking.bondExtra
```

**Type**

```
function bondExtra(
  max_additional: Compact<u128>
)
```

### cancelDeferredSlash

Cancel enactment of a deferred slash.

Can be called by the `T::SlashCancelOrigin`.

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

**Namespace**

```
api.tx.staking.cancelDeferredSlash
```

**Type**

```
function cancelDeferredSlash(
  era: u32,
  slash_indices: Vec<u32>
)
```

### chill

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.

**Namespace**

```
api.tx.staking.chill
```

**Type**

```
function chill(

)
```

### chillOther

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.

**Namespace**

```
api.tx.staking.chillOther
```

**Type**

```
function chillOther(
  controller: SeedPrimitivesSignatureAccountId20
)
```

### forceApplyMinCommission

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.

**Namespace**

```
api.tx.staking.forceApplyMinCommission
```

**Type**

```
function forceApplyMinCommission(
  validator_stash: SeedPrimitivesSignatureAccountId20
)
```

### forceNewEra

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>
  **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.
</Warning>

**Namespace**

```
api.tx.staking.forceNewEra
```

**Type**

```
function forceNewEra(

)
```

### forceNewEraAlways

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

The dispatch origin must be Root.

<Warning>
  **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.
</Warning>

**Namespace**

```
api.tx.staking.forceNewEraAlways
```

**Type**

```
function forceNewEraAlways(

)
```

### forceNoEras

Force there to be no new eras indefinitely.

The dispatch origin must be Root.

<Warning>
  **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.
</Warning>

**Namespace**

```
api.tx.staking.forceNoEras
```

**Type**

```
function forceNoEras(

)
```

### forceUnstake

Force a current staker to become completely unstaked, immediately.

The dispatch origin must be Root.

**Namespace**

```
api.tx.staking.forceUnstake
```

**Type**

```
function forceUnstake(
  stash: SeedPrimitivesSignatureAccountId20,
  num_slashing_spans: u32
)
```

### increaseValidatorCount

Increments the ideal number of validators.

The dispatch origin must be Root.

**Namespace**

```
api.tx.staking.increaseValidatorCount
```

**Type**

```
function increaseValidatorCount(
  additional: Compact<u32>
)
```

### kick

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.

**Namespace**

```
api.tx.staking.kick
```

**Type**

```
function kick(
  who: Vec<SeedPrimitivesSignatureAccountId20>
)
```

### nominate

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.

**Namespace**

```
api.tx.staking.nominate
```

**Type**

```
function nominate(
  targets: Vec<SeedPrimitivesSignatureAccountId20>
)
```

### payoutStakers

<Info>
  Currently disabled on TRN in favour of the [Vortex Distribution System](../../../../learn/tokenomics)
</Info>

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.

**Namespace**

```
api.tx.staking.payoutStakers
```

**Type**

```
function payoutStakers(
  validator_stash: SeedPrimitivesSignatureAccountId20,
  era: u32
)
```

### reapStash

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.

**Namespace**

```
api.tx.staking.reapStash
```

**Type**

```
function reapStash(
  stash: SeedPrimitivesSignatureAccountId20,
  num_slashing_spans: u32
)
```

### rebond

Rebond a portion of the stash scheduled to be unlocked.

The dispatch origin must be signed by the controller.

**Namespace**

```
api.tx.staking.rebond
```

**Type**

```
function rebond(
  value: Compact<u128>
)
```

### scaleValidatorCount

Scale up the ideal number of validators by a factor.

The dispatch origin must be Root.

**Namespace**

```
api.tx.staking.scaleValidatorCount
```

**Type**

```
function scaleValidatorCount(
  factor: Percent
)
```

### setController

(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.

**Namespace**

```
api.tx.staking.setController
```

**Type**

```
function setController(
  controller: SeedPrimitivesSignatureAccountId20
)
```

### setInvulnerables

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

The dispatch origin must be Root.

**Namespace**

```
api.tx.staking.setInvulnerables
```

**Type**

```
function setInvulnerables(
  invulnerables: Vec<SeedPrimitivesSignatureAccountId20>
)
```

### setPayee

(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.

**Namespace**

```
api.tx.staking.setPayee
```

**Type**

```
function setPayee(
  payee: PalletStakingRewardDestination
)
```

### setStakingConfigs

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.

**Namespace**

```
api.tx.staking.setStakingConfigs
```

**Type**

```
function setStakingConfigs(
  min_nominator_bond: PalletStakingPalletConfigOpU128,
  min_validator_bond: PalletStakingPalletConfigOpU128,
  max_nominator_count: PalletStakingPalletConfigOpU32,
  max_validator_count: PalletStakingPalletConfigOpU32,
  chill_threshold: PalletStakingPalletConfigOpPercent,
  min_commission: PalletStakingPalletConfigOpPerbill
)
```

### setValidatorCount

Sets the ideal number of validators.

The dispatch origin must be Root.

**Namespace**

```
api.tx.staking.setValidatorCount
```

**Type**

```
function setValidatorCount(
  new: Compact<u32>
)
```

### unbond

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. In that case, \[`Call::withdraw_unbonded`] need to be called first 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`].

**Namespace**

```
api.tx.staking.unbond
```

**Type**

```
function unbond(
  value: Compact<u128>
)
```

### validate

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.
preferences contain the **Validator Commission** which is a **Perbill** value

**Namespace**

```
api.tx.staking.validate
```

**Type**

```
function validate(
  prefs: PalletStakingValidatorPrefs
)
```

### withdrawUnbonded

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`].

**Namespace**

```
api.tx.staking.withdrawUnbonded
```

**Type**

```
function withdrawUnbonded(
  num_slashing_spans: u32
)
```

## Storage

### activeEra

The active era information, it holds index and start.

The active era is the era being currently rewarded. Validator set of this era must be equal to \[`SessionInterface::validators`].

**Namespace**

```
api.query.staking.activeEra
```

**Type**

```
function activeEra(

): Option<PalletStakingActiveEraInfo>
```

### bonded

Map from all locked "stash" accounts to the controller account.

**Namespace**

```
api.query.staking.bonded
```

**Type**

```
function bonded(
  SeedPrimitivesSignatureAccountId20
): Option<SeedPrimitivesSignatureAccountId20>
```

### bondedEras

A mapping from still-bonded eras to the first session index of that era.

Must contains information for eras for the range: `[active_era - bounding_duration; active_era]`

**Namespace**

```
api.query.staking.bondedEras
```

**Type**

```
function bondedEras(

): Vec<(u32,u32)>
```

### canceledSlashPayout

The amount of currency given to reporters of a slash event which was canceled by extraordinary circumstances (e.g. governance).

**Namespace**

```
api.query.staking.canceledSlashPayout
```

**Type**

```
function canceledSlashPayout(

): u128
```

### chillThreshold

The threshold for when users can start calling `chill_other` for other validators / nominators. The threshold is compared to the actual number of validators / nominators (`CountFor*`) in the system compared to the configured max (`Max*Count`).

**Namespace**

```
api.query.staking.chillThreshold
```

**Type**

```
function chillThreshold(

): Option<Percent>
```

### counterForNominators

Counter for the related counted storage map

**Namespace**

```
api.query.staking.counterForNominators
```

**Type**

```
function counterForNominators(

): u32
```

### counterForValidators

Counter for the related counted storage map

**Namespace**

```
api.query.staking.counterForValidators
```

**Type**

```
function counterForValidators(

): u32
```

### currentEra

The current era index.

This is the latest planned era, depending on how the Session pallet queues the validator set, it might be active or not.

**Namespace**

```
api.query.staking.currentEra
```

**Type**

```
function currentEra(

): Option<u32>
```

### currentPlannedSession

The last planned session scheduled by the session pallet.

This is basically in sync with the call to \[`pallet_session::SessionManager::new_session`].

**Namespace**

```
api.query.staking.currentPlannedSession
```

**Type**

```
function currentPlannedSession(

): u32
```

### erasRewardPoints

Rewards for the last `HISTORY_DEPTH` eras. If reward hasn't been set or has been removed then 0 reward is returned.

**Namespace**

```
api.query.staking.erasRewardPoints
```

**Type**

```
function erasRewardPoints(
  u32
): PalletStakingEraRewardPoints
```

### erasStakers

Exposure of validator at era.

This is keyed first by the era index to allow bulk deletion and then the stash account.

Is it removed after `HISTORY_DEPTH` eras. If stakers hasn't been set or has been removed then empty exposure is returned.

**Namespace**

```
api.query.staking.erasStakers
```

**Type**

```
function erasStakers(
  u32,
  SeedPrimitivesSignatureAccountId20
): PalletStakingExposure
```

### erasStakersClipped

Clipped Exposure of validator at era.

This is similar to \[`ErasStakers`] but number of nominators exposed is reduced to the `T::MaxNominatorRewardedPerValidator` biggest stakers. Note: The field `total` and `own` of the exposure remains unchanged. This is used to limit the i/o cost for the nominator payout.

This is keyed fist by the era index to allow bulk deletion and then the stash account.

Is it removed after `HISTORY_DEPTH` eras. If stakers hasn't been set or has been removed then empty exposure is returned.

**Namespace**

```
api.query.staking.erasStakersClipped
```

**Type**

```
function erasStakersClipped(
  u32,
  SeedPrimitivesSignatureAccountId20
): PalletStakingExposure
```

### erasStartSessionIndex

The session index at which the era start for the last `HISTORY_DEPTH` eras.

Note: This tracks the starting session (i.e. session index when era start being active) for the eras in `[CurrentEra - HISTORY_DEPTH, CurrentEra]`.

**Namespace**

```
api.query.staking.erasStartSessionIndex
```

**Type**

```
function erasStartSessionIndex(
  u32
): Option<u32>
```

### erasTotalStake

The total amount staked for the last `HISTORY_DEPTH` eras. If total hasn't been set or has been removed then 0 stake is returned.

**Namespace**

```
api.query.staking.erasTotalStake
```

**Type**

```
function erasTotalStake(
  u32
): u128
```

### erasValidatorPrefs

Similar to `ErasStakers`, this holds the preferences of validators.

This is keyed first by the era index to allow bulk deletion and then the stash account.

Is it removed after `HISTORY_DEPTH` eras.

**Namespace**

```
api.query.staking.erasValidatorPrefs
```

**Type**

```
function erasValidatorPrefs(
  u32,
  SeedPrimitivesSignatureAccountId20
): PalletStakingValidatorPrefs
```

### erasValidatorReward

The total validator era payout for the last `HISTORY_DEPTH` eras.

Eras that haven't finished yet or has been removed doesn't have reward.

**Namespace**

```
api.query.staking.erasValidatorReward
```

**Type**

```
function erasValidatorReward(
  u32
): Option<u128>
```

### forceEra

Mode of era forcing.

**Namespace**

```
api.query.staking.forceEra
```

**Type**

```
function forceEra(

): PalletStakingForcing
```

### invulnerables

Any validators that may never be slashed or forcibly kicked. It's a Vec since they're easy to initialize and the performance hit is minimal (we expect no more than four invulnerables) and restricted to testnets.

**Namespace**

```
api.query.staking.invulnerables
```

**Type**

```
function invulnerables(

): Vec<SeedPrimitivesSignatureAccountId20>
```

### ledger

Map from all (unlocked) "controller" accounts to the info regarding the staking.

**Namespace**

```
api.query.staking.ledger
```

**Type**

```
function ledger(
  SeedPrimitivesSignatureAccountId20
): Option<PalletStakingStakingLedger>
```

### maxNominatorsCount

The maximum nominator count before we stop allowing new validators to join.

When this value is not set, no limits are enforced.

**Namespace**

```
api.query.staking.maxNominatorsCount
```

**Type**

```
function maxNominatorsCount(

): Option<u32>
```

### maxValidatorsCount

The maximum validator count before we stop allowing new validators to join.

When this value is not set, no limits are enforced.

**Namespace**

```
api.query.staking.maxValidatorsCount
```

**Type**

```
function maxValidatorsCount(

): Option<u32>
```

### minCommission

The minimum amount of commission that validators can set.

If set to `0`, no limit exists.

**Namespace**

```
api.query.staking.minCommission
```

**Type**

```
function minCommission(

): Perbill
```

### minimumValidatorCount

Minimum number of staking participants before emergency conditions are imposed.

**Namespace**

```
api.query.staking.minimumValidatorCount
```

**Type**

```
function minimumValidatorCount(

): u32
```

### minNominatorBond

The minimum active bond to become and maintain the role of a nominator.

**Namespace**

```
api.query.staking.minNominatorBond
```

**Type**

```
function minNominatorBond(

): u128
```

### minValidatorBond

The minimum active bond to become and maintain the role of a validator.

**Namespace**

```
api.query.staking.minValidatorBond
```

**Type**

```
function minValidatorBond(

): u128
```

### nominators

The map from nominator stash key to their nomination preferences, namely the validators that they wish to support.

Note that the keys of this storage map might become non-decodable in case the \[`Config::MaxNominations`] configuration is decreased. In this rare case, these nominators are still existent in storage, their key is correct and retrievable (i.e. `contains_key` indicates that they exist), but their value cannot be decoded. Therefore, the non-decodable nominators will effectively not-exist, until they re-submit their preferences such that it is within the bounds of the newly set `Config::MaxNominations`.

This implies that `::iter_keys().count()` and `::iter().count()` might return different values for this map. Moreover, the main `::count()` is aligned with the former, namely the number of keys that exist.

Lastly, if any of the nominators become non-decodable, they can be chilled immediately via \[`Call::chill_other`] dispatchable by anyone.

**Namespace**

```
api.query.staking.nominators
```

**Type**

```
function nominators(
  SeedPrimitivesSignatureAccountId20
): Option<PalletStakingNominations>
```

### nominatorSlashInEra

All slashing events on nominators, mapped by era to the highest slash value of the era.

**Namespace**

```
api.query.staking.nominatorSlashInEra
```

**Type**

```
function nominatorSlashInEra(
  u32,
  SeedPrimitivesSignatureAccountId20
): Option<u128>
```

### offendingValidators

Indices of validators that have offended in the active era and whether they are currently disabled.

This value should be a superset of disabled validators since not all offences lead to the validator being disabled (if there was no slash). This is needed to track the percentage of validators that have offended in the current era, ensuring a new era is forced if `OffendingValidatorsThreshold` is reached. The vec is always kept sorted so that we can find whether a given validator has previously offended using binary search. It gets cleared when the era ends.

**Namespace**

```
api.query.staking.offendingValidators
```

**Type**

```
function offendingValidators(

): Vec<(u32,bool)>
```

### payee

Where the reward payment should be made. Keyed by stash.

**Namespace**

```
api.query.staking.payee
```

**Type**

```
function payee(
  SeedPrimitivesSignatureAccountId20
): PalletStakingRewardDestination
```

### slashingSpans

Slashing spans for stash accounts.

**Namespace**

```
api.query.staking.slashingSpans
```

**Type**

```
function slashingSpans(
  SeedPrimitivesSignatureAccountId20
): Option<PalletStakingSlashingSlashingSpans>
```

### slashRewardFraction

The percentage of the slash that is distributed to reporters.

The rest of the slashed value is handled by the `Slash`.

**Namespace**

```
api.query.staking.slashRewardFraction
```

**Type**

```
function slashRewardFraction(

): Perbill
```

### spanSlash

Records information about the maximum slash of a stash within a slashing span, as well as how much reward has been paid out.

**Namespace**

```
api.query.staking.spanSlash
```

**Type**

```
function spanSlash(
  (SeedPrimitivesSignatureAccountId20,u32)
): PalletStakingSlashingSpanRecord
```

### storageVersion

True if network has been upgraded to this version. Storage version of the pallet.

This is set to v7.0.0 for new networks.

**Namespace**

```
api.query.staking.storageVersion
```

**Type**

```
function storageVersion(

): PalletStakingReleases
```

### unappliedSlashes

All unapplied slashes that are queued for later.

**Namespace**

```
api.query.staking.unappliedSlashes
```

**Type**

```
function unappliedSlashes(
  u32
): Vec<PalletStakingUnappliedSlash>
```

### validatorCount

The ideal number of staking participants.

**Namespace**

```
api.query.staking.validatorCount
```

**Type**

```
function validatorCount(

): u32
```

### validators

The map from (wannabe) validator stash key to the preferences of that validator.

**Namespace**

```
api.query.staking.validators
```

**Type**

```
function validators(
  SeedPrimitivesSignatureAccountId20
): PalletStakingValidatorPrefs
```

### validatorSlashInEra

All slashing events on validators, mapped by era to the highest slash proportion and slash value of the era.

**Namespace**

```
api.query.staking.validatorSlashInEra
```

**Type**

```
function validatorSlashInEra(
  u32,
  SeedPrimitivesSignatureAccountId20
): Option<(Perbill,u128)>
```

## Events

### Bonded

An account has bonded this amount. \[stash, amount]

NOTE: This event is only emitted when funds are bonded via a dispatchable. Notably, it will not be emitted for staking rewards when they are added to stake.

**Namespace**

```
api.events.staking.Bonded
```

**Type**

```
type Bonded = {
  stash: SeedPrimitivesSignatureAccountId20,
  amount: u128
}
```

### Chilled

An account has stopped participating as either a validator or nominator.

**Namespace**

```
api.events.staking.Chilled
```

**Type**

```
type Chilled = {
  stash: SeedPrimitivesSignatureAccountId20
}
```

### EraPaid

The era payout has been set; the first balance is the validator-payout; the second is the remainder from the maximum amount of reward.

**Namespace**

```
api.events.staking.EraPaid
```

**Type**

```
type EraPaid = {
  era_index: u32,
  validator_payout: u128,
  remainder: u128
}
```

### Kicked

A nominator has been kicked from a validator.

**Namespace**

```
api.events.staking.Kicked
```

**Type**

```
type Kicked = {
  nominator: SeedPrimitivesSignatureAccountId20,
  stash: SeedPrimitivesSignatureAccountId20
}
```

### OldSlashingReportDiscarded

An old slashing report from a prior era was discarded because it could not be processed.

**Namespace**

```
api.events.staking.OldSlashingReportDiscarded
```

**Type**

```
type OldSlashingReportDiscarded = {
  session_index: u32
}
```

### PayoutStarted

The stakers' rewards are getting paid.

**Namespace**

```
api.events.staking.PayoutStarted
```

**Type**

```
type PayoutStarted = {
  era_index: u32,
  validator_stash: SeedPrimitivesSignatureAccountId20
}
```

### Rewarded

The nominator has been rewarded by this amount.

**Namespace**

```
api.events.staking.Rewarded
```

**Type**

```
type Rewarded = {
  stash: SeedPrimitivesSignatureAccountId20,
  amount: u128
}
```

### Slashed

One staker (and potentially its nominators) has been slashed by the given amount.

**Namespace**

```
api.events.staking.Slashed
```

**Type**

```
type Slashed = {
  staker: SeedPrimitivesSignatureAccountId20,
  amount: u128
}
```

### StakersElected

A new set of stakers was elected.

**Namespace**

```
api.events.staking.StakersElected
```

**Type**

```
type StakersElected = {

}
```

### StakingElectionFailed

The election failed. No new era is planned.

**Namespace**

```
api.events.staking.StakingElectionFailed
```

**Type**

```
type StakingElectionFailed = {

}
```

### Unbonded

An account has unbonded this amount.

**Namespace**

```
api.events.staking.Unbonded
```

**Type**

```
type Unbonded = {
  stash: SeedPrimitivesSignatureAccountId20,
  amount: u128
}
```

### ValidatorPrefsSet

A validator has set their preferences.

**Namespace**

```
api.events.staking.ValidatorPrefsSet
```

**Type**

```
type ValidatorPrefsSet = {
  stash: SeedPrimitivesSignatureAccountId20,
  prefs: PalletStakingValidatorPrefs
}
```

### Withdrawn

An account has called `withdraw_unbonded` and removed unbonding chunks worth `Balance` from the unlocking queue.

**Namespace**

```
api.events.staking.Withdrawn
```

**Type**

```
type Withdrawn = {
  stash: SeedPrimitivesSignatureAccountId20,
  amount: u128
}
```

## Errors

### AlreadyBonded

Stash is already bonded.

**Namespace**

```
api.errors.staking.AlreadyBonded
```

### AlreadyClaimed

Rewards for this era have already been claimed for this validator.

**Namespace**

```
api.errors.staking.AlreadyClaimed
```

### AlreadyPaired

Controller is already paired.

**Namespace**

```
api.errors.staking.AlreadyPaired
```

### BadState

Internal state has become somehow corrupted and the operation cannot continue.

**Namespace**

```
api.errors.staking.BadState
```

### BadTarget

A nomination target was supplied that was blocked or otherwise not a validator.

**Namespace**

```
api.errors.staking.BadTarget
```

### BoundNotMet

Some bound is not met.

**Namespace**

```
api.errors.staking.BoundNotMet
```

### CannotChillOther

The user has enough bond and thus cannot be chilled forcefully by an external person.

**Namespace**

```
api.errors.staking.CannotChillOther
```

### CommissionTooLow

Commission is too low. Must be at least `MinCommission`.

**Namespace**

```
api.errors.staking.CommissionTooLow
```

### DuplicateIndex

Duplicate index.

**Namespace**

```
api.errors.staking.DuplicateIndex
```

### EmptyTargets

Targets cannot be empty.

**Namespace**

```
api.errors.staking.EmptyTargets
```

### FundedTarget

Attempting to target a stash that still has funds.

**Namespace**

```
api.errors.staking.FundedTarget
```

### IncorrectHistoryDepth

Incorrect previous history depth input provided.

**Namespace**

```
api.errors.staking.IncorrectHistoryDepth
```

### IncorrectSlashingSpans

Incorrect number of slashing spans provided.

**Namespace**

```
api.errors.staking.IncorrectSlashingSpans
```

### InsufficientBond

Cannot have a validator or nominator role, with value less than the minimum defined by governance (see `MinValidatorBond` and `MinNominatorBond`). If unbonding is the intention, `chill` first to remove one's role as validator/nominator.

**Namespace**

```
api.errors.staking.InsufficientBond
```

### InvalidEraToReward

Invalid era to reward.

**Namespace**

```
api.errors.staking.InvalidEraToReward
```

### InvalidNumberOfNominations

Invalid number of nominations.

**Namespace**

```
api.errors.staking.InvalidNumberOfNominations
```

### InvalidSlashIndex

Slash record index out of bounds.

**Namespace**

```
api.errors.staking.InvalidSlashIndex
```

### NoMoreChunks

Can not schedule more unlock chunks.

**Namespace**

```
api.errors.staking.NoMoreChunks
```

### NotController

Not a controller account.

**Namespace**

```
api.errors.staking.NotController
```

### NotSortedAndUnique

Items are not sorted and unique.

**Namespace**

```
api.errors.staking.NotSortedAndUnique
```

### NotStash

Not a stash account.

**Namespace**

```
api.errors.staking.NotStash
```

### NoUnlockChunk

Can not rebond without unlocking chunks.

**Namespace**

```
api.errors.staking.NoUnlockChunk
```

### TooManyNominators

There are too many nominators in the system. Governance needs to adjust the staking settings to keep things safe for the runtime.

**Namespace**

```
api.errors.staking.TooManyNominators
```

### TooManyTargets

Too many nomination targets supplied.

**Namespace**

```
api.errors.staking.TooManyTargets
```

### TooManyValidators

There are too many validators in the system. Governance needs to adjust the staking settings to keep things safe for the runtime.

**Namespace**

```
api.errors.staking.TooManyValidators
```

## Constants

### bondingDuration

Number of eras that staked funds must remain bonded for.

**Namespace**

```
api.consts.staking.bondingDuration
```

**Type**

```
type bondingDuration = u32
```

### historyDepth

Number of eras to keep in history.

Following information is kept for eras in `[current_era - HistoryDepth, current_era]`: `ErasStakers`, `ErasStakersClipped`, `ErasValidatorPrefs`, `ErasValidatorReward`, `ErasRewardPoints`, `ErasTotalStake`, `ErasStartSessionIndex`, `StakingLedger.claimed_rewards`.

Must be more than the number of eras delayed by session. I.e. active era must always be in history. I.e. `active_era > current_era - history_depth` must be guaranteed.

If migrating an existing pallet from storage value to config value, this should be set to same value or greater as in storage.

Note: `HistoryDepth` is used as the upper bound for the `BoundedVec` item `StakingLedger.claimed_rewards`. Setting this value lower than the existing value can lead to inconsistencies in the `StakingLedger` and will need to be handled properly in a migration. The test `reducing_history_depth_abrupt` shows this effect.

**Namespace**

```
api.consts.staking.historyDepth
```

**Type**

```
type historyDepth = u32
```

### maxNominations

Maximum number of nominations per nominator.

**Namespace**

```
api.consts.staking.maxNominations
```

**Type**

```
type maxNominations = u32
```

### maxNominatorRewardedPerValidator

The maximum number of nominators rewarded for each validator.

For each validator only the `$MaxNominatorRewardedPerValidator` biggest stakers can claim their reward. This used to limit the i/o cost for the nominator payout.

**Namespace**

```
api.consts.staking.maxNominatorRewardedPerValidator
```

**Type**

```
type maxNominatorRewardedPerValidator = u32
```

### maxUnlockingChunks

The maximum number of `unlocking` chunks a \[`StakingLedger`] can have. Effectively determines how many unique eras a staker may be unbonding in.

Note: `MaxUnlockingChunks` is used as the upper bound for the `BoundedVec` item `StakingLedger.unlocking`. Setting this value lower than the existing value can lead to inconsistencies in the `StakingLedger` and will need to be handled properly in a runtime migration. The test `reducing_max_unlocking_chunks_abrupt` shows this effect.

**Namespace**

```
api.consts.staking.maxUnlockingChunks
```

**Type**

```
type maxUnlockingChunks = u32
```

### sessionsPerEra

Number of sessions per era.

**Namespace**

```
api.consts.staking.sessionsPerEra
```

**Type**

```
type sessionsPerEra = u32
```

### slashDeferDuration

Number of eras that slashes are deferred by, after computation.

This should be less than the bonding duration. Set to 0 if slashes should be applied immediately, without opportunity for intervention.

**Namespace**

```
api.consts.staking.slashDeferDuration
```

**Type**

```
type slashDeferDuration = u32
```
