referrerpolicy=no-referrer-when-downgrade

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	type BlockNumberProvider = System;
48	type VotingHooks = ();
49}
50
51parameter_types! {
52	pub const AlarmInterval: BlockNumber = 1;
53	pub const SubmissionDeposit: Balance = 1 * 3 * CENTS;
54	pub const UndecidingTimeout: BlockNumber = 14 * DAYS;
55}
56
57parameter_types! {
58	pub const MaxBalance: Balance = Balance::max_value();
59}
60pub type TreasurySpender = EitherOf<EnsureRootWithSuccess<AccountId, MaxBalance>, Spender>;
61
62impl origins::pallet_custom_origins::Config for Runtime {}
63
64parameter_types! {
65	// Fellows pluralistic body.
66	pub const FellowsBodyId: BodyId = BodyId::Technical;
67}
68
69impl pallet_whitelist::Config for Runtime {
70	type WeightInfo = weights::pallet_whitelist::WeightInfo<Self>;
71	type RuntimeCall = RuntimeCall;
72	type RuntimeEvent = RuntimeEvent;
73	type WhitelistOrigin = EitherOfDiverse<
74		EnsureRoot<Self::AccountId>,
75		EnsureXcm<IsVoiceOfBody<Collectives, FellowsBodyId>>,
76	>;
77	type DispatchWhitelistedOrigin = EitherOf<EnsureRoot<Self::AccountId>, WhitelistedCaller>;
78	type Preimages = Preimage;
79}
80
81impl pallet_referenda::Config for Runtime {
82	type WeightInfo = weights::pallet_referenda_referenda::WeightInfo<Self>;
83	type RuntimeCall = RuntimeCall;
84	type RuntimeEvent = RuntimeEvent;
85	type Scheduler = Scheduler;
86	type Currency = Balances;
87	type SubmitOrigin = frame_system::EnsureSigned<AccountId>;
88	type CancelOrigin = EitherOf<EnsureRoot<AccountId>, ReferendumCanceller>;
89	type KillOrigin = EitherOf<EnsureRoot<AccountId>, ReferendumKiller>;
90	type Slash = Treasury;
91	type Votes = pallet_conviction_voting::VotesOf<Runtime>;
92	type Tally = pallet_conviction_voting::TallyOf<Runtime>;
93	type SubmissionDeposit = SubmissionDeposit;
94	type MaxQueued = ConstU32<100>;
95	type UndecidingTimeout = UndecidingTimeout;
96	type AlarmInterval = AlarmInterval;
97	type Tracks = TracksInfo;
98	type Preimages = Preimage;
99	type BlockNumberProvider = System;
100}