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

difftreelog

source

pallets/unique/src/common.rs1.7 KiBsourcehistory
1use core::marker::PhantomData;2use frame_support::{weights::Weight};3use pallet_common::{CommonWeightInfo};45use pallet_fungible::{common::CommonWeights as FungibleWeights};6use pallet_nonfungible::{common::CommonWeights as NonfungibleWeights};7use pallet_refungible::{common::CommonWeights as RefungibleWeights};8use up_data_structs::CreateItemExData;910use crate::{Config, dispatch::dispatch_weight};1112macro_rules! max_weight_of {13	($method:ident ( $($args:tt)* )) => {14		<FungibleWeights<T>>::$method($($args)*)15		.max(<NonfungibleWeights<T>>::$method($($args)*))16		.max(<RefungibleWeights<T>>::$method($($args)*))17	};18}1920pub struct CommonWeights<T: Config>(PhantomData<T>);21impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {22	fn create_item() -> up_data_structs::Weight {23		dispatch_weight::<T>() + max_weight_of!(create_item())24	}2526	fn create_multiple_items(amount: u32) -> Weight {27		dispatch_weight::<T>() + max_weight_of!(create_multiple_items(amount))28	}2930	fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {31		dispatch_weight::<T>() + max_weight_of!(create_multiple_items_ex(data))32	}3334	fn burn_item() -> Weight {35		dispatch_weight::<T>() + max_weight_of!(burn_item())36	}3738	fn transfer() -> up_data_structs::Weight {39		dispatch_weight::<T>() + max_weight_of!(transfer())40	}4142	fn approve() -> up_data_structs::Weight {43		dispatch_weight::<T>() + max_weight_of!(approve())44	}4546	fn transfer_from() -> up_data_structs::Weight {47		dispatch_weight::<T>() + max_weight_of!(transfer_from())48	}4950	fn set_variable_metadata(bytes: u32) -> up_data_structs::Weight {51		dispatch_weight::<T>() + max_weight_of!(set_variable_metadata(bytes))52	}5354	fn burn_from() -> Weight {55		dispatch_weight::<T>() + max_weight_of!(burn_from())56	}57}