westend_runtime/governance/
mod.rs1use 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 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}