difftreelog
cargo fmt
in: master
5 files changed
runtime/common/src/lib.rsdiffbeforeafterboth--- a/runtime/common/src/lib.rs
+++ b/runtime/common/src/lib.rs
@@ -17,10 +17,10 @@
#![cfg_attr(not(feature = "std"), no_std)]
pub mod constants;
+pub mod construct_runtime;
pub mod dispatch;
pub mod eth_sponsoring;
pub mod runtime_apis;
pub mod sponsoring;
pub mod types;
pub mod weights;
-pub mod construct_runtime;
runtime/common/src/weights.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use core::marker::PhantomData;18use frame_support::{weights::Weight};19use pallet_common::{CommonWeightInfo, dispatch::dispatch_weight, RefungibleExtensionsWeightInfo};2021use pallet_fungible::{Config as FungibleConfig, common::CommonWeights as FungibleWeights};22use pallet_nonfungible::{Config as NonfungibleConfig, common::CommonWeights as NonfungibleWeights};2324#[cfg(feature = "refungible")]25use pallet_refungible::{26 Config as RefungibleConfig, weights::WeightInfo, common::CommonWeights as RefungibleWeights,27};28use up_data_structs::{CreateItemExData, CreateItemData};2930macro_rules! max_weight_of {31 ($method:ident ( $($args:tt)* )) => {{32 let max_weight = <FungibleWeights<T>>::$method($($args)*)33 .max(<NonfungibleWeights<T>>::$method($($args)*));3435 #[cfg(feature = "refungible")]36 let max_weight = max_weight.max(<RefungibleWeights<T>>::$method($($args)*));3738 max_weight39 }};40}4142#[cfg(not(feature = "refungible"))]43pub trait CommonWeightConfigs: FungibleConfig + NonfungibleConfig {}4445#[cfg(not(feature = "refungible"))]46impl<T: FungibleConfig + NonfungibleConfig> CommonWeightConfigs for T {}4748#[cfg(feature = "refungible")]49pub trait CommonWeightConfigs: FungibleConfig + NonfungibleConfig + RefungibleConfig {}5051#[cfg(feature = "refungible")]52impl<T: FungibleConfig + NonfungibleConfig + RefungibleConfig> CommonWeightConfigs for T {}535455pub struct CommonWeights<T>(PhantomData<T>);5657impl<T> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T>58where59 T: CommonWeightConfigs,60{61 fn create_item() -> Weight {62 dispatch_weight::<T>() + max_weight_of!(create_item())63 }6465 fn create_multiple_items(data: &[CreateItemData]) -> Weight {66 dispatch_weight::<T>() + max_weight_of!(create_multiple_items(data))67 }6869 fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {70 dispatch_weight::<T>() + max_weight_of!(create_multiple_items_ex(data))71 }7273 fn burn_item() -> Weight {74 dispatch_weight::<T>() + max_weight_of!(burn_item())75 }7677 fn set_collection_properties(amount: u32) -> Weight {78 dispatch_weight::<T>() + max_weight_of!(set_collection_properties(amount))79 }8081 fn delete_collection_properties(amount: u32) -> Weight {82 dispatch_weight::<T>() + max_weight_of!(delete_collection_properties(amount))83 }8485 fn set_token_properties(amount: u32) -> Weight {86 dispatch_weight::<T>() + max_weight_of!(set_token_properties(amount))87 }8889 fn delete_token_properties(amount: u32) -> Weight {90 dispatch_weight::<T>() + max_weight_of!(delete_token_properties(amount))91 }9293 fn set_token_property_permissions(amount: u32) -> Weight {94 dispatch_weight::<T>() + max_weight_of!(set_token_property_permissions(amount))95 }9697 fn transfer() -> Weight {98 dispatch_weight::<T>() + max_weight_of!(transfer())99 }100101 fn approve() -> Weight {102 dispatch_weight::<T>() + max_weight_of!(approve())103 }104105 fn transfer_from() -> Weight {106 dispatch_weight::<T>() + max_weight_of!(transfer_from())107 }108109 fn burn_from() -> Weight {110 dispatch_weight::<T>() + max_weight_of!(burn_from())111 }112113 fn burn_recursively_self_raw() -> Weight {114 max_weight_of!(burn_recursively_self_raw())115 }116117 fn burn_recursively_breadth_raw(amount: u32) -> Weight {118 max_weight_of!(burn_recursively_breadth_raw(amount))119 }120}121122#[cfg(feature = "refungible")]123impl<T> RefungibleExtensionsWeightInfo for CommonWeights<T>124where125 T: FungibleConfig + NonfungibleConfig + RefungibleConfig,126{127 fn repartition() -> Weight {128 dispatch_weight::<T>() + <<T as RefungibleConfig>::WeightInfo>::repartition_item()129 }130}131132#[cfg(not(feature = "refungible"))]133impl<T> RefungibleExtensionsWeightInfo for CommonWeights<T>134where135 T: FungibleConfig + NonfungibleConfig,136{137 fn repartition() -> Weight {138 dispatch_weight::<T>()139 }140}1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use core::marker::PhantomData;18use frame_support::{weights::Weight};19use pallet_common::{CommonWeightInfo, dispatch::dispatch_weight, RefungibleExtensionsWeightInfo};2021use pallet_fungible::{Config as FungibleConfig, common::CommonWeights as FungibleWeights};22use pallet_nonfungible::{Config as NonfungibleConfig, common::CommonWeights as NonfungibleWeights};2324#[cfg(feature = "refungible")]25use pallet_refungible::{26 Config as RefungibleConfig, weights::WeightInfo, common::CommonWeights as RefungibleWeights,27};28use up_data_structs::{CreateItemExData, CreateItemData};2930macro_rules! max_weight_of {31 ($method:ident ( $($args:tt)* )) => {{32 let max_weight = <FungibleWeights<T>>::$method($($args)*)33 .max(<NonfungibleWeights<T>>::$method($($args)*));3435 #[cfg(feature = "refungible")]36 let max_weight = max_weight.max(<RefungibleWeights<T>>::$method($($args)*));3738 max_weight39 }};40}4142#[cfg(not(feature = "refungible"))]43pub trait CommonWeightConfigs: FungibleConfig + NonfungibleConfig {}4445#[cfg(not(feature = "refungible"))]46impl<T: FungibleConfig + NonfungibleConfig> CommonWeightConfigs for T {}4748#[cfg(feature = "refungible")]49pub trait CommonWeightConfigs: FungibleConfig + NonfungibleConfig + RefungibleConfig {}5051#[cfg(feature = "refungible")]52impl<T: FungibleConfig + NonfungibleConfig + RefungibleConfig> CommonWeightConfigs for T {}5354pub struct CommonWeights<T>(PhantomData<T>);5556impl<T> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T>57where58 T: CommonWeightConfigs,59{60 fn create_item() -> Weight {61 dispatch_weight::<T>() + max_weight_of!(create_item())62 }6364 fn create_multiple_items(data: &[CreateItemData]) -> Weight {65 dispatch_weight::<T>() + max_weight_of!(create_multiple_items(data))66 }6768 fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {69 dispatch_weight::<T>() + max_weight_of!(create_multiple_items_ex(data))70 }7172 fn burn_item() -> Weight {73 dispatch_weight::<T>() + max_weight_of!(burn_item())74 }7576 fn set_collection_properties(amount: u32) -> Weight {77 dispatch_weight::<T>() + max_weight_of!(set_collection_properties(amount))78 }7980 fn delete_collection_properties(amount: u32) -> Weight {81 dispatch_weight::<T>() + max_weight_of!(delete_collection_properties(amount))82 }8384 fn set_token_properties(amount: u32) -> Weight {85 dispatch_weight::<T>() + max_weight_of!(set_token_properties(amount))86 }8788 fn delete_token_properties(amount: u32) -> Weight {89 dispatch_weight::<T>() + max_weight_of!(delete_token_properties(amount))90 }9192 fn set_token_property_permissions(amount: u32) -> Weight {93 dispatch_weight::<T>() + max_weight_of!(set_token_property_permissions(amount))94 }9596 fn transfer() -> Weight {97 dispatch_weight::<T>() + max_weight_of!(transfer())98 }99100 fn approve() -> Weight {101 dispatch_weight::<T>() + max_weight_of!(approve())102 }103104 fn transfer_from() -> Weight {105 dispatch_weight::<T>() + max_weight_of!(transfer_from())106 }107108 fn burn_from() -> Weight {109 dispatch_weight::<T>() + max_weight_of!(burn_from())110 }111112 fn burn_recursively_self_raw() -> Weight {113 max_weight_of!(burn_recursively_self_raw())114 }115116 fn burn_recursively_breadth_raw(amount: u32) -> Weight {117 max_weight_of!(burn_recursively_breadth_raw(amount))118 }119}120121#[cfg(feature = "refungible")]122impl<T> RefungibleExtensionsWeightInfo for CommonWeights<T>123where124 T: FungibleConfig + NonfungibleConfig + RefungibleConfig,125{126 fn repartition() -> Weight {127 dispatch_weight::<T>() + <<T as RefungibleConfig>::WeightInfo>::repartition_item()128 }129}130131#[cfg(not(feature = "refungible"))]132impl<T> RefungibleExtensionsWeightInfo for CommonWeights<T>133where134 T: FungibleConfig + NonfungibleConfig,135{136 fn repartition() -> Weight {137 dispatch_weight::<T>()138 }139}runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -33,9 +33,9 @@
#[cfg(feature = "scheduler")]
use sp_runtime::{
- traits::{Applyable, Member},
- generic::Era,
- DispatchErrorWithPostInfo
+ traits::{Applyable, Member},
+ generic::Era,
+ DispatchErrorWithPostInfo,
};
// #[cfg(any(feature = "std", test))]
// pub use sp_runtime::BuildStorage;
@@ -104,10 +104,11 @@
use fp_rpc::TransactionStatus;
use sp_runtime::{
traits::{
- BlockNumberProvider, Dispatchable, PostDispatchInfoOf, DispatchInfoOf,
- Saturating, CheckedConversion,
+ BlockNumberProvider, Dispatchable, PostDispatchInfoOf, DispatchInfoOf, Saturating,
+ CheckedConversion,
},
- transaction_validity::TransactionValidityError, SaturatedConversion,
+ transaction_validity::TransactionValidityError,
+ SaturatedConversion,
};
// pub use pallet_timestamp::Call as TimestampCall;
@@ -118,11 +119,10 @@
use polkadot_parachain::primitives::Sibling;
use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};
use xcm_builder::{
- AccountId32Aliases, AllowTopLevelPaidExecutionFrom, CurrencyAdapter,
- EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,
- RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
- SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
- ParentIsPreset,
+ AccountId32Aliases, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin,
+ FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser, RelayChainAsNative,
+ SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
+ SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, ParentIsPreset,
};
use xcm_executor::{Config, XcmExecutor, Assets};
use sp_std::{cmp::Ordering, marker::PhantomData};
@@ -137,8 +137,7 @@
use xcm_executor::traits::{MatchesFungible, WeightTrader};
use unique_runtime_common::{
- construct_runtime,
- impl_common_runtime_apis,
+ construct_runtime, impl_common_runtime_apis,
types::*,
constants::*,
dispatch::{CollectionDispatchT, CollectionDispatch},
runtime/quartz/src/lib.rsdiffbeforeafterboth--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -33,9 +33,9 @@
#[cfg(feature = "scheduler")]
use sp_runtime::{
- traits::{Applyable, Member},
- generic::Era,
- DispatchErrorWithPostInfo
+ traits::{Applyable, Member},
+ generic::Era,
+ DispatchErrorWithPostInfo,
};
// #[cfg(any(feature = "std", test))]
// pub use sp_runtime::BuildStorage;
@@ -104,10 +104,11 @@
use fp_rpc::TransactionStatus;
use sp_runtime::{
traits::{
- BlockNumberProvider, Dispatchable, PostDispatchInfoOf, DispatchInfoOf,
- Saturating, CheckedConversion,
+ BlockNumberProvider, Dispatchable, PostDispatchInfoOf, DispatchInfoOf, Saturating,
+ CheckedConversion,
},
- transaction_validity::TransactionValidityError, SaturatedConversion,
+ transaction_validity::TransactionValidityError,
+ SaturatedConversion,
};
// pub use pallet_timestamp::Call as TimestampCall;
@@ -118,11 +119,10 @@
use polkadot_parachain::primitives::Sibling;
use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};
use xcm_builder::{
- AccountId32Aliases, AllowTopLevelPaidExecutionFrom, CurrencyAdapter,
- EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,
- RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
- SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
- ParentIsPreset,
+ AccountId32Aliases, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin,
+ FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser, RelayChainAsNative,
+ SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
+ SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, ParentIsPreset,
};
use xcm_executor::{Config, XcmExecutor, Assets};
use sp_std::{cmp::Ordering, marker::PhantomData};
@@ -137,8 +137,7 @@
use xcm_executor::traits::{MatchesFungible, WeightTrader};
use unique_runtime_common::{
- construct_runtime,
- impl_common_runtime_apis,
+ construct_runtime, impl_common_runtime_apis,
types::*,
constants::*,
dispatch::{CollectionDispatchT, CollectionDispatch},
runtime/unique/src/lib.rsdiffbeforeafterboth--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -36,7 +36,7 @@
use sp_runtime::{
traits::{Applyable, Member},
generic::Era,
- DispatchErrorWithPostInfo
+ DispatchErrorWithPostInfo,
};
// #[cfg(any(feature = "std", test))]
// pub use sp_runtime::BuildStorage;
@@ -105,10 +105,11 @@
use fp_rpc::TransactionStatus;
use sp_runtime::{
traits::{
- BlockNumberProvider, Dispatchable, PostDispatchInfoOf, DispatchInfoOf,
- Saturating, CheckedConversion,
+ BlockNumberProvider, Dispatchable, PostDispatchInfoOf, DispatchInfoOf, Saturating,
+ CheckedConversion,
},
- transaction_validity::TransactionValidityError, SaturatedConversion,
+ transaction_validity::TransactionValidityError,
+ SaturatedConversion,
};
// pub use pallet_timestamp::Call as TimestampCall;
@@ -119,11 +120,10 @@
use polkadot_parachain::primitives::Sibling;
use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};
use xcm_builder::{
- AccountId32Aliases, AllowTopLevelPaidExecutionFrom, CurrencyAdapter,
- EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,
- RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
- SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
- ParentIsPreset,
+ AccountId32Aliases, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin,
+ FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser, RelayChainAsNative,
+ SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
+ SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, ParentIsPreset,
};
use xcm_executor::{Config, XcmExecutor, Assets};
use sp_std::{cmp::Ordering, marker::PhantomData};
@@ -138,8 +138,7 @@
use xcm_executor::traits::{MatchesFungible, WeightTrader};
use unique_runtime_common::{
- construct_runtime,
- impl_common_runtime_apis,
+ construct_runtime, impl_common_runtime_apis,
types::*,
constants::*,
dispatch::{CollectionDispatchT, CollectionDispatch},