1234567891011121314151617use core::marker::PhantomData;18use frame_support::{weights::Weight};19use pallet_common::{CommonWeightInfo, dispatch::dispatch_weight};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;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() -> 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() -> Weight {55 dispatch_weight::<T>() + max_weight_of!(transfer())56 }5758 fn approve() -> Weight {59 dispatch_weight::<T>() + max_weight_of!(approve())60 }6162 fn transfer_from() -> Weight {63 dispatch_weight::<T>() + max_weight_of!(transfer_from())64 }6566 fn set_variable_metadata(bytes: u32) -> 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}