pub trait Config: Config {
    type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>;
    type WeightInfo: WeightInfo;
    type Currency: Currency<Self::AccountId>;
    type RewardCounter: FixedPointNumber + MaxEncodedLen + TypeInfo + Default + FullCodec;
    type PalletId: Get<PalletId>;
    type MaxPointsToBalance: Get<u8>;
    type BalanceToU256: Convert<BalanceOf<Self>, U256>;
    type U256ToBalance: Convert<U256, BalanceOf<Self>>;
    type Staking: StakingInterface<Balance = BalanceOf<Self>, AccountId = Self::AccountId>;
    type PostUnbondingPoolsWindow: Get<u32>;
    type MaxMetadataLen: Get<u32>;
    type MaxUnbonding: Get<u32>;
}
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§

source

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

The overarching event type.

source

type WeightInfo: WeightInfo

Weight information for extrinsics in this pallet.

source

type Currency: Currency<Self::AccountId>

The nominating balance.

source

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.

source

type PalletId: Get<PalletId>

The nomination pool’s pallet id.

source

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.

source

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

Infallible method for converting Currency::Balance to U256.

source

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

Infallible method for converting U256 to Currency::Balance.

source

type Staking: StakingInterface<Balance = BalanceOf<Self>, AccountId = Self::AccountId>

The interface for nominating.

source

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.

source

type MaxMetadataLen: Get<u32>

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

source

type MaxUnbonding: Get<u32>

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

Implementors§