git.delta.rocks / unique-network / refs/commits / de0fd484c6ec

difftreelog

source

runtime/common/config/governance/mod.rs2.1 KiBsourcehistory
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use frame_support::{18	PalletId, parameter_types,19	traits::{20		EnsureOrigin, EqualPrivilegeOnly, EitherOfDiverse, EitherOf, MapSuccess, ConstU16, Polling,21	},22	weights::Weight,23	pallet_prelude::*,24};25use frame_system::{EnsureRoot, EnsureNever};26use sp_runtime::{27	Perbill,28	traits::{AccountIdConversion, ConstU32, Replace, CheckedSub, Convert},29	morph_types,30};31use crate::{32	Runtime, RuntimeOrigin, RuntimeEvent, RuntimeCall, OriginCaller, Preimage, Balances, Treasury,33	Scheduler, Council, TechnicalCommittee,34};35pub use up_common::{36	constants::{UNIQUE, DAYS, HOURS, MINUTES, CENTIUNIQUE},37	types::{AccountId, Balance, BlockNumber},38};39use pallet_collective::EnsureProportionAtLeast;4041pub mod council;42pub use council::*;4344pub mod democracy;45pub use democracy::*;4647pub mod technical_committee;48pub use technical_committee::*;4950pub mod fellowship;51pub use fellowship::*;5253pub mod scheduler;54pub use scheduler::*;5556impl pallet_gov_origins::Config for Runtime {}5758morph_types! {59	/// A `TryMorph` implementation to reduce a scalar by a particular amount, checking for60	/// underflow.61	pub type CheckedReduceBy<N: TypedGet>: TryMorph = |r: N::Type| -> Result<N::Type, ()> {62		r.checked_sub(&N::get()).ok_or(())63	} where N::Type: CheckedSub;64}6566parameter_types! {67	pub MaxCollectivesProposalWeight: Weight = Perbill::from_percent(80) * <Runtime as frame_system::Config>::BlockWeights::get().max_block;68}