difftreelog
feat add refungible and new-functionality feature
in: master
5 files changed
runtime/common/Cargo.tomldiffbeforeafterboth32 'frame-support/runtime-benchmarks',32 'frame-support/runtime-benchmarks',33 'frame-system/runtime-benchmarks',33 'frame-system/runtime-benchmarks',34]34]35unique-runtime = ['std']35unique-runtime = []36quartz-runtime = ['std']36quartz-runtime = []3738refungible = []373938[dependencies.sp-core]40[dependencies.sp-core]39default-features = false41default-features = falseruntime/common/src/weights.rsdiffbeforeafterboth25};25};26use up_data_structs::{CreateItemExData, CreateItemData};26use up_data_structs::{CreateItemExData, CreateItemData};272728#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]29macro_rules! max_weight_of {28macro_rules! max_weight_of {30 ($method:ident ( $($args:tt)* )) => {29 ($method:ident ( $($args:tt)* )) => {{31 <FungibleWeights<T>>::$method($($args)*)30 let max_weight = <FungibleWeights<T>>::$method($($args)*)32 .max(<NonfungibleWeights<T>>::$method($($args)*))31 .max(<NonfungibleWeights<T>>::$method($($args)*));3233 #[cfg(feature = "refungible")]33 .max(<RefungibleWeights<T>>::$method($($args)*))34 let max_weight = max_weight.max(<RefungibleWeights<T>>::$method($($args)*));3536 max_weight34 };37 }};35}38}3940#[cfg(not(feature = "refungible"))]41pub trait CommonWeightConfigs: FungibleConfig + NonfungibleConfig {}364237#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]43#[cfg(not(feature = "refungible"))]38macro_rules! max_weight_of {39 ($method:ident ( $($args:tt)* )) => {44impl<T: FungibleConfig + NonfungibleConfig> CommonWeightConfigs for T {}40 <FungibleWeights<T>>::$method($($args)*)4541 .max(<NonfungibleWeights<T>>::$method($($args)*))46#[cfg(feature = "refungible")]4247pub trait CommonWeightConfigs: FungibleConfig + NonfungibleConfig + RefungibleConfig {}43 };44}454846#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]49#[cfg(feature = "refungible")]47pub struct CommonWeights<T>(PhantomData<T>)48where49 T: FungibleConfig + NonfungibleConfig + RefungibleConfig;50impl<T: FungibleConfig + NonfungibleConfig + RefungibleConfig> CommonWeightConfigs for T {}51505251#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]53pub struct CommonWeights<T>(PhantomData<T>);5452impl<T> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T>55impl<T> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T>53where56where54 T: FungibleConfig + NonfungibleConfig + RefungibleConfig,57 T: CommonWeightConfigs,55{58{56 fn create_item() -> Weight {59 fn create_item() -> Weight {57 dispatch_weight::<T>() + max_weight_of!(create_item())60 dispatch_weight::<T>() + max_weight_of!(create_item())114 }117 }115}118}116119117#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]120#[cfg(feature = "refungible")]118impl<T> RefungibleExtensionsWeightInfo for CommonWeights<T>121impl<T> RefungibleExtensionsWeightInfo for CommonWeights<T>119where122where120 T: FungibleConfig + NonfungibleConfig + RefungibleConfig,123 T: FungibleConfig + NonfungibleConfig + RefungibleConfig,124 }127 }125}128}126127#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]128pub struct CommonWeights<T>(PhantomData<T>)129where130 T: FungibleConfig + NonfungibleConfig;131132#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]133impl<T> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T>134where135 T: FungibleConfig + NonfungibleConfig,136{137 fn create_item() -> Weight {138 dispatch_weight::<T>() + max_weight_of!(create_item())139 }140141 fn create_multiple_items(data: &[CreateItemData]) -> Weight {142 dispatch_weight::<T>() + max_weight_of!(create_multiple_items(data))143 }144145 fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {146 dispatch_weight::<T>() + max_weight_of!(create_multiple_items_ex(data))147 }148149 fn burn_item() -> Weight {150 dispatch_weight::<T>() + max_weight_of!(burn_item())151 }152153 fn set_collection_properties(amount: u32) -> Weight {154 dispatch_weight::<T>() + max_weight_of!(set_collection_properties(amount))155 }156157 fn delete_collection_properties(amount: u32) -> Weight {158 dispatch_weight::<T>() + max_weight_of!(delete_collection_properties(amount))159 }160161 fn set_token_properties(amount: u32) -> Weight {162 dispatch_weight::<T>() + max_weight_of!(set_token_properties(amount))163 }164165 fn delete_token_properties(amount: u32) -> Weight {166 dispatch_weight::<T>() + max_weight_of!(delete_token_properties(amount))167 }168169 fn set_token_property_permissions(amount: u32) -> Weight {170 dispatch_weight::<T>() + max_weight_of!(set_token_property_permissions(amount))171 }172173 fn transfer() -> Weight {174 dispatch_weight::<T>() + max_weight_of!(transfer())175 }176177 fn approve() -> Weight {178 dispatch_weight::<T>() + max_weight_of!(approve())179 }180181 fn transfer_from() -> Weight {182 dispatch_weight::<T>() + max_weight_of!(transfer_from())183 }184185 fn burn_from() -> Weight {186 dispatch_weight::<T>() + max_weight_of!(burn_from())187 }188189 fn burn_recursively_self_raw() -> Weight {190 max_weight_of!(burn_recursively_self_raw())191 }192193 fn burn_recursively_breadth_raw(amount: u32) -> Weight {194 max_weight_of!(burn_recursively_breadth_raw(amount))195 }196}197129198#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]130#[cfg(not(feature = "refungible"))]199impl<T> RefungibleExtensionsWeightInfo for CommonWeights<T>131impl<T> RefungibleExtensionsWeightInfo for CommonWeights<T>200where132where201 T: FungibleConfig + NonfungibleConfig,133 T: FungibleConfig + NonfungibleConfig,runtime/opal/Cargo.tomldiffbeforeafterboth16targets = ['x86_64-unknown-linux-gnu']16targets = ['x86_64-unknown-linux-gnu']171718[features]18[features]19default = ['std']19default = ['std', 'new-functionality']20runtime-benchmarks = [20runtime-benchmarks = [21 'hex-literal',21 'hex-literal',22 'frame-benchmarking',22 'frame-benchmarking',119 "orml-vesting/std",119 "orml-vesting/std",120]120]121limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']121limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']122new-functionality = [123 'unique-runtime-common/refungible',124]122125123################################################################################126################################################################################124# Substrate Dependencies127# Substrate Dependenciesruntime/quartz/Cargo.tomldiffbeforeafterboth16targets = ['x86_64-unknown-linux-gnu']16targets = ['x86_64-unknown-linux-gnu']171718[features]18[features]19default = ['std']19default = ['std', 'new-functionality']20runtime-benchmarks = [20runtime-benchmarks = [21 'hex-literal',21 'hex-literal',22 'frame-benchmarking',22 'frame-benchmarking',118 "orml-vesting/std",118 "orml-vesting/std",119]119]120limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']120limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']121new-functionality = []121122122################################################################################123################################################################################123# Substrate Dependencies124# Substrate Dependenciesruntime/unique/Cargo.tomldiffbeforeafterboth16targets = ['x86_64-unknown-linux-gnu']16targets = ['x86_64-unknown-linux-gnu']171718[features]18[features]19default = ['std', 'unique-runtime']19default = ['std', 'new-functionality']20runtime-benchmarks = [20runtime-benchmarks = [21 'hex-literal',21 'hex-literal',22 'frame-benchmarking',22 'frame-benchmarking',119 "orml-vesting/std",119 "orml-vesting/std",120]120]121limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']121limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']122unique-runtime = []122new-functionality = []123123124################################################################################124################################################################################125# Substrate Dependencies125# Substrate Dependencies