difftreelog
feat add refungible and new-functionality feature
in: master
5 files changed
runtime/common/Cargo.tomldiffbeforeafterboth--- a/runtime/common/Cargo.toml
+++ b/runtime/common/Cargo.toml
@@ -32,8 +32,10 @@
'frame-support/runtime-benchmarks',
'frame-system/runtime-benchmarks',
]
-unique-runtime = ['std']
-quartz-runtime = ['std']
+unique-runtime = []
+quartz-runtime = []
+
+refungible = []
[dependencies.sp-core]
default-features = false
runtime/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.tomldiffbeforeafterboth--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -16,7 +16,7 @@
targets = ['x86_64-unknown-linux-gnu']
[features]
-default = ['std']
+default = ['std', 'new-functionality']
runtime-benchmarks = [
'hex-literal',
'frame-benchmarking',
@@ -119,6 +119,9 @@
"orml-vesting/std",
]
limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
+new-functionality = [
+ 'unique-runtime-common/refungible',
+]
################################################################################
# Substrate Dependencies
runtime/quartz/Cargo.tomldiffbeforeafterboth--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -16,7 +16,7 @@
targets = ['x86_64-unknown-linux-gnu']
[features]
-default = ['std']
+default = ['std', 'new-functionality']
runtime-benchmarks = [
'hex-literal',
'frame-benchmarking',
@@ -118,6 +118,7 @@
"orml-vesting/std",
]
limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
+new-functionality = []
################################################################################
# Substrate Dependencies
runtime/unique/Cargo.tomldiffbeforeafterboth--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -16,7 +16,7 @@
targets = ['x86_64-unknown-linux-gnu']
[features]
-default = ['std', 'unique-runtime']
+default = ['std', 'new-functionality']
runtime-benchmarks = [
'hex-literal',
'frame-benchmarking',
@@ -119,7 +119,7 @@
"orml-vesting/std",
]
limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
-unique-runtime = []
+new-functionality = []
################################################################################
# Substrate Dependencies