pub trait Config: Config {
Show 14 associated items type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>; type WeightInfo: WeightInfo; type Currency: Mutate<Self::AccountId> + MutateFreeze<Self::AccountId, Id = Self::RuntimeFreezeReason>; type RuntimeFreezeReason: From<FreezeReason>; type RewardCounter: FixedPointNumber + MaxEncodedLen + TypeInfo + Default + FullCodec; type PalletId: Get<PalletId>; type MaxPointsToBalance: Get<u8>; type MaxUnbonding: Get<u32>; type BalanceToU256: Convert<BalanceOf<Self>, U256>; type U256ToBalance: Convert<U256, BalanceOf<Self>>; type StakeAdapter: StakeStrategy<AccountId = Self::AccountId, Balance = BalanceOf<Self>>; type PostUnbondingPoolsWindow: Get<u32>; type MaxMetadataLen: Get<u32>; type AdminOrigin: EnsureOrigin<Self::RuntimeOrigin>;
Expand description

Configuration trait of this pallet.

The main purpose of this trait is to act as an interface between this pallet and the runtime in which it is embedded in. A type, function, or constant in this trait is essentially left to be configured by the runtime that includes this pallet.

Consequently, a runtime that wants to include this pallet must implement this trait.

Required Associated Types§


type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>

The overarching event type.


type WeightInfo: WeightInfo

Weight information for extrinsics in this pallet.


type Currency: Mutate<Self::AccountId> + MutateFreeze<Self::AccountId, Id = Self::RuntimeFreezeReason>

The currency type used for nomination pool.


type RuntimeFreezeReason: From<FreezeReason>

The overarching freeze reason.


type RewardCounter: FixedPointNumber + MaxEncodedLen + TypeInfo + Default + FullCodec

The type that is used for reward counter.

The arithmetic of the reward counter might saturate based on the size of the Currency::Balance. If this happens, operations fails. Nonetheless, this type should be chosen such that this failure almost never happens, as if it happens, the pool basically needs to be dismantled (or all pools migrated to a larger RewardCounter type, which is a PITA to do).

See the inline code docs of Member::pending_rewards and RewardPool::update_recorded for example analysis. A sp_runtime::FixedU128 should be fine for chains with balance types similar to that of Polkadot and Kusama, in the absence of severe slashing (or prevented via a reasonable MaxPointsToBalance), for many many years to come.


type PalletId: Get<PalletId>

The nomination pool’s pallet id.


type MaxPointsToBalance: Get<u8>

The maximum pool points-to-balance ratio that an open pool can have.

This is important in the event slashing takes place and the pool’s points-to-balance ratio becomes disproportional.

Moreover, this relates to the RewardCounter type as well, as the arithmetic operations are a function of number of points, and by setting this value to e.g. 10, you ensure that the total number of points in the system are at most 10 times the total_issuance of the chain, in the absolute worse case.

For a value of 10, the threshold would be a pool points-to-balance ratio of 10:1. Such a scenario would also be the equivalent of the pool being 90% slashed.


type MaxUnbonding: Get<u32>

The maximum number of simultaneous unbonding chunks that can exist per member.


type BalanceToU256: Convert<BalanceOf<Self>, U256>

Infallible method for converting Currency::Balance to U256.


type U256ToBalance: Convert<U256, BalanceOf<Self>>

Infallible method for converting U256 to Currency::Balance.


type StakeAdapter: StakeStrategy<AccountId = Self::AccountId, Balance = BalanceOf<Self>>

The interface for nominating.

Note: Switching to a new StakeStrategy might require a migration of the storage.


type PostUnbondingPoolsWindow: Get<u32>

The amount of eras a SubPools::with_era pool can exist before it gets merged into the SubPools::no_era pool. In other words, this is the amount of eras a member will be able to withdraw from an unbonding pool which is guaranteed to have the correct ratio of points to balance; once the with_era pool is merged into the no_era pool, the ratio can become skewed due to some slashed ratio getting merged in at some point.


type MaxMetadataLen: Get<u32>

The maximum length, in bytes, that a pools metadata maybe.


type AdminOrigin: EnsureOrigin<Self::RuntimeOrigin>

The origin that can manage pool configurations.

Object Safety§

This trait is not object safe.