difftreelog
feat add refungible and new-functionality feature
in: master
5 files changed
runtime/common/Cargo.tomldiffbeforeafterboth1[package]2authors = ['Unique Network <support@uniquenetwork.io>']3description = 'Unique Runtime Common'4edition = '2021'5homepage = 'https://unique.network'6license = 'All Rights Reserved'7name = 'unique-runtime-common'8repository = 'https://github.com/UniqueNetwork/unique-chain'9version = '0.9.24'1011[features]12default = ['std']13std = [14 'sp-core/std',15 'sp-std/std',16 'sp-runtime/std',17 'codec/std',18 'frame-support/std',19 'frame-system/std',20 'sp-consensus-aura/std',21 'pallet-common/std',22 'pallet-unique/std',23 'pallet-fungible/std',24 'pallet-nonfungible/std',25 'pallet-refungible/std',26 'up-data-structs/std',27 'pallet-evm/std',28 'fp-rpc/std',29]30runtime-benchmarks = [31 'sp-runtime/runtime-benchmarks',32 'frame-support/runtime-benchmarks',33 'frame-system/runtime-benchmarks',34]35unique-runtime = ['std']36quartz-runtime = ['std']3738[dependencies.sp-core]39default-features = false40git = "https://github.com/paritytech/substrate"41branch = "polkadot-v0.9.24"4243[dependencies.sp-std]44default-features = false45git = 'https://github.com/paritytech/substrate'46branch = 'polkadot-v0.9.24'4748[dependencies.sp-runtime]49default-features = false50git = "https://github.com/paritytech/substrate"51branch = "polkadot-v0.9.24"5253[dependencies.codec]54default-features = false55features = ['derive']56package = 'parity-scale-codec'57version = '3.1.2'5859[dependencies.scale-info]60default-features = false61features = ["derive"]62version = "2.0.1"6364[dependencies.frame-support]65default-features = false66git = "https://github.com/paritytech/substrate"67branch = "polkadot-v0.9.24"6869[dependencies.frame-system]70default-features = false71git = "https://github.com/paritytech/substrate"72branch = "polkadot-v0.9.24"7374[dependencies.pallet-common]75default-features = false76path = "../../pallets/common"7778[dependencies.pallet-unique]79default-features = false80path = "../../pallets/unique"8182[dependencies.pallet-fungible]83default-features = false84path = "../../pallets/fungible"8586[dependencies.pallet-nonfungible]87default-features = false88path = "../../pallets/nonfungible"8990[dependencies.pallet-refungible]91default-features = false92path = "../../pallets/refungible"9394[dependencies.pallet-unique-scheduler]95default-features = false96path = "../../pallets/scheduler"9798[dependencies.up-data-structs]99default-features = false100path = "../../primitives/data-structs"101102[dependencies.sp-consensus-aura]103default-features = false104git = "https://github.com/paritytech/substrate"105branch = "polkadot-v0.9.24"106107[dependencies.fp-rpc]108default-features = false109git = "https://github.com/uniquenetwork/frontier"110branch = "unique-polkadot-v0.9.24"111112[dependencies]113pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.24" }114evm-coder = { default-features = false, path = '../../crates/evm-coder' }115up-sponsorship = { default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.24' }116117rmrk-rpc = { default-features = false, path = "../../primitives/rmrk-rpc" }runtime/common/src/weights.rsdiffbeforeafterboth--- a/runtime/common/src/weights.rs
+++ b/runtime/common/src/weights.rs
@@ -25,33 +25,36 @@
};
use up_data_structs::{CreateItemExData, CreateItemData};
-#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]
macro_rules! max_weight_of {
- ($method:ident ( $($args:tt)* )) => {
- <FungibleWeights<T>>::$method($($args)*)
- .max(<NonfungibleWeights<T>>::$method($($args)*))
- .max(<RefungibleWeights<T>>::$method($($args)*))
- };
+ ($method:ident ( $($args:tt)* )) => {{
+ let max_weight = <FungibleWeights<T>>::$method($($args)*)
+ .max(<NonfungibleWeights<T>>::$method($($args)*));
+
+ #[cfg(feature = "refungible")]
+ let max_weight = max_weight.max(<RefungibleWeights<T>>::$method($($args)*));
+
+ max_weight
+ }};
}
-#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]
-macro_rules! max_weight_of {
- ($method:ident ( $($args:tt)* )) => {
- <FungibleWeights<T>>::$method($($args)*)
- .max(<NonfungibleWeights<T>>::$method($($args)*))
+#[cfg(not(feature = "refungible"))]
+pub trait CommonWeightConfigs: FungibleConfig + NonfungibleConfig {}
+
+#[cfg(not(feature = "refungible"))]
+impl<T: FungibleConfig + NonfungibleConfig> CommonWeightConfigs for T {}
+
+#[cfg(feature = "refungible")]
+pub trait CommonWeightConfigs: FungibleConfig + NonfungibleConfig + RefungibleConfig {}
+
+#[cfg(feature = "refungible")]
+impl<T: FungibleConfig + NonfungibleConfig + RefungibleConfig> CommonWeightConfigs for T {}
- };
-}
-#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]
-pub struct CommonWeights<T>(PhantomData<T>)
-where
- T: FungibleConfig + NonfungibleConfig + RefungibleConfig;
+pub struct CommonWeights<T>(PhantomData<T>);
-#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]
impl<T> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T>
where
- T: FungibleConfig + NonfungibleConfig + RefungibleConfig,
+ T: CommonWeightConfigs,
{
fn create_item() -> Weight {
dispatch_weight::<T>() + max_weight_of!(create_item())
@@ -114,7 +117,7 @@
}
}
-#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]
+#[cfg(feature = "refungible")]
impl<T> RefungibleExtensionsWeightInfo for CommonWeights<T>
where
T: FungibleConfig + NonfungibleConfig + RefungibleConfig,
@@ -124,78 +127,7 @@
}
}
-#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]
-pub struct CommonWeights<T>(PhantomData<T>)
-where
- T: FungibleConfig + NonfungibleConfig;
-
-#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]
-impl<T> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T>
-where
- T: FungibleConfig + NonfungibleConfig,
-{
- fn create_item() -> Weight {
- dispatch_weight::<T>() + max_weight_of!(create_item())
- }
-
- fn create_multiple_items(data: &[CreateItemData]) -> Weight {
- dispatch_weight::<T>() + max_weight_of!(create_multiple_items(data))
- }
-
- fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {
- dispatch_weight::<T>() + max_weight_of!(create_multiple_items_ex(data))
- }
-
- fn burn_item() -> Weight {
- dispatch_weight::<T>() + max_weight_of!(burn_item())
- }
-
- fn set_collection_properties(amount: u32) -> Weight {
- dispatch_weight::<T>() + max_weight_of!(set_collection_properties(amount))
- }
-
- fn delete_collection_properties(amount: u32) -> Weight {
- dispatch_weight::<T>() + max_weight_of!(delete_collection_properties(amount))
- }
-
- fn set_token_properties(amount: u32) -> Weight {
- dispatch_weight::<T>() + max_weight_of!(set_token_properties(amount))
- }
-
- fn delete_token_properties(amount: u32) -> Weight {
- dispatch_weight::<T>() + max_weight_of!(delete_token_properties(amount))
- }
-
- fn set_token_property_permissions(amount: u32) -> Weight {
- dispatch_weight::<T>() + max_weight_of!(set_token_property_permissions(amount))
- }
-
- fn transfer() -> Weight {
- dispatch_weight::<T>() + max_weight_of!(transfer())
- }
-
- fn approve() -> Weight {
- dispatch_weight::<T>() + max_weight_of!(approve())
- }
-
- fn transfer_from() -> Weight {
- dispatch_weight::<T>() + max_weight_of!(transfer_from())
- }
-
- fn burn_from() -> Weight {
- dispatch_weight::<T>() + max_weight_of!(burn_from())
- }
-
- fn burn_recursively_self_raw() -> Weight {
- max_weight_of!(burn_recursively_self_raw())
- }
-
- fn burn_recursively_breadth_raw(amount: u32) -> Weight {
- max_weight_of!(burn_recursively_breadth_raw(amount))
- }
-}
-
-#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]
+#[cfg(not(feature = "refungible"))]
impl<T> RefungibleExtensionsWeightInfo for CommonWeights<T>
where
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