git.delta.rocks / unique-network / refs/commits / 13d4a7ecf461

difftreelog

source

pallets/unique/src/common.rs2.5 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 core::marker::PhantomData;18use frame_support::{weights::Weight};19use pallet_common::{CommonWeightInfo};2021use pallet_fungible::{common::CommonWeights as FungibleWeights};22use pallet_nonfungible::{common::CommonWeights as NonfungibleWeights};23use pallet_refungible::{common::CommonWeights as RefungibleWeights};24use up_data_structs::CreateItemExData;2526use crate::{Config, dispatch::dispatch_weight};2728macro_rules! max_weight_of {29	($method:ident ( $($args:tt)* )) => {30		<FungibleWeights<T>>::$method($($args)*)31		.max(<NonfungibleWeights<T>>::$method($($args)*))32		.max(<RefungibleWeights<T>>::$method($($args)*))33	};34}3536pub struct CommonWeights<T: Config>(PhantomData<T>);37impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {38	fn create_item() -> up_data_structs::Weight {39		dispatch_weight::<T>() + max_weight_of!(create_item())40	}4142	fn create_multiple_items(amount: u32) -> Weight {43		dispatch_weight::<T>() + max_weight_of!(create_multiple_items(amount))44	}4546	fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {47		dispatch_weight::<T>() + max_weight_of!(create_multiple_items_ex(data))48	}4950	fn burn_item() -> Weight {51		dispatch_weight::<T>() + max_weight_of!(burn_item())52	}5354	fn transfer() -> up_data_structs::Weight {55		dispatch_weight::<T>() + max_weight_of!(transfer())56	}5758	fn approve() -> up_data_structs::Weight {59		dispatch_weight::<T>() + max_weight_of!(approve())60	}6162	fn transfer_from() -> up_data_structs::Weight {63		dispatch_weight::<T>() + max_weight_of!(transfer_from())64	}6566	fn set_variable_metadata(bytes: u32) -> up_data_structs::Weight {67		dispatch_weight::<T>() + max_weight_of!(set_variable_metadata(bytes))68	}6970	fn burn_from() -> Weight {71		dispatch_weight::<T>() + max_weight_of!(burn_from())72	}73}