Trait pallet_elections_phragmen::pallet::Config
source · pub trait Config: Config {
Show 18 associated items
type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>;
type PalletId: Get<LockIdentifier>;
type Currency: LockableCurrency<Self::AccountId, Moment = BlockNumberFor<Self>> + ReservableCurrency<Self::AccountId>;
type ChangeMembers: ChangeMembers<Self::AccountId>;
type InitializeMembers: InitializeMembers<Self::AccountId>;
type CurrencyToVote: CurrencyToVote<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>;
type CandidacyBond: Get<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>;
type VotingBondBase: Get<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>;
type VotingBondFactor: Get<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>;
type LoserCandidate: OnUnbalanced<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::NegativeImbalance>;
type KickedMember: OnUnbalanced<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::NegativeImbalance>;
type DesiredMembers: Get<u32>;
type DesiredRunnersUp: Get<u32>;
type TermDuration: Get<BlockNumberFor<Self>>;
type MaxCandidates: Get<u32>;
type MaxVoters: Get<u32>;
type MaxVotesPerVoter: Get<u32>;
type WeightInfo: WeightInfo;
}
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>
sourcetype PalletId: Get<LockIdentifier>
type PalletId: Get<LockIdentifier>
Identifier for the elections-phragmen pallet’s lock
sourcetype Currency: LockableCurrency<Self::AccountId, Moment = BlockNumberFor<Self>> + ReservableCurrency<Self::AccountId>
type Currency: LockableCurrency<Self::AccountId, Moment = BlockNumberFor<Self>> + ReservableCurrency<Self::AccountId>
The currency that people are electing with.
sourcetype ChangeMembers: ChangeMembers<Self::AccountId>
type ChangeMembers: ChangeMembers<Self::AccountId>
What to do when the members change.
sourcetype InitializeMembers: InitializeMembers<Self::AccountId>
type InitializeMembers: InitializeMembers<Self::AccountId>
What to do with genesis members
sourcetype CurrencyToVote: CurrencyToVote<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>
type CurrencyToVote: CurrencyToVote<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>
Convert a balance into a number used for election calculation.
This must fit into a u64
but is allowed to be sensibly lossy.
sourcetype CandidacyBond: Get<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>
type CandidacyBond: Get<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>
How much should be locked up in order to submit one’s candidacy.
sourcetype VotingBondBase: Get<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>
type VotingBondBase: Get<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>
Base deposit associated with voting.
This should be sensibly high to economically ensure the pallet cannot be attacked by creating a gigantic number of votes.
sourcetype VotingBondFactor: Get<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>
type VotingBondFactor: Get<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>
The amount of bond that need to be locked for each vote (32 bytes).
sourcetype LoserCandidate: OnUnbalanced<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::NegativeImbalance>
type LoserCandidate: OnUnbalanced<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::NegativeImbalance>
Handler for the unbalanced reduction when a candidate has lost (and is not a runner-up)
sourcetype KickedMember: OnUnbalanced<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::NegativeImbalance>
type KickedMember: OnUnbalanced<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::NegativeImbalance>
Handler for the unbalanced reduction when a member has been kicked.
sourcetype DesiredMembers: Get<u32>
type DesiredMembers: Get<u32>
Number of members to elect.
sourcetype DesiredRunnersUp: Get<u32>
type DesiredRunnersUp: Get<u32>
Number of runners_up to keep.
sourcetype TermDuration: Get<BlockNumberFor<Self>>
type TermDuration: Get<BlockNumberFor<Self>>
How long each seat is kept. This defines the next block number at which an election round will happen. If set to zero, no elections are ever triggered and the module will be in passive mode.
sourcetype MaxCandidates: Get<u32>
type MaxCandidates: Get<u32>
The maximum number of candidates in a phragmen election.
Warning: This impacts the size of the election which is run onchain. Chose wisely, and
consider how it will impact T::WeightInfo::election_phragmen
.
When this limit is reached no more candidates are accepted in the election.
sourcetype MaxVoters: Get<u32>
type MaxVoters: Get<u32>
The maximum number of voters to allow in a phragmen election.
Warning: This impacts the size of the election which is run onchain. Chose wisely, and
consider how it will impact T::WeightInfo::election_phragmen
.
When the limit is reached the new voters are ignored.
sourcetype MaxVotesPerVoter: Get<u32>
type MaxVotesPerVoter: Get<u32>
Maximum numbers of votes per voter.
Warning: This impacts the size of the election which is run onchain. Chose wisely, and
consider how it will impact T::WeightInfo::election_phragmen
.
sourcetype WeightInfo: WeightInfo
type WeightInfo: WeightInfo
Weight information for extrinsics in this pallet.