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

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	pallet_prelude::*,19	parameter_types,20	traits::{21		ConstU16, EitherOf, EitherOfDiverse, EnsureOrigin, EqualPrivilegeOnly, MapSuccess, Polling,22	},23	weights::Weight,24	PalletId,25};26use frame_system::{EnsureNever, EnsureRoot};27use pallet_collective::EnsureProportionAtLeast;28use sp_runtime::{29	morph_types,30	traits::{AccountIdConversion, CheckedSub, ConstU32, Convert, Replace},31	Perbill,32};33pub use up_common::{34	constants::{CENTIUNIQUE, DAYS, HOURS, MINUTES, UNIQUE},35	types::{AccountId, Balance, BlockNumber},36};3738use crate::{39	Balances, Council, OriginCaller, Preimage, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin,40	Scheduler, TechnicalCommittee, Treasury,41};4243pub mod council;44pub use council::*;4546pub mod democracy;47pub use democracy::*;4849pub mod technical_committee;50pub use technical_committee::*;5152pub mod fellowship;53pub use fellowship::*;5455pub mod scheduler;56pub use scheduler::*;5758pub mod identity;5960impl pallet_gov_origins::Config for Runtime {}6162morph_types! {63	/// A `TryMorph` implementation to reduce a scalar by a particular amount, checking for64	/// underflow.65	pub type CheckedReduceBy<N: TypedGet>: TryMorph = |r: N::Type| -> Result<N::Type, ()> {66		r.checked_sub(&N::get()).ok_or(())67	} where N::Type: CheckedSub;68}6970parameter_types! {71	pub MaxCollectivesProposalWeight: Weight = Perbill::from_percent(80) * <Runtime as frame_system::Config>::BlockWeights::get().max_block;72}