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

difftreelog

source

pallets/nft/src/common.rs1.5 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};89use crate::{Config, dispatch::dispatch_weight};1011macro_rules! max_weight_of {12	($method:ident ( $($args:tt)* )) => {13		<FungibleWeights<T>>::$method($($args)*)14		.max(<NonfungibleWeights<T>>::$method($($args)*))15		.max(<RefungibleWeights<T>>::$method($($args)*))16	};17}1819pub struct CommonWeights<T: Config>(PhantomData<T>);20impl<T: Config> CommonWeightInfo for CommonWeights<T> {21	fn create_item() -> nft_data_structs::Weight {22		dispatch_weight::<T>() + max_weight_of!(create_item())23	}2425	fn create_multiple_items(amount: u32) -> Weight {26		dispatch_weight::<T>() + max_weight_of!(create_multiple_items(amount))27	}2829	fn burn_item() -> Weight {30		dispatch_weight::<T>() + max_weight_of!(burn_item())31	}3233	fn transfer() -> nft_data_structs::Weight {34		dispatch_weight::<T>() + max_weight_of!(transfer())35	}3637	fn approve() -> nft_data_structs::Weight {38		dispatch_weight::<T>() + max_weight_of!(approve())39	}4041	fn transfer_from() -> nft_data_structs::Weight {42		dispatch_weight::<T>() + max_weight_of!(transfer_from())43	}4445	fn set_variable_metadata(bytes: u32) -> nft_data_structs::Weight {46		dispatch_weight::<T>() + max_weight_of!(set_variable_metadata(bytes))47	}4849	fn burn_from() -> Weight {50		dispatch_weight::<T>() + max_weight_of!(burn_from())51	}52}