asset_hub_westend_runtime/governance/
mod.rs1use super::*;
20use crate::xcm_config::Collectives;
21use frame_support::{
22 parameter_types,
23 traits::{tokens::UnityOrOuterConversion, EitherOf, EitherOfDiverse, FromContains},
24};
25use frame_system::EnsureRootWithSuccess;
26use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
27use parachains_common::pay::{LocalPay, VersionedLocatableAccount};
28use polkadot_runtime_common::{
29 impls::{ContainsParts, VersionedLocatableAsset},
30 prod_or_fast,
31};
32use sp_runtime::{traits::IdentityLookup, Percent};
33use xcm::latest::BodyId;
34
35mod origins;
36pub use origins::{
37 pallet_custom_origins, AuctionAdmin, FellowshipAdmin, GeneralAdmin, LeaseAdmin,
38 ReferendumCanceller, ReferendumKiller, Spender, StakingAdmin, Treasurer, WhitelistedCaller,
39};
40mod tracks;
41pub use tracks::TracksInfo;
42parameter_types! {
43 pub const VoteLockingPeriod: BlockNumber = prod_or_fast!(7 * RC_DAYS, 1);
44}
45
46mod impls;
47
48impl pallet_conviction_voting::Config for Runtime {
49 type WeightInfo = weights::pallet_conviction_voting::WeightInfo<Self>;
50 type RuntimeEvent = RuntimeEvent;
51 type Currency = Balances;
52 type VoteLockingPeriod = VoteLockingPeriod;
53 type MaxVotes = ConstU32<512>;
54 type MaxTurnout =
55 frame_support::traits::tokens::currency::ActiveIssuanceOf<Balances, Self::AccountId>;
56 type Polls = Referenda;
57 type BlockNumberProvider = RelaychainDataProvider<Runtime>;
58 type VotingHooks = ();
59}
60
61parameter_types! {
62 pub const AlarmInterval: BlockNumber = 1;
63 pub const SubmissionDeposit: Balance = 1 * 3 * CENTS;
64 pub const UndecidingTimeout: BlockNumber = 14 * RC_DAYS;
65}
66
67impl origins::pallet_custom_origins::Config for Runtime {}
68
69parameter_types! {
70 pub const FellowsBodyId: BodyId = BodyId::Technical;
72}
73
74impl pallet_whitelist::Config for Runtime {
75 type WeightInfo = weights::pallet_whitelist::WeightInfo<Self>;
76 type RuntimeCall = RuntimeCall;
77 type RuntimeEvent = RuntimeEvent;
78 type WhitelistOrigin = EitherOfDiverse<
79 EnsureRoot<Self::AccountId>,
80 EnsureXcm<IsVoiceOfBody<Collectives, FellowsBodyId>>,
81 >;
82 type DispatchWhitelistedOrigin = EitherOf<EnsureRoot<Self::AccountId>, WhitelistedCaller>;
83 type Preimages = Preimage;
84}
85
86impl pallet_referenda::Config for Runtime {
87 type WeightInfo = weights::pallet_referenda::WeightInfo<Self>;
88 type RuntimeCall = RuntimeCall;
89 type RuntimeEvent = RuntimeEvent;
90 type Scheduler = Scheduler;
91 type Currency = Balances;
92 type SubmitOrigin = frame_system::EnsureSigned<AccountId>;
93 type CancelOrigin = EitherOf<EnsureRoot<AccountId>, ReferendumCanceller>;
94 type KillOrigin = EitherOf<EnsureRoot<AccountId>, ReferendumKiller>;
95 type Slash = Treasury;
96 type Votes = pallet_conviction_voting::VotesOf<Runtime>;
97 type Tally = pallet_conviction_voting::TallyOf<Runtime>;
98 type SubmissionDeposit = SubmissionDeposit;
99 type MaxQueued = ConstU32<100>;
100 type UndecidingTimeout = UndecidingTimeout;
101 type AlarmInterval = AlarmInterval;
102 type Tracks = TracksInfo;
103 type Preimages = Preimage;
104 type BlockNumberProvider = RelaychainDataProvider<Runtime>;
105}
106
107parameter_types! {
108 pub const SpendPeriod: BlockNumber = 6 * DAYS;
109 pub const Burn: Permill = Permill::from_perthousand(2);
110 pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
111 pub const PayoutSpendPeriod: BlockNumber = 30 * DAYS;
112
113 pub const TipCountdown: BlockNumber = 1 * DAYS;
114 pub const TipFindersFee: Percent = Percent::from_percent(20);
115 pub const TipReportDepositBase: Balance = 100 * CENTS;
116 pub const DataDepositPerByte: Balance = 1 * CENTS;
117 pub const MaxApprovals: u32 = 100;
118 pub const MaxAuthorities: u32 = 100_000;
119 pub const MaxKeys: u32 = 10_000;
120 pub const MaxPeerInHeartbeats: u32 = 10_000;
121 pub const MaxBalance: Balance = Balance::max_value();
122 pub TreasuryAccount: AccountId = Treasury::account_id();
123}
124
125pub type TreasurySpender = EitherOf<EnsureRootWithSuccess<AccountId, MaxBalance>, Spender>;
126
127impl pallet_treasury::Config for Runtime {
128 type PalletId = TreasuryPalletId;
129 type Currency = Balances;
130 type RejectOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Treasurer>;
131 type RuntimeEvent = RuntimeEvent;
132 type SpendPeriod = SpendPeriod;
133 type Burn = Burn;
134 type BurnDestination = ();
135 type MaxApprovals = MaxApprovals;
136 type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>;
137 type SpendFunds = ();
138 type SpendOrigin = TreasurySpender;
139 type AssetKind = VersionedLocatableAsset;
140 type Beneficiary = VersionedLocatableAccount;
141 type BeneficiaryLookup = IdentityLookup<Self::Beneficiary>;
142 type Paymaster = LocalPay<NativeAndAllAssets, TreasuryAccount, xcm_config::LocationToAccountId>;
143 type BalanceConverter = UnityOrOuterConversion<
144 ContainsParts<
145 FromContains<
146 xcm_builder::IsChildSystemParachain<ParaId>,
147 xcm_builder::IsParentsOnly<ConstU8<1>>,
148 >,
149 >,
150 AssetRate,
151 >;
152 type PayoutPeriod = PayoutSpendPeriod;
153 type BlockNumberProvider = RelaychainDataProvider<Runtime>;
154 #[cfg(feature = "runtime-benchmarks")]
155 type BenchmarkHelper = parachains_common::pay::benchmarks::LocalPayArguments<
156 xcm_config::TrustBackedAssetsPalletIndex,
157 >;
158}
159
160impl pallet_asset_rate::Config for Runtime {
161 type WeightInfo = weights::pallet_asset_rate::WeightInfo<Runtime>;
162 type RuntimeEvent = RuntimeEvent;
163 type CreateOrigin = EnsureRoot<AccountId>;
164 type RemoveOrigin = EnsureRoot<AccountId>;
165 type UpdateOrigin = EnsureRoot<AccountId>;
166 type Currency = Balances;
167 type AssetKind = <Runtime as pallet_treasury::Config>::AssetKind;
168 #[cfg(feature = "runtime-benchmarks")]
169 type BenchmarkHelper = polkadot_runtime_common::impls::benchmarks::AssetRateArguments;
170}