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

difftreelog

source

runtime/common/config/pallets/scheduler.rs2.2 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    traits::PrivilegeCmp,19    weights::Weight,20    parameter_types21};22use frame_system::EnsureSigned;23use sp_runtime::Perbill;24use sp_std::cmp::Ordering;25use crate::{26    runtime_common::{27        scheduler::SchedulerPaymentExecutor,28        config::substrate::RuntimeBlockWeights,29    },30    Runtime, Call, Event, Origin, OriginCaller, Balances31};32use common_types::AccountId;3334parameter_types! {35	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *36		RuntimeBlockWeights::get().max_block;37	pub const MaxScheduledPerBlock: u32 = 50;3839    pub const NoPreimagePostponement: Option<u32> = Some(10);40	pub const Preimage: Option<u32> = Some(10);41}4243/// Used the compare the privilege of an origin inside the scheduler.44pub struct OriginPrivilegeCmp;4546impl PrivilegeCmp<OriginCaller> for OriginPrivilegeCmp {47	fn cmp_privilege(_left: &OriginCaller, _right: &OriginCaller) -> Option<Ordering> {48		Some(Ordering::Equal)49	}50}5152impl pallet_unique_scheduler::Config for Runtime {53	type Event = Event;54	type Origin = Origin;55	type Currency = Balances;56	type PalletsOrigin = OriginCaller;57	type Call = Call;58	type MaximumWeight = MaximumSchedulerWeight;59	type ScheduleOrigin = EnsureSigned<AccountId>;60	type MaxScheduledPerBlock = MaxScheduledPerBlock;61	type WeightInfo = ();62	type CallExecutor = SchedulerPaymentExecutor;63	type OriginPrivilegeCmp = OriginPrivilegeCmp;64	type PreimageProvider = ();65	type NoPreimagePostponement = NoPreimagePostponement;66}