westend_runtime/governance/
mod.rs

1// Copyright (C) Parity Technologies (UK) Ltd.
2// This file is part of Polkadot.
3
4// Polkadot is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8
9// Polkadot is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License
15// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
16
17//! New governance configurations for the Kusama runtime.
18
19use super::*;
20use crate::xcm_config::Collectives;
21use frame_support::{parameter_types, traits::EitherOf};
22use frame_system::EnsureRootWithSuccess;
23use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
24use xcm::latest::BodyId;
25
26mod origins;
27pub use origins::{
28	pallet_custom_origins, AuctionAdmin, FellowshipAdmin, GeneralAdmin, LeaseAdmin,
29	ReferendumCanceller, ReferendumKiller, Spender, StakingAdmin, Treasurer, WhitelistedCaller,
30};
31mod tracks;
32pub use tracks::TracksInfo;
33
34parameter_types! {
35	pub const VoteLockingPeriod: BlockNumber = 7 * DAYS;
36}
37
38impl pallet_conviction_voting::Config for Runtime {
39	type WeightInfo = weights::pallet_conviction_voting::WeightInfo<Self>;
40	type RuntimeEvent = RuntimeEvent;
41	type Currency = Balances;
42	type VoteLockingPeriod = VoteLockingPeriod;
43	type MaxVotes = ConstU32<512>;
44	type MaxTurnout =
45		frame_support::traits::tokens::currency::ActiveIssuanceOf<Balances, Self::AccountId>;
46	type Polls = Referenda;
47}
48
49parameter_types! {
50	pub const AlarmInterval: BlockNumber = 1;
51	pub const SubmissionDeposit: Balance = 1 * 3 * CENTS;
52	pub const UndecidingTimeout: BlockNumber = 14 * DAYS;
53}
54
55parameter_types! {
56	pub const MaxBalance: Balance = Balance::max_value();
57}
58pub type TreasurySpender = EitherOf<EnsureRootWithSuccess<AccountId, MaxBalance>, Spender>;
59
60impl origins::pallet_custom_origins::Config for Runtime {}
61
62parameter_types! {
63	// Fellows pluralistic body.
64	pub const FellowsBodyId: BodyId = BodyId::Technical;
65}
66
67impl pallet_whitelist::Config for Runtime {
68	type WeightInfo = weights::pallet_whitelist::WeightInfo<Self>;
69	type RuntimeCall = RuntimeCall;
70	type RuntimeEvent = RuntimeEvent;
71	type WhitelistOrigin = EitherOfDiverse<
72		EnsureRoot<Self::AccountId>,
73		EnsureXcm<IsVoiceOfBody<Collectives, FellowsBodyId>>,
74	>;
75	type DispatchWhitelistedOrigin = EitherOf<EnsureRoot<Self::AccountId>, WhitelistedCaller>;
76	type Preimages = Preimage;
77}
78
79impl pallet_referenda::Config for Runtime {
80	type WeightInfo = weights::pallet_referenda_referenda::WeightInfo<Self>;
81	type RuntimeCall = RuntimeCall;
82	type RuntimeEvent = RuntimeEvent;
83	type Scheduler = Scheduler;
84	type Currency = Balances;
85	type SubmitOrigin = frame_system::EnsureSigned<AccountId>;
86	type CancelOrigin = EitherOf<EnsureRoot<AccountId>, ReferendumCanceller>;
87	type KillOrigin = EitherOf<EnsureRoot<AccountId>, ReferendumKiller>;
88	type Slash = Treasury;
89	type Votes = pallet_conviction_voting::VotesOf<Runtime>;
90	type Tally = pallet_conviction_voting::TallyOf<Runtime>;
91	type SubmissionDeposit = SubmissionDeposit;
92	type MaxQueued = ConstU32<100>;
93	type UndecidingTimeout = UndecidingTimeout;
94	type AlarmInterval = AlarmInterval;
95	type Tracks = TracksInfo;
96	type Preimages = Preimage;
97}