git.delta.rocks / unique-network / refs/commits / 4dd148686c6b

difftreelog

refactor reorganize imports

Yaroslav Bolyukin2023-10-02parent: #a64769f.patch.diff
in: master

119 files changed

modified.rustfmt.tomldiffbeforeafterboth
--- a/.rustfmt.toml
+++ b/.rustfmt.toml
@@ -1,2 +1,3 @@
+group_imports = "stdexternalcrate"
 hard_tabs = true
-reorder_imports = false
+imports_granularity = "crate"
modifiedclient/rpc/src/lib.rsdiffbeforeafterboth
--- a/client/rpc/src/lib.rs
+++ b/client/rpc/src/lib.rs
@@ -17,23 +17,19 @@
 // Original License
 use std::sync::Arc;
 
-use codec::Decode;
-use jsonrpsee::{
-	core::{RpcResult as Result},
-	proc_macros::rpc,
-};
 use anyhow::anyhow;
+use app_promotion_rpc::AppPromotionApi as AppPromotionRuntimeApi;
+pub use app_promotion_unique_rpc::AppPromotionApiServer;
+use jsonrpsee::{core::RpcResult as Result, proc_macros::rpc};
+use parity_scale_codec::Decode;
+use sp_api::{ApiExt, BlockT, ProvideRuntimeApi};
+use sp_blockchain::HeaderBackend;
 use sp_runtime::traits::{AtLeast32BitUnsigned, Member};
 use up_data_structs::{
-	RpcCollection, CollectionId, CollectionStats, CollectionLimits, TokenId, Property,
-	PropertyKeyPermission, TokenData, TokenChild,
+	CollectionId, CollectionLimits, CollectionStats, Property, PropertyKeyPermission,
+	RpcCollection, TokenChild, TokenData, TokenId,
 };
-use sp_api::{BlockT, ProvideRuntimeApi, ApiExt};
-use sp_blockchain::HeaderBackend;
 use up_rpc::UniqueApi as UniqueRuntimeApi;
-use app_promotion_rpc::AppPromotionApi as AppPromotionRuntimeApi;
-
-pub use app_promotion_unique_rpc::AppPromotionApiServer;
 
 #[cfg(feature = "pov-estimate")]
 pub mod pov_estimate;
@@ -549,16 +545,16 @@
 	keys.map(|keys| keys.into_iter().map(|key| key.into_bytes()).collect())
 }
 
-fn decode_collection_from_bytes<T: codec::Decode>(
+fn decode_collection_from_bytes<T: parity_scale_codec::Decode>(
 	bytes: &[u8],
-) -> core::result::Result<T, codec::Error> {
-	let mut reader = codec::IoReader(bytes);
+) -> core::result::Result<T, parity_scale_codec::Error> {
+	let mut reader = parity_scale_codec::IoReader(bytes);
 	T::decode(&mut reader)
 }
 
 fn detect_type_and_decode_collection<AccountId: Decode>(
 	bytes: &[u8],
-) -> core::result::Result<RpcCollection<AccountId>, codec::Error> {
+) -> core::result::Result<RpcCollection<AccountId>, parity_scale_codec::Error> {
 	use up_data_structs::{CollectionVersion1, RpcCollectionVersion1};
 
 	decode_collection_from_bytes::<RpcCollection<AccountId>>(bytes)
@@ -574,11 +570,12 @@
 
 #[cfg(test)]
 mod tests {
-	use super::*;
-	use codec::IoReader;
 	use hex_literal::hex;
+	use parity_scale_codec::IoReader;
 	use up_data_structs::{CollectionVersion1, RawEncoded};
 
+	use super::*;
+
 	const ENCODED_COLLECTION_V1: [u8; 180] = hex!("aab94a1ee784bc17f68d76d4d48d736916ca6ff6315b8c1fa1175726c8345a390000285000720069006d00610020004c00690076006500d04500730065006d00700069006f00200064006900200063007200650061007a0069006f006e006500200064006900200075006e00610020006e0075006f0076006100200063006f006c006c0065007a0069006f006e00650020006400690020004e004600540021000c464e5400000000000000000000000000000000");
 	const ENCODED_RPC_COLLECTION_V2: [u8; 618] = hex!("d00dcc24bf66750d3809aa26884b930ec8a3094d6f6f19fdc62020b2fbec013400604d0069006e007400460065007300740020002d002000460075006e006e007900200061006e0069006d0061006c0073008c430072006f00730073006f0076006500720020006200650074007700650065006e00200061006e0069006d0061006c00730020002d00200066006f0072002000660075006e00104d46464100000000000000000000010001000100000004385f6f6c645f636f6e7374446174610001000c5c5f6f6c645f636f6e73744f6e436861696e536368656d6139047b226e6573746564223a7b226f6e436861696e4d65746144617461223a7b226e6573746564223a7b224e46544d657461223a7b226669656c6473223a7b22697066734a736f6e223a7b226964223a312c2272756c65223a227265717569726564222c2274797065223a22737472696e67227d2c2248656164223a7b226964223a322c2272756c65223a227265717569726564222c2274797065223a22737472696e67227d2c22426f6479223a7b226964223a332c2272756c65223a227265717569726564222c2274797065223a22737472696e67227d2c225461696c223a7b226964223a342c2272756c65223a227265717569726564222c2274797065223a22737472696e67227d7d7d7d7d7d7d485f6f6c645f736368656d6156657273696f6e18556e69717565685f6f6c645f7661726961626c654f6e436861696e536368656d6111017b22636f6c6c656374696f6e436f766572223a22516d53557a7139354c357a556777795a584d3731576a3762786b36557048515468633162536965347766706e5435227d000000");
 
modifiedclient/rpc/src/pov_estimate.rsdiffbeforeafterboth
--- a/client/rpc/src/pov_estimate.rs
+++ b/client/rpc/src/pov_estimate.rs
@@ -16,39 +16,31 @@
 
 use std::sync::Arc;
 
-use codec::{Encode, Decode};
-use sp_externalities::Extensions;
-
-use up_pov_estimate_rpc::{PovEstimateApi as PovEstimateRuntimeApi};
-use up_common::types::opaque::RuntimeId;
-
-use sc_service::{NativeExecutionDispatch, config::ExecutionStrategy};
-use sp_state_machine::{StateMachine, TrieBackendBuilder};
-use trie_db::{Trie, TrieDBBuilder};
-
+use anyhow::anyhow;
 use jsonrpsee::{core::RpcResult as Result, proc_macros::rpc};
-use anyhow::anyhow;
-
+use parity_scale_codec::{Decode, Encode};
 use sc_client_api::backend::Backend;
+use sc_executor::NativeElseWasmExecutor;
+use sc_rpc_api::DenyUnsafe;
+use sc_service::{config::ExecutionStrategy, NativeExecutionDispatch};
+use sp_api::{AsTrieBackend, BlockId, BlockT, ProvideRuntimeApi};
 use sp_blockchain::HeaderBackend;
 use sp_core::{
-	Bytes,
 	offchain::{
 		testing::{TestOffchainExt, TestTransactionPoolExt},
 		OffchainDbExt, OffchainWorkerExt, TransactionPoolExt,
 	},
 	testing::TaskExecutor,
 	traits::TaskExecutorExt,
+	Bytes,
 };
+use sp_externalities::Extensions;
 use sp_keystore::{testing::KeyStore, KeystoreExt};
-use sp_api::{AsTrieBackend, BlockId, BlockT, ProvideRuntimeApi};
-
-use sc_executor::NativeElseWasmExecutor;
-use sc_rpc_api::DenyUnsafe;
-
 use sp_runtime::traits::Header;
-
-use up_pov_estimate_rpc::{PovInfo, TrieKeyValue};
+use sp_state_machine::{StateMachine, TrieBackendBuilder};
+use trie_db::{Trie, TrieDBBuilder};
+use up_common::types::opaque::RuntimeId;
+use up_pov_estimate_rpc::{PovEstimateApi as PovEstimateRuntimeApi, PovInfo, TrieKeyValue};
 
 use crate::define_struct_for_server_api;
 
modifiedcrates/struct-versioning/src/lib.rsdiffbeforeafterboth
--- a/crates/struct-versioning/src/lib.rs
+++ b/crates/struct-versioning/src/lib.rs
@@ -17,13 +17,12 @@
 #![doc = include_str!("../README.md")]
 
 use proc_macro::TokenStream;
-use quote::format_ident;
+use quote::{format_ident, quote};
 use syn::{
-	parse::{Parse, ParseStream},
-	Token, LitInt, parse_macro_input, ItemStruct, Error, Fields, Result, Field, Expr,
 	parenthesized,
+	parse::{Parse, ParseStream},
+	parse_macro_input, Error, Expr, Field, Fields, ItemStruct, LitInt, Result, Token,
 };
-use quote::quote;
 
 mod kw {
 	syn::custom_keyword!(version);
modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -14,36 +14,35 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
+use std::collections::BTreeMap;
+
+#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]
+pub use opal_runtime as default_runtime;
+#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]
+pub use quartz_runtime as default_runtime;
 use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
 use sc_service::ChainType;
+use serde::{Deserialize, Serialize};
+use serde_json::map::Map;
 use sp_core::{sr25519, Pair, Public};
 use sp_runtime::traits::{IdentifyAccount, Verify};
-use std::collections::BTreeMap;
-
-use serde::{Deserialize, Serialize};
-use serde_json::map::Map;
-
-use up_common::types::opaque::*;
-
 #[cfg(feature = "unique-runtime")]
 pub use unique_runtime as default_runtime;
-
-#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]
-pub use quartz_runtime as default_runtime;
-
-#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]
-pub use opal_runtime as default_runtime;
+use up_common::types::opaque::*;
 
 /// The `ChainSpec` parameterized for the unique runtime.
 #[cfg(feature = "unique-runtime")]
-pub type UniqueChainSpec = sc_service::GenericChainSpec<unique_runtime::GenesisConfig, Extensions>;
+pub type UniqueChainSpec =
+	sc_service::GenericChainSpec<unique_runtime::RuntimeGenesisConfig, Extensions>;
 
 /// The `ChainSpec` parameterized for the quartz runtime.
 #[cfg(feature = "quartz-runtime")]
-pub type QuartzChainSpec = sc_service::GenericChainSpec<quartz_runtime::GenesisConfig, Extensions>;
+pub type QuartzChainSpec =
+	sc_service::GenericChainSpec<quartz_runtime::RuntimeGenesisConfig, Extensions>;
 
 /// The `ChainSpec` parameterized for the opal runtime.
-pub type OpalChainSpec = sc_service::GenericChainSpec<opal_runtime::GenesisConfig, Extensions>;
+pub type OpalChainSpec =
+	sc_service::GenericChainSpec<opal_runtime::RuntimeGenesisConfig, Extensions>;
 
 #[cfg(feature = "unique-runtime")]
 pub type DefaultChainSpec = UniqueChainSpec;
modifiednode/cli/src/cli.rsdiffbeforeafterboth
--- a/node/cli/src/cli.rs
+++ b/node/cli/src/cli.rs
@@ -14,10 +14,12 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use crate::chain_spec;
 use std::path::PathBuf;
+
 use clap::Parser;
 
+use crate::chain_spec;
+
 /// Sub-commands supported by the collator.
 #[derive(Debug, Parser)]
 pub enum Subcommand {
modifiednode/cli/src/command.rsdiffbeforeafterboth
--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -32,28 +32,11 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-use crate::{
-	chain_spec::{self, RuntimeIdentification, ServiceId, ServiceIdentification},
-	cli::{Cli, RelayChainCli, Subcommand},
-	service::{new_partial, start_node, start_dev_node},
-};
-#[cfg(feature = "runtime-benchmarks")]
-use crate::chain_spec::default_runtime;
-
-#[cfg(feature = "unique-runtime")]
-use crate::service::UniqueRuntimeExecutor;
-
-#[cfg(feature = "quartz-runtime")]
-use crate::service::QuartzRuntimeExecutor;
-
-use crate::service::OpalRuntimeExecutor;
-
-#[cfg(feature = "runtime-benchmarks")]
-use crate::service::DefaultRuntimeExecutor;
+use std::time::Duration;
 
 use codec::Encode;
-use cumulus_primitives_core::ParaId;
 use cumulus_client_cli::generate_genesis_block;
+use cumulus_primitives_core::ParaId;
 use log::{debug, info};
 use sc_cli::{
 	ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
@@ -62,8 +45,21 @@
 use sc_service::config::{BasePath, PrometheusConfig};
 use sp_core::hexdisplay::HexDisplay;
 use sp_runtime::traits::{AccountIdConversion, Block as BlockT};
+use up_common::types::opaque::{Block, RuntimeId};
 
-use up_common::types::opaque::{Block, RuntimeId};
+#[cfg(feature = "runtime-benchmarks")]
+use crate::chain_spec::default_runtime;
+#[cfg(feature = "runtime-benchmarks")]
+use crate::service::DefaultRuntimeExecutor;
+#[cfg(feature = "quartz-runtime")]
+use crate::service::QuartzRuntimeExecutor;
+#[cfg(feature = "unique-runtime")]
+use crate::service::UniqueRuntimeExecutor;
+use crate::{
+	chain_spec::{self, RuntimeIdentification, ServiceId, ServiceIdentification},
+	cli::{Cli, RelayChainCli, Subcommand},
+	service::{new_partial, start_dev_node, start_node, OpalRuntimeExecutor},
+};
 
 macro_rules! no_runtime_err {
 	($runtime_id:expr) => {
deletednode/cli/src/lib.rsdiffbeforeafterboth
--- a/node/cli/src/lib.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Unique Network is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-pub mod chain_spec;
-pub mod service;
modifiednode/cli/src/main.rsdiffbeforeafterboth
--- a/node/cli/src/main.rs
+++ b/node/cli/src/main.rs
@@ -19,6 +19,7 @@
 mod service;
 mod cli;
 mod command;
+mod rpc;
 
 fn main() -> sc_cli::Result<()> {
 	command::run()
modifiednode/cli/src/service.rsdiffbeforeafterboth
--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -15,73 +15,72 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 // std
-use std::sync::Arc;
-use std::sync::Mutex;
-use std::collections::BTreeMap;
-use std::time::Duration;
-use std::pin::Pin;
-use fc_mapping_sync::EthereumBlockNotificationSinks;
-use fc_rpc::EthBlockDataCacheTask;
-use fc_rpc::EthTask;
-use fc_rpc_core::types::FeeHistoryCache;
-use futures::{
-	Stream, StreamExt,
-	stream::select,
-	task::{Context, Poll},
+use std::{
+	collections::BTreeMap,
+	marker::PhantomData,
+	pin::Pin,
+	sync::{Arc, Mutex},
+	time::Duration,
 };
-use sc_rpc::SubscriptionTaskExecutor;
-use sp_keystore::KeystorePtr;
-use tokio::time::Interval;
-use jsonrpsee::RpcModule;
-
-use serde::{Serialize, Deserialize};
 
-// Cumulus Imports
-use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion};
-use cumulus_client_consensus_common::{
-	ParachainConsensus, ParachainBlockImport as TParachainBlockImport,
+use cumulus_client_cli::CollatorOptions;
+use cumulus_client_collator::service::CollatorService;
+#[cfg(not(feature = "lookahead"))]
+use cumulus_client_consensus_aura::collators::basic::{
+	run as run_aura, Params as BuildAuraConsensusParams,
 };
+#[cfg(feature = "lookahead")]
+use cumulus_client_consensus_aura::collators::lookahead::{
+	run as run_aura, Params as BuildAuraConsensusParams,
+};
+use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport;
+use cumulus_client_consensus_proposer::Proposer;
+use cumulus_client_network::RequireSecondedInBlockAnnounce;
 use cumulus_client_service::{
-	prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,
+	build_relay_chain_interface, prepare_node_config, start_relay_chain_tasks, DARecoveryProfile,
+	StartRelayChainTasksParams,
 };
-use cumulus_client_cli::CollatorOptions;
-use cumulus_client_network::BlockAnnounceValidator;
 use cumulus_primitives_core::ParaId;
-use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain;
-use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult};
-use cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node;
-
-// Substrate Imports
-use sp_api::{BlockT, HeaderT, ProvideRuntimeApi, StateBackend};
-use sc_executor::NativeElseWasmExecutor;
-use sc_executor::NativeExecutionDispatch;
+use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface};
+use fc_mapping_sync::{kv::MappingSyncWorker, EthereumBlockNotificationSinks, SyncStrategy};
+use fc_rpc::{
+	frontier_backend_client::SystemAccountId32StorageOverride, EthBlockDataCacheTask, EthConfig,
+	EthTask, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override, SchemaV2Override,
+	SchemaV3Override, StorageOverride,
+};
+use fc_rpc_core::types::{FeeHistoryCache, FilterPool};
+use fp_rpc::EthereumRuntimeRPCApi;
+use fp_storage::EthereumStorageSchema;
+use futures::{
+	stream::select,
+	task::{Context, Poll},
+	Stream, StreamExt,
+};
+use jsonrpsee::RpcModule;
+use polkadot_service::CollatorPair;
+use sc_client_api::{AuxStore, Backend, BlockOf, BlockchainEvents, StorageProvider};
+use sc_consensus::ImportQueue;
+use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch};
 use sc_network::NetworkBlock;
 use sc_network_sync::SyncingService;
+use sc_rpc::SubscriptionTaskExecutor;
 use sc_service::{Configuration, PartialComponents, TaskManager};
 use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
+use serde::{Deserialize, Serialize};
+use sp_api::{ProvideRuntimeApi, StateBackend};
+use sp_block_builder::BlockBuilder;
+use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
+use sp_consensus_aura::sr25519::AuthorityPair as AuraAuthorityPair;
+use sp_keystore::KeystorePtr;
 use sp_runtime::traits::BlakeTwo256;
 use substrate_prometheus_endpoint::Registry;
-use sc_client_api::{BlockchainEvents, BlockOf, Backend, AuxStore, StorageProvider};
-use sp_blockchain::{HeaderBackend, HeaderMetadata, Error as BlockChainError};
-use sc_consensus::ImportQueue;
-use sp_core::H256;
-use sp_block_builder::BlockBuilder;
+use tokio::time::Interval;
+use up_common::types::{opaque::*, Nonce};
 
-use polkadot_service::CollatorPair;
-
-// Frontier Imports
-use fc_rpc_core::types::FilterPool;
-use fc_mapping_sync::{kv::MappingSyncWorker, SyncStrategy};
-use fc_rpc::{
-	StorageOverride, OverrideHandle, SchemaV1Override, SchemaV2Override, SchemaV3Override,
-	RuntimeApiStorageOverride,
+use crate::{
+	chain_spec::RuntimeIdentification,
+	rpc::{create_eth, create_full, EthDeps, FullDeps},
 };
-use fp_rpc::EthereumRuntimeRPCApi;
-use fp_storage::EthereumStorageSchema;
-
-use up_common::types::opaque::*;
-
-use crate::chain_spec::RuntimeIdentification;
 
 /// Unique native executor instance.
 #[cfg(feature = "unique-runtime")]
modifiedpallets/app-promotion/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/app-promotion/src/benchmarking.rs
+++ b/pallets/app-promotion/src/benchmarking.rs
@@ -16,16 +16,15 @@
 
 #![cfg(feature = "runtime-benchmarks")]
 
-use super::*;
-use crate::Pallet as PromototionPallet;
-use frame_support::traits::fungible::Unbalanced;
-use sp_runtime::traits::Bounded;
-
-use frame_benchmarking::{benchmarks, account};
-use frame_support::traits::OnInitialize;
+use frame_benchmarking::{account, benchmarks};
+use frame_support::traits::{fungible::Unbalanced, OnInitialize};
 use frame_system::RawOrigin;
+use pallet_evm_migration::Pallet as EvmMigrationPallet;
 use pallet_unique::benchmarking::create_nft_collection;
-use pallet_evm_migration::Pallet as EvmMigrationPallet;
+use sp_runtime::traits::Bounded;
+
+use super::*;
+use crate::Pallet as PromototionPallet;
 
 const SEED: u32 = 0;
 
modifiedpallets/app-promotion/src/lib.rsdiffbeforeafterboth
--- a/pallets/app-promotion/src/lib.rs
+++ b/pallets/app-promotion/src/lib.rs
@@ -53,32 +53,32 @@
 pub mod types;
 pub mod weights;
 
-use sp_std::{vec::Vec, vec, iter::Sum, borrow::ToOwned, cell::RefCell};
-use sp_core::H160;
-use codec::EncodeLike;
-pub use types::*;
-
-use up_data_structs::CollectionId;
-
 use frame_support::{
-	dispatch::{DispatchResult},
+	dispatch::DispatchResult,
+	ensure,
+	pallet_prelude::*,
+	storage::Key,
 	traits::{
-		Get,
+		fungible::{Inspect, InspectFreeze, Mutate, MutateFreeze},
 		tokens::Balance,
-		fungible::{Inspect, InspectFreeze, Mutate, MutateFreeze},
+		Get,
 	},
-	ensure, BoundedVec,
+	weights::Weight,
+	Blake2_128Concat, BoundedVec, PalletId, Twox64Concat,
 };
-
-use weights::WeightInfo;
-
+use frame_system::pallet_prelude::*;
 pub use pallet::*;
 use pallet_evm::account::CrossAccountId;
+use parity_scale_codec::EncodeLike;
+use sp_core::H160;
 use sp_runtime::{
-	Perbill,
-	traits::{BlockNumberProvider, CheckedAdd, CheckedSub, AccountIdConversion, Zero},
-	ArithmeticError, DispatchError,
+	traits::{AccountIdConversion, BlockNumberProvider, CheckedAdd, CheckedSub, Zero},
+	ArithmeticError, DispatchError, Perbill,
 };
+use sp_std::{borrow::ToOwned, cell::RefCell, iter::Sum, vec, vec::Vec};
+pub use types::*;
+use up_data_structs::CollectionId;
+use weights::WeightInfo;
 
 const PENDING_LIMIT_PER_BLOCK: u32 = 3;
 
@@ -87,12 +87,8 @@
 
 #[frame_support::pallet]
 pub mod pallet {
+
 	use super::*;
-	use frame_support::{
-		Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key, PalletId, weights::Weight,
-	};
-	use frame_system::pallet_prelude::*;
-	use sp_runtime::DispatchError;
 
 	#[pallet::config]
 	pub trait Config:
modifiedpallets/app-promotion/src/types.rsdiffbeforeafterboth
--- a/pallets/app-promotion/src/types.rs
+++ b/pallets/app-promotion/src/types.rs
@@ -1,13 +1,12 @@
-use frame_support::{dispatch::DispatchResult};
-
+use frame_support::dispatch::DispatchResult;
+use frame_system::pallet_prelude::*;
 use pallet_common::CollectionHandle;
-
+use pallet_configuration::AppPromomotionConfigurationOverride;
+use pallet_evm_contract_helpers::{Config as EvmHelpersConfig, Pallet as EvmHelpersPallet};
+use sp_core::Get;
 use sp_runtime::{DispatchError, Perbill};
-use up_data_structs::{CollectionId};
 use sp_std::borrow::ToOwned;
-use pallet_evm_contract_helpers::{Pallet as EvmHelpersPallet, Config as EvmHelpersConfig};
-use pallet_configuration::{AppPromomotionConfigurationOverride};
-use sp_core::Get;
+use up_data_structs::CollectionId;
 
 const MAX_NUMBER_PAYOUTS: u8 = 100;
 pub(crate) const DEFAULT_NUMBER_PAYOUTS: u8 = 20;
modifiedpallets/balances-adapter/src/common.rsdiffbeforeafterboth
--- a/pallets/balances-adapter/src/common.rs
+++ b/pallets/balances-adapter/src/common.rs
@@ -1,11 +1,13 @@
 use alloc::{vec, vec::Vec};
 use core::marker::PhantomData;
-use crate::{Config, NativeFungibleHandle, Pallet};
+
 use frame_support::{fail, weights::Weight};
 use pallet_balances::{weights::SubstrateWeight as BalancesWeight, WeightInfo};
 use pallet_common::{CommonCollectionOperations, CommonWeightInfo};
 use up_data_structs::TokenId;
 
+use crate::{Config, NativeFungibleHandle, Pallet};
+
 pub struct CommonWeights<T: Config>(PhantomData<T>);
 
 // All implementations with `Weight::default` used in methods that return error `UnsupportedOperation`.
modifiedpallets/balances-adapter/src/erc.rsdiffbeforeafterboth
--- a/pallets/balances-adapter/src/erc.rs
+++ b/pallets/balances-adapter/src/erc.rs
@@ -1,4 +1,3 @@
-use crate::{Config, NativeFungibleHandle, Pallet, SelfWeightOf};
 use evm_coder::{abi::AbiType, generate_stubgen, solidity_interface, types::*};
 use pallet_balances::WeightInfo;
 use pallet_common::{
@@ -10,8 +9,10 @@
 	execution::{PreDispatch, Result},
 	frontier_contract, WithRecorder,
 };
-use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};
-use sp_core::{U256, Get};
+use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};
+use sp_core::{Get, U256};
+
+use crate::{Config, NativeFungibleHandle, Pallet, SelfWeightOf};
 
 frontier_contract! {
 	macro_rules! NativeFungibleHandle_result {...}
modifiedpallets/balances-adapter/src/lib.rsdiffbeforeafterboth
--- a/pallets/balances-adapter/src/lib.rs
+++ b/pallets/balances-adapter/src/lib.rs
@@ -4,8 +4,8 @@
 use core::ops::Deref;
 
 use frame_support::sp_runtime::DispatchResult;
-use pallet_evm_coder_substrate::{WithRecorder, SubstrateRecorder};
 pub use pallet::*;
+use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
 
 pub mod common;
 pub mod erc;
@@ -55,16 +55,16 @@
 }
 #[frame_support::pallet]
 pub mod pallet {
-	use super::*;
 	use alloc::string::String;
+
 	use frame_support::{
 		dispatch::PostDispatchInfo,
 		ensure,
-		pallet_prelude::{DispatchResultWithPostInfo, Pays},
+		pallet_prelude::*,
 		traits::{
-			Get,
 			fungible::{Inspect, Mutate},
 			tokens::Preservation,
+			Get,
 		},
 	};
 	use pallet_balances::WeightInfo;
@@ -74,6 +74,8 @@
 	use sp_runtime::DispatchError;
 	use up_data_structs::{budget::Budget, mapping::TokenAddressMapping};
 
+	use super::*;
+
 	#[pallet::config]
 	pub trait Config:
 		frame_system::Config
modifiedpallets/collator-selection/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/collator-selection/src/benchmarking.rs
+++ b/pallets/collator-selection/src/benchmarking.rs
@@ -32,18 +32,13 @@
 
 //! Benchmarking setup for pallet-collator-selection
 
-use super::*;
-
-#[allow(unused)]
-use crate::{Pallet as CollatorSelection, BalanceOf};
 use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, whitelisted_caller};
 use frame_support::{
 	assert_ok,
-	codec::Decode,
+	parity_scale_codec::Decode,
 	traits::{
-		EnsureOrigin,
 		fungible::{Inspect, Mutate},
-		Get,
+		EnsureOrigin, Get,
 	},
 };
 use frame_system::{EventRecord, RawOrigin};
modifiedpallets/collator-selection/src/lib.rsdiffbeforeafterboth
--- a/pallets/collator-selection/src/lib.rs
+++ b/pallets/collator-selection/src/lib.rs
@@ -96,26 +96,27 @@
 	<<T as Config>::Currency as Inspect<<T as frame_system::Config>::AccountId>>::Balance;
 #[frame_support::pallet]
 pub mod pallet {
-	use super::*;
-	pub use crate::weights::WeightInfo;
 	use core::ops::Div;
+
 	use frame_support::{
 		dispatch::{DispatchClass, DispatchResultWithPostInfo},
-		inherent::Vec,
 		pallet_prelude::*,
 		sp_runtime::traits::{AccountIdConversion, CheckedSub, Saturating, Zero},
 		traits::{
-			EnsureOrigin,
-			fungible::{Balanced, BalancedHold, Inspect, InspectHold, Mutate, MutateHold},
-			ValidatorRegistration,
+			fungible::{Balanced, BalancedHold, Inspect, Mutate, MutateHold},
 			tokens::{Precision, Preservation},
+			EnsureOrigin, ValidatorRegistration,
 		},
 		BoundedVec, PalletId,
 	};
 	use frame_system::pallet_prelude::*;
 	use pallet_session::SessionManager;
-	use sp_runtime::{Perbill, traits::Convert};
+	use sp_runtime::{traits::Convert, Perbill};
 	use sp_staking::SessionIndex;
+	use sp_std::vec::Vec;
+
+	use super::*;
+	pub use crate::weights::WeightInfo;
 
 	/// A convertor from collators id. Since this pallet does not have stash/controller, this is
 	/// just identity.
modifiedpallets/collator-selection/src/mock.rsdiffbeforeafterboth
--- a/pallets/collator-selection/src/mock.rs
+++ b/pallets/collator-selection/src/mock.rs
@@ -30,8 +30,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-use super::*;
-use crate as collator_selection;
 use frame_support::{
 	ord_parameter_types, parameter_types,
 	traits::{FindAuthor, GenesisBuild, ValidatorRegistration},
@@ -46,6 +44,9 @@
 	Perbill, RuntimeAppPublic,
 };
 
+use super::*;
+use crate as collator_selection;
+
 type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
 type Block = frame_system::mocking::MockBlock<Test>;
 
modifiedpallets/collator-selection/src/tests.rsdiffbeforeafterboth
--- a/pallets/collator-selection/src/tests.rs
+++ b/pallets/collator-selection/src/tests.rs
@@ -30,15 +30,15 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-use crate::{self as collator_selection, Config};
-use crate::{mock::*, Error};
 use frame_support::{
 	assert_noop, assert_ok,
 	traits::{fungible, GenesisBuild, OnInitialize},
 };
+use scale_info::prelude::*;
 use sp_runtime::{traits::BadOrigin, TokenError};
-use scale_info::prelude::*;
 
+use crate::{self as collator_selection, mock::*, Config, Error};
+
 fn get_license_and_onboard(account_id: <Test as frame_system::Config>::AccountId) {
 	assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(
 		account_id
modifiedpallets/common/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/common/src/benchmarking.rs
+++ b/pallets/common/src/benchmarking.rs
@@ -16,23 +16,25 @@
 
 #![allow(missing_docs)]
 
-use sp_std::vec::Vec;
-use crate::{Config, CollectionHandle, Pallet};
-use pallet_evm::account::CrossAccountId;
-use frame_benchmarking::{benchmarks, account};
-use up_data_structs::{
-	CollectionMode, CreateCollectionData, CollectionId, Property, PropertyKey, PropertyValue,
-	CollectionPermissions, NestingPermissions, AccessMode, PropertiesPermissionMap,
-	MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
-	MAX_PROPERTIES_PER_ITEM,
-};
+use core::convert::TryInto;
+
+use frame_benchmarking::{account, benchmarks};
 use frame_support::{
-	traits::{Get, fungible::Balanced, Imbalance, tokens::Precision},
 	pallet_prelude::ConstU32,
+	traits::{fungible::Balanced, tokens::Precision, Get, Imbalance},
 	BoundedVec,
 };
-use core::convert::TryInto;
-use sp_runtime::{DispatchError, traits::Zero};
+use pallet_evm::account::CrossAccountId;
+use sp_runtime::{traits::Zero, DispatchError};
+use sp_std::vec::Vec;
+use up_data_structs::{
+	AccessMode, CollectionId, CollectionMode, CollectionPermissions, CreateCollectionData,
+	NestingPermissions, PropertiesPermissionMap, Property, PropertyKey, PropertyValue,
+	MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_COLLECTION_NAME_LENGTH, MAX_PROPERTIES_PER_ITEM,
+	MAX_TOKEN_PREFIX_LENGTH,
+};
+
+use crate::{CollectionHandle, Config, Pallet};
 
 const SEED: u32 = 1;
 
modifiedpallets/common/src/dispatch.rsdiffbeforeafterboth
--- a/pallets/common/src/dispatch.rs
+++ b/pallets/common/src/dispatch.rs
@@ -2,13 +2,13 @@
 
 use frame_support::{
 	dispatch::{
-		DispatchResultWithPostInfo, PostDispatchInfo, Weight, DispatchErrorWithPostInfo,
-		DispatchResult,
+		DispatchErrorWithPostInfo, DispatchResult, DispatchResultWithPostInfo, Pays,
+		PostDispatchInfo,
 	},
-	dispatch::Pays,
 	traits::Get,
 };
 use sp_runtime::DispatchError;
+use sp_weights::Weight;
 use up_data_structs::{CollectionId, CreateCollectionData};
 
 use crate::{pallet::Config, CommonCollectionOperations};
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -16,15 +16,17 @@
 
 //! This module contains the implementation of pallet methods for evm.
 
-pub use pallet_evm::{PrecompileOutput, PrecompileResult, PrecompileHandle, account::CrossAccountId};
+pub use pallet_evm::{
+	account::CrossAccountId, PrecompileHandle, PrecompileOutput, PrecompileResult,
+};
 use pallet_evm_coder_substrate::{
 	abi::AbiType,
-	solidity_interface, ToLog,
+	dispatch_to_evm,
+	execution::{Error, PreDispatch, Result},
+	frontier_contract, solidity_interface,
 	types::*,
-	execution::{Result, Error, PreDispatch},
-	frontier_contract,
+	ToLog,
 };
-use pallet_evm_coder_substrate::dispatch_to_evm;
 use sp_std::{vec, vec::Vec};
 use up_data_structs::{
 	CollectionMode, CollectionPermissions, OwnerRestrictedSet, Property, SponsoringRateLimit,
@@ -32,7 +34,7 @@
 };
 
 use crate::{
-	Pallet, CollectionHandle, Config, CollectionProperties, eth, SelfWeightOf, weights::WeightInfo,
+	eth, weights::WeightInfo, CollectionHandle, CollectionProperties, Config, Pallet, SelfWeightOf,
 };
 
 frontier_contract! {
@@ -727,11 +729,10 @@
 
 /// Contains static property keys and values.
 pub mod static_property {
-	use pallet_evm_coder_substrate::{
-		execution::{Result, Error},
-	};
 	use alloc::format;
 
+	use pallet_evm_coder_substrate::execution::{Error, Result};
+
 	const EXPECT_CONVERT_ERROR: &str = "length < limit";
 
 	/// Keys.
modifiedpallets/common/src/eth.rsdiffbeforeafterboth
--- a/pallets/common/src/eth.rs
+++ b/pallets/common/src/eth.rs
@@ -17,15 +17,16 @@
 //! The module contains a number of functions for converting and checking ethereum identifiers.
 
 use alloc::format;
-use sp_std::{vec, vec::Vec};
+
 use evm_coder::{
+	types::{Address, String},
 	AbiCoder,
-	types::{Address, String},
 };
-pub use pallet_evm::{Config, account::CrossAccountId};
-use sp_core::{H160, U256};
-use up_data_structs::{CollectionId, CollectionFlags};
+pub use pallet_evm::{account::CrossAccountId, Config};
 use pallet_evm_coder_substrate::execution::Error;
+use sp_core::{H160, U256};
+use sp_std::{vec, vec::Vec};
+use up_data_structs::{CollectionFlags, CollectionId};
 
 // 0x17c4e6453Cc49AAAaEACA894e6D9683e00000001 - collection 1
 // TODO: Unhardcode prefix
modifiedpallets/common/src/helpers.rsdiffbeforeafterboth
--- a/pallets/common/src/helpers.rs
+++ b/pallets/common/src/helpers.rs
@@ -3,9 +3,9 @@
 //! The module contains helpers.
 //!
 use frame_support::{
+	dispatch::{DispatchErrorWithPostInfo, PostDispatchInfo},
 	pallet_prelude::DispatchResultWithPostInfo,
 	weights::Weight,
-	dispatch::{DispatchErrorWithPostInfo, PostDispatchInfo},
 };
 
 /// Add weight for a `DispatchResultWithPostInfo`
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -58,37 +58,37 @@
 	slice::from_ref,
 	marker::PhantomData,
 };
-use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
-use sp_std::vec::Vec;
-use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
+
 use evm_coder::ToLog;
 use frame_support::{
-	dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, Weight, PostDispatchInfo},
-	ensure,
+	dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, Pays, PostDispatchInfo},
+	ensure, fail,
 	traits::{
-		Get,
 		fungible::{Balanced, Debt, Inspect},
 		tokens::{Imbalance, Precision, Preservation},
+		Get,
 	},
-	dispatch::Pays,
-	transactional, fail,
+	transactional,
 };
+pub use pallet::*;
+use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
+use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
+use sp_core::H160;
+use sp_runtime::{traits::Zero, ArithmeticError, DispatchError, DispatchResult};
+use sp_std::vec::Vec;
+use sp_weights::Weight;
 use up_data_structs::{
-	AccessMode, COLLECTION_NUMBER_LIMIT, Collection, RpcCollection, RpcCollectionFlags,
-	CollectionId, CreateItemData, MAX_TOKEN_PREFIX_LENGTH, COLLECTION_ADMINS_LIMIT, TokenId,
-	TokenChild, CollectionStats, MAX_TOKEN_OWNERSHIP, CollectionMode, NFT_SPONSOR_TRANSFER_TIMEOUT,
-	FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MAX_SPONSOR_TIMEOUT,
-	CUSTOM_DATA_LIMIT, CollectionLimits, CreateCollectionData, SponsorshipState, CreateItemExData,
-	SponsoringRateLimit, budget::Budget, PhantomType, Property,
-	CollectionProperties as CollectionPropertiesT, TokenProperties, PropertiesPermissionMap,
-	PropertyKey, PropertyValue, PropertyPermission, PropertiesError, TokenOwnerError,
-	PropertyKeyPermission, TokenData, TrySetProperty, PropertyScope, CollectionPermissions,
+	budget::Budget, AccessMode, Collection, CollectionId, CollectionLimits, CollectionMode,
+	CollectionPermissions, CollectionProperties as CollectionPropertiesT, CollectionStats,
+	CreateCollectionData, CreateItemData, CreateItemExData, PhantomType, PropertiesError,
+	PropertiesPermissionMap, Property, PropertyKey, PropertyKeyPermission, PropertyPermission,
+	PropertyScope, PropertyValue, RpcCollection, RpcCollectionFlags, SponsoringRateLimit,
+	SponsorshipState, TokenChild, TokenData, TokenId, TokenOwnerError, TokenProperties,
+	TrySetProperty, COLLECTION_ADMINS_LIMIT, COLLECTION_NUMBER_LIMIT, CUSTOM_DATA_LIMIT,
+	FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MAX_SPONSOR_TIMEOUT, MAX_TOKEN_OWNERSHIP,
+	MAX_TOKEN_PREFIX_LENGTH, NFT_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,
 };
 use up_pov_estimate_rpc::PovInfo;
-
-pub use pallet::*;
-use sp_core::H160;
-use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, traits::Zero};
 
 #[cfg(feature = "runtime-benchmarks")]
 pub mod benchmarking;
@@ -401,13 +401,16 @@
 #[frame_support::pallet]
 pub mod pallet {
 
-	use super::*;
 	use dispatch::CollectionDispatch;
-	use frame_support::{Blake2_128Concat, pallet_prelude::*, storage::Key, traits::StorageVersion};
-	use up_data_structs::{TokenId, mapping::TokenAddressMapping};
+	use frame_support::{
+		pallet_prelude::*, storage::Key, traits::StorageVersion, Blake2_128Concat,
+	};
 	use scale_info::TypeInfo;
+	use up_data_structs::{mapping::TokenAddressMapping, TokenId};
 	use weights::WeightInfo;
 
+	use super::*;
+
 	#[pallet::config]
 	pub trait Config:
 		frame_system::Config + pallet_evm_coder_substrate::Config + pallet_evm::Config + TypeInfo
@@ -2720,7 +2723,7 @@
 #[cfg(any(feature = "tests", test))]
 #[allow(missing_docs)]
 pub mod tests {
-	use crate::{DispatchResult, DispatchError, LazyValue, Config};
+	use crate::{Config, DispatchError, DispatchResult, LazyValue};
 
 	const fn to_bool(u: u8) -> bool {
 		u != 0
modifiedpallets/configuration/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/configuration/src/benchmarking.rs
+++ b/pallets/configuration/src/benchmarking.rs
@@ -16,10 +16,11 @@
 
 //! Benchmarking setup for pallet-configuration
 
-use super::*;
 use frame_benchmarking::benchmarks;
-use frame_system::{EventRecord, RawOrigin};
 use frame_support::assert_ok;
+use frame_system::{EventRecord, RawOrigin};
+
+use super::*;
 
 fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
 	let events = frame_system::Pallet::<T>::events();
modifiedpallets/configuration/src/lib.rsdiffbeforeafterboth
--- a/pallets/configuration/src/lib.rs
+++ b/pallets/configuration/src/lib.rs
@@ -20,19 +20,17 @@
 
 use frame_support::{
 	pallet,
-	weights::{WeightToFeePolynomial, WeightToFeeCoefficients, WeightToFeeCoefficient, Weight},
 	traits::Get,
-	Parameter,
+	weights::{Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial},
 };
-use codec::{Decode, Encode, MaxEncodedLen};
+pub use pallet::*;
+use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
 use scale_info::TypeInfo;
+use smallvec::smallvec;
 use sp_arithmetic::{
-	per_things::{Perbill, PerThing},
+	per_things::{PerThing, Perbill},
 	traits::{BaseArithmetic, Unsigned},
 };
-use smallvec::smallvec;
-
-pub use pallet::*;
 use sp_core::U256;
 
 #[cfg(feature = "runtime-benchmarks")]
@@ -41,15 +39,14 @@
 
 #[pallet]
 mod pallet {
+	use core::fmt::Debug;
+
+	use frame_support::{pallet_prelude::*, traits::Get};
+	use frame_system::{ensure_root, pallet_prelude::*};
+	use parity_scale_codec::Codec;
+	use sp_arithmetic::{traits::AtLeast32BitUnsigned, FixedPointOperand, Permill};
+
 	use super::*;
-	use frame_support::{
-		traits::Get,
-		pallet_prelude::*,
-		log,
-		dispatch::{Codec, fmt::Debug},
-	};
-	use frame_system::{pallet_prelude::OriginFor, ensure_root, pallet_prelude::*};
-	use sp_arithmetic::{FixedPointOperand, traits::AtLeast32BitUnsigned, Permill};
 	pub use crate::weights::WeightInfo;
 
 	#[pallet::config]
modifiedpallets/evm-coder-substrate/procedural/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-coder-substrate/procedural/src/lib.rs
+++ b/pallets/evm-coder-substrate/procedural/src/lib.rs
@@ -1,12 +1,12 @@
 use std::result;
 
-use proc_macro2::{TokenStream, Ident};
+use proc_macro2::{Ident, TokenStream};
 use quote::quote;
 use syn::{
-	Error, DeriveInput, Data, Attribute,
+	parenthesized,
 	parse::{Parse, ParseBuffer},
 	spanned::Spanned,
-	Expr, parenthesized,
+	Attribute, Data, DeriveInput, Error, Expr,
 };
 
 type Result<T = TokenStream, E = syn::Error> = result::Result<T, E>;
modifiedpallets/evm-coder-substrate/src/execution.rsdiffbeforeafterboth
--- a/pallets/evm-coder-substrate/src/execution.rs
+++ b/pallets/evm-coder-substrate/src/execution.rs
@@ -22,10 +22,9 @@
 use std::string::{String, ToString};
 
 use evm_coder::ERC165Call;
+pub use evm_coder_substrate_procedural::PreDispatch;
 use evm_core::{ExitError, ExitFatal};
-
 pub use frame_support::weights::Weight;
-pub use evm_coder_substrate_procedural::PreDispatch;
 
 /// Execution error, should be convertible between EVM and Substrate.
 #[derive(Debug, Clone)]
modifiedpallets/evm-coder-substrate/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-coder-substrate/src/lib.rs
+++ b/pallets/evm-coder-substrate/src/lib.rs
@@ -22,42 +22,39 @@
 extern crate alloc;
 #[cfg(not(feature = "std"))]
 use alloc::format;
-use execution::PreDispatch;
-use frame_support::dispatch::Weight;
-
 use core::marker::PhantomData;
-use sp_std::{cell::RefCell, vec::Vec};
 
-use codec::Decode;
-use frame_support::pallet_prelude::DispatchError;
-use frame_support::traits::PalletInfo;
-use frame_support::{ensure, sp_runtime::ModuleError};
-use up_data_structs::budget;
+use execution::PreDispatch;
+use frame_support::{
+	ensure, pallet_prelude::DispatchError, sp_runtime::ModuleError, traits::PalletInfo,
+};
 use pallet_evm::{
-	ExitError, ExitRevert, ExitSucceed, GasWeightMapping, PrecompileFailure, PrecompileOutput,
-	PrecompileResult, PrecompileHandle,
+	ExitError, ExitRevert, ExitSucceed, GasWeightMapping, PrecompileFailure, PrecompileHandle,
+	PrecompileOutput, PrecompileResult,
 };
+use parity_scale_codec::Decode;
 use sp_core::{Get, H160};
+use sp_std::{cell::RefCell, vec::Vec};
+use sp_weights::Weight;
+use up_data_structs::budget;
 // #[cfg(feature = "runtime-benchmarks")]
 // pub mod benchmarking;
 pub mod execution;
 
-#[doc(hidden)]
-pub use spez::spez;
-
+pub use evm_coder::{abi, solidity_interface, types, Contract, ResultWithPostInfoOf, ToLog};
 use evm_coder::{
 	types::{Msg, Value},
 	AbiEncode,
 };
-
 pub use pallet::*;
-pub use evm_coder::{ResultWithPostInfoOf, Contract, abi, solidity_interface, ToLog, types};
+#[doc(hidden)]
+pub use spez::spez;
 
 #[frame_support::pallet]
 pub mod pallet {
+	pub use frame_support::dispatch::DispatchResult;
+
 	use super::*;
-
-	pub use frame_support::dispatch::DispatchResult;
 
 	/// DispatchError is opaque, but we need to somehow extract correct error in case of OutOfGas failure
 	/// So we have this pallet, which defines OutOfGas error, and knews its own id to check if DispatchError
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -18,32 +18,35 @@
 
 extern crate alloc;
 use core::marker::PhantomData;
+
 use evm_coder::{
-	abi::{AbiType, AbiEncode},
+	abi::{AbiEncode, AbiType},
 	generate_stubgen, solidity_interface,
 	types::*,
 	ToLog,
 };
+use frame_support::traits::Get;
+use frame_system::pallet_prelude::*;
 use pallet_common::eth;
 use pallet_evm::{
-	ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure, PrecompileHandle,
-	account::CrossAccountId,
+	account::CrossAccountId, ExitRevert, OnCreate, OnMethodCall, PrecompileFailure,
+	PrecompileHandle, PrecompileResult,
 };
 use pallet_evm_coder_substrate::{
-	SubstrateRecorder, WithRecorder, dispatch_to_evm,
-	execution::{Result, PreDispatch},
-	frontier_contract,
+	dispatch_to_evm,
+	execution::{PreDispatch, Result},
+	frontier_contract, SubstrateRecorder, WithRecorder,
 };
 use pallet_evm_transaction_payment::CallContext;
 use sp_core::{H160, U256};
+use sp_std::vec::Vec;
 use up_data_structs::SponsorshipState;
+use up_sponsorship::SponsorshipHandler;
+
 use crate::{
-	AllowlistEnabled, Config, Owner, Pallet, SponsorBasket, SponsoringFeeLimit,
-	SponsoringRateLimit, SponsoringModeT, Sponsoring,
+	AllowlistEnabled, Config, Owner, Pallet, SponsorBasket, Sponsoring, SponsoringFeeLimit,
+	SponsoringModeT, SponsoringRateLimit,
 };
-use frame_support::traits::Get;
-use up_sponsorship::SponsorshipHandler;
-use sp_std::vec::Vec;
 
 frontier_contract! {
 	macro_rules! ContractHelpers_result {...}
modifiedpallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/lib.rs
+++ b/pallets/evm-contract-helpers/src/lib.rs
@@ -18,12 +18,12 @@
 #![cfg_attr(not(feature = "std"), no_std)]
 #![warn(missing_docs)]
 
-use codec::{Decode, Encode, MaxEncodedLen};
+pub use eth::*;
 use evm_coder::AbiCoder;
+use frame_support::storage::bounded_btree_map::BoundedBTreeMap;
 pub use pallet::*;
-pub use eth::*;
+use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
 use scale_info::TypeInfo;
-use frame_support::storage::bounded_btree_map::BoundedBTreeMap;
 pub mod eth;
 
 /// Maximum number of methods per contract that could have fee limit
@@ -31,15 +31,16 @@
 
 #[frame_support::pallet]
 pub mod pallet {
-	pub use super::*;
+	use evm_coder::ToLog;
 	use frame_support::{pallet_prelude::*, sp_runtime::DispatchResult};
-	use frame_system::{pallet_prelude::OriginFor, ensure_root};
+	use frame_system::{ensure_root, pallet_prelude::*};
+	use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
 	use sp_core::{H160, U256};
 	use sp_std::vec::Vec;
-	use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
 	use up_data_structs::SponsorshipState;
-	use evm_coder::ToLog;
 
+	pub use super::*;
+
 	#[pallet::config]
 	pub trait Config:
 		frame_system::Config + pallet_evm_coder_substrate::Config + pallet_evm::Config
modifiedpallets/evm-migration/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/evm-migration/src/benchmarking.rs
+++ b/pallets/evm-migration/src/benchmarking.rs
@@ -16,11 +16,12 @@
 
 #![allow(missing_docs)]
 
-use super::{Call, Config, Pallet};
 use frame_benchmarking::benchmarks;
 use frame_system::RawOrigin;
 use sp_core::{H160, H256};
-use sp_std::{vec::Vec, vec};
+use sp_std::{vec, vec::Vec};
+
+use super::{Call, Config, Pallet};
 
 benchmarks! {
 	where_clause { where <T as Config>::RuntimeEvent: parity_scale_codec::Encode }
modifiedpallets/evm-migration/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-migration/src/lib.rs
+++ b/pallets/evm-migration/src/lib.rs
@@ -26,15 +26,13 @@
 
 #[frame_support::pallet]
 pub mod pallet {
-	use frame_support::{
-		pallet_prelude::{*, DispatchResult},
-		traits::IsType,
-	};
-	use frame_system::pallet_prelude::{*, OriginFor};
+	use frame_support::{pallet_prelude::*, traits::IsType};
+	use frame_system::pallet_prelude::*;
+	use pallet_evm::{Pallet as PalletEvm, PrecompileHandle};
 	use sp_core::{H160, H256};
 	use sp_std::vec::Vec;
+
 	use super::weights::WeightInfo;
-	use pallet_evm::{PrecompileHandle, Pallet as PalletEvm};
 
 	#[pallet::config]
 	pub trait Config: frame_system::Config + pallet_evm::Config {
modifiedpallets/evm-transaction-payment/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-transaction-payment/src/lib.rs
+++ b/pallets/evm-transaction-payment/src/lib.rs
@@ -19,19 +19,26 @@
 #![deny(missing_docs)]
 
 use core::marker::PhantomData;
-use fp_evm::WithdrawReason;
-use frame_support::traits::IsSubType;
+
+use fp_evm::{CheckEvmTransaction, FeeCalculator, TransactionValidationError, WithdrawReason};
+use frame_support::{
+	storage::with_transaction,
+	traits::{Currency, Imbalance, IsSubType, OnUnbalanced},
+};
 pub use pallet::*;
-use pallet_evm::{account::CrossAccountId, EnsureAddressOrigin};
+use pallet_evm::{
+	account::CrossAccountId, EnsureAddressOrigin, NegativeImbalanceOf, OnChargeEVMTransaction,
+	OnCheckEvmTransaction,
+};
 use sp_core::{H160, U256};
-use sp_runtime::{TransactionOutcome, DispatchError};
+use sp_runtime::{traits::UniqueSaturatedInto, DispatchError, TransactionOutcome};
 use up_sponsorship::SponsorshipHandler;
 
 #[frame_support::pallet]
 pub mod pallet {
+	use sp_std::vec::Vec;
+
 	use super::*;
-
-	use sp_std::vec::Vec;
 
 	/// Contains call data
 	pub struct CallContext {
modifiedpallets/foreign-assets/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/foreign-assets/src/benchmarking.rs
+++ b/pallets/foreign-assets/src/benchmarking.rs
@@ -16,15 +16,14 @@
 
 #![allow(missing_docs)]
 
-use super::{Config, Pallet, Call};
-use frame_benchmarking::{benchmarks, account};
+use frame_benchmarking::{account, benchmarks};
+use frame_support::traits::Currency;
 use frame_system::RawOrigin;
+use sp_std::{boxed::Box, vec::Vec};
+use staging_xcm::{opaque::latest::Junction::Parachain, v3::Junctions::X1, VersionedMultiLocation};
+
+use super::{Call, Config, Pallet};
 use crate::AssetMetadata;
-use xcm::opaque::latest::Junction::Parachain;
-use xcm::VersionedMultiLocation;
-use xcm::v3::Junctions::X1;
-use frame_support::traits::Currency;
-use sp_std::{vec::Vec, boxed::Box};
 
 fn bounded<T: TryFrom<Vec<u8>>>(slice: &[u8]) -> T {
 	T::try_from(slice.to_vec())
modifiedpallets/foreign-assets/src/impl_fungibles.rsdiffbeforeafterboth
--- a/pallets/foreign-assets/src/impl_fungibles.rs
+++ b/pallets/foreign-assets/src/impl_fungibles.rs
@@ -16,18 +16,17 @@
 
 //! Implementations for fungibles trait.
 
-use super::*;
-use frame_system::Config as SystemConfig;
-
 use frame_support::traits::tokens::{
-	DepositConsequence, WithdrawConsequence, Preservation, Fortitude, Provenance, Precision,
+	DepositConsequence, Fortitude, Precision, Preservation, Provenance, WithdrawConsequence,
 };
-use pallet_common::CollectionHandle;
+use frame_system::Config as SystemConfig;
+use pallet_common::{CollectionHandle, CommonCollectionOperations};
 use pallet_fungible::FungibleHandle;
-use pallet_common::CommonCollectionOperations;
+use sp_runtime::traits::{CheckedAdd, CheckedSub};
 use up_data_structs::budget::Value;
-use sp_runtime::traits::{CheckedAdd, CheckedSub};
 
+use super::*;
+
 impl<T: Config> fungibles::Inspect<<T as SystemConfig>::AccountId> for Pallet<T>
 where
 	T: orml_tokens::Config<CurrencyId = AssetId>,
modifiedpallets/foreign-assets/src/lib.rsdiffbeforeafterboth
--- a/pallets/foreign-assets/src/lib.rs
+++ b/pallets/foreign-assets/src/lib.rs
@@ -39,29 +39,26 @@
 	ensure,
 	pallet_prelude::*,
 	traits::{fungible, fungibles, Currency, EnsureOrigin},
-	RuntimeDebug,
 };
 use frame_system::pallet_prelude::*;
-use up_data_structs::CollectionMode;
+use pallet_common::erc::CrossAccountId;
 use pallet_fungible::Pallet as PalletFungible;
 use scale_info::TypeInfo;
+use serde::{Deserialize, Serialize};
 use sp_runtime::{
 	traits::{One, Zero},
 	ArithmeticError,
 };
 use sp_std::{boxed::Box, vec::Vec};
-use up_data_structs::{CollectionId, TokenId, CreateCollectionData};
-
+use staging_xcm::{latest::MultiLocation, VersionedMultiLocation};
 // NOTE: MultiLocation is used in storages, we will need to do migration if upgrade the
 // MultiLocation to the XCM v3.
-use xcm::opaque::latest::{prelude::XcmError, Weight};
-use xcm::{latest::MultiLocation, VersionedMultiLocation};
-use xcm_executor::{traits::WeightTrader, Assets};
-
-use pallet_common::erc::CrossAccountId;
-
-#[cfg(feature = "std")]
-use serde::{Deserialize, Serialize};
+use staging_xcm::{
+	opaque::latest::{prelude::XcmError, Weight},
+	v3::XcmContext,
+};
+use staging_xcm_executor::{traits::WeightTrader, Assets};
+use up_data_structs::{CollectionId, CollectionMode, CreateCollectionData, TokenId};
 
 // TODO: Move to primitives
 // Id of native currency.
modifiedpallets/fungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/fungible/src/benchmarking.rs
+++ b/pallets/fungible/src/benchmarking.rs
@@ -14,14 +14,13 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use super::*;
-use crate::{Pallet, Config, FungibleHandle};
-
+use frame_benchmarking::{account, benchmarks};
+use pallet_common::{bench_init, benchmarking::create_collection_raw};
 use sp_std::prelude::*;
-use pallet_common::benchmarking::create_collection_raw;
-use frame_benchmarking::{benchmarks, account};
-use up_data_structs::{CollectionMode, MAX_ITEMS_PER_BATCH, budget::Unlimited};
-use pallet_common::bench_init;
+use up_data_structs::{budget::Unlimited, CollectionMode, MAX_ITEMS_PER_BATCH};
+
+use super::*;
+use crate::{Config, FungibleHandle, Pallet};
 
 const SEED: u32 = 1;
 
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -16,22 +16,24 @@
 
 use core::marker::PhantomData;
 
-use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, traits::Get};
-use up_data_structs::{
-	TokenId, CollectionId, CreateItemExData, budget::Budget, CreateItemData, TokenOwnerError,
+use frame_support::{
+	dispatch::DispatchResultWithPostInfo, ensure, fail, traits::Get, weights::Weight,
 };
 use pallet_common::{
-	CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,
-	weights::WeightInfo as _, SelfWeightOf as PalletCommonWeightOf,
+	weights::WeightInfo as _, with_weight, CommonCollectionOperations, CommonWeightInfo,
+	RefungibleExtensions, SelfWeightOf as PalletCommonWeightOf,
 };
 use pallet_structure::Error as StructureError;
 use sp_runtime::{ArithmeticError, DispatchError};
-use sp_std::{vec::Vec, vec};
-use up_data_structs::{Property, PropertyKey, PropertyValue, PropertyKeyPermission};
+use sp_std::{vec, vec::Vec};
+use up_data_structs::{
+	budget::Budget, CollectionId, CreateItemData, CreateItemExData, Property, PropertyKey,
+	PropertyKeyPermission, PropertyValue, TokenId, TokenOwnerError,
+};
 
 use crate::{
-	Allowance, TotalSupply, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf,
-	weights::WeightInfo,
+	weights::WeightInfo, Allowance, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf,
+	TotalSupply,
 };
 
 pub struct CommonWeights<T: Config>(PhantomData<T>);
modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -17,30 +17,31 @@
 //! ERC-20 standart support implementation.
 
 extern crate alloc;
-use core::char::{REPLACEMENT_CHARACTER, decode_utf16};
-use core::convert::TryInto;
-use evm_coder::AbiCoder;
-use evm_coder::{abi::AbiType, ToLog, generate_stubgen, solidity_interface, types::*};
-use up_data_structs::CollectionMode;
+use core::{
+	char::{decode_utf16, REPLACEMENT_CHARACTER},
+	convert::TryInto,
+};
+
+use evm_coder::{abi::AbiType, generate_stubgen, solidity_interface, types::*, AbiCoder, ToLog};
 use pallet_common::{
-	CollectionHandle,
-	erc::{CommonEvmHandler, PrecompileResult, CollectionCall},
+	erc::{CollectionCall, CommonEvmHandler, PrecompileResult},
 	eth::CrossAddress,
-	CommonWeightInfo as _,
+	CollectionHandle, CommonWeightInfo as _,
 };
-use sp_std::vec::Vec;
 use pallet_evm::{account::CrossAccountId, PrecompileHandle};
 use pallet_evm_coder_substrate::{
 	call, dispatch_to_evm,
 	execution::{PreDispatch, Result},
 	frontier_contract,
 };
-use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};
-use sp_core::{U256, Get};
+use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};
+use sp_core::{Get, U256};
+use sp_std::vec::Vec;
+use up_data_structs::CollectionMode;
 
 use crate::{
-	Allowance, Balance, Config, FungibleHandle, Pallet, TotalSupply, SelfWeightOf,
-	weights::WeightInfo, common::CommonWeights,
+	common::CommonWeights, weights::WeightInfo, Allowance, Balance, Config, FungibleHandle, Pallet,
+	SelfWeightOf, TotalSupply,
 };
 
 frontier_contract! {
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -79,30 +79,26 @@
 #![cfg_attr(not(feature = "std"), no_std)]
 
 use core::ops::Deref;
+
 use evm_coder::ToLog;
-use frame_support::{
-	ensure,
-	pallet_prelude::{DispatchResultWithPostInfo, Pays},
-	dispatch::PostDispatchInfo,
-};
-use pallet_evm::account::CrossAccountId;
-use up_data_structs::{
-	AccessMode, CollectionId, TokenId, CreateCollectionData, mapping::TokenAddressMapping,
-	budget::Budget, PropertyKey, Property,
-};
+use frame_support::{dispatch::PostDispatchInfo, ensure, pallet_prelude::*};
+pub use pallet::*;
 use pallet_common::{
-	Error as CommonError, Event as CommonEvent, Pallet as PalletCommon,
-	eth::collection_id_to_address, SelfWeightOf as PalletCommonWeightOf,
-	weights::WeightInfo as CommonWeightInfo, helpers::add_weight_to_post_info,
+	eth::collection_id_to_address, helpers::add_weight_to_post_info,
+	weights::WeightInfo as CommonWeightInfo, Error as CommonError, Event as CommonEvent,
+	Pallet as PalletCommon, SelfWeightOf as PalletCommonWeightOf,
 };
-use pallet_evm::Pallet as PalletEvm;
+use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
+use pallet_evm_coder_substrate::WithRecorder;
 use pallet_structure::Pallet as PalletStructure;
-use pallet_evm_coder_substrate::WithRecorder;
 use sp_core::H160;
 use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};
 use sp_std::{collections::btree_map::BTreeMap, vec::Vec};
+use up_data_structs::{
+	budget::Budget, mapping::TokenAddressMapping, AccessMode, CollectionId, CreateCollectionData,
+	Property, PropertyKey, TokenId,
+};
 use weights::WeightInfo;
-pub use pallet::*;
 
 use crate::erc::ERC20Events;
 #[cfg(feature = "runtime-benchmarks")]
@@ -116,8 +112,11 @@
 
 #[frame_support::pallet]
 pub mod pallet {
-	use frame_support::{Blake2_128, Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key};
+	use frame_support::{
+		pallet_prelude::*, storage::Key, Blake2_128, Blake2_128Concat, Twox64Concat,
+	};
 	use up_data_structs::CollectionId;
+
 	use super::weights::WeightInfo;
 
 	#[pallet::error]
modifiedpallets/gov-origins/src/lib.rsdiffbeforeafterboth
--- a/pallets/gov-origins/src/lib.rs
+++ b/pallets/gov-origins/src/lib.rs
@@ -17,7 +17,6 @@
 #![cfg_attr(not(feature = "std"), no_std)]
 
 use frame_support::pallet_prelude::*;
-
 pub use pallet::*;
 
 #[frame_support::pallet]
modifiedpallets/identity/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/identity/src/benchmarking.rs
+++ b/pallets/identity/src/benchmarking.rs
@@ -37,17 +37,17 @@
 #![cfg(feature = "runtime-benchmarks")]
 #![allow(clippy::no_effect)]
 
-use super::*;
-
-use crate::Pallet as Identity;
 use frame_benchmarking::{account, benchmarks, whitelisted_caller};
 use frame_support::{
-	ensure, assert_ok,
+	assert_ok, ensure,
 	traits::{EnsureOrigin, Get},
 };
 use frame_system::RawOrigin;
 use sp_runtime::traits::Bounded;
 
+use super::*;
+use crate::Pallet as Identity;
+
 const SEED: u32 = 0;
 
 fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
modifiedpallets/identity/src/lib.rsdiffbeforeafterboth
--- a/pallets/identity/src/lib.rs
+++ b/pallets/identity/src/lib.rs
@@ -95,21 +95,18 @@
 mod types;
 pub mod weights;
 
-use frame_support::{
-	traits::{BalanceStatus, Currency, OnUnbalanced, ReservableCurrency},
-};
+use frame_support::traits::{BalanceStatus, Currency, OnUnbalanced, ReservableCurrency};
+pub use pallet::*;
 use sp_runtime::{
-	BoundedVec,
 	traits::{AppendZerosInput, Hash, Saturating, StaticLookup, Zero},
+	BoundedVec,
 };
 use sp_std::prelude::*;
-pub use weights::WeightInfo;
-
-pub use pallet::*;
 pub use types::{
 	Data, IdentityField, IdentityFields, IdentityInfo, Judgement, RegistrarIndex, RegistrarInfo,
 	Registration,
 };
+pub use weights::WeightInfo;
 
 pub type BalanceOf<T> =
 	<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
@@ -132,10 +129,11 @@
 
 #[frame_support::pallet]
 pub mod pallet {
-	use super::*;
 	use frame_support::pallet_prelude::*;
 	use frame_system::pallet_prelude::*;
 
+	use super::*;
+
 	#[pallet::config]
 	pub trait Config: frame_system::Config {
 		/// The overarching event type.
modifiedpallets/identity/src/tests.rsdiffbeforeafterboth
--- a/pallets/identity/src/tests.rs
+++ b/pallets/identity/src/tests.rs
@@ -34,22 +34,23 @@
 
 // Tests for Identity Pallet
 
-use super::*;
-use crate as pallet_identity;
-
-use codec::{Decode, Encode};
 use frame_support::{
 	assert_noop, assert_ok, ord_parameter_types, parameter_types,
 	traits::{ConstU32, ConstU64, EitherOfDiverse},
 	BoundedVec,
 };
 use frame_system::{EnsureRoot, EnsureSignedBy};
+use parity_scale_codec::{Decode, Encode};
 use sp_core::H256;
 use sp_runtime::{
 	testing::Header,
 	traits::{BadOrigin, BlakeTwo256, IdentityLookup},
+	BuildStorage,
 };
 
+use super::*;
+use crate as pallet_identity;
+
 type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
 type Block = frame_system::mocking::MockBlock<Test>;
 
modifiedpallets/identity/src/types.rsdiffbeforeafterboth
--- a/pallets/identity/src/types.rs
+++ b/pallets/identity/src/types.rs
@@ -32,13 +32,12 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-use super::*;
-use codec::{Decode, Encode, MaxEncodedLen};
 use enumflags2::{bitflags, BitFlags};
 use frame_support::{
 	traits::{ConstU32, Get},
 	BoundedVec, CloneNoBound, PartialEqNoBound, RuntimeDebugNoBound,
 };
+use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
 use scale_info::{
 	build::{Fields, Variants},
 	meta_type, Path, Type, TypeInfo, TypeParameter,
@@ -46,6 +45,8 @@
 use sp_runtime::{traits::Zero, RuntimeDebug};
 use sp_std::{fmt::Debug, iter::once, ops::Add, prelude::*};
 
+use super::*;
+
 /// Either underlying data blob if it is at most 32 bytes, or a hash of it. If the data is greater
 /// than 32-bytes then it will be truncated when encoding.
 ///
modifiedpallets/inflation/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/inflation/src/benchmarking.rs
+++ b/pallets/inflation/src/benchmarking.rs
@@ -16,11 +16,11 @@
 
 #![cfg(feature = "runtime-benchmarks")]
 
+use frame_benchmarking::benchmarks;
+use frame_support::traits::OnInitialize;
+
 use super::*;
 use crate::Pallet as Inflation;
-
-use frame_benchmarking::{benchmarks};
-use frame_support::traits::OnInitialize;
 
 benchmarks! {
 
modifiedpallets/inflation/src/lib.rsdiffbeforeafterboth
--- a/pallets/inflation/src/lib.rs
+++ b/pallets/inflation/src/lib.rs
@@ -37,17 +37,14 @@
 #[cfg(test)]
 mod tests;
 
-use frame_support::{
-	dispatch::{DispatchResult},
-	traits::{
-		fungible::{Balanced, Inspect, Mutate},
-		Get,
-		tokens::Precision,
-	},
+use frame_support::traits::{
+	fungible::{Balanced, Inspect, Mutate},
+	tokens::Precision,
+	Get,
 };
+use frame_system::pallet_prelude::BlockNumberFor;
 pub use pallet::*;
-use sp_runtime::{Perbill, traits::BlockNumberProvider};
-
+use sp_runtime::{traits::BlockNumberProvider, Perbill};
 use sp_std::convert::TryInto;
 
 type BalanceOf<T> =
@@ -61,10 +58,11 @@
 
 #[frame_support::pallet]
 pub mod pallet {
-	use super::*;
 	use frame_support::pallet_prelude::*;
 	use frame_system::pallet_prelude::*;
 
+	use super::*;
+
 	#[pallet::config]
 	pub trait Config: frame_system::Config {
 		type Currency: Balanced<Self::AccountId>
modifiedpallets/inflation/src/tests.rsdiffbeforeafterboth
--- a/pallets/inflation/src/tests.rs
+++ b/pallets/inflation/src/tests.rs
@@ -16,14 +16,12 @@
 
 #![cfg(test)]
 #![allow(clippy::from_over_into)]
-use crate as pallet_inflation;
-
 use frame_support::{
 	assert_ok, parameter_types,
 	traits::{
 		fungible::{Balanced, Inspect},
-		OnInitialize, Everything, ConstU32,
 		tokens::Precision,
+		ConstU32, Everything, OnInitialize,
 	},
 	weights::Weight,
 };
@@ -31,9 +29,11 @@
 use sp_core::H256;
 use sp_runtime::{
 	traits::{BlakeTwo256, BlockNumberProvider, IdentityLookup},
-	testing::Header,
+	BuildStorage,
 };
 
+use crate as pallet_inflation;
+
 type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
 type Block = frame_system::mocking::MockBlock<Test>;
 
modifiedpallets/maintenance/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/maintenance/src/benchmarking.rs
+++ b/pallets/maintenance/src/benchmarking.rs
@@ -14,13 +14,13 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use super::*;
-use crate::{Pallet as Maintenance, Config};
-
-use codec::Encode;
 use frame_benchmarking::benchmarks;
+use frame_support::{ensure, pallet_prelude::Weight, traits::StorePreimage};
 use frame_system::RawOrigin;
-use frame_support::{ensure, pallet_prelude::Weight, traits::StorePreimage};
+use parity_scale_codec::Encode;
+
+use super::*;
+use crate::{Config, Pallet as Maintenance};
 
 benchmarks! {
 	enable {
modifiedpallets/maintenance/src/lib.rsdiffbeforeafterboth
--- a/pallets/maintenance/src/lib.rs
+++ b/pallets/maintenance/src/lib.rs
@@ -26,10 +26,14 @@
 #[frame_support::pallet]
 pub mod pallet {
 
-	use frame_support::{dispatch::*, pallet_prelude::*};
-	use frame_support::traits::{QueryPreimage, StorePreimage, EnsureOrigin};
+	use frame_support::{
+		dispatch::*,
+		pallet_prelude::*,
+		traits::{EnsureOrigin, QueryPreimage, StorePreimage},
+	};
 	use frame_system::pallet_prelude::*;
 	use sp_core::H256;
+	use sp_runtime::traits::Dispatchable;
 
 	use crate::weights::WeightInfo;
 
@@ -111,7 +115,7 @@
 			hash: H256,
 			weight_bound: Weight,
 		) -> DispatchResultWithPostInfo {
-			use codec::Decode;
+			use parity_scale_codec::Decode;
 
 			T::PreimageOrigin::ensure_origin(origin.clone())?;
 
modifiedpallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/benchmarking.rs
+++ b/pallets/nonfungible/src/benchmarking.rs
@@ -14,10 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use super::*;
-use crate::{Pallet, Config, NonfungibleHandle};
-
-use frame_benchmarking::{benchmarks, account};
+use frame_benchmarking::{account, benchmarks};
 use pallet_common::{
 	bench_init,
 	benchmarking::{
@@ -27,10 +24,13 @@
 };
 use sp_std::prelude::*;
 use up_data_structs::{
-	CollectionMode, MAX_ITEMS_PER_BATCH, MAX_PROPERTIES_PER_ITEM, budget::Unlimited,
-	PropertyPermission,
+	budget::Unlimited, CollectionMode, PropertyPermission, MAX_ITEMS_PER_BATCH,
+	MAX_PROPERTIES_PER_ITEM,
 };
 
+use super::*;
+use crate::{Config, NonfungibleHandle, Pallet};
+
 const SEED: u32 = 1;
 
 fn create_max_item_data<T: Config>(owner: T::CrossAccountId) -> CreateItemData<T> {
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -17,21 +17,21 @@
 use core::marker::PhantomData;
 
 use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};
-use up_data_structs::{
-	TokenId, CreateItemExData, CollectionId, budget::Budget, Property, PropertyKey,
-	PropertyKeyPermission, PropertyValue, TokenOwnerError,
-};
 use pallet_common::{
-	CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,
-	weights::WeightInfo as _, SelfWeightOf as PalletCommonWeightOf, init_token_properties_delta,
+	init_token_properties_delta, weights::WeightInfo as _, with_weight, CommonCollectionOperations,
+	CommonWeightInfo, RefungibleExtensions, SelfWeightOf as PalletCommonWeightOf,
 };
 use pallet_structure::Pallet as PalletStructure;
 use sp_runtime::DispatchError;
-use sp_std::{vec::Vec, vec};
+use sp_std::{vec, vec::Vec};
+use up_data_structs::{
+	budget::Budget, CollectionId, CreateItemExData, Property, PropertyKey, PropertyKeyPermission,
+	PropertyValue, TokenId, TokenOwnerError,
+};
 
 use crate::{
-	AccountBalance, Allowance, Config, CreateItemData, Error, NonfungibleHandle, Owned, Pallet,
-	SelfWeightOf, TokenData, weights::WeightInfo, TokensMinted, TokenProperties,
+	weights::WeightInfo, AccountBalance, Allowance, Config, CreateItemData, Error,
+	NonfungibleHandle, Owned, Pallet, SelfWeightOf, TokenData, TokenProperties, TokensMinted,
 };
 
 pub struct CommonWeights<T: Config>(PhantomData<T>);
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -23,34 +23,34 @@
 
 use alloc::string::ToString;
 use core::{
-	char::{REPLACEMENT_CHARACTER, decode_utf16},
+	char::{decode_utf16, REPLACEMENT_CHARACTER},
 	convert::TryInto,
 };
-use evm_coder::{abi::AbiType, AbiCoder, ToLog, generate_stubgen, solidity_interface, types::*};
+
+use evm_coder::{abi::AbiType, generate_stubgen, solidity_interface, types::*, AbiCoder, ToLog};
 use frame_support::BoundedVec;
-use up_data_structs::{
-	TokenId, PropertyPermission, PropertyKeyPermission, Property, CollectionId, PropertyKey,
-	CollectionPropertiesVec,
+use pallet_common::{
+	erc::{static_property::key, CollectionCall, CommonEvmHandler, PrecompileResult},
+	eth::{self, TokenUri},
+	CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations, CommonWeightInfo,
 };
+use pallet_evm::{account::CrossAccountId, PrecompileHandle};
 use pallet_evm_coder_substrate::{
-	dispatch_to_evm, frontier_contract,
-	execution::{Result, PreDispatch, Error},
+	call, dispatch_to_evm,
+	execution::{Error, PreDispatch, Result},
+	frontier_contract,
 };
-use sp_std::{vec::Vec, vec};
-use pallet_common::{
-	CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,
-	erc::{CommonEvmHandler, PrecompileResult, CollectionCall, static_property::key},
-	eth::{self, TokenUri},
-	CommonWeightInfo,
+use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};
+use sp_core::{Get, U256};
+use sp_std::{vec, vec::Vec};
+use up_data_structs::{
+	CollectionId, CollectionPropertiesVec, Property, PropertyKey, PropertyKeyPermission,
+	PropertyPermission, TokenId,
 };
-use pallet_evm::{account::CrossAccountId, PrecompileHandle};
-use pallet_evm_coder_substrate::call;
-use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};
-use sp_core::{U256, Get};
 
 use crate::{
-	AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, TokenData, TokensMinted,
-	TokenProperties, SelfWeightOf, weights::WeightInfo, common::CommonWeights,
+	common::CommonWeights, weights::WeightInfo, AccountBalance, Config, CreateItemData,
+	NonfungibleHandle, Pallet, SelfWeightOf, TokenData, TokenProperties, TokensMinted,
 };
 
 /// Nft events.
modifiedpallets/refungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -14,12 +14,9 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use super::*;
-use crate::{Pallet, Config, RefungibleHandle};
+use core::{convert::TryInto, iter::IntoIterator};
 
-use core::convert::TryInto;
-use core::iter::IntoIterator;
-use frame_benchmarking::{benchmarks, account};
+use frame_benchmarking::{account, benchmarks};
 use pallet_common::{
 	bench_init,
 	benchmarking::{
@@ -28,10 +25,13 @@
 };
 use sp_std::prelude::*;
 use up_data_structs::{
-	CollectionMode, MAX_ITEMS_PER_BATCH, MAX_PROPERTIES_PER_ITEM, budget::Unlimited,
-	PropertyPermission,
+	budget::Unlimited, CollectionMode, PropertyPermission, MAX_ITEMS_PER_BATCH,
+	MAX_PROPERTIES_PER_ITEM,
 };
 
+use super::*;
+use crate::{Config, Pallet, RefungibleHandle};
+
 const SEED: u32 = 1;
 
 fn create_max_item_data<T: Config>(
modifiedpallets/refungible/src/common.rsdiffbeforeafterboth
--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -16,24 +16,25 @@
 
 use core::marker::PhantomData;
 
-use sp_std::collections::btree_map::BTreeMap;
-use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, traits::Get};
-use up_data_structs::{
-	CollectionId, TokenId, CreateItemExData, budget::Budget, Property, PropertyKey, PropertyValue,
-	PropertyKeyPermission, CreateRefungibleExMultipleOwners, CreateRefungibleExSingleOwner,
-	TokenOwnerError,
+use frame_support::{
+	dispatch::DispatchResultWithPostInfo, ensure, fail, traits::Get, weights::Weight,
 };
 use pallet_common::{
-	CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,
-	weights::WeightInfo as _, init_token_properties_delta,
+	init_token_properties_delta, weights::WeightInfo as _, with_weight, CommonCollectionOperations,
+	CommonWeightInfo, RefungibleExtensions,
 };
-use pallet_structure::{Pallet as PalletStructure, Error as StructureError};
-use sp_runtime::{DispatchError};
-use sp_std::{vec::Vec, vec};
+use pallet_structure::{Error as StructureError, Pallet as PalletStructure};
+use sp_runtime::DispatchError;
+use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec};
+use up_data_structs::{
+	budget::Budget, CollectionId, CreateItemExData, CreateRefungibleExMultipleOwners,
+	CreateRefungibleExSingleOwner, Property, PropertyKey, PropertyKeyPermission, PropertyValue,
+	TokenId, TokenOwnerError,
+};
 
 use crate::{
-	AccountBalance, Allowance, Balance, Config, Error, Owned, Pallet, RefungibleHandle,
-	SelfWeightOf, weights::WeightInfo, TokensMinted, TotalSupply, CreateItemData, TokenProperties,
+	weights::WeightInfo, AccountBalance, Allowance, Balance, Config, CreateItemData, Error, Owned,
+	Pallet, RefungibleHandle, SelfWeightOf, TokenProperties, TokensMinted, TotalSupply,
 };
 
 macro_rules! max_weight_of {
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -23,34 +23,35 @@
 
 use alloc::string::ToString;
 use core::{
-	char::{REPLACEMENT_CHARACTER, decode_utf16},
+	char::{decode_utf16, REPLACEMENT_CHARACTER},
 	convert::TryInto,
 };
-use evm_coder::{abi::AbiType, AbiCoder, ToLog, generate_stubgen, solidity_interface, types::*};
+
+use evm_coder::{abi::AbiType, generate_stubgen, solidity_interface, types::*, AbiCoder, ToLog};
 use frame_support::{BoundedBTreeMap, BoundedVec};
 use pallet_common::{
+	erc::{static_property::key, CollectionCall, CommonEvmHandler},
+	eth::{self, TokenUri},
 	CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,
 	Error as CommonError,
-	erc::{CommonEvmHandler, CollectionCall, static_property::key},
-	eth::{self, TokenUri},
 };
 use pallet_evm::{account::CrossAccountId, PrecompileHandle};
 use pallet_evm_coder_substrate::{
 	call, dispatch_to_evm,
-	execution::{PreDispatch, Result, Error},
+	execution::{Error, PreDispatch, Result},
 	frontier_contract,
 };
-use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};
-use sp_core::{H160, U256, Get};
-use sp_std::{collections::btree_map::BTreeMap, vec::Vec, vec};
+use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};
+use sp_core::{Get, H160, U256};
+use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec};
 use up_data_structs::{
-	CollectionId, CollectionPropertiesVec, mapping::TokenAddressMapping, Property, PropertyKey,
+	mapping::TokenAddressMapping, CollectionId, CollectionPropertiesVec, Property, PropertyKey,
 	PropertyKeyPermission, PropertyPermission, TokenId, TokenOwnerError,
 };
 
 use crate::{
-	AccountBalance, Balance, Config, CreateItemData, Pallet, RefungibleHandle, TokenProperties,
-	TokensMinted, TotalSupply, SelfWeightOf, weights::WeightInfo,
+	weights::WeightInfo, AccountBalance, Balance, Config, CreateItemData, Pallet, RefungibleHandle,
+	SelfWeightOf, TokenProperties, TokensMinted, TotalSupply,
 };
 
 frontier_contract! {
modifiedpallets/refungible/src/erc_token.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc_token.rs
+++ b/pallets/refungible/src/erc_token.rs
@@ -20,11 +20,12 @@
 //! Method implementations are mostly doing parameter conversion and calling Nonfungible Pallet methods.
 
 use core::{
-	char::{REPLACEMENT_CHARACTER, decode_utf16},
+	char::{decode_utf16, REPLACEMENT_CHARACTER},
 	convert::TryInto,
 	ops::Deref,
 };
-use evm_coder::{abi::AbiType, ToLog, generate_stubgen, solidity_interface, types::*};
+
+use evm_coder::{abi::AbiType, generate_stubgen, solidity_interface, types::*, ToLog};
 use pallet_common::{
 	erc::{CommonEvmHandler, PrecompileResult},
 	eth::{collection_id_to_address, CrossAddress},
@@ -32,17 +33,18 @@
 };
 use pallet_evm::{account::CrossAccountId, PrecompileHandle};
 use pallet_evm_coder_substrate::{
-	call, dispatch_to_evm, WithRecorder, frontier_contract,
-	execution::{Result, PreDispatch},
+	call, dispatch_to_evm,
+	execution::{PreDispatch, Result},
+	frontier_contract, WithRecorder,
 };
-use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};
-use sp_std::vec::Vec;
+use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};
 use sp_core::U256;
+use sp_std::vec::Vec;
 use up_data_structs::TokenId;
 
 use crate::{
-	Allowance, Balance, Config, Pallet, RefungibleHandle, TotalSupply, common::CommonWeights,
-	SelfWeightOf, weights::WeightInfo,
+	common::CommonWeights, weights::WeightInfo, Allowance, Balance, Config, Pallet,
+	RefungibleHandle, SelfWeightOf, TotalSupply,
 };
 
 /// Refungible token handle contains information about token's collection and id
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -87,30 +87,29 @@
 
 #![cfg_attr(not(feature = "std"), no_std)]
 
-use crate::erc_token::ERC20Events;
-use crate::erc::ERC721Events;
+use core::{cmp::Ordering, ops::Deref};
 
-use core::{ops::Deref, cmp::Ordering};
 use evm_coder::ToLog;
 use frame_support::{ensure, storage::with_transaction, transactional};
-use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
-use pallet_evm_coder_substrate::WithRecorder;
+pub use pallet::*;
 use pallet_common::{
-	Error as CommonError, eth::collection_id_to_address, Event as CommonEvent,
+	eth::collection_id_to_address, Error as CommonError, Event as CommonEvent,
 	Pallet as PalletCommon,
 };
+use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
+use pallet_evm_coder_substrate::WithRecorder;
 use pallet_structure::Pallet as PalletStructure;
 use sp_core::{Get, H160};
 use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, TransactionOutcome};
-use sp_std::{vec::Vec, vec, collections::btree_map::BTreeMap};
+use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec};
 use up_data_structs::{
-	AccessMode, budget::Budget, CollectionId, CreateCollectionData, mapping::TokenAddressMapping,
-	MAX_REFUNGIBLE_PIECES, Property, PropertyKey, PropertyKeyPermission, PropertyScope,
-	PropertyValue, TokenId, PropertiesPermissionMap, CreateRefungibleExMultipleOwners,
-	TokenOwnerError, TokenProperties as TokenPropertiesT,
+	budget::Budget, mapping::TokenAddressMapping, AccessMode, CollectionId, CreateCollectionData,
+	CreateRefungibleExMultipleOwners, PropertiesPermissionMap, Property, PropertyKey,
+	PropertyKeyPermission, PropertyScope, PropertyValue, TokenId, TokenOwnerError,
+	TokenProperties as TokenPropertiesT, TrySetProperty, MAX_REFUNGIBLE_PIECES,
 };
 
-pub use pallet::*;
+use crate::{erc::ERC721Events, erc_token::ERC20Events};
 #[cfg(feature = "runtime-benchmarks")]
 pub mod benchmarking;
 pub mod common;
@@ -124,14 +123,14 @@
 
 #[frame_support::pallet]
 pub mod pallet {
-	use super::*;
 	use frame_support::{
-		Blake2_128, Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key,
-		traits::StorageVersion,
+		pallet_prelude::*, storage::Key, traits::StorageVersion, Blake2_128, Blake2_128Concat,
+		Twox64Concat,
 	};
 	use up_data_structs::{CollectionId, TokenId};
-	use super::weights::WeightInfo;
 
+	use super::{weights::WeightInfo, *};
+
 	#[pallet::error]
 	pub enum Error<T> {
 		/// Not Refungible item data used to mint in Refungible collection.
modifiedpallets/structure/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/structure/src/benchmarking.rs
+++ b/pallets/structure/src/benchmarking.rs
@@ -14,16 +14,16 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use super::*;
-
-use frame_benchmarking::{benchmarks, account};
-use frame_support::traits::{fungible::Balanced, Get, tokens::Precision};
+use frame_benchmarking::{account, benchmarks};
+use frame_support::traits::{fungible::Balanced, tokens::Precision, Get};
+use pallet_common::Config as CommonConfig;
+use pallet_evm::account::CrossAccountId;
 use up_data_structs::{
-	CreateCollectionData, CollectionMode, CreateItemData, CreateNftData, budget::Unlimited,
+	budget::Unlimited, CollectionMode, CreateCollectionData, CreateItemData, CreateNftData,
 };
-use pallet_common::Config as CommonConfig;
-use pallet_evm::account::CrossAccountId;
 
+use super::*;
+
 const SEED: u32 = 1;
 
 benchmarks! {
modifiedpallets/structure/src/lib.rsdiffbeforeafterboth
--- a/pallets/structure/src/lib.rs
+++ b/pallets/structure/src/lib.rs
@@ -53,29 +53,31 @@
 
 #![cfg_attr(not(feature = "std"), no_std)]
 
-use pallet_common::CommonCollectionOperations;
-use pallet_common::{erc::CrossAccountId, eth::is_collection};
+use frame_support::{
+	dispatch::{DispatchResult, DispatchResultWithPostInfo},
+	fail,
+	pallet_prelude::*,
+};
+use pallet_common::{
+	dispatch::CollectionDispatch, erc::CrossAccountId, eth::is_collection,
+	CommonCollectionOperations,
+};
 use sp_std::collections::btree_set::BTreeSet;
-
-use frame_support::dispatch::{DispatchError, DispatchResult, DispatchResultWithPostInfo};
-use frame_support::fail;
-pub use pallet::*;
-use pallet_common::{dispatch::CollectionDispatch};
 use up_data_structs::{
-	CollectionId, TokenId, mapping::TokenAddressMapping, budget::Budget, TokenOwnerError,
+	budget::Budget, mapping::TokenAddressMapping, CollectionId, TokenId, TokenOwnerError,
 };
 
 #[cfg(feature = "runtime-benchmarks")]
 pub mod benchmarking;
 pub mod weights;
 
+pub use pallet::*;
+
 pub type SelfWeightOf<T> = <T as crate::Config>::WeightInfo;
 
 #[frame_support::pallet]
 pub mod pallet {
-	use frame_support::Parameter;
-	use frame_support::dispatch::{GetDispatchInfo, UnfilteredDispatchable};
-	use frame_support::pallet_prelude::*;
+	use frame_support::{dispatch::GetDispatchInfo, traits::UnfilteredDispatchable, Parameter};
 
 	use super::*;
 
modifiedpallets/unique/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/unique/src/benchmarking.rs
+++ b/pallets/unique/src/benchmarking.rs
@@ -16,22 +16,23 @@
 
 #![cfg(feature = "runtime-benchmarks")]
 
-use super::*;
-use crate::Pallet;
+use frame_benchmarking::{account, benchmarks};
+use frame_support::traits::{fungible::Balanced, tokens::Precision, Get};
 use frame_system::RawOrigin;
-use frame_support::traits::{fungible::Balanced, Get, tokens::Precision};
-use frame_benchmarking::{benchmarks, account};
-use sp_runtime::DispatchError;
 use pallet_common::{
-	Config as CommonConfig,
 	benchmarking::{create_data, create_u16_data},
+	erc::CrossAccountId,
+	Config as CommonConfig,
 };
+use sp_runtime::DispatchError;
 use up_data_structs::{
-	CollectionId, CollectionMode, MAX_COLLECTION_NAME_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
-	MAX_COLLECTION_DESCRIPTION_LENGTH, CollectionLimits,
+	CollectionId, CollectionLimits, CollectionMode, MAX_COLLECTION_DESCRIPTION_LENGTH,
+	MAX_COLLECTION_NAME_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
 };
-use pallet_common::erc::CrossAccountId;
 
+use super::*;
+use crate::Pallet;
+
 const SEED: u32 = 1;
 
 fn create_collection_helper<T: Config>(
modifiedpallets/unique/src/eth/mod.rsdiffbeforeafterboth
--- a/pallets/unique/src/eth/mod.rs
+++ b/pallets/unique/src/eth/mod.rs
@@ -16,32 +16,31 @@
 
 //! Implementation of CollectionHelpers contract.
 //!
+use alloc::{collections::BTreeSet, format};
 use core::marker::PhantomData;
+
 use ethereum as _;
 use evm_coder::{abi::AbiType, generate_stubgen, solidity_interface, types::*};
-use frame_support::{BoundedVec, traits::Get};
+use frame_support::{traits::Get, BoundedVec};
 use pallet_common::{
-	CollectionById,
 	dispatch::CollectionDispatch,
-	erc::{CollectionHelpersEvents, static_property::key},
-	eth::{self, map_eth_to_id, collection_id_to_address},
-	Pallet as PalletCommon, CollectionHandle,
+	erc::{static_property::key, CollectionHelpersEvents},
+	eth::{self, collection_id_to_address, map_eth_to_id},
+	CollectionById, CollectionHandle, Pallet as PalletCommon,
 };
 use pallet_evm::{account::CrossAccountId, OnMethodCall, PrecompileHandle, PrecompileResult};
 use pallet_evm_coder_substrate::{
-	dispatch_to_evm, SubstrateRecorder, WithRecorder,
-	execution::{PreDispatch, Result, Error},
-	frontier_contract,
+	dispatch_to_evm,
+	execution::{Error, PreDispatch, Result},
+	frontier_contract, SubstrateRecorder, WithRecorder,
 };
+use sp_std::vec::Vec;
 use up_data_structs::{
 	CollectionDescription, CollectionMode, CollectionName, CollectionPermissions,
 	CollectionTokenPrefix, CreateCollectionData, NestingPermissions,
 };
 
 use crate::{weights::WeightInfo, Config, Pallet, SelfWeightOf};
-
-use alloc::{format, collections::BTreeSet};
-use sp_std::vec::Vec;
 
 frontier_contract! {
 	macro_rules! EvmCollectionHelpers_result {...}
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -73,9 +73,9 @@
 
 extern crate alloc;
 
-pub use pallet::*;
 use frame_support::pallet_prelude::*;
 use frame_system::pallet_prelude::*;
+pub use pallet::*;
 pub mod eth;
 
 #[cfg(feature = "runtime-benchmarks")]
@@ -84,27 +84,27 @@
 
 #[frame_support::pallet]
 pub mod pallet {
-	use super::*;
-
-	use frame_support::{dispatch::DispatchResult, ensure, fail, BoundedVec, storage::Key};
+	use frame_support::{dispatch::DispatchResult, ensure, fail, storage::Key, BoundedVec};
+	use frame_system::{ensure_root, ensure_signed};
+	use pallet_common::{
+		dispatch::{dispatch_tx, CollectionDispatch},
+		CollectionHandle, CommonWeightInfo, Pallet as PalletCommon, RefungibleExtensionsWeightInfo,
+	};
+	use pallet_evm::account::CrossAccountId;
 	use scale_info::TypeInfo;
-	use frame_system::{ensure_signed, ensure_root};
 	use sp_std::{vec, vec::Vec};
 	use up_data_structs::{
-		MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
-		MAX_PROPERTIES_PER_ITEM, MAX_PROPERTY_KEY_LENGTH, MAX_PROPERTY_VALUE_LENGTH,
-		MAX_COLLECTION_PROPERTIES_SIZE, COLLECTION_ADMINS_LIMIT, MAX_TOKEN_PROPERTIES_SIZE,
-		CreateItemData, CollectionLimits, CollectionPermissions, CollectionId, CollectionMode,
-		TokenId, CreateCollectionData, CreateItemExData, budget, Property, PropertyKey,
-		PropertyKeyPermission,
-	};
-	use pallet_evm::account::CrossAccountId;
-	use pallet_common::{
-		CollectionHandle, Pallet as PalletCommon, CommonWeightInfo, dispatch::dispatch_tx,
-		dispatch::CollectionDispatch, RefungibleExtensionsWeightInfo,
+		budget, CollectionId, CollectionLimits, CollectionMode, CollectionPermissions,
+		CreateCollectionData, CreateItemData, CreateItemExData, Property, PropertyKey,
+		PropertyKeyPermission, TokenId, COLLECTION_ADMINS_LIMIT, MAX_COLLECTION_DESCRIPTION_LENGTH,
+		MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_PROPERTIES_SIZE, MAX_PROPERTIES_PER_ITEM,
+		MAX_PROPERTY_KEY_LENGTH, MAX_PROPERTY_VALUE_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
+		MAX_TOKEN_PROPERTIES_SIZE,
 	};
 	use weights::WeightInfo;
 
+	use super::*;
+
 	/// A maximum number of levels of depth in the token nesting tree.
 	pub const NESTING_BUDGET: u32 = 5;
 
modifiedprimitives/app_promotion_rpc/src/lib.rsdiffbeforeafterboth
--- a/primitives/app_promotion_rpc/src/lib.rs
+++ b/primitives/app_promotion_rpc/src/lib.rs
@@ -16,12 +16,12 @@
 
 #![cfg_attr(not(feature = "std"), no_std)]
 
-use sp_std::vec::Vec;
-use codec::Decode;
+use parity_scale_codec::Decode;
 use sp_runtime::{
+	traits::{AtLeast32BitUnsigned, Member},
 	DispatchError,
-	traits::{AtLeast32BitUnsigned, Member},
 };
+use sp_std::vec::Vec;
 
 type Result<T> = core::result::Result<T, DispatchError>;
 
modifiedprimitives/common/src/constants.rsdiffbeforeafterboth
--- a/primitives/common/src/constants.rs
+++ b/primitives/common/src/constants.rs
@@ -14,13 +14,14 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use sp_runtime::Perbill;
+use cumulus_primitives_core::relay_chain::MAX_POV_SIZE;
 use frame_support::{
 	parameter_types,
-	weights::{Weight, constants::WEIGHT_REF_TIME_PER_SECOND},
+	weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
 };
-use cumulus_primitives_core::relay_chain::MAX_POV_SIZE;
-use crate::types::{BlockNumber, Balance};
+use sp_runtime::Perbill;
+
+use crate::types::{Balance, BlockNumber};
 
 pub const MILLISECS_PER_BLOCK: u64 = 12000;
 pub const MILLISECS_PER_RELAY_BLOCK: u64 = 6000;
modifiedprimitives/common/src/types.rsdiffbeforeafterboth
--- a/primitives/common/src/types.rs
+++ b/primitives/common/src/types.rs
@@ -16,7 +16,7 @@
 
 use sp_runtime::{
 	generic,
-	traits::{Verify, IdentifyAccount},
+	traits::{IdentifyAccount, Verify},
 	MultiSignature,
 };
 
@@ -27,7 +27,7 @@
 pub mod opaque {
 	pub use sp_runtime::{generic, traits::BlakeTwo256, OpaqueExtrinsic as UncheckedExtrinsic};
 
-	pub use super::{BlockNumber, Signature, AccountId, Balance, Index, Hash, AuraId};
+	pub use super::{AccountId, AuraId, Balance, BlockNumber, Hash, Signature};
 
 	#[derive(Debug, Clone)]
 	pub enum RuntimeId {
modifiedprimitives/data-structs/src/bounded.rsdiffbeforeafterboth
--- a/primitives/data-structs/src/bounded.rs
+++ b/primitives/data-structs/src/bounded.rs
@@ -17,13 +17,15 @@
 //! This module contins implementations for support bounded structures ([`BoundedVec`], [`BoundedBTreeMap`], [`BoundedBTreeSet`]) in [`serde`].
 
 use core::fmt;
-use sp_std::collections::{btree_map::BTreeMap, btree_set::BTreeSet};
-use sp_std::vec::Vec;
 
 use frame_support::{
+	storage::{bounded_btree_map::BoundedBTreeMap, bounded_btree_set::BoundedBTreeSet},
 	BoundedVec,
-	storage::{bounded_btree_map::BoundedBTreeMap, bounded_btree_set::BoundedBTreeSet},
 };
+use sp_std::{
+	collections::{btree_map::BTreeMap, btree_set::BTreeSet},
+	vec::Vec,
+};
 
 /// [`serde`] implementations for [`BoundedVec`].
 pub mod vec_serde {
modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
before · primitives/data-structs/src/lib.rs
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/>.1617//! # Primitives crate.18//!19//! This crate contains types, traits and constants.2021#![cfg_attr(not(feature = "std"), no_std)]2223use core::{24	convert::{TryFrom, TryInto},25	fmt,26	ops::Deref,27};28use frame_support::storage::{bounded_btree_map::BoundedBTreeMap, bounded_btree_set::BoundedBTreeSet};2930#[cfg(feature = "serde")]31use serde::{Serialize, Deserialize};3233use sp_core::U256;34use sp_runtime::{ArithmeticError, sp_std::prelude::Vec};35use sp_std::collections::btree_set::BTreeSet;36use codec::{Decode, Encode, EncodeLike, MaxEncodedLen};37use frame_support::{BoundedVec, traits::ConstU32};38use derivative::Derivative;39use scale_info::TypeInfo;40use evm_coder::AbiCoderFlags;41use bondrewd::Bitfields;4243mod bondrewd_codec;44mod bounded;45pub mod budget;46pub mod mapping;47mod migration;4849/// Maximum of decimal points.50pub const MAX_DECIMAL_POINTS: DecimalPoints = 30;5152/// Maximum pieces for refungible token.53pub const MAX_REFUNGIBLE_PIECES: u128 = 1_000_000_000_000_000_000_000;54pub const MAX_SPONSOR_TIMEOUT: u32 = 10_368_000;5556/// Maximum tokens for user.57pub const MAX_TOKEN_OWNERSHIP: u32 = if cfg!(not(feature = "limit-testing")) {58	100_00059} else {60	1061};6263/// Maximum for collections can be created.64pub const COLLECTION_NUMBER_LIMIT: u32 = if cfg!(not(feature = "limit-testing")) {65	100_00066} else {67	1068};6970/// Maximum for various custom data of token.71pub const CUSTOM_DATA_LIMIT: u32 = if cfg!(not(feature = "limit-testing")) {72	204873} else {74	1075};7677/// Maximum admins per collection.78pub const COLLECTION_ADMINS_LIMIT: u32 = 5;7980/// Maximum tokens per collection.81pub const COLLECTION_TOKEN_LIMIT: u32 = u32::MAX;8283/// Maximum tokens per account.84pub const ACCOUNT_TOKEN_OWNERSHIP_LIMIT: u32 = if cfg!(not(feature = "limit-testing")) {85	1_000_00086} else {87	1088};8990/// Default timeout for transfer sponsoring NFT item.91pub const NFT_SPONSOR_TRANSFER_TIMEOUT: u32 = 5;92/// Default timeout for transfer sponsoring fungible item.93pub const FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT: u32 = 5;94/// Default timeout for transfer sponsoring refungible item.95pub const REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT: u32 = 5;9697/// Default timeout for sponsored approving.98pub const SPONSOR_APPROVE_TIMEOUT: u32 = 5;99100// Schema limits101pub const OFFCHAIN_SCHEMA_LIMIT: u32 = 8192;102pub const VARIABLE_ON_CHAIN_SCHEMA_LIMIT: u32 = 8192;103pub const CONST_ON_CHAIN_SCHEMA_LIMIT: u32 = 32768;104105// TODO: not used. Delete?106pub const COLLECTION_FIELD_LIMIT: u32 = CONST_ON_CHAIN_SCHEMA_LIMIT;107108/// Maximal length of a collection name.109pub const MAX_COLLECTION_NAME_LENGTH: u32 = 64;110111/// Maximal length of a collection description.112pub const MAX_COLLECTION_DESCRIPTION_LENGTH: u32 = 256;113114/// Maximal length of a token prefix.115pub const MAX_TOKEN_PREFIX_LENGTH: u32 = 16;116117/// Maximal length of a property key.118pub const MAX_PROPERTY_KEY_LENGTH: u32 = 256;119120/// Maximal length of a property value.121pub const MAX_PROPERTY_VALUE_LENGTH: u32 = 32768;122123/// A maximum number of token properties.124pub const MAX_PROPERTIES_PER_ITEM: u32 = 64;125126/// Maximal lenght of extended property value.127pub const MAX_AUX_PROPERTY_VALUE_LENGTH: u32 = 2048;128129/// Maximum size for all collection properties.130pub const MAX_COLLECTION_PROPERTIES_SIZE: u32 = 40960;131132/// Maximum size of all token properties.133pub const MAX_TOKEN_PROPERTIES_SIZE: u32 = 32768;134135/// How much items can be created per single136/// create_many call.137pub const MAX_ITEMS_PER_BATCH: u32 = 200;138139/// Used for limit bounded types of token custom data.140pub type CustomDataLimit = ConstU32<CUSTOM_DATA_LIMIT>;141142/// Collection id.143#[derive(144	Encode,145	Decode,146	PartialEq,147	Eq,148	PartialOrd,149	Ord,150	Clone,151	Copy,152	Debug,153	Default,154	TypeInfo,155	MaxEncodedLen,156	Serialize,157	Deserialize,158)]159pub struct CollectionId(pub u32);160impl EncodeLike<u32> for CollectionId {}161impl EncodeLike<CollectionId> for u32 {}162163impl From<u32> for CollectionId {164	fn from(value: u32) -> Self {165		Self(value)166	}167}168169impl Deref for CollectionId {170	type Target = u32;171172	fn deref(&self) -> &Self::Target {173		&self.0174	}175}176177/// Token id.178#[derive(179	Encode,180	Decode,181	PartialEq,182	Eq,183	PartialOrd,184	Ord,185	Clone,186	Copy,187	Debug,188	Default,189	TypeInfo,190	MaxEncodedLen,191	Serialize,192	Deserialize,193)]194pub struct TokenId(pub u32);195impl EncodeLike<u32> for TokenId {}196impl EncodeLike<TokenId> for u32 {}197198impl TokenId {199	/// Try to get next token id.200	///201	/// If next id cause overflow, then [`ArithmeticError::Overflow`] returned.202	pub fn try_next(self) -> Result<TokenId, ArithmeticError> {203		self.0204			.checked_add(1)205			.ok_or(ArithmeticError::Overflow)206			.map(Self)207	}208}209210impl From<TokenId> for U256 {211	fn from(t: TokenId) -> Self {212		t.0.into()213	}214}215216impl TryFrom<U256> for TokenId {217	type Error = &'static str;218219	fn try_from(value: U256) -> Result<Self, Self::Error> {220		Ok(TokenId(value.try_into().map_err(|_| "too large token id")?))221	}222}223224/// Token data.225#[struct_versioning::versioned(version = 2, upper)]226#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, Serialize, Deserialize)]227pub struct TokenData<CrossAccountId> {228	/// Properties of token.229	pub properties: Vec<Property>,230231	/// Token owner.232	pub owner: Option<CrossAccountId>,233234	/// Token pieces.235	#[version(2.., upper(0))]236	pub pieces: u128,237}238239// TODO: unused type240pub struct OverflowError;241impl From<OverflowError> for &'static str {242	fn from(_: OverflowError) -> Self {243		"overflow occured"244	}245}246247/// Alias for decimal points type.248pub type DecimalPoints = u8;249250/// Collection mode.251///252/// Collection can represent various types of tokens.253/// Each collection can contain only one type of tokens at a time.254/// This type helps to understand which tokens the collection contains.255#[derive(256	Encode, Decode, Eq, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen, Serialize, Deserialize,257)]258pub enum CollectionMode {259	/// Non fungible tokens.260	NFT,261	/// Fungible tokens.262	Fungible(DecimalPoints),263	/// Refungible tokens.264	ReFungible,265}266267impl CollectionMode {268	/// Get collection mod as number.269	pub fn id(&self) -> u8 {270		match self {271			CollectionMode::NFT => 1,272			CollectionMode::Fungible(_) => 2,273			CollectionMode::ReFungible => 3,274		}275	}276}277278// TODO: unused trait279pub trait SponsoringResolve<AccountId, Call> {280	fn resolve(who: &AccountId, call: &Call) -> Option<AccountId>;281}282283/// Access mode for some token operations.284#[derive(285	Encode,286	Decode,287	Eq,288	Debug,289	Clone,290	Copy,291	PartialEq,292	TypeInfo,293	MaxEncodedLen,294	Serialize,295	Deserialize,296)]297pub enum AccessMode {298	/// Access grant for owner and admins. Used as default.299	Normal,300	/// Like a [`Normal`](AccessMode::Normal) but also users in allow list.301	AllowList,302}303impl Default for AccessMode {304	fn default() -> Self {305		Self::Normal306	}307}308309// TODO: remove in future.310#[derive(311	Encode, Decode, Eq, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen, Serialize, Deserialize,312)]313pub enum SchemaVersion {314	ImageURL,315	Unique,316}317impl Default for SchemaVersion {318	fn default() -> Self {319		Self::ImageURL320	}321}322323// TODO: unused type324#[derive(Encode, Decode, Default, Debug, Clone, PartialEq, TypeInfo, Serialize, Deserialize)]325pub struct Ownership<AccountId> {326	pub owner: AccountId,327	pub fraction: u128,328}329330/// The state of collection sponsorship.331#[derive(332	Encode, Decode, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen, Serialize, Deserialize,333)]334pub enum SponsorshipState<AccountId> {335	/// The fees are applied to the transaction sender.336	Disabled,337	/// The sponsor is under consideration. Until the sponsor gives his consent,338	/// the fee will still be charged to sender.339	Unconfirmed(AccountId),340	/// Transactions are sponsored by specified account.341	Confirmed(AccountId),342}343344impl<AccountId> SponsorshipState<AccountId> {345	/// Get a sponsor of the collection who has confirmed his status.346	pub fn sponsor(&self) -> Option<&AccountId> {347		match self {348			Self::Confirmed(sponsor) => Some(sponsor),349			_ => None,350		}351	}352353	/// Get a sponsor of the collection who has pending or confirmed status.354	pub fn pending_sponsor(&self) -> Option<&AccountId> {355		match self {356			Self::Unconfirmed(sponsor) | Self::Confirmed(sponsor) => Some(sponsor),357			_ => None,358		}359	}360361	/// Whether the sponsorship is confirmed.362	pub fn confirmed(&self) -> bool {363		matches!(self, Self::Confirmed(_))364	}365}366367impl<T> Default for SponsorshipState<T> {368	fn default() -> Self {369		Self::Disabled370	}371}372373pub type CollectionName = BoundedVec<u16, ConstU32<MAX_COLLECTION_NAME_LENGTH>>;374pub type CollectionDescription = BoundedVec<u16, ConstU32<MAX_COLLECTION_DESCRIPTION_LENGTH>>;375pub type CollectionTokenPrefix = BoundedVec<u8, ConstU32<MAX_TOKEN_PREFIX_LENGTH>>;376377#[derive(AbiCoderFlags, Bitfields, Clone, Copy, PartialEq, Eq, Debug, Default)]378#[bondrewd(enforce_bytes = 1)]379pub struct CollectionFlags {380	/// Tokens in foreign collections can be transferred, but not burnt381	#[bondrewd(bits = "0..1")]382	pub foreign: bool,383	/// Supports ERC721Metadata384	#[bondrewd(bits = "1..2")]385	pub erc721metadata: bool,386	/// External collections can't be managed using `unique` api387	#[bondrewd(bits = "7..8")]388	pub external: bool,389	/// Reserved flags390	#[bondrewd(bits = "2..7")]391	pub reserved: u8,392}393bondrewd_codec!(CollectionFlags);394395impl CollectionFlags {396	pub fn is_allowed_for_user(self) -> bool {397		!self.foreign && !self.external && self.reserved == 0398	}399}400401/// Base structure for represent collection.402///403/// Used to provide basic functionality for all types of collections.404///405/// #### Note406/// Collection parameters, used in storage (see [`RpcCollection`] for the RPC version).407#[struct_versioning::versioned(version = 2, upper)]408#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen)]409pub struct Collection<AccountId> {410	/// Collection owner account.411	pub owner: AccountId,412413	/// Collection mode.414	pub mode: CollectionMode,415416	/// Access mode.417	#[version(..2)]418	pub access: AccessMode,419420	/// Collection name.421	pub name: CollectionName,422423	/// Collection description.424	pub description: CollectionDescription,425426	/// Token prefix.427	pub token_prefix: CollectionTokenPrefix,428429	#[version(..2)]430	pub mint_mode: bool,431432	#[version(..2)]433	pub offchain_schema: BoundedVec<u8, ConstU32<OFFCHAIN_SCHEMA_LIMIT>>,434435	#[version(..2)]436	pub schema_version: SchemaVersion,437438	/// The state of sponsorship of the collection.439	pub sponsorship: SponsorshipState<AccountId>,440441	/// Collection limits.442	pub limits: CollectionLimits,443444	/// Collection permissions.445	#[version(2.., upper(Default::default()))]446	pub permissions: CollectionPermissions,447448	#[version(2.., upper(Default::default()))]449	pub flags: CollectionFlags,450451	#[version(..2)]452	pub variable_on_chain_schema: BoundedVec<u8, ConstU32<VARIABLE_ON_CHAIN_SCHEMA_LIMIT>>,453454	#[version(..2)]455	pub const_on_chain_schema: BoundedVec<u8, ConstU32<CONST_ON_CHAIN_SCHEMA_LIMIT>>,456457	#[version(..2)]458	pub meta_update_permission: MetaUpdatePermission,459}460461#[derive(Debug, Encode, Decode, Clone, PartialEq, TypeInfo, Serialize, Deserialize)]462pub struct RpcCollectionFlags {463	/// Is collection is foreign.464	pub foreign: bool,465	/// Collection supports ERC721Metadata.466	pub erc721metadata: bool,467}468469/// Collection parameters, used in RPC calls (see [`Collection`] for the storage version).470#[struct_versioning::versioned(version = 2, upper)]471#[derive(Debug, Encode, Decode, Clone, PartialEq, TypeInfo, Serialize, Deserialize)]472pub struct RpcCollection<AccountId> {473	/// Collection owner account.474	pub owner: AccountId,475476	/// Collection mode.477	pub mode: CollectionMode,478479	/// Collection name.480	pub name: Vec<u16>,481482	/// Collection description.483	pub description: Vec<u16>,484485	/// Token prefix.486	pub token_prefix: Vec<u8>,487488	/// The state of sponsorship of the collection.489	pub sponsorship: SponsorshipState<AccountId>,490491	/// Collection limits.492	pub limits: CollectionLimits,493494	/// Collection permissions.495	pub permissions: CollectionPermissions,496497	/// Token property permissions.498	pub token_property_permissions: Vec<PropertyKeyPermission>,499500	/// Collection properties.501	pub properties: Vec<Property>,502503	/// Is collection read only.504	pub read_only: bool,505506	/// Extra collection flags507	#[version(2.., upper(RpcCollectionFlags {foreign: false, erc721metadata: false}))]508	pub flags: RpcCollectionFlags,509}510511impl<AccountId> From<CollectionVersion1<AccountId>> for RpcCollection<AccountId> {512	fn from(value: CollectionVersion1<AccountId>) -> Self {513		let CollectionVersion1 {514			name,515			description,516			owner,517			mode,518			access,519			token_prefix,520			mint_mode,521			sponsorship,522			limits,523			..524		} = value;525526		RpcCollection {527			name: name.into_inner(),528			description: description.into_inner(),529			owner,530			mode,531			token_prefix: token_prefix.into_inner(),532			sponsorship,533			limits,534			permissions: CollectionPermissions {535				access: Some(access),536				mint_mode: Some(mint_mode),537				nesting: None,538			},539			token_property_permissions: Vec::default(),540			properties: Vec::default(),541			read_only: true,542543			flags: RpcCollectionFlags {544				foreign: false,545				erc721metadata: false,546			},547		}548	}549}550551pub struct RawEncoded(Vec<u8>);552553impl parity_scale_codec::Decode for RawEncoded {554	fn decode<I: parity_scale_codec::Input>(555		input: &mut I,556	) -> Result<Self, parity_scale_codec::Error> {557		let mut out = Vec::new();558		while let Ok(v) = input.read_byte() {559			out.push(v);560		}561		Ok(Self(out))562	}563}564565impl Deref for RawEncoded {566	type Target = Vec<u8>;567568	fn deref(&self) -> &Self::Target {569		&self.0570	}571}572573/// Data used for create collection.574///575/// All fields are wrapped in [`Option`], where `None` means chain default.576#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, Derivative, MaxEncodedLen)]577#[derivative(Debug, Default(bound = ""))]578pub struct CreateCollectionData<CrossAccountId> {579	/// Collection mode.580	#[derivative(Default(value = "CollectionMode::NFT"))]581	pub mode: CollectionMode,582583	/// Access mode.584	pub access: Option<AccessMode>,585586	/// Collection name.587	pub name: CollectionName,588589	/// Collection description.590	pub description: CollectionDescription,591592	/// Token prefix.593	pub token_prefix: CollectionTokenPrefix,594595	/// Collection limits.596	pub limits: Option<CollectionLimits>,597598	/// Collection permissions.599	pub permissions: Option<CollectionPermissions>,600601	/// Token property permissions.602	pub token_property_permissions: CollectionPropertiesPermissionsVec,603604	/// Collection properties.605	pub properties: CollectionPropertiesVec,606607	pub admin_list: Vec<CrossAccountId>,608609	/// Pending collection sponsor.610	pub pending_sponsor: Option<CrossAccountId>,611612	pub flags: CollectionFlags,613}614615/// Bounded vector of properties permissions. Max length is [`MAX_PROPERTIES_PER_ITEM`].616// TODO: maybe rename to PropertiesPermissionsVec617pub type CollectionPropertiesPermissionsVec =618	BoundedVec<PropertyKeyPermission, ConstU32<MAX_PROPERTIES_PER_ITEM>>;619620/// Bounded vector of properties. Max length is [`MAX_PROPERTIES_PER_ITEM`].621pub type CollectionPropertiesVec = BoundedVec<Property, ConstU32<MAX_PROPERTIES_PER_ITEM>>;622623/// Limits and restrictions of a collection.624///625/// All fields are wrapped in [`Option`], where `None` means chain default.626///627/// Update with `pallet_common::Pallet::clamp_limits`.628// IMPORTANT: When adding/removing fields from this struct - don't forget to also629#[derive(630	Encode,631	Decode,632	Debug,633	Default,634	Clone,635	PartialEq,636	TypeInfo,637	MaxEncodedLen,638	Serialize,639	Deserialize,640)]641// When adding/removing fields from this struct - don't forget to also update with `pallet_common::Pallet::clamp_limits`.642// TODO: move `pallet_common::Pallet::clamp_limits` into `impl CollectionLimits`.643// TODO: may be remove [`Option`] and **pub** from fields and create struct with default values.644pub struct CollectionLimits {645	/// How many tokens can a user have on one account.646	/// * Default - [`ACCOUNT_TOKEN_OWNERSHIP_LIMIT`].647	/// * Limit - [`MAX_TOKEN_OWNERSHIP`].648	pub account_token_ownership_limit: Option<u32>,649650	/// How many bytes of data are available for sponsorship.651	/// * Default - [`CUSTOM_DATA_LIMIT`].652	/// * Limit - [`CUSTOM_DATA_LIMIT`].653	pub sponsored_data_size: Option<u32>,654655	// FIXME should we delete this or repurpose it?656	/// Times in how many blocks we sponsor data.657	///658	/// If is `Some(v)` then **setVariableMetadata** is sponsored if there is `v` block between transactions.659	///660	/// * Default - [`SponsoringDisabled`](SponsoringRateLimit::SponsoringDisabled).661	/// * Limit - [`MAX_SPONSOR_TIMEOUT`].662	///663	/// In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]664	pub sponsored_data_rate_limit: Option<SponsoringRateLimit>,665	/// Maximum amount of tokens inside the collection. Chain default: [`COLLECTION_TOKEN_LIMIT`]666667	/// How many tokens can be mined into this collection.668	///669	/// * Default - [`COLLECTION_TOKEN_LIMIT`].670	/// * Limit - [`COLLECTION_TOKEN_LIMIT`].671	pub token_limit: Option<u32>,672673	/// Timeouts for transfer sponsoring.674	///675	/// * Default676	///   - **Fungible** - [`FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT`]677	///   - **NFT** - [`NFT_SPONSOR_TRANSFER_TIMEOUT`]678	///   - **Refungible** - [`REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT`]679	/// * Limit - [`MAX_SPONSOR_TIMEOUT`].680	pub sponsor_transfer_timeout: Option<u32>,681682	/// Timeout for sponsoring an approval in passed blocks.683	///684	/// * Default - [`SPONSOR_APPROVE_TIMEOUT`].685	/// * Limit - [`MAX_SPONSOR_TIMEOUT`].686	pub sponsor_approve_timeout: Option<u32>,687688	/// Whether the collection owner of the collection can send tokens (which belong to other users).689	///690	/// * Default - **false**.691	pub owner_can_transfer: Option<bool>,692693	/// Can the collection owner burn other people's tokens.694	///695	/// * Default - **true**.696	pub owner_can_destroy: Option<bool>,697698	/// Is it possible to send tokens from this collection between users.699	///700	/// * Default - **true**.701	pub transfers_enabled: Option<bool>,702}703704impl CollectionLimits {705	pub fn with_default_limits(collection_type: CollectionMode) -> Self {706		CollectionLimits {707			account_token_ownership_limit: Some(ACCOUNT_TOKEN_OWNERSHIP_LIMIT),708			sponsored_data_size: Some(CUSTOM_DATA_LIMIT),709			sponsored_data_rate_limit: Some(SponsoringRateLimit::SponsoringDisabled),710			token_limit: Some(COLLECTION_TOKEN_LIMIT),711			sponsor_transfer_timeout: match collection_type {712				CollectionMode::NFT => Some(NFT_SPONSOR_TRANSFER_TIMEOUT),713				CollectionMode::ReFungible => Some(REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT),714				CollectionMode::Fungible(_) => Some(FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT),715			},716			sponsor_approve_timeout: Some(SPONSOR_APPROVE_TIMEOUT),717			owner_can_transfer: Some(false),718			owner_can_destroy: Some(true),719			transfers_enabled: Some(true),720		}721	}722723	/// Get effective value for [`account_token_ownership_limit`](self.account_token_ownership_limit).724	pub fn account_token_ownership_limit(&self) -> u32 {725		self.account_token_ownership_limit726			.unwrap_or(ACCOUNT_TOKEN_OWNERSHIP_LIMIT)727			.min(MAX_TOKEN_OWNERSHIP)728	}729730	/// Get effective value for [`sponsored_data_size`](self.sponsored_data_size).731	pub fn sponsored_data_size(&self) -> u32 {732		self.sponsored_data_size733			.unwrap_or(CUSTOM_DATA_LIMIT)734			.min(CUSTOM_DATA_LIMIT)735	}736737	/// Get effective value for [`token_limit`](self.token_limit).738	pub fn token_limit(&self) -> u32 {739		self.token_limit740			.unwrap_or(COLLECTION_TOKEN_LIMIT)741			.min(COLLECTION_TOKEN_LIMIT)742	}743744	// TODO: may be replace u32 to mode?745	/// Get effective value for [`sponsor_transfer_timeout`](self.sponsor_transfer_timeout).746	pub fn sponsor_transfer_timeout(&self, default: u32) -> u32 {747		self.sponsor_transfer_timeout748			.unwrap_or(default)749			.min(MAX_SPONSOR_TIMEOUT)750	}751752	/// Get effective value for [`sponsor_approve_timeout`](self.sponsor_approve_timeout).753	pub fn sponsor_approve_timeout(&self) -> u32 {754		self.sponsor_approve_timeout755			.unwrap_or(SPONSOR_APPROVE_TIMEOUT)756			.min(MAX_SPONSOR_TIMEOUT)757	}758759	/// Get effective value for [`owner_can_transfer`](self.owner_can_transfer).760	pub fn owner_can_transfer(&self) -> bool {761		self.owner_can_transfer.unwrap_or(false)762	}763764	/// Get effective value for [`owner_can_transfer_instaled`](self.owner_can_transfer_instaled).765	pub fn owner_can_transfer_instaled(&self) -> bool {766		self.owner_can_transfer.is_some()767	}768769	/// Get effective value for [`owner_can_destroy`](self.owner_can_destroy).770	pub fn owner_can_destroy(&self) -> bool {771		self.owner_can_destroy.unwrap_or(true)772	}773774	/// Get effective value for [`transfers_enabled`](self.transfers_enabled).775	pub fn transfers_enabled(&self) -> bool {776		self.transfers_enabled.unwrap_or(true)777	}778779	/// Get effective value for [`sponsored_data_rate_limit`](self.sponsored_data_rate_limit).780	pub fn sponsored_data_rate_limit(&self) -> Option<u32> {781		match self782			.sponsored_data_rate_limit783			.unwrap_or(SponsoringRateLimit::SponsoringDisabled)784		{785			SponsoringRateLimit::SponsoringDisabled => None,786			SponsoringRateLimit::Blocks(v) => Some(v.min(MAX_SPONSOR_TIMEOUT)),787		}788	}789}790791/// Permissions on certain operations within a collection.792///793/// Some fields are wrapped in [`Option`], where `None` means chain default.794///795/// Update with `pallet_common::Pallet::clamp_permissions`.796#[derive(797	Encode,798	Decode,799	Debug,800	Default,801	Clone,802	PartialEq,803	TypeInfo,804	MaxEncodedLen,805	Serialize,806	Deserialize,807)]808// When adding/removing fields from this struct - don't forget to also update `pallet_common::Pallet::clamp_permissions`.809// TODO: move `pallet_common::Pallet::clamp_permissions` into `impl CollectionPermissions`.810pub struct CollectionPermissions {811	/// Access mode.812	///813	/// * Default - [`AccessMode::Normal`].814	pub access: Option<AccessMode>,815816	/// Minting allowance.817	///818	/// * Default - **false**.819	pub mint_mode: Option<bool>,820821	/// Permissions for nesting.822	///823	/// * Default824	///   - `token_owner` - **false**825	///   - `collection_admin` - **false**826	///   - `restricted` - **None**827	pub nesting: Option<NestingPermissions>,828}829830impl CollectionPermissions {831	/// Get effective value for [`access`](self.access).832	pub fn access(&self) -> AccessMode {833		self.access.unwrap_or(AccessMode::Normal)834	}835836	/// Get effective value for [`mint_mode`](self.mint_mode).837	pub fn mint_mode(&self) -> bool {838		self.mint_mode.unwrap_or(false)839	}840841	/// Get effective value for [`nesting`](self.nesting).842	pub fn nesting(&self) -> &NestingPermissions {843		static DEFAULT: NestingPermissions = NestingPermissions {844			token_owner: false,845			collection_admin: false,846			restricted: None,847			#[cfg(feature = "runtime-benchmarks")]848			permissive: false,849		};850		self.nesting.as_ref().unwrap_or(&DEFAULT)851	}852}853854/// Inner set for collections allowed to nest.855type OwnerRestrictedSetInner = BoundedBTreeSet<CollectionId, ConstU32<16>>;856857/// Wraper for collections set allowing nest.858#[derive(859	Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen, Derivative, Serialize, Deserialize,860)]861#[derivative(Debug)]862pub struct OwnerRestrictedSet(863	#[serde(with = "bounded::set_serde")]864	#[derivative(Debug(format_with = "bounded::set_debug"))]865	pub OwnerRestrictedSetInner,866);867868impl OwnerRestrictedSet {869	/// Create new set.870	pub fn new() -> Self {871		Self(Default::default())872	}873}874impl Default for OwnerRestrictedSet {875	fn default() -> Self {876		Self::new()877	}878}879impl core::ops::Deref for OwnerRestrictedSet {880	type Target = OwnerRestrictedSetInner;881	fn deref(&self) -> &Self::Target {882		&self.0883	}884}885impl core::ops::DerefMut for OwnerRestrictedSet {886	fn deref_mut(&mut self) -> &mut Self::Target {887		&mut self.0888	}889}890891impl TryFrom<BTreeSet<CollectionId>> for OwnerRestrictedSet {892	type Error = ();893894	fn try_from(value: BTreeSet<CollectionId>) -> Result<Self, Self::Error> {895		Ok(Self(value.try_into()?))896	}897}898899/// Part of collection permissions, if set, defines who is able to nest tokens into other tokens.900#[derive(901	Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen, Derivative, Serialize, Deserialize,902)]903#[derivative(Debug)]904pub struct NestingPermissions {905	/// Owner of token can nest tokens under it.906	pub token_owner: bool,907	/// Admin of token collection can nest tokens under token.908	pub collection_admin: bool,909	/// If set - only tokens from specified collections can be nested.910	pub restricted: Option<OwnerRestrictedSet>,911912	#[cfg(feature = "runtime-benchmarks")]913	/// Anyone can nest tokens, mutually exclusive with `token_owner`, `admin`.914	pub permissive: bool,915}916917/// Enum denominating how often can sponsoring occur if it is enabled.918///919/// Used for [`collection limits`](CollectionLimits).920#[derive(921	Encode, Decode, Debug, Clone, Copy, PartialEq, TypeInfo, MaxEncodedLen, Serialize, Deserialize,922)]923pub enum SponsoringRateLimit {924	/// Sponsoring is disabled, and the collection sponsor will not pay for transactions925	SponsoringDisabled,926	/// Once per how many blocks can sponsorship of a transaction type occur927	Blocks(u32),928}929930/// Data used to describe an NFT at creation.931#[derive(932	Encode,933	Decode,934	MaxEncodedLen,935	Default,936	PartialEq,937	Clone,938	Derivative,939	TypeInfo,940	Serialize,941	Deserialize,942)]943#[derivative(Debug)]944pub struct CreateNftData {945	/// Key-value pairs used to describe the token as metadata946	#[serde(with = "bounded::vec_serde")]947	#[derivative(Debug(format_with = "bounded::vec_debug"))]948	/// Properties that wil be assignet to created item.949	pub properties: CollectionPropertiesVec,950}951952/// Data used to describe a Fungible token at creation.953#[derive(954	Encode,955	Decode,956	MaxEncodedLen,957	Default,958	Debug,959	Clone,960	PartialEq,961	TypeInfo,962	Serialize,963	Deserialize,964)]965pub struct CreateFungibleData {966	/// Number of fungible coins minted967	pub value: u128,968}969970/// Data used to describe a Refungible token at creation.971#[derive(972	Encode,973	Decode,974	MaxEncodedLen,975	Default,976	PartialEq,977	Clone,978	Derivative,979	TypeInfo,980	Serialize,981	Deserialize,982)]983#[derivative(Debug)]984pub struct CreateReFungibleData {985	/// Number of pieces the RFT is split into986	pub pieces: u128,987988	/// Key-value pairs used to describe the token as metadata989	#[serde(with = "bounded::vec_serde")]990	#[derivative(Debug(format_with = "bounded::vec_debug"))]991	pub properties: CollectionPropertiesVec,992}993994// TODO: remove this.995#[derive(996	Encode, Decode, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen, Serialize, Deserialize,997)]998pub enum MetaUpdatePermission {999	ItemOwner,1000	Admin,1001	None,1002}10031004/// Enum holding data used for creation of all three item types.1005/// Unified data for create item.1006#[derive(1007	Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo, Serialize, Deserialize,1008)]1009pub enum CreateItemData {1010	/// Data for create NFT.1011	NFT(CreateNftData),1012	/// Data for create Fungible item.1013	Fungible(CreateFungibleData),1014	/// Data for create ReFungible item.1015	ReFungible(CreateReFungibleData),1016}10171018/// Extended data for create NFT.1019#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]1020#[derivative(Debug)]1021pub struct CreateNftExData<CrossAccountId> {1022	/// Properties that wil be assignet to created item.1023	#[derivative(Debug(format_with = "bounded::vec_debug"))]1024	pub properties: CollectionPropertiesVec,10251026	/// Owner of creating item.1027	pub owner: CrossAccountId,1028}10291030/// Extended data for create ReFungible item.1031#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]1032#[derivative(Debug(bound = "CrossAccountId: fmt::Debug + Ord"))]1033pub struct CreateRefungibleExMultipleOwners<CrossAccountId> {1034	#[derivative(Debug(format_with = "bounded::map_debug"))]1035	pub users: BoundedBTreeMap<CrossAccountId, u128, ConstU32<MAX_ITEMS_PER_BATCH>>,1036	#[derivative(Debug(format_with = "bounded::vec_debug"))]1037	pub properties: CollectionPropertiesVec,1038}10391040/// Extended data for create ReFungible item.1041#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]1042#[derivative(Debug(bound = "CrossAccountId: fmt::Debug"))]1043pub struct CreateRefungibleExSingleOwner<CrossAccountId> {1044	pub user: CrossAccountId,1045	pub pieces: u128,1046	#[derivative(Debug(format_with = "bounded::vec_debug"))]1047	pub properties: CollectionPropertiesVec,1048}10491050/// Unified extended data for creating item.1051#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]1052#[derivative(Debug(bound = "CrossAccountId: fmt::Debug + Ord"))]1053pub enum CreateItemExData<CrossAccountId> {1054	/// Extended data for create NFT.1055	NFT(1056		#[derivative(Debug(format_with = "bounded::vec_debug"))]1057		BoundedVec<CreateNftExData<CrossAccountId>, ConstU32<MAX_ITEMS_PER_BATCH>>,1058	),10591060	/// Extended data for create Fungible item.1061	Fungible(1062		#[derivative(Debug(format_with = "bounded::map_debug"))]1063		BoundedBTreeMap<CrossAccountId, u128, ConstU32<MAX_ITEMS_PER_BATCH>>,1064	),10651066	/// Extended data for create ReFungible item in case of1067	/// many tokens, each may have only one owner1068	RefungibleMultipleItems(1069		#[derivative(Debug(format_with = "bounded::vec_debug"))]1070		BoundedVec<CreateRefungibleExSingleOwner<CrossAccountId>, ConstU32<MAX_ITEMS_PER_BATCH>>,1071	),10721073	/// Extended data for create ReFungible item in case of1074	/// single token, which may have many owners1075	RefungibleMultipleOwners(CreateRefungibleExMultipleOwners<CrossAccountId>),1076}10771078impl From<CreateNftData> for CreateItemData {1079	fn from(item: CreateNftData) -> Self {1080		CreateItemData::NFT(item)1081	}1082}10831084impl From<CreateReFungibleData> for CreateItemData {1085	fn from(item: CreateReFungibleData) -> Self {1086		CreateItemData::ReFungible(item)1087	}1088}10891090impl From<CreateFungibleData> for CreateItemData {1091	fn from(item: CreateFungibleData) -> Self {1092		CreateItemData::Fungible(item)1093	}1094}10951096/// Token's address, dictated by its collection and token IDs.1097#[derive(1098	Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo, Serialize, Deserialize,1099)]1100// todo possibly rename to be used generally as an address pair1101pub struct TokenChild {1102	/// Token id.1103	pub token: TokenId,11041105	/// Collection id.1106	pub collection: CollectionId,1107}11081109/// Collection statistics.1110#[derive(1111	Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo, Serialize, Deserialize,1112)]1113pub struct CollectionStats {1114	/// Number of created items.1115	pub created: u32,11161117	/// Number of burned items.1118	pub destroyed: u32,11191120	/// Number of current items.1121	pub alive: u32,1122}11231124/// This type works like [`PhantomData`] but supports generating _scale-info_ descriptions to generate node metadata.1125#[derive(Encode, Decode, Clone, Debug)]1126#[cfg_attr(feature = "std", derive(PartialEq))]1127pub struct PhantomType<T>(core::marker::PhantomData<T>);11281129impl<T: TypeInfo + 'static> TypeInfo for PhantomType<T> {1130	type Identity = PhantomType<T>;11311132	fn type_info() -> scale_info::Type {1133		use scale_info::{1134			build::{FieldsBuilder, UnnamedFields},1135			form::MetaForm,1136			type_params, Path, Type,1137		};1138		Type::builder()1139			.path(Path::new("up_data_structs", "PhantomType"))1140			.type_params(type_params!(T))1141			.composite(1142				<FieldsBuilder<MetaForm, UnnamedFields>>::default().field(|b| b.ty::<[T; 0]>()),1143			)1144	}1145}1146impl<T> MaxEncodedLen for PhantomType<T> {1147	fn max_encoded_len() -> usize {1148		01149	}1150}11511152/// Bounded vector of bytes.1153pub type BoundedBytes<S> = BoundedVec<u8, S>;11541155/// Extra properties for external collections.1156pub type AuxPropertyValue = BoundedBytes<ConstU32<MAX_AUX_PROPERTY_VALUE_LENGTH>>;11571158/// Property key.1159pub type PropertyKey = BoundedBytes<ConstU32<MAX_PROPERTY_KEY_LENGTH>>;11601161/// Property value.1162pub type PropertyValue = BoundedBytes<ConstU32<MAX_PROPERTY_VALUE_LENGTH>>;11631164/// Property permission.1165#[derive(1166	Encode,1167	Decode,1168	TypeInfo,1169	Debug,1170	MaxEncodedLen,1171	PartialEq,1172	Clone,1173	Default,1174	Serialize,1175	Deserialize,1176)]1177pub struct PropertyPermission {1178	/// Permission to change the property and property permission.1179	///1180	/// If it **false** then you can not change corresponding property even if [`collection_admin`] and [`token_owner`] are **true**.1181	pub mutable: bool,11821183	/// Change permission for the collection administrator.1184	pub collection_admin: bool,11851186	/// Permission to change the property for the owner of the token.1187	pub token_owner: bool,1188}11891190impl PropertyPermission {1191	/// Creates mutable property permission but changes restricted for collection admin and token owner.1192	pub fn none() -> Self {1193		Self {1194			mutable: true,1195			collection_admin: false,1196			token_owner: false,1197		}1198	}1199}12001201/// Property is simpl key-value record.1202#[derive(1203	Encode, Decode, Debug, TypeInfo, Clone, PartialEq, MaxEncodedLen, Serialize, Deserialize,1204)]1205pub struct Property {1206	/// Property key.1207	#[serde(with = "bounded::vec_serde")]1208	pub key: PropertyKey,12091210	/// Property value.1211	#[serde(with = "bounded::vec_serde")]1212	pub value: PropertyValue,1213}12141215impl From<Property> for (PropertyKey, PropertyValue) {1216	fn from(value: Property) -> Self {1217		(value.key, value.value)1218	}1219}12201221/// Record for proprty key permission.1222#[derive(1223	Encode, Decode, TypeInfo, Debug, MaxEncodedLen, PartialEq, Clone, Serialize, Deserialize,1224)]1225pub struct PropertyKeyPermission {1226	/// Key.1227	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]1228	pub key: PropertyKey,12291230	/// Permission.1231	pub permission: PropertyPermission,1232}12331234impl From<PropertyKeyPermission> for (PropertyKey, PropertyPermission) {1235	fn from(value: PropertyKeyPermission) -> Self {1236		(value.key, value.permission)1237	}1238}12391240/// Errors for properties actions.1241#[derive(Debug)]1242pub enum PropertiesError {1243	/// The space allocated for properties has run out.1244	///1245	/// * Limit for colection - [`MAX_COLLECTION_PROPERTIES_SIZE`].1246	/// * Limit for token - [`MAX_TOKEN_PROPERTIES_SIZE`].1247	NoSpaceForProperty,12481249	/// The property limit has been reached.1250	///1251	/// * Limit - [`MAX_PROPERTIES_PER_ITEM`].1252	PropertyLimitReached,12531254	/// Property key contains not allowed character.1255	InvalidCharacterInPropertyKey,12561257	/// Property key length is too long.1258	///1259	/// * Limit - [`MAX_PROPERTY_KEY_LENGTH`].1260	PropertyKeyIsTooLong,12611262	/// Property key is empty.1263	EmptyPropertyKey,1264}12651266/// Token owner error: it could be either `NotFound` ot `MultipleOwners`.1267#[derive(Debug)]1268pub enum TokenOwnerError {1269	NotFound,1270	MultipleOwners,1271}12721273/// Marker for scope of property.1274///1275/// Scoped property can't be changed by user. Used for external collections.1276#[derive(Encode, Decode, MaxEncodedLen, TypeInfo, PartialEq, Clone, Copy)]1277pub enum PropertyScope {1278	None,1279	Rmrk,1280}12811282impl PropertyScope {1283	pub fn prefix(&self) -> &'static [u8] {1284		match self {1285			Self::None => b"",1286			Self::Rmrk => b"rmrk:",1287		}1288	}1289	/// Apply scope to property key.1290	pub fn apply(self, key: PropertyKey) -> Result<PropertyKey, PropertiesError> {1291		let prefix = self.prefix();1292		if prefix == b"" {1293			return Ok(key);1294		}1295		[prefix, key.as_slice()]1296			.concat()1297			.try_into()1298			.map_err(|_| PropertiesError::PropertyKeyIsTooLong)1299	}1300}13011302/// Trait for operate with properties.1303pub trait TrySetProperty: Sized {1304	type Value;13051306	/// Try to set property with scope.1307	fn try_scoped_set(1308		&mut self,1309		scope: PropertyScope,1310		key: PropertyKey,1311		value: Self::Value,1312	) -> Result<Option<Self::Value>, PropertiesError>;13131314	/// Try to set property with scope from iterator.1315	fn try_scoped_set_from_iter<I, KV>(1316		&mut self,1317		scope: PropertyScope,1318		iter: I,1319	) -> Result<(), PropertiesError>1320	where1321		I: Iterator<Item = KV>,1322		KV: Into<(PropertyKey, Self::Value)>,1323	{1324		for kv in iter {1325			let (key, value) = kv.into();1326			self.try_scoped_set(scope, key, value)?;1327		}13281329		Ok(())1330	}13311332	/// Try to set property.1333	fn try_set(1334		&mut self,1335		key: PropertyKey,1336		value: Self::Value,1337	) -> Result<Option<Self::Value>, PropertiesError> {1338		self.try_scoped_set(PropertyScope::None, key, value)1339	}13401341	/// Try to set property from iterator.1342	fn try_set_from_iter<I, KV>(&mut self, iter: I) -> Result<(), PropertiesError>1343	where1344		I: Iterator<Item = KV>,1345		KV: Into<(PropertyKey, Self::Value)>,1346	{1347		self.try_scoped_set_from_iter(PropertyScope::None, iter)1348	}1349}13501351/// Wrapped map for storing properties.1352#[derive(Encode, Decode, TypeInfo, Derivative, Clone, PartialEq, MaxEncodedLen)]1353#[derivative(Default(bound = ""))]1354pub struct PropertiesMap<Value>(1355	BoundedBTreeMap<PropertyKey, Value, ConstU32<MAX_PROPERTIES_PER_ITEM>>,1356);13571358impl<Value> PropertiesMap<Value> {1359	/// Create new property map.1360	pub fn new() -> Self {1361		Self(BoundedBTreeMap::new())1362	}13631364	/// Remove property from map.1365	pub fn remove(&mut self, key: &PropertyKey) -> Result<Option<Value>, PropertiesError> {1366		Self::check_property_key(key)?;13671368		Ok(self.0.remove(key))1369	}13701371	/// Get property with appropriate key from map.1372	pub fn get(&self, key: &PropertyKey) -> Option<&Value> {1373		self.0.get(key)1374	}13751376	/// Check if map contains key.1377	pub fn contains_key(&self, key: &PropertyKey) -> bool {1378		self.0.contains_key(key)1379	}13801381	/// Check if map contains key with key validation.1382	fn check_property_key(key: &PropertyKey) -> Result<(), PropertiesError> {1383		if key.is_empty() {1384			return Err(PropertiesError::EmptyPropertyKey);1385		}13861387		for byte in key.as_slice().iter() {1388			let byte = *byte;13891390			if !byte.is_ascii_alphanumeric() && byte != b'_' && byte != b'-' && byte != b'.' {1391				return Err(PropertiesError::InvalidCharacterInPropertyKey);1392			}1393		}13941395		Ok(())1396	}13971398	pub fn values(&self) -> impl Iterator<Item = &Value> {1399		self.0.values()1400	}14011402	pub fn iter(&self) -> impl Iterator<Item = (&PropertyKey, &Value)> {1403		self.0.iter()1404	}1405}14061407impl<Value> IntoIterator for PropertiesMap<Value> {1408	type Item = (PropertyKey, Value);1409	type IntoIter = <1410		BoundedBTreeMap<1411			PropertyKey,1412			Value,1413			ConstU32<MAX_PROPERTIES_PER_ITEM>1414		> as IntoIterator1415	>::IntoIter;14161417	fn into_iter(self) -> Self::IntoIter {1418		self.0.into_iter()1419	}1420}14211422impl<Value> TrySetProperty for PropertiesMap<Value> {1423	type Value = Value;14241425	fn try_scoped_set(1426		&mut self,1427		scope: PropertyScope,1428		key: PropertyKey,1429		value: Self::Value,1430	) -> Result<Option<Self::Value>, PropertiesError> {1431		Self::check_property_key(&key)?;14321433		let key = scope.apply(key)?;1434		self.01435			.try_insert(key, value)1436			.map_err(|_| PropertiesError::PropertyLimitReached)1437	}1438}14391440/// Alias for property permissions map.1441pub type PropertiesPermissionMap = PropertiesMap<PropertyPermission>;14421443fn slice_size(data: &[u8]) -> u32 {1444	scoped_slice_size(PropertyScope::None, data)1445}1446fn scoped_slice_size(scope: PropertyScope, data: &[u8]) -> u32 {1447	use parity_scale_codec::Compact;1448	let prefix = scope.prefix();1449	<Compact<u32>>::encoded_size(&Compact(data.len() as u32 + prefix.len() as u32)) as u321450		+ data.len() as u321451		+ prefix.len() as u321452}14531454/// Wrapper for properties map with consumed space control.1455#[derive(Encode, Decode, TypeInfo, Clone, PartialEq)]1456pub struct Properties<const S: u32> {1457	map: PropertiesMap<PropertyValue>,1458	consumed_space: u32,1459	// May be not zero, previously served as a current S generic1460	_reserved: u32,1461}14621463impl<const S: u32> MaxEncodedLen for Properties<S> {1464	fn max_encoded_len() -> usize {1465		// len of map + len of consumed_space + len of space_limit1466		u32::max_encoded_len() * 3 + S as usize1467	}1468}14691470impl<const S: u32> Default for Properties<S> {1471	fn default() -> Self {1472		Self::new()1473	}1474}14751476impl<const S: u32> Properties<S> {1477	/// Create new properies container.1478	pub fn new() -> Self {1479		Self {1480			map: PropertiesMap::new(),1481			consumed_space: 0,1482			_reserved: 0,1483		}1484	}14851486	/// Remove propery with appropiate key.1487	pub fn remove(&mut self, key: &PropertyKey) -> Result<Option<PropertyValue>, PropertiesError> {1488		let value = self.map.remove(key)?;14891490		if let Some(ref value) = value {1491			let kv_len = slice_size(key) + slice_size(value);1492			self.consumed_space = self.consumed_space.saturating_sub(kv_len);1493		}14941495		Ok(value)1496	}14971498	/// Get property with appropriate key.1499	pub fn get(&self, key: &PropertyKey) -> Option<&PropertyValue> {1500		self.map.get(key)1501	}15021503	/// Recomputes the consumed space for the current properties state.1504	/// Needed to repair a token due to a bug fixed in the [PR #733](https://github.com/UniqueNetwork/unique-chain/pull/773).1505	pub fn recompute_consumed_space(&mut self) {1506		self.consumed_space = self1507			.map1508			.iter()1509			.map(|(key, value)| slice_size(key) + slice_size(value))1510			.sum();1511	}1512}15131514impl<const S: u32> IntoIterator for Properties<S> {1515	type Item = (PropertyKey, PropertyValue);1516	type IntoIter = <PropertiesMap<PropertyValue> as IntoIterator>::IntoIter;15171518	fn into_iter(self) -> Self::IntoIter {1519		self.map.into_iter()1520	}1521}15221523impl<const S: u32> TrySetProperty for Properties<S> {1524	type Value = PropertyValue;15251526	fn try_scoped_set(1527		&mut self,1528		scope: PropertyScope,1529		key: PropertyKey,1530		value: Self::Value,1531	) -> Result<Option<Self::Value>, PropertiesError> {1532		let key_size = scoped_slice_size(scope, &key);1533		let value_size = slice_size(&value);15341535		if self.consumed_space + value_size + key_size > S && !cfg!(feature = "runtime-benchmarks")1536		{1537			return Err(PropertiesError::NoSpaceForProperty);1538		}15391540		let old_value = self.map.try_scoped_set(scope, key, value)?;15411542		if let Some(old_value) = old_value.as_ref() {1543			let old_value_size = slice_size(old_value);1544			self.consumed_space = self.consumed_space.saturating_sub(old_value_size) + value_size;1545		} else {1546			self.consumed_space += key_size + value_size;1547		}15481549		Ok(old_value)1550	}1551}15521553pub type CollectionProperties = Properties<MAX_COLLECTION_PROPERTIES_SIZE>;1554pub type TokenProperties = Properties<MAX_TOKEN_PROPERTIES_SIZE>;
after · primitives/data-structs/src/lib.rs
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/>.1617//! # Primitives crate.18//!19//! This crate contains types, traits and constants.2021#![cfg_attr(not(feature = "std"), no_std)]2223use core::{24	convert::{TryFrom, TryInto},25	fmt,26	ops::Deref,27};2829use bondrewd::Bitfields;30use derivative::Derivative;31use evm_coder::AbiCoderFlags;32use frame_support::{33	storage::{bounded_btree_map::BoundedBTreeMap, bounded_btree_set::BoundedBTreeSet},34	traits::ConstU32,35	BoundedVec,36};37use parity_scale_codec::{Decode, Encode, EncodeLike, MaxEncodedLen};38use scale_info::TypeInfo;39use serde::{Deserialize, Serialize};40use sp_core::U256;41use sp_runtime::{sp_std::prelude::Vec, ArithmeticError};42use sp_std::collections::btree_set::BTreeSet;4344mod bondrewd_codec;45mod bounded;46pub mod budget;47pub mod mapping;48mod migration;4950/// Maximum of decimal points.51pub const MAX_DECIMAL_POINTS: DecimalPoints = 30;5253/// Maximum pieces for refungible token.54pub const MAX_REFUNGIBLE_PIECES: u128 = 1_000_000_000_000_000_000_000;55pub const MAX_SPONSOR_TIMEOUT: u32 = 10_368_000;5657/// Maximum tokens for user.58pub const MAX_TOKEN_OWNERSHIP: u32 = if cfg!(not(feature = "limit-testing")) {59	100_00060} else {61	1062};6364/// Maximum for collections can be created.65pub const COLLECTION_NUMBER_LIMIT: u32 = if cfg!(not(feature = "limit-testing")) {66	100_00067} else {68	1069};7071/// Maximum for various custom data of token.72pub const CUSTOM_DATA_LIMIT: u32 = if cfg!(not(feature = "limit-testing")) {73	204874} else {75	1076};7778/// Maximum admins per collection.79pub const COLLECTION_ADMINS_LIMIT: u32 = 5;8081/// Maximum tokens per collection.82pub const COLLECTION_TOKEN_LIMIT: u32 = u32::MAX;8384/// Maximum tokens per account.85pub const ACCOUNT_TOKEN_OWNERSHIP_LIMIT: u32 = if cfg!(not(feature = "limit-testing")) {86	1_000_00087} else {88	1089};9091/// Default timeout for transfer sponsoring NFT item.92pub const NFT_SPONSOR_TRANSFER_TIMEOUT: u32 = 5;93/// Default timeout for transfer sponsoring fungible item.94pub const FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT: u32 = 5;95/// Default timeout for transfer sponsoring refungible item.96pub const REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT: u32 = 5;9798/// Default timeout for sponsored approving.99pub const SPONSOR_APPROVE_TIMEOUT: u32 = 5;100101// Schema limits102pub const OFFCHAIN_SCHEMA_LIMIT: u32 = 8192;103pub const VARIABLE_ON_CHAIN_SCHEMA_LIMIT: u32 = 8192;104pub const CONST_ON_CHAIN_SCHEMA_LIMIT: u32 = 32768;105106// TODO: not used. Delete?107pub const COLLECTION_FIELD_LIMIT: u32 = CONST_ON_CHAIN_SCHEMA_LIMIT;108109/// Maximal length of a collection name.110pub const MAX_COLLECTION_NAME_LENGTH: u32 = 64;111112/// Maximal length of a collection description.113pub const MAX_COLLECTION_DESCRIPTION_LENGTH: u32 = 256;114115/// Maximal length of a token prefix.116pub const MAX_TOKEN_PREFIX_LENGTH: u32 = 16;117118/// Maximal length of a property key.119pub const MAX_PROPERTY_KEY_LENGTH: u32 = 256;120121/// Maximal length of a property value.122pub const MAX_PROPERTY_VALUE_LENGTH: u32 = 32768;123124/// A maximum number of token properties.125pub const MAX_PROPERTIES_PER_ITEM: u32 = 64;126127/// Maximal lenght of extended property value.128pub const MAX_AUX_PROPERTY_VALUE_LENGTH: u32 = 2048;129130/// Maximum size for all collection properties.131pub const MAX_COLLECTION_PROPERTIES_SIZE: u32 = 40960;132133/// Maximum size of all token properties.134pub const MAX_TOKEN_PROPERTIES_SIZE: u32 = 32768;135136/// How much items can be created per single137/// create_many call.138pub const MAX_ITEMS_PER_BATCH: u32 = 200;139140/// Used for limit bounded types of token custom data.141pub type CustomDataLimit = ConstU32<CUSTOM_DATA_LIMIT>;142143/// Collection id.144#[derive(145	Encode,146	Decode,147	PartialEq,148	Eq,149	PartialOrd,150	Ord,151	Clone,152	Copy,153	Debug,154	Default,155	TypeInfo,156	MaxEncodedLen,157	Serialize,158	Deserialize,159)]160pub struct CollectionId(pub u32);161impl EncodeLike<u32> for CollectionId {}162impl EncodeLike<CollectionId> for u32 {}163164impl From<u32> for CollectionId {165	fn from(value: u32) -> Self {166		Self(value)167	}168}169170impl Deref for CollectionId {171	type Target = u32;172173	fn deref(&self) -> &Self::Target {174		&self.0175	}176}177178/// Token id.179#[derive(180	Encode,181	Decode,182	PartialEq,183	Eq,184	PartialOrd,185	Ord,186	Clone,187	Copy,188	Debug,189	Default,190	TypeInfo,191	MaxEncodedLen,192	Serialize,193	Deserialize,194)]195pub struct TokenId(pub u32);196impl EncodeLike<u32> for TokenId {}197impl EncodeLike<TokenId> for u32 {}198199impl TokenId {200	/// Try to get next token id.201	///202	/// If next id cause overflow, then [`ArithmeticError::Overflow`] returned.203	pub fn try_next(self) -> Result<TokenId, ArithmeticError> {204		self.0205			.checked_add(1)206			.ok_or(ArithmeticError::Overflow)207			.map(Self)208	}209}210211impl From<TokenId> for U256 {212	fn from(t: TokenId) -> Self {213		t.0.into()214	}215}216217impl TryFrom<U256> for TokenId {218	type Error = &'static str;219220	fn try_from(value: U256) -> Result<Self, Self::Error> {221		Ok(TokenId(value.try_into().map_err(|_| "too large token id")?))222	}223}224225/// Token data.226#[struct_versioning::versioned(version = 2, upper)]227#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, Serialize, Deserialize)]228pub struct TokenData<CrossAccountId> {229	/// Properties of token.230	pub properties: Vec<Property>,231232	/// Token owner.233	pub owner: Option<CrossAccountId>,234235	/// Token pieces.236	#[version(2.., upper(0))]237	pub pieces: u128,238}239240// TODO: unused type241pub struct OverflowError;242impl From<OverflowError> for &'static str {243	fn from(_: OverflowError) -> Self {244		"overflow occured"245	}246}247248/// Alias for decimal points type.249pub type DecimalPoints = u8;250251/// Collection mode.252///253/// Collection can represent various types of tokens.254/// Each collection can contain only one type of tokens at a time.255/// This type helps to understand which tokens the collection contains.256#[derive(257	Encode, Decode, Eq, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen, Serialize, Deserialize,258)]259pub enum CollectionMode {260	/// Non fungible tokens.261	NFT,262	/// Fungible tokens.263	Fungible(DecimalPoints),264	/// Refungible tokens.265	ReFungible,266}267268impl CollectionMode {269	/// Get collection mod as number.270	pub fn id(&self) -> u8 {271		match self {272			CollectionMode::NFT => 1,273			CollectionMode::Fungible(_) => 2,274			CollectionMode::ReFungible => 3,275		}276	}277}278279// TODO: unused trait280pub trait SponsoringResolve<AccountId, Call> {281	fn resolve(who: &AccountId, call: &Call) -> Option<AccountId>;282}283284/// Access mode for some token operations.285#[derive(286	Encode,287	Decode,288	Eq,289	Debug,290	Clone,291	Copy,292	PartialEq,293	TypeInfo,294	MaxEncodedLen,295	Serialize,296	Deserialize,297)]298pub enum AccessMode {299	/// Access grant for owner and admins. Used as default.300	Normal,301	/// Like a [`Normal`](AccessMode::Normal) but also users in allow list.302	AllowList,303}304impl Default for AccessMode {305	fn default() -> Self {306		Self::Normal307	}308}309310// TODO: remove in future.311#[derive(312	Encode, Decode, Eq, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen, Serialize, Deserialize,313)]314pub enum SchemaVersion {315	ImageURL,316	Unique,317}318impl Default for SchemaVersion {319	fn default() -> Self {320		Self::ImageURL321	}322}323324// TODO: unused type325#[derive(Encode, Decode, Default, Debug, Clone, PartialEq, TypeInfo, Serialize, Deserialize)]326pub struct Ownership<AccountId> {327	pub owner: AccountId,328	pub fraction: u128,329}330331/// The state of collection sponsorship.332#[derive(333	Encode, Decode, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen, Serialize, Deserialize,334)]335pub enum SponsorshipState<AccountId> {336	/// The fees are applied to the transaction sender.337	Disabled,338	/// The sponsor is under consideration. Until the sponsor gives his consent,339	/// the fee will still be charged to sender.340	Unconfirmed(AccountId),341	/// Transactions are sponsored by specified account.342	Confirmed(AccountId),343}344345impl<AccountId> SponsorshipState<AccountId> {346	/// Get a sponsor of the collection who has confirmed his status.347	pub fn sponsor(&self) -> Option<&AccountId> {348		match self {349			Self::Confirmed(sponsor) => Some(sponsor),350			_ => None,351		}352	}353354	/// Get a sponsor of the collection who has pending or confirmed status.355	pub fn pending_sponsor(&self) -> Option<&AccountId> {356		match self {357			Self::Unconfirmed(sponsor) | Self::Confirmed(sponsor) => Some(sponsor),358			_ => None,359		}360	}361362	/// Whether the sponsorship is confirmed.363	pub fn confirmed(&self) -> bool {364		matches!(self, Self::Confirmed(_))365	}366}367368impl<T> Default for SponsorshipState<T> {369	fn default() -> Self {370		Self::Disabled371	}372}373374pub type CollectionName = BoundedVec<u16, ConstU32<MAX_COLLECTION_NAME_LENGTH>>;375pub type CollectionDescription = BoundedVec<u16, ConstU32<MAX_COLLECTION_DESCRIPTION_LENGTH>>;376pub type CollectionTokenPrefix = BoundedVec<u8, ConstU32<MAX_TOKEN_PREFIX_LENGTH>>;377378#[derive(AbiCoderFlags, Bitfields, Clone, Copy, PartialEq, Eq, Debug, Default)]379#[bondrewd(enforce_bytes = 1)]380pub struct CollectionFlags {381	/// Tokens in foreign collections can be transferred, but not burnt382	#[bondrewd(bits = "0..1")]383	pub foreign: bool,384	/// Supports ERC721Metadata385	#[bondrewd(bits = "1..2")]386	pub erc721metadata: bool,387	/// External collections can't be managed using `unique` api388	#[bondrewd(bits = "7..8")]389	pub external: bool,390	/// Reserved flags391	#[bondrewd(bits = "2..7")]392	pub reserved: u8,393}394bondrewd_codec!(CollectionFlags);395396impl CollectionFlags {397	pub fn is_allowed_for_user(self) -> bool {398		!self.foreign && !self.external && self.reserved == 0399	}400}401402/// Base structure for represent collection.403///404/// Used to provide basic functionality for all types of collections.405///406/// #### Note407/// Collection parameters, used in storage (see [`RpcCollection`] for the RPC version).408#[struct_versioning::versioned(version = 2, upper)]409#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen)]410pub struct Collection<AccountId> {411	/// Collection owner account.412	pub owner: AccountId,413414	/// Collection mode.415	pub mode: CollectionMode,416417	/// Access mode.418	#[version(..2)]419	pub access: AccessMode,420421	/// Collection name.422	pub name: CollectionName,423424	/// Collection description.425	pub description: CollectionDescription,426427	/// Token prefix.428	pub token_prefix: CollectionTokenPrefix,429430	#[version(..2)]431	pub mint_mode: bool,432433	#[version(..2)]434	pub offchain_schema: BoundedVec<u8, ConstU32<OFFCHAIN_SCHEMA_LIMIT>>,435436	#[version(..2)]437	pub schema_version: SchemaVersion,438439	/// The state of sponsorship of the collection.440	pub sponsorship: SponsorshipState<AccountId>,441442	/// Collection limits.443	pub limits: CollectionLimits,444445	/// Collection permissions.446	#[version(2.., upper(Default::default()))]447	pub permissions: CollectionPermissions,448449	#[version(2.., upper(Default::default()))]450	pub flags: CollectionFlags,451452	#[version(..2)]453	pub variable_on_chain_schema: BoundedVec<u8, ConstU32<VARIABLE_ON_CHAIN_SCHEMA_LIMIT>>,454455	#[version(..2)]456	pub const_on_chain_schema: BoundedVec<u8, ConstU32<CONST_ON_CHAIN_SCHEMA_LIMIT>>,457458	#[version(..2)]459	pub meta_update_permission: MetaUpdatePermission,460}461462#[derive(Debug, Encode, Decode, Clone, PartialEq, TypeInfo, Serialize, Deserialize)]463pub struct RpcCollectionFlags {464	/// Is collection is foreign.465	pub foreign: bool,466	/// Collection supports ERC721Metadata.467	pub erc721metadata: bool,468}469470/// Collection parameters, used in RPC calls (see [`Collection`] for the storage version).471#[struct_versioning::versioned(version = 2, upper)]472#[derive(Debug, Encode, Decode, Clone, PartialEq, TypeInfo, Serialize, Deserialize)]473pub struct RpcCollection<AccountId> {474	/// Collection owner account.475	pub owner: AccountId,476477	/// Collection mode.478	pub mode: CollectionMode,479480	/// Collection name.481	pub name: Vec<u16>,482483	/// Collection description.484	pub description: Vec<u16>,485486	/// Token prefix.487	pub token_prefix: Vec<u8>,488489	/// The state of sponsorship of the collection.490	pub sponsorship: SponsorshipState<AccountId>,491492	/// Collection limits.493	pub limits: CollectionLimits,494495	/// Collection permissions.496	pub permissions: CollectionPermissions,497498	/// Token property permissions.499	pub token_property_permissions: Vec<PropertyKeyPermission>,500501	/// Collection properties.502	pub properties: Vec<Property>,503504	/// Is collection read only.505	pub read_only: bool,506507	/// Extra collection flags508	#[version(2.., upper(RpcCollectionFlags {foreign: false, erc721metadata: false}))]509	pub flags: RpcCollectionFlags,510}511512impl<AccountId> From<CollectionVersion1<AccountId>> for RpcCollection<AccountId> {513	fn from(value: CollectionVersion1<AccountId>) -> Self {514		let CollectionVersion1 {515			name,516			description,517			owner,518			mode,519			access,520			token_prefix,521			mint_mode,522			sponsorship,523			limits,524			..525		} = value;526527		RpcCollection {528			name: name.into_inner(),529			description: description.into_inner(),530			owner,531			mode,532			token_prefix: token_prefix.into_inner(),533			sponsorship,534			limits,535			permissions: CollectionPermissions {536				access: Some(access),537				mint_mode: Some(mint_mode),538				nesting: None,539			},540			token_property_permissions: Vec::default(),541			properties: Vec::default(),542			read_only: true,543544			flags: RpcCollectionFlags {545				foreign: false,546				erc721metadata: false,547			},548		}549	}550}551552pub struct RawEncoded(Vec<u8>);553554impl parity_scale_codec::Decode for RawEncoded {555	fn decode<I: parity_scale_codec::Input>(556		input: &mut I,557	) -> Result<Self, parity_scale_codec::Error> {558		let mut out = Vec::new();559		while let Ok(v) = input.read_byte() {560			out.push(v);561		}562		Ok(Self(out))563	}564}565566impl Deref for RawEncoded {567	type Target = Vec<u8>;568569	fn deref(&self) -> &Self::Target {570		&self.0571	}572}573574/// Data used for create collection.575///576/// All fields are wrapped in [`Option`], where `None` means chain default.577#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, Derivative, MaxEncodedLen)]578#[derivative(Debug, Default(bound = ""))]579pub struct CreateCollectionData<CrossAccountId> {580	/// Collection mode.581	#[derivative(Default(value = "CollectionMode::NFT"))]582	pub mode: CollectionMode,583584	/// Access mode.585	pub access: Option<AccessMode>,586587	/// Collection name.588	pub name: CollectionName,589590	/// Collection description.591	pub description: CollectionDescription,592593	/// Token prefix.594	pub token_prefix: CollectionTokenPrefix,595596	/// Collection limits.597	pub limits: Option<CollectionLimits>,598599	/// Collection permissions.600	pub permissions: Option<CollectionPermissions>,601602	/// Token property permissions.603	pub token_property_permissions: CollectionPropertiesPermissionsVec,604605	/// Collection properties.606	pub properties: CollectionPropertiesVec,607608	pub admin_list: Vec<CrossAccountId>,609610	/// Pending collection sponsor.611	pub pending_sponsor: Option<CrossAccountId>,612613	pub flags: CollectionFlags,614}615616/// Bounded vector of properties permissions. Max length is [`MAX_PROPERTIES_PER_ITEM`].617// TODO: maybe rename to PropertiesPermissionsVec618pub type CollectionPropertiesPermissionsVec =619	BoundedVec<PropertyKeyPermission, ConstU32<MAX_PROPERTIES_PER_ITEM>>;620621/// Bounded vector of properties. Max length is [`MAX_PROPERTIES_PER_ITEM`].622pub type CollectionPropertiesVec = BoundedVec<Property, ConstU32<MAX_PROPERTIES_PER_ITEM>>;623624/// Limits and restrictions of a collection.625///626/// All fields are wrapped in [`Option`], where `None` means chain default.627///628/// Update with `pallet_common::Pallet::clamp_limits`.629// IMPORTANT: When adding/removing fields from this struct - don't forget to also630#[derive(631	Encode,632	Decode,633	Debug,634	Default,635	Clone,636	PartialEq,637	TypeInfo,638	MaxEncodedLen,639	Serialize,640	Deserialize,641)]642// When adding/removing fields from this struct - don't forget to also update with `pallet_common::Pallet::clamp_limits`.643// TODO: move `pallet_common::Pallet::clamp_limits` into `impl CollectionLimits`.644// TODO: may be remove [`Option`] and **pub** from fields and create struct with default values.645pub struct CollectionLimits {646	/// How many tokens can a user have on one account.647	/// * Default - [`ACCOUNT_TOKEN_OWNERSHIP_LIMIT`].648	/// * Limit - [`MAX_TOKEN_OWNERSHIP`].649	pub account_token_ownership_limit: Option<u32>,650651	/// How many bytes of data are available for sponsorship.652	/// * Default - [`CUSTOM_DATA_LIMIT`].653	/// * Limit - [`CUSTOM_DATA_LIMIT`].654	pub sponsored_data_size: Option<u32>,655656	// FIXME should we delete this or repurpose it?657	/// Times in how many blocks we sponsor data.658	///659	/// If is `Some(v)` then **setVariableMetadata** is sponsored if there is `v` block between transactions.660	///661	/// * Default - [`SponsoringDisabled`](SponsoringRateLimit::SponsoringDisabled).662	/// * Limit - [`MAX_SPONSOR_TIMEOUT`].663	///664	/// In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]665	pub sponsored_data_rate_limit: Option<SponsoringRateLimit>,666	/// Maximum amount of tokens inside the collection. Chain default: [`COLLECTION_TOKEN_LIMIT`]667668	/// How many tokens can be mined into this collection.669	///670	/// * Default - [`COLLECTION_TOKEN_LIMIT`].671	/// * Limit - [`COLLECTION_TOKEN_LIMIT`].672	pub token_limit: Option<u32>,673674	/// Timeouts for transfer sponsoring.675	///676	/// * Default677	///   - **Fungible** - [`FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT`]678	///   - **NFT** - [`NFT_SPONSOR_TRANSFER_TIMEOUT`]679	///   - **Refungible** - [`REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT`]680	/// * Limit - [`MAX_SPONSOR_TIMEOUT`].681	pub sponsor_transfer_timeout: Option<u32>,682683	/// Timeout for sponsoring an approval in passed blocks.684	///685	/// * Default - [`SPONSOR_APPROVE_TIMEOUT`].686	/// * Limit - [`MAX_SPONSOR_TIMEOUT`].687	pub sponsor_approve_timeout: Option<u32>,688689	/// Whether the collection owner of the collection can send tokens (which belong to other users).690	///691	/// * Default - **false**.692	pub owner_can_transfer: Option<bool>,693694	/// Can the collection owner burn other people's tokens.695	///696	/// * Default - **true**.697	pub owner_can_destroy: Option<bool>,698699	/// Is it possible to send tokens from this collection between users.700	///701	/// * Default - **true**.702	pub transfers_enabled: Option<bool>,703}704705impl CollectionLimits {706	pub fn with_default_limits(collection_type: CollectionMode) -> Self {707		CollectionLimits {708			account_token_ownership_limit: Some(ACCOUNT_TOKEN_OWNERSHIP_LIMIT),709			sponsored_data_size: Some(CUSTOM_DATA_LIMIT),710			sponsored_data_rate_limit: Some(SponsoringRateLimit::SponsoringDisabled),711			token_limit: Some(COLLECTION_TOKEN_LIMIT),712			sponsor_transfer_timeout: match collection_type {713				CollectionMode::NFT => Some(NFT_SPONSOR_TRANSFER_TIMEOUT),714				CollectionMode::ReFungible => Some(REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT),715				CollectionMode::Fungible(_) => Some(FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT),716			},717			sponsor_approve_timeout: Some(SPONSOR_APPROVE_TIMEOUT),718			owner_can_transfer: Some(false),719			owner_can_destroy: Some(true),720			transfers_enabled: Some(true),721		}722	}723724	/// Get effective value for [`account_token_ownership_limit`](self.account_token_ownership_limit).725	pub fn account_token_ownership_limit(&self) -> u32 {726		self.account_token_ownership_limit727			.unwrap_or(ACCOUNT_TOKEN_OWNERSHIP_LIMIT)728			.min(MAX_TOKEN_OWNERSHIP)729	}730731	/// Get effective value for [`sponsored_data_size`](self.sponsored_data_size).732	pub fn sponsored_data_size(&self) -> u32 {733		self.sponsored_data_size734			.unwrap_or(CUSTOM_DATA_LIMIT)735			.min(CUSTOM_DATA_LIMIT)736	}737738	/// Get effective value for [`token_limit`](self.token_limit).739	pub fn token_limit(&self) -> u32 {740		self.token_limit741			.unwrap_or(COLLECTION_TOKEN_LIMIT)742			.min(COLLECTION_TOKEN_LIMIT)743	}744745	// TODO: may be replace u32 to mode?746	/// Get effective value for [`sponsor_transfer_timeout`](self.sponsor_transfer_timeout).747	pub fn sponsor_transfer_timeout(&self, default: u32) -> u32 {748		self.sponsor_transfer_timeout749			.unwrap_or(default)750			.min(MAX_SPONSOR_TIMEOUT)751	}752753	/// Get effective value for [`sponsor_approve_timeout`](self.sponsor_approve_timeout).754	pub fn sponsor_approve_timeout(&self) -> u32 {755		self.sponsor_approve_timeout756			.unwrap_or(SPONSOR_APPROVE_TIMEOUT)757			.min(MAX_SPONSOR_TIMEOUT)758	}759760	/// Get effective value for [`owner_can_transfer`](self.owner_can_transfer).761	pub fn owner_can_transfer(&self) -> bool {762		self.owner_can_transfer.unwrap_or(false)763	}764765	/// Get effective value for [`owner_can_transfer_instaled`](self.owner_can_transfer_instaled).766	pub fn owner_can_transfer_instaled(&self) -> bool {767		self.owner_can_transfer.is_some()768	}769770	/// Get effective value for [`owner_can_destroy`](self.owner_can_destroy).771	pub fn owner_can_destroy(&self) -> bool {772		self.owner_can_destroy.unwrap_or(true)773	}774775	/// Get effective value for [`transfers_enabled`](self.transfers_enabled).776	pub fn transfers_enabled(&self) -> bool {777		self.transfers_enabled.unwrap_or(true)778	}779780	/// Get effective value for [`sponsored_data_rate_limit`](self.sponsored_data_rate_limit).781	pub fn sponsored_data_rate_limit(&self) -> Option<u32> {782		match self783			.sponsored_data_rate_limit784			.unwrap_or(SponsoringRateLimit::SponsoringDisabled)785		{786			SponsoringRateLimit::SponsoringDisabled => None,787			SponsoringRateLimit::Blocks(v) => Some(v.min(MAX_SPONSOR_TIMEOUT)),788		}789	}790}791792/// Permissions on certain operations within a collection.793///794/// Some fields are wrapped in [`Option`], where `None` means chain default.795///796/// Update with `pallet_common::Pallet::clamp_permissions`.797#[derive(798	Encode,799	Decode,800	Debug,801	Default,802	Clone,803	PartialEq,804	TypeInfo,805	MaxEncodedLen,806	Serialize,807	Deserialize,808)]809// When adding/removing fields from this struct - don't forget to also update `pallet_common::Pallet::clamp_permissions`.810// TODO: move `pallet_common::Pallet::clamp_permissions` into `impl CollectionPermissions`.811pub struct CollectionPermissions {812	/// Access mode.813	///814	/// * Default - [`AccessMode::Normal`].815	pub access: Option<AccessMode>,816817	/// Minting allowance.818	///819	/// * Default - **false**.820	pub mint_mode: Option<bool>,821822	/// Permissions for nesting.823	///824	/// * Default825	///   - `token_owner` - **false**826	///   - `collection_admin` - **false**827	///   - `restricted` - **None**828	pub nesting: Option<NestingPermissions>,829}830831impl CollectionPermissions {832	/// Get effective value for [`access`](self.access).833	pub fn access(&self) -> AccessMode {834		self.access.unwrap_or(AccessMode::Normal)835	}836837	/// Get effective value for [`mint_mode`](self.mint_mode).838	pub fn mint_mode(&self) -> bool {839		self.mint_mode.unwrap_or(false)840	}841842	/// Get effective value for [`nesting`](self.nesting).843	pub fn nesting(&self) -> &NestingPermissions {844		static DEFAULT: NestingPermissions = NestingPermissions {845			token_owner: false,846			collection_admin: false,847			restricted: None,848			#[cfg(feature = "runtime-benchmarks")]849			permissive: false,850		};851		self.nesting.as_ref().unwrap_or(&DEFAULT)852	}853}854855/// Inner set for collections allowed to nest.856type OwnerRestrictedSetInner = BoundedBTreeSet<CollectionId, ConstU32<16>>;857858/// Wraper for collections set allowing nest.859#[derive(860	Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen, Derivative, Serialize, Deserialize,861)]862#[derivative(Debug)]863pub struct OwnerRestrictedSet(864	#[serde(with = "bounded::set_serde")]865	#[derivative(Debug(format_with = "bounded::set_debug"))]866	pub OwnerRestrictedSetInner,867);868869impl OwnerRestrictedSet {870	/// Create new set.871	pub fn new() -> Self {872		Self(Default::default())873	}874}875impl Default for OwnerRestrictedSet {876	fn default() -> Self {877		Self::new()878	}879}880impl core::ops::Deref for OwnerRestrictedSet {881	type Target = OwnerRestrictedSetInner;882	fn deref(&self) -> &Self::Target {883		&self.0884	}885}886impl core::ops::DerefMut for OwnerRestrictedSet {887	fn deref_mut(&mut self) -> &mut Self::Target {888		&mut self.0889	}890}891892impl TryFrom<BTreeSet<CollectionId>> for OwnerRestrictedSet {893	type Error = ();894895	fn try_from(value: BTreeSet<CollectionId>) -> Result<Self, Self::Error> {896		Ok(Self(value.try_into()?))897	}898}899900/// Part of collection permissions, if set, defines who is able to nest tokens into other tokens.901#[derive(902	Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen, Derivative, Serialize, Deserialize,903)]904#[derivative(Debug)]905pub struct NestingPermissions {906	/// Owner of token can nest tokens under it.907	pub token_owner: bool,908	/// Admin of token collection can nest tokens under token.909	pub collection_admin: bool,910	/// If set - only tokens from specified collections can be nested.911	pub restricted: Option<OwnerRestrictedSet>,912913	#[cfg(feature = "runtime-benchmarks")]914	/// Anyone can nest tokens, mutually exclusive with `token_owner`, `admin`.915	pub permissive: bool,916}917918/// Enum denominating how often can sponsoring occur if it is enabled.919///920/// Used for [`collection limits`](CollectionLimits).921#[derive(922	Encode, Decode, Debug, Clone, Copy, PartialEq, TypeInfo, MaxEncodedLen, Serialize, Deserialize,923)]924pub enum SponsoringRateLimit {925	/// Sponsoring is disabled, and the collection sponsor will not pay for transactions926	SponsoringDisabled,927	/// Once per how many blocks can sponsorship of a transaction type occur928	Blocks(u32),929}930931/// Data used to describe an NFT at creation.932#[derive(933	Encode,934	Decode,935	MaxEncodedLen,936	Default,937	PartialEq,938	Clone,939	Derivative,940	TypeInfo,941	Serialize,942	Deserialize,943)]944#[derivative(Debug)]945pub struct CreateNftData {946	/// Key-value pairs used to describe the token as metadata947	#[serde(with = "bounded::vec_serde")]948	#[derivative(Debug(format_with = "bounded::vec_debug"))]949	/// Properties that wil be assignet to created item.950	pub properties: CollectionPropertiesVec,951}952953/// Data used to describe a Fungible token at creation.954#[derive(955	Encode,956	Decode,957	MaxEncodedLen,958	Default,959	Debug,960	Clone,961	PartialEq,962	TypeInfo,963	Serialize,964	Deserialize,965)]966pub struct CreateFungibleData {967	/// Number of fungible coins minted968	pub value: u128,969}970971/// Data used to describe a Refungible token at creation.972#[derive(973	Encode,974	Decode,975	MaxEncodedLen,976	Default,977	PartialEq,978	Clone,979	Derivative,980	TypeInfo,981	Serialize,982	Deserialize,983)]984#[derivative(Debug)]985pub struct CreateReFungibleData {986	/// Number of pieces the RFT is split into987	pub pieces: u128,988989	/// Key-value pairs used to describe the token as metadata990	#[serde(with = "bounded::vec_serde")]991	#[derivative(Debug(format_with = "bounded::vec_debug"))]992	pub properties: CollectionPropertiesVec,993}994995// TODO: remove this.996#[derive(997	Encode, Decode, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen, Serialize, Deserialize,998)]999pub enum MetaUpdatePermission {1000	ItemOwner,1001	Admin,1002	None,1003}10041005/// Enum holding data used for creation of all three item types.1006/// Unified data for create item.1007#[derive(1008	Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo, Serialize, Deserialize,1009)]1010pub enum CreateItemData {1011	/// Data for create NFT.1012	NFT(CreateNftData),1013	/// Data for create Fungible item.1014	Fungible(CreateFungibleData),1015	/// Data for create ReFungible item.1016	ReFungible(CreateReFungibleData),1017}10181019/// Extended data for create NFT.1020#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]1021#[derivative(Debug)]1022pub struct CreateNftExData<CrossAccountId> {1023	/// Properties that wil be assignet to created item.1024	#[derivative(Debug(format_with = "bounded::vec_debug"))]1025	pub properties: CollectionPropertiesVec,10261027	/// Owner of creating item.1028	pub owner: CrossAccountId,1029}10301031/// Extended data for create ReFungible item.1032#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]1033#[derivative(Debug(bound = "CrossAccountId: fmt::Debug + Ord"))]1034pub struct CreateRefungibleExMultipleOwners<CrossAccountId> {1035	#[derivative(Debug(format_with = "bounded::map_debug"))]1036	pub users: BoundedBTreeMap<CrossAccountId, u128, ConstU32<MAX_ITEMS_PER_BATCH>>,1037	#[derivative(Debug(format_with = "bounded::vec_debug"))]1038	pub properties: CollectionPropertiesVec,1039}10401041/// Extended data for create ReFungible item.1042#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]1043#[derivative(Debug(bound = "CrossAccountId: fmt::Debug"))]1044pub struct CreateRefungibleExSingleOwner<CrossAccountId> {1045	pub user: CrossAccountId,1046	pub pieces: u128,1047	#[derivative(Debug(format_with = "bounded::vec_debug"))]1048	pub properties: CollectionPropertiesVec,1049}10501051/// Unified extended data for creating item.1052#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]1053#[derivative(Debug(bound = "CrossAccountId: fmt::Debug + Ord"))]1054pub enum CreateItemExData<CrossAccountId> {1055	/// Extended data for create NFT.1056	NFT(1057		#[derivative(Debug(format_with = "bounded::vec_debug"))]1058		BoundedVec<CreateNftExData<CrossAccountId>, ConstU32<MAX_ITEMS_PER_BATCH>>,1059	),10601061	/// Extended data for create Fungible item.1062	Fungible(1063		#[derivative(Debug(format_with = "bounded::map_debug"))]1064		BoundedBTreeMap<CrossAccountId, u128, ConstU32<MAX_ITEMS_PER_BATCH>>,1065	),10661067	/// Extended data for create ReFungible item in case of1068	/// many tokens, each may have only one owner1069	RefungibleMultipleItems(1070		#[derivative(Debug(format_with = "bounded::vec_debug"))]1071		BoundedVec<CreateRefungibleExSingleOwner<CrossAccountId>, ConstU32<MAX_ITEMS_PER_BATCH>>,1072	),10731074	/// Extended data for create ReFungible item in case of1075	/// single token, which may have many owners1076	RefungibleMultipleOwners(CreateRefungibleExMultipleOwners<CrossAccountId>),1077}10781079impl From<CreateNftData> for CreateItemData {1080	fn from(item: CreateNftData) -> Self {1081		CreateItemData::NFT(item)1082	}1083}10841085impl From<CreateReFungibleData> for CreateItemData {1086	fn from(item: CreateReFungibleData) -> Self {1087		CreateItemData::ReFungible(item)1088	}1089}10901091impl From<CreateFungibleData> for CreateItemData {1092	fn from(item: CreateFungibleData) -> Self {1093		CreateItemData::Fungible(item)1094	}1095}10961097/// Token's address, dictated by its collection and token IDs.1098#[derive(1099	Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo, Serialize, Deserialize,1100)]1101// todo possibly rename to be used generally as an address pair1102pub struct TokenChild {1103	/// Token id.1104	pub token: TokenId,11051106	/// Collection id.1107	pub collection: CollectionId,1108}11091110/// Collection statistics.1111#[derive(1112	Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo, Serialize, Deserialize,1113)]1114pub struct CollectionStats {1115	/// Number of created items.1116	pub created: u32,11171118	/// Number of burned items.1119	pub destroyed: u32,11201121	/// Number of current items.1122	pub alive: u32,1123}11241125/// This type works like [`PhantomData`] but supports generating _scale-info_ descriptions to generate node metadata.1126#[derive(Encode, Decode, Clone, Debug)]1127#[cfg_attr(feature = "std", derive(PartialEq))]1128pub struct PhantomType<T>(core::marker::PhantomData<T>);11291130impl<T: TypeInfo + 'static> TypeInfo for PhantomType<T> {1131	type Identity = PhantomType<T>;11321133	fn type_info() -> scale_info::Type {1134		use scale_info::{1135			build::{FieldsBuilder, UnnamedFields},1136			form::MetaForm,1137			type_params, Path, Type,1138		};1139		Type::builder()1140			.path(Path::new("up_data_structs", "PhantomType"))1141			.type_params(type_params!(T))1142			.composite(1143				<FieldsBuilder<MetaForm, UnnamedFields>>::default().field(|b| b.ty::<[T; 0]>()),1144			)1145	}1146}1147impl<T> MaxEncodedLen for PhantomType<T> {1148	fn max_encoded_len() -> usize {1149		01150	}1151}11521153/// Bounded vector of bytes.1154pub type BoundedBytes<S> = BoundedVec<u8, S>;11551156/// Extra properties for external collections.1157pub type AuxPropertyValue = BoundedBytes<ConstU32<MAX_AUX_PROPERTY_VALUE_LENGTH>>;11581159/// Property key.1160pub type PropertyKey = BoundedBytes<ConstU32<MAX_PROPERTY_KEY_LENGTH>>;11611162/// Property value.1163pub type PropertyValue = BoundedBytes<ConstU32<MAX_PROPERTY_VALUE_LENGTH>>;11641165/// Property permission.1166#[derive(1167	Encode,1168	Decode,1169	TypeInfo,1170	Debug,1171	MaxEncodedLen,1172	PartialEq,1173	Clone,1174	Default,1175	Serialize,1176	Deserialize,1177)]1178pub struct PropertyPermission {1179	/// Permission to change the property and property permission.1180	///1181	/// If it **false** then you can not change corresponding property even if [`collection_admin`] and [`token_owner`] are **true**.1182	pub mutable: bool,11831184	/// Change permission for the collection administrator.1185	pub collection_admin: bool,11861187	/// Permission to change the property for the owner of the token.1188	pub token_owner: bool,1189}11901191impl PropertyPermission {1192	/// Creates mutable property permission but changes restricted for collection admin and token owner.1193	pub fn none() -> Self {1194		Self {1195			mutable: true,1196			collection_admin: false,1197			token_owner: false,1198		}1199	}1200}12011202/// Property is simpl key-value record.1203#[derive(1204	Encode, Decode, Debug, TypeInfo, Clone, PartialEq, MaxEncodedLen, Serialize, Deserialize,1205)]1206pub struct Property {1207	/// Property key.1208	#[serde(with = "bounded::vec_serde")]1209	pub key: PropertyKey,12101211	/// Property value.1212	#[serde(with = "bounded::vec_serde")]1213	pub value: PropertyValue,1214}12151216impl From<Property> for (PropertyKey, PropertyValue) {1217	fn from(value: Property) -> Self {1218		(value.key, value.value)1219	}1220}12211222/// Record for proprty key permission.1223#[derive(1224	Encode, Decode, TypeInfo, Debug, MaxEncodedLen, PartialEq, Clone, Serialize, Deserialize,1225)]1226pub struct PropertyKeyPermission {1227	/// Key.1228	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]1229	pub key: PropertyKey,12301231	/// Permission.1232	pub permission: PropertyPermission,1233}12341235impl From<PropertyKeyPermission> for (PropertyKey, PropertyPermission) {1236	fn from(value: PropertyKeyPermission) -> Self {1237		(value.key, value.permission)1238	}1239}12401241/// Errors for properties actions.1242#[derive(Debug)]1243pub enum PropertiesError {1244	/// The space allocated for properties has run out.1245	///1246	/// * Limit for colection - [`MAX_COLLECTION_PROPERTIES_SIZE`].1247	/// * Limit for token - [`MAX_TOKEN_PROPERTIES_SIZE`].1248	NoSpaceForProperty,12491250	/// The property limit has been reached.1251	///1252	/// * Limit - [`MAX_PROPERTIES_PER_ITEM`].1253	PropertyLimitReached,12541255	/// Property key contains not allowed character.1256	InvalidCharacterInPropertyKey,12571258	/// Property key length is too long.1259	///1260	/// * Limit - [`MAX_PROPERTY_KEY_LENGTH`].1261	PropertyKeyIsTooLong,12621263	/// Property key is empty.1264	EmptyPropertyKey,1265}12661267/// Token owner error: it could be either `NotFound` ot `MultipleOwners`.1268#[derive(Debug)]1269pub enum TokenOwnerError {1270	NotFound,1271	MultipleOwners,1272}12731274/// Marker for scope of property.1275///1276/// Scoped property can't be changed by user. Used for external collections.1277#[derive(Encode, Decode, MaxEncodedLen, TypeInfo, PartialEq, Clone, Copy)]1278pub enum PropertyScope {1279	None,1280	Rmrk,1281}12821283impl PropertyScope {1284	pub fn prefix(&self) -> &'static [u8] {1285		match self {1286			Self::None => b"",1287			Self::Rmrk => b"rmrk:",1288		}1289	}1290	/// Apply scope to property key.1291	pub fn apply(self, key: PropertyKey) -> Result<PropertyKey, PropertiesError> {1292		let prefix = self.prefix();1293		if prefix == b"" {1294			return Ok(key);1295		}1296		[prefix, key.as_slice()]1297			.concat()1298			.try_into()1299			.map_err(|_| PropertiesError::PropertyKeyIsTooLong)1300	}1301}13021303/// Trait for operate with properties.1304pub trait TrySetProperty: Sized {1305	type Value;13061307	/// Try to set property with scope.1308	fn try_scoped_set(1309		&mut self,1310		scope: PropertyScope,1311		key: PropertyKey,1312		value: Self::Value,1313	) -> Result<Option<Self::Value>, PropertiesError>;13141315	/// Try to set property with scope from iterator.1316	fn try_scoped_set_from_iter<I, KV>(1317		&mut self,1318		scope: PropertyScope,1319		iter: I,1320	) -> Result<(), PropertiesError>1321	where1322		I: Iterator<Item = KV>,1323		KV: Into<(PropertyKey, Self::Value)>,1324	{1325		for kv in iter {1326			let (key, value) = kv.into();1327			self.try_scoped_set(scope, key, value)?;1328		}13291330		Ok(())1331	}13321333	/// Try to set property.1334	fn try_set(1335		&mut self,1336		key: PropertyKey,1337		value: Self::Value,1338	) -> Result<Option<Self::Value>, PropertiesError> {1339		self.try_scoped_set(PropertyScope::None, key, value)1340	}13411342	/// Try to set property from iterator.1343	fn try_set_from_iter<I, KV>(&mut self, iter: I) -> Result<(), PropertiesError>1344	where1345		I: Iterator<Item = KV>,1346		KV: Into<(PropertyKey, Self::Value)>,1347	{1348		self.try_scoped_set_from_iter(PropertyScope::None, iter)1349	}1350}13511352/// Wrapped map for storing properties.1353#[derive(Encode, Decode, TypeInfo, Derivative, Clone, PartialEq, MaxEncodedLen)]1354#[derivative(Default(bound = ""))]1355pub struct PropertiesMap<Value>(1356	BoundedBTreeMap<PropertyKey, Value, ConstU32<MAX_PROPERTIES_PER_ITEM>>,1357);13581359impl<Value> PropertiesMap<Value> {1360	/// Create new property map.1361	pub fn new() -> Self {1362		Self(BoundedBTreeMap::new())1363	}13641365	/// Remove property from map.1366	pub fn remove(&mut self, key: &PropertyKey) -> Result<Option<Value>, PropertiesError> {1367		Self::check_property_key(key)?;13681369		Ok(self.0.remove(key))1370	}13711372	/// Get property with appropriate key from map.1373	pub fn get(&self, key: &PropertyKey) -> Option<&Value> {1374		self.0.get(key)1375	}13761377	/// Check if map contains key.1378	pub fn contains_key(&self, key: &PropertyKey) -> bool {1379		self.0.contains_key(key)1380	}13811382	/// Check if map contains key with key validation.1383	fn check_property_key(key: &PropertyKey) -> Result<(), PropertiesError> {1384		if key.is_empty() {1385			return Err(PropertiesError::EmptyPropertyKey);1386		}13871388		for byte in key.as_slice().iter() {1389			let byte = *byte;13901391			if !byte.is_ascii_alphanumeric() && byte != b'_' && byte != b'-' && byte != b'.' {1392				return Err(PropertiesError::InvalidCharacterInPropertyKey);1393			}1394		}13951396		Ok(())1397	}13981399	pub fn values(&self) -> impl Iterator<Item = &Value> {1400		self.0.values()1401	}14021403	pub fn iter(&self) -> impl Iterator<Item = (&PropertyKey, &Value)> {1404		self.0.iter()1405	}1406}14071408impl<Value> IntoIterator for PropertiesMap<Value> {1409	type Item = (PropertyKey, Value);1410	type IntoIter = <1411		BoundedBTreeMap<1412			PropertyKey,1413			Value,1414			ConstU32<MAX_PROPERTIES_PER_ITEM>1415		> as IntoIterator1416	>::IntoIter;14171418	fn into_iter(self) -> Self::IntoIter {1419		self.0.into_iter()1420	}1421}14221423impl<Value> TrySetProperty for PropertiesMap<Value> {1424	type Value = Value;14251426	fn try_scoped_set(1427		&mut self,1428		scope: PropertyScope,1429		key: PropertyKey,1430		value: Self::Value,1431	) -> Result<Option<Self::Value>, PropertiesError> {1432		Self::check_property_key(&key)?;14331434		let key = scope.apply(key)?;1435		self.01436			.try_insert(key, value)1437			.map_err(|_| PropertiesError::PropertyLimitReached)1438	}1439}14401441/// Alias for property permissions map.1442pub type PropertiesPermissionMap = PropertiesMap<PropertyPermission>;14431444fn slice_size(data: &[u8]) -> u32 {1445	scoped_slice_size(PropertyScope::None, data)1446}1447fn scoped_slice_size(scope: PropertyScope, data: &[u8]) -> u32 {1448	use parity_scale_codec::Compact;1449	let prefix = scope.prefix();1450	<Compact<u32>>::encoded_size(&Compact(data.len() as u32 + prefix.len() as u32)) as u321451		+ data.len() as u321452		+ prefix.len() as u321453}14541455/// Wrapper for properties map with consumed space control.1456#[derive(Encode, Decode, TypeInfo, Clone, PartialEq)]1457pub struct Properties<const S: u32> {1458	map: PropertiesMap<PropertyValue>,1459	consumed_space: u32,1460	// May be not zero, previously served as a current S generic1461	_reserved: u32,1462}14631464impl<const S: u32> MaxEncodedLen for Properties<S> {1465	fn max_encoded_len() -> usize {1466		// len of map + len of consumed_space + len of space_limit1467		u32::max_encoded_len() * 3 + S as usize1468	}1469}14701471impl<const S: u32> Default for Properties<S> {1472	fn default() -> Self {1473		Self::new()1474	}1475}14761477impl<const S: u32> Properties<S> {1478	/// Create new properies container.1479	pub fn new() -> Self {1480		Self {1481			map: PropertiesMap::new(),1482			consumed_space: 0,1483			_reserved: 0,1484		}1485	}14861487	/// Remove propery with appropiate key.1488	pub fn remove(&mut self, key: &PropertyKey) -> Result<Option<PropertyValue>, PropertiesError> {1489		let value = self.map.remove(key)?;14901491		if let Some(ref value) = value {1492			let kv_len = slice_size(key) + slice_size(value);1493			self.consumed_space = self.consumed_space.saturating_sub(kv_len);1494		}14951496		Ok(value)1497	}14981499	/// Get property with appropriate key.1500	pub fn get(&self, key: &PropertyKey) -> Option<&PropertyValue> {1501		self.map.get(key)1502	}15031504	/// Recomputes the consumed space for the current properties state.1505	/// Needed to repair a token due to a bug fixed in the [PR #733](https://github.com/UniqueNetwork/unique-chain/pull/773).1506	pub fn recompute_consumed_space(&mut self) {1507		self.consumed_space = self1508			.map1509			.iter()1510			.map(|(key, value)| slice_size(key) + slice_size(value))1511			.sum();1512	}1513}15141515impl<const S: u32> IntoIterator for Properties<S> {1516	type Item = (PropertyKey, PropertyValue);1517	type IntoIter = <PropertiesMap<PropertyValue> as IntoIterator>::IntoIter;15181519	fn into_iter(self) -> Self::IntoIter {1520		self.map.into_iter()1521	}1522}15231524impl<const S: u32> TrySetProperty for Properties<S> {1525	type Value = PropertyValue;15261527	fn try_scoped_set(1528		&mut self,1529		scope: PropertyScope,1530		key: PropertyKey,1531		value: Self::Value,1532	) -> Result<Option<Self::Value>, PropertiesError> {1533		let key_size = scoped_slice_size(scope, &key);1534		let value_size = slice_size(&value);15351536		if self.consumed_space + value_size + key_size > S && !cfg!(feature = "runtime-benchmarks")1537		{1538			return Err(PropertiesError::NoSpaceForProperty);1539		}15401541		let old_value = self.map.try_scoped_set(scope, key, value)?;15421543		if let Some(old_value) = old_value.as_ref() {1544			let old_value_size = slice_size(old_value);1545			self.consumed_space = self.consumed_space.saturating_sub(old_value_size) + value_size;1546		} else {1547			self.consumed_space += key_size + value_size;1548		}15491550		Ok(old_value)1551	}1552}15531554pub type CollectionProperties = Properties<MAX_COLLECTION_PROPERTIES_SIZE>;1555pub type TokenProperties = Properties<MAX_TOKEN_PROPERTIES_SIZE>;
modifiedprimitives/data-structs/src/mapping.rsdiffbeforeafterboth
--- a/primitives/data-structs/src/mapping.rs
+++ b/primitives/data-structs/src/mapping.rs
@@ -18,10 +18,10 @@
 
 use core::marker::PhantomData;
 
+use pallet_evm::account::CrossAccountId;
 use sp_core::H160;
 
 use crate::{CollectionId, TokenId};
-use pallet_evm::account::CrossAccountId;
 
 /// Trait for mapping between token id and some `Address`.
 pub trait TokenAddressMapping<Address> {
modifiedprimitives/data-structs/src/migration.rsdiffbeforeafterboth
--- a/primitives/data-structs/src/migration.rs
+++ b/primitives/data-structs/src/migration.rs
@@ -17,8 +17,9 @@
 /// Storage migration is not required for this change, as SponsoringRateLimit has same encoding as Option<u32>
 #[test]
 fn sponsoring_rate_limit_has_same_encoding_as_option_u32() {
+	use parity_scale_codec::Encode;
+
 	use crate::SponsoringRateLimit;
-	use codec::Encode;
 
 	fn limit_to_option(limit: SponsoringRateLimit) -> Option<u32> {
 		match limit {
@@ -41,8 +42,9 @@
 
 #[test]
 fn collection_flags_have_same_encoding_as_bool() {
+	use parity_scale_codec::Encode;
+
 	use crate::CollectionFlags;
-	use codec::Encode;
 
 	assert_eq!(
 		true.encode(),
modifiedprimitives/pov-estimate-rpc/src/lib.rsdiffbeforeafterboth
--- a/primitives/pov-estimate-rpc/src/lib.rs
+++ b/primitives/pov-estimate-rpc/src/lib.rs
@@ -17,12 +17,10 @@
 #![cfg_attr(not(feature = "std"), no_std)]
 
 use scale_info::TypeInfo;
-use sp_std::vec::Vec;
-
 #[cfg(feature = "std")]
 use serde::Serialize;
-
 use sp_runtime::ApplyExtrinsicResult;
+use sp_std::vec::Vec;
 
 #[cfg_attr(feature = "std", derive(Serialize))]
 #[derive(Debug, TypeInfo)]
modifiedprimitives/rpc/src/lib.rsdiffbeforeafterboth
--- a/primitives/rpc/src/lib.rs
+++ b/primitives/rpc/src/lib.rs
@@ -18,14 +18,13 @@
 
 extern crate alloc;
 
+use parity_scale_codec::Decode;
+use sp_runtime::DispatchError;
+use sp_std::vec::Vec;
 use up_data_structs::{
-	CollectionId, TokenId, RawEncoded, RpcCollection, CollectionStats, CollectionLimits, Property,
-	PropertyKeyPermission, TokenData, TokenChild, TokenDataVersion1,
+	CollectionId, CollectionLimits, CollectionStats, Property, PropertyKeyPermission,
+	RpcCollection, TokenChild, TokenData, TokenId,
 };
-
-use sp_std::vec::Vec;
-use codec::Decode;
-use sp_runtime::DispatchError;
 
 type Result<T> = core::result::Result<T, DispatchError>;
 
modifiedruntime/common/config/ethereum.rsdiffbeforeafterboth
--- a/runtime/common/config/ethereum.rs
+++ b/runtime/common/config/ethereum.rs
@@ -1,22 +1,24 @@
-use sp_core::{U256, H160};
 use frame_support::{
-	weights::{Weight, constants::WEIGHT_REF_TIME_PER_SECOND},
-	traits::{FindAuthor},
-	parameter_types, ConsensusEngineId,
+	parameter_types,
+	traits::FindAuthor,
+	weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
+	ConsensusEngineId,
 };
-use sp_runtime::{RuntimeAppPublic, Perbill, traits::ConstU32};
+use pallet_ethereum::PostLogContent;
+use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping};
+use sp_core::{H160, U256};
+use sp_runtime::{traits::ConstU32, Perbill, RuntimeAppPublic};
+use up_common::constants::*;
+
 use crate::{
 	runtime_common::{
 		config::sponsoring::DefaultSponsoringRateLimit,
-		DealWithFees,
 		dispatch::CollectionDispatchT,
 		ethereum::{precompiles::UniquePrecompiles, sponsoring::EvmSponsorshipHandler},
+		DealWithFees,
 	},
-	Runtime, Aura, Balances, RuntimeEvent, ChainId,
+	Aura, Balances, ChainId, Runtime, RuntimeEvent,
 };
-use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping};
-use pallet_ethereum::PostLogContent;
-use up_common::constants::*;
 
 pub type CrossAccountId = pallet_evm::account::BasicCrossAccountId<Runtime>;
 
modifiedruntime/common/config/governance/fellowship.rsdiffbeforeafterboth
--- a/runtime/common/config/governance/fellowship.rs
+++ b/runtime/common/config/governance/fellowship.rs
@@ -1,8 +1,11 @@
-use crate::{Preimage, Treasury, RuntimeCall, RuntimeEvent, Scheduler, FellowshipReferenda, Runtime};
-use super::*;
 use pallet_gov_origins::Origin as GovOrigins;
 use pallet_ranked_collective::{Config as RankedConfig, Rank, TallyOf};
 
+use super::*;
+use crate::{
+	FellowshipReferenda, Preimage, Runtime, RuntimeCall, RuntimeEvent, Scheduler, Treasury,
+};
+
 pub const FELLOWSHIP_MODULE_ID: PalletId = PalletId(*b"flowship");
 pub const DEMOCRACY_TRACK_ID: u16 = 10;
 
modifiedruntime/common/config/governance/mod.rsdiffbeforeafterboth
--- a/runtime/common/config/governance/mod.rs
+++ b/runtime/common/config/governance/mod.rs
@@ -15,29 +15,31 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use frame_support::{
-	PalletId, parameter_types,
+	pallet_prelude::*,
+	parameter_types,
 	traits::{
-		EnsureOrigin, EqualPrivilegeOnly, EitherOfDiverse, EitherOf, MapSuccess, ConstU16, Polling,
+		ConstU16, EitherOf, EitherOfDiverse, EnsureOrigin, EqualPrivilegeOnly, MapSuccess, Polling,
 	},
 	weights::Weight,
-	pallet_prelude::*,
+	PalletId,
 };
-use frame_system::{EnsureRoot, EnsureNever};
+use frame_system::{EnsureNever, EnsureRoot};
+use pallet_collective::EnsureProportionAtLeast;
 use sp_runtime::{
+	morph_types,
+	traits::{AccountIdConversion, CheckedSub, ConstU32, Convert, Replace},
 	Perbill,
-	traits::{AccountIdConversion, ConstU32, Replace, CheckedSub, Convert},
-	morph_types,
 };
-use crate::{
-	Runtime, RuntimeOrigin, RuntimeEvent, RuntimeCall, OriginCaller, Preimage, Balances, Treasury,
-	Scheduler, Council, TechnicalCommittee,
-};
 pub use up_common::{
-	constants::{UNIQUE, DAYS, HOURS, MINUTES, CENTIUNIQUE},
+	constants::{CENTIUNIQUE, DAYS, HOURS, MINUTES, UNIQUE},
 	types::{AccountId, Balance, BlockNumber},
 };
-use pallet_collective::EnsureProportionAtLeast;
 
+use crate::{
+	Balances, Council, OriginCaller, Preimage, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin,
+	Scheduler, TechnicalCommittee, Treasury,
+};
+
 pub mod council;
 pub use council::*;
 
modifiedruntime/common/config/orml.rsdiffbeforeafterboth
--- a/runtime/common/config/orml.rs
+++ b/runtime/common/config/orml.rs
@@ -20,26 +20,26 @@
 };
 use frame_system::EnsureSigned;
 use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key};
+use pallet_foreign_assets::{CurrencyId, NativeCurrency};
 use sp_runtime::traits::Convert;
-use xcm::latest::{Weight, Junction::*, Junctions::*, MultiLocation};
-use xcm_executor::XcmExecutor;
 use sp_std::{vec, vec::Vec};
-use pallet_foreign_assets::{CurrencyId, NativeCurrency};
+use staging_xcm::latest::{Junction::*, Junctions::*, MultiLocation, Weight};
+use staging_xcm_executor::XcmExecutor;
+use up_common::{
+	constants::*,
+	types::{AccountId, Balance},
+};
+
 use crate::{
-	Runtime, RuntimeEvent, RelayChainBlockNumberProvider,
 	runtime_common::config::{
+		pallets::TreasuryAccountId,
+		substrate::{MaxLocks, MaxReserves},
 		xcm::{
-			SelfLocation, Weigher, XcmExecutorConfig, UniversalLocation,
-			xcm_assets::{CurrencyIdConvert},
+			xcm_assets::CurrencyIdConvert, SelfLocation, UniversalLocation, Weigher,
+			XcmExecutorConfig,
 		},
-		pallets::TreasuryAccountId,
-		substrate::{MaxLocks, MaxReserves},
 	},
-};
-
-use up_common::{
-	types::{AccountId, Balance},
-	constants::*,
+	RelayChainBlockNumberProvider, Runtime, RuntimeEvent,
 };
 
 // Signed version of balance
modifiedruntime/common/config/pallets/app_promotion.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/app_promotion.rs
+++ b/runtime/common/config/pallets/app_promotion.rs
@@ -14,18 +14,18 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use crate::{
-	runtime_common::config::pallets::{TreasuryAccountId, RelayChainBlockNumberProvider},
-	Runtime, Balances, BlockNumber, Unique, RuntimeEvent, EvmContractHelpers, Maintenance,
-};
-
 use frame_support::{parameter_types, PalletId};
 use sp_arithmetic::Perbill;
 use up_common::{
-	constants::{UNIQUE, DAYS, RELAY_DAYS},
+	constants::{DAYS, RELAY_DAYS, UNIQUE},
 	types::Balance,
 };
 
+use crate::{
+	runtime_common::config::pallets::{RelayChainBlockNumberProvider, TreasuryAccountId},
+	Balances, BlockNumber, EvmContractHelpers, Maintenance, Runtime, RuntimeEvent, Unique,
+};
+
 parameter_types! {
 	pub const AppPromotionId: PalletId = PalletId(*b"appstake");
 	pub const RecalculationInterval: BlockNumber = RELAY_DAYS;
modifiedruntime/common/config/pallets/collator_selection.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/collator_selection.rs
+++ b/runtime/common/config/pallets/collator_selection.rs
@@ -15,23 +15,21 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use frame_support::{parameter_types, PalletId};
-use crate::{
-	Balance, Balances, BlockNumber, Runtime, RuntimeEvent, Aura, Session, SessionKeys,
-	CollatorSelection, Treasury,
-	config::pallets::{MaxCollators, SessionPeriod, TreasuryAccountId},
+#[cfg(not(feature = "governance"))]
+use frame_system::EnsureRoot;
+use pallet_configuration::{
+	CollatorSelectionDesiredCollatorsOverride, CollatorSelectionKickThresholdOverride,
+	CollatorSelectionLicenseBondOverride,
 };
+use sp_runtime::Perbill;
+use up_common::constants::{MILLIUNIQUE, UNIQUE};
 
 #[cfg(feature = "governance")]
 use crate::config::governance;
-
-#[cfg(not(feature = "governance"))]
-use frame_system::EnsureRoot;
-
-use sp_runtime::Perbill;
-use up_common::constants::{UNIQUE, MILLIUNIQUE};
-use pallet_configuration::{
-	CollatorSelectionKickThresholdOverride, CollatorSelectionLicenseBondOverride,
-	CollatorSelectionDesiredCollatorsOverride,
+use crate::{
+	config::pallets::{MaxCollators, SessionPeriod, TreasuryAccountId},
+	Aura, Balance, Balances, BlockNumber, CollatorSelection, Runtime, RuntimeEvent,
+	RuntimeHoldReason, Session, SessionKeys, Treasury,
 };
 parameter_types! {
 	pub const SessionOffset: BlockNumber = 0;
modifiedruntime/common/config/pallets/foreign_asset.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/foreign_asset.rs
+++ b/runtime/common/config/pallets/foreign_asset.rs
@@ -1,6 +1,7 @@
-use crate::{Runtime, RuntimeEvent, Balances};
 use up_common::types::AccountId;
 
+use crate::{Balances, Runtime, RuntimeEvent};
+
 impl pallet_foreign_assets::Config for Runtime {
 	type RuntimeEvent = RuntimeEvent;
 	type Currency = Balances;
modifiedruntime/common/config/pallets/mod.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -15,29 +15,30 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use alloc::string::{String, ToString};
-use frame_support::parameter_types;
+
+use frame_support::{
+	parameter_types,
+	traits::{ConstU32, ConstU64, Currency},
+};
+use sp_arithmetic::Perbill;
 use sp_runtime::traits::AccountIdConversion;
+use up_common::{
+	constants::*,
+	types::{AccountId, Balance, BlockNumber},
+};
+use up_data_structs::mapping::{CrossTokenAddressMapping, EvmTokenAddressMapping};
+
+#[cfg(feature = "governance")]
+use crate::runtime_common::config::governance;
 use crate::{
 	runtime_common::{
+		config::{ethereum::EvmCollectionHelpersAddress, substrate::TreasuryModuleId},
 		dispatch::CollectionDispatchT,
-		config::{substrate::TreasuryModuleId, ethereum::EvmCollectionHelpersAddress},
 		weights::CommonWeights,
 		RelayChainBlockNumberProvider,
 	},
-	Runtime, RuntimeEvent, RuntimeCall, VERSION, TOKEN_SYMBOL, DECIMALS, Balances,
-};
-use frame_support::traits::{ConstU32, ConstU64, Currency};
-use up_common::{
-	types::{AccountId, Balance, BlockNumber},
-	constants::*,
-};
-use up_data_structs::{
-	mapping::{EvmTokenAddressMapping, CrossTokenAddressMapping},
+	Balances, Runtime, RuntimeCall, RuntimeEvent, DECIMALS, TOKEN_SYMBOL, VERSION,
 };
-use sp_arithmetic::Perbill;
-
-#[cfg(feature = "governance")]
-use crate::runtime_common::config::governance;
 
 #[cfg(feature = "unique-scheduler")]
 pub mod scheduler;
modifiedruntime/common/config/pallets/preimage.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/preimage.rs
+++ b/runtime/common/config/pallets/preimage.rs
@@ -16,9 +16,10 @@
 
 use frame_support::parameter_types;
 use frame_system::EnsureRoot;
-use crate::{AccountId, Balance, Balances, Runtime, RuntimeEvent};
 use up_common::constants::*;
 
+use crate::{AccountId, Balance, Balances, Runtime, RuntimeEvent};
+
 parameter_types! {
 	pub PreimageBaseDeposit: Balance = 1000 * UNIQUE;
 }
modifiedruntime/common/config/pallets/scheduler.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/scheduler.rs
+++ b/runtime/common/config/pallets/scheduler.rs
@@ -14,21 +14,23 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
+use core::cmp::Ordering;
+
 use frame_support::{
-	traits::{PrivilegeCmp, EnsureOrigin},
-	weights::Weight,
 	parameter_types,
+	traits::{EnsureOrigin, PrivilegeCmp},
+	weights::Weight,
 };
 use frame_system::{EnsureRoot, RawOrigin};
+use pallet_unique_scheduler_v2::ScheduledEnsureOriginSuccess;
+use parity_scale_codec::Decode;
 use sp_runtime::Perbill;
-use core::cmp::Ordering;
-use codec::Decode;
+use up_common::types::AccountId;
+
 use crate::{
-	runtime_common::{scheduler::SchedulerPaymentExecutor, config::substrate::RuntimeBlockWeights},
-	Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, OriginCaller,
+	runtime_common::{config::substrate::RuntimeBlockWeights, scheduler::SchedulerPaymentExecutor},
+	OriginCaller, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin,
 };
-use pallet_unique_scheduler_v2::ScheduledEnsureOriginSuccess;
-use up_common::types::AccountId;
 
 parameter_types! {
 	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *
modifiedruntime/common/config/parachain.rsdiffbeforeafterboth
--- a/runtime/common/config/parachain.rs
+++ b/runtime/common/config/parachain.rs
@@ -14,10 +14,11 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use frame_support::{weights::Weight, parameter_types};
-use crate::{Runtime, RuntimeEvent, XcmpQueue, DmpQueue};
+use frame_support::{parameter_types, weights::Weight};
 use up_common::constants::*;
 
+use crate::{DmpQueue, Runtime, RuntimeEvent, XcmpQueue};
+
 parameter_types! {
 	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
 	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
modifiedruntime/common/config/sponsoring.rsdiffbeforeafterboth
--- a/runtime/common/config/sponsoring.rs
+++ b/runtime/common/config/sponsoring.rs
@@ -14,14 +14,12 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use crate::{
-	runtime_common::{sponsoring::UniqueSponsorshipHandler},
-	Runtime,
-};
 use frame_support::parameter_types;
 use sp_core::U256;
 use up_common::{constants::*, types::BlockNumber};
 
+use crate::{runtime_common::sponsoring::UniqueSponsorshipHandler, Runtime};
+
 parameter_types! {
 	pub const DefaultSponsoringRateLimit: BlockNumber = 1 * DAYS;
 	pub const DefaultSponsoringFeeLimit: U256 = U256::MAX;
modifiedruntime/common/config/substrate.rsdiffbeforeafterboth
--- a/runtime/common/config/substrate.rs
+++ b/runtime/common/config/substrate.rs
@@ -15,31 +15,32 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use frame_support::{
-	traits::{Everything, ConstU32, NeverEnsureOrigin},
+	dispatch::DispatchClass,
+	ord_parameter_types, parameter_types,
+	traits::{ConstBool, ConstU32, Everything, NeverEnsureOrigin},
 	weights::{
 		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},
 		ConstantMultiplier,
 	},
-	dispatch::DispatchClass,
-	parameter_types, ord_parameter_types, PalletId,
-};
-use sp_runtime::{
-	generic,
-	traits::{BlakeTwo256, AccountIdLookup},
-	Perbill, Permill, Percent,
+	PalletId,
 };
-use sp_arithmetic::traits::One;
 use frame_system::{
 	limits::{BlockLength, BlockWeights},
 	EnsureRoot, EnsureSignedBy,
 };
-use pallet_transaction_payment::{Multiplier, ConstFeeMultiplier};
-use crate::{
-	runtime_common::DealWithFees, Runtime, RuntimeEvent, RuntimeCall, RuntimeOrigin, OriginCaller,
-	PalletInfo, System, Balances, SS58Prefix, Version,
+use pallet_transaction_payment::{ConstFeeMultiplier, Multiplier};
+use sp_arithmetic::traits::One;
+use sp_runtime::{
+	traits::{AccountIdLookup, BlakeTwo256},
+	Perbill, Percent, Permill,
 };
-use up_common::{types::*, constants::*};
 use sp_std::vec;
+use up_common::{constants::*, types::*};
+
+use crate::{
+	runtime_common::DealWithFees, Balances, Block, OriginCaller, PalletInfo, Runtime, RuntimeCall,
+	RuntimeEvent, RuntimeHoldReason, RuntimeOrigin, SS58Prefix, System, Version,
+};
 
 parameter_types! {
 	pub const BlockHashCount: BlockNumber = 2400;
modifiedruntime/common/config/test_pallets.rsdiffbeforeafterboth
--- a/runtime/common/config/test_pallets.rs
+++ b/runtime/common/config/test_pallets.rs
@@ -14,7 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use crate::{Runtime, RuntimeEvent, RuntimeCall};
+use crate::{Runtime, RuntimeCall, RuntimeEvent};
 
 impl pallet_test_utils::Config for Runtime {
 	type RuntimeEvent = RuntimeEvent;
modifiedruntime/common/config/xcm/foreignassets.rsdiffbeforeafterboth
--- a/runtime/common/config/xcm/foreignassets.rs
+++ b/runtime/common/config/xcm/foreignassets.rs
@@ -14,23 +14,22 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use frame_support::{traits::Get, parameter_types};
-use sp_runtime::traits::Convert;
-use xcm::latest::{prelude::*, MultiAsset, MultiLocation};
-use xcm_builder::{FungiblesAdapter, NoChecking, ConvertedConcreteId};
-use xcm_executor::traits::{TransactAsset, Convert as ConvertXcm, JustTry};
-use pallet_foreign_assets::{
-	AssetIds, AssetIdMapping, XcmForeignAssetIdMapping, NativeCurrency, FreeForAll, TryAsForeign,
-	ForeignAssetId, CurrencyId,
-};
-use sp_std::{borrow::Borrow, marker::PhantomData};
+use frame_support::{parameter_types, traits::Get};
 use orml_traits::location::AbsoluteReserveProvider;
 use orml_xcm_support::MultiNativeAsset;
-use crate::{Runtime, Balances, ParachainInfo, PolkadotXcm, ForeignAssets};
+use pallet_foreign_assets::{
+	AssetId, AssetIdMapping, CurrencyId, ForeignAssetId, FreeForAll, NativeCurrency, TryAsForeign,
+	XcmForeignAssetIdMapping,
+};
+use sp_runtime::traits::{Convert, MaybeEquivalence};
+use sp_std::marker::PhantomData;
+use staging_xcm::latest::{prelude::*, MultiAsset, MultiLocation};
+use staging_xcm_builder::{ConvertedConcreteId, FungiblesAdapter, NoChecking};
+use staging_xcm_executor::traits::{JustTry, TransactAsset};
+use up_common::types::{AccountId, Balance};
 
 use super::{LocationToAccountId, RelayLocation};
-
-use up_common::types::{AccountId, Balance};
+use crate::{Balances, ForeignAssets, ParachainInfo, PolkadotXcm, Runtime};
 
 parameter_types! {
 	pub CheckingAccount: AccountId = PolkadotXcm::check_account();
modifiedruntime/common/config/xcm/mod.rsdiffbeforeafterboth
--- a/runtime/common/config/xcm/mod.rs
+++ b/runtime/common/config/xcm/mod.rs
@@ -15,28 +15,33 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use frame_support::{
-	traits::{Everything, Nothing, Get, ConstU32, ProcessMessageError, Contains},
 	parameter_types,
+	traits::{ConstU32, Contains, Everything, Get, Nothing, ProcessMessageError},
 };
 use frame_system::EnsureRoot;
 use pallet_xcm::XcmPassthrough;
-use polkadot_parachain::primitives::Sibling;
-use xcm::latest::{prelude::*, Weight, MultiLocation};
-use xcm::v3::Instruction;
-use xcm_builder::{
-	AccountId32Aliases, EnsureXcmOrigin, FixedWeightBounds, ParentAsSuperuser, RelayChainAsNative,
-	SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
-	SignedToAccountId32, SovereignSignedViaLocation, ParentIsPreset,
-};
-use xcm_executor::{XcmExecutor, traits::ShouldExecute};
+use polkadot_parachain_primitives::primitives::Sibling;
 use sp_std::marker::PhantomData;
-use crate::{
-	Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, ParachainInfo, ParachainSystem, PolkadotXcm,
-	XcmpQueue, xcm_barrier::Barrier, RelayNetwork, AllPalletsWithSystem, Balances,
+use staging_xcm::{
+	latest::{prelude::*, MultiLocation, Weight},
+	v3::Instruction,
+};
+use staging_xcm_builder::{
+	AccountId32Aliases, EnsureXcmOrigin, FixedWeightBounds, ParentAsSuperuser, ParentIsPreset,
+	RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
+	SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation,
+};
+use staging_xcm_executor::{
+	traits::{Properties, ShouldExecute},
+	XcmExecutor,
 };
-
 use up_common::types::AccountId;
 
+use crate::{
+	xcm_barrier::Barrier, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem,
+	PolkadotXcm, RelayNetwork, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, XcmpQueue,
+};
+
 #[cfg(feature = "foreign-assets")]
 pub mod foreignassets;
 
@@ -45,14 +50,12 @@
 
 #[cfg(feature = "foreign-assets")]
 pub use foreignassets as xcm_assets;
-
 #[cfg(not(feature = "foreign-assets"))]
 pub use nativeassets as xcm_assets;
+use xcm_assets::{AssetTransactor, IsReserve, Trader};
 
 #[cfg(feature = "governance")]
 use crate::runtime_common::config::governance;
-
-use xcm_assets::{AssetTransactor, IsReserve, Trader};
 
 parameter_types! {
 	pub const RelayLocation: MultiLocation = MultiLocation::parent();
modifiedruntime/common/config/xcm/nativeassets.rsdiffbeforeafterboth
--- a/runtime/common/config/xcm/nativeassets.rs
+++ b/runtime/common/config/xcm/nativeassets.rs
@@ -14,31 +14,28 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
+use cumulus_primitives_core::XcmContext;
 use frame_support::{
-	traits::{tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Get},
+	traits::{tokens::currency::Currency as CurrencyT, Get, OnUnbalanced as OnUnbalancedT},
 	weights::WeightToFeePolynomial,
 };
-use sp_runtime::traits::{CheckedConversion, Zero, Convert};
-use xcm::latest::{
-	AssetId::{Concrete},
-	Fungibility::Fungible as XcmFungible,
-	MultiAsset, Error as XcmError, Weight,
-	Junction::*,
-	MultiLocation,
-	Junctions::*,
+use pallet_foreign_assets::{AssetIds, NativeCurrency};
+use sp_runtime::traits::{CheckedConversion, Convert, Zero};
+use sp_std::marker::PhantomData;
+use staging_xcm::latest::{
+	AssetId::Concrete, Error as XcmError, Fungibility::Fungible as XcmFungible, Junction::*,
+	Junctions::*, MultiAsset, MultiLocation, Weight,
 };
-use xcm_builder::{CurrencyAdapter, NativeAsset};
-use xcm_executor::{
+use staging_xcm_builder::{CurrencyAdapter, NativeAsset};
+use staging_xcm_executor::{
+	traits::{MatchesFungible, WeightTrader},
 	Assets,
-	traits::{MatchesFungible, WeightTrader},
 };
-use pallet_foreign_assets::{AssetIds, NativeCurrency};
-use sp_std::marker::PhantomData;
-use crate::{Balances, ParachainInfo};
-use super::{LocationToAccountId, RelayLocation};
-
 use up_common::types::{AccountId, Balance};
 
+use super::{LocationToAccountId, RelayLocation};
+use crate::{Balances, ParachainInfo};
+
 pub struct OnlySelfCurrency;
 impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {
 	fn matches_fungible(a: &MultiAsset) -> Option<B> {
modifiedruntime/common/dispatch.rsdiffbeforeafterboth
--- a/runtime/common/dispatch.rs
+++ b/runtime/common/dispatch.rs
@@ -15,28 +15,27 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use frame_support::{dispatch::DispatchResult, ensure, fail};
-use pallet_evm::{PrecompileHandle, PrecompileResult};
-use sp_core::H160;
-use sp_runtime::DispatchError;
-use sp_std::{borrow::ToOwned, vec::Vec};
+use pallet_balances_adapter::NativeFungibleHandle;
+pub use pallet_common::dispatch::CollectionDispatch;
+#[cfg(not(feature = "refungible"))]
+use pallet_common::unsupported;
 use pallet_common::{
-	CollectionById, CollectionHandle, CommonCollectionOperations, erc::CommonEvmHandler,
-	eth::map_eth_to_id,
+	erc::CommonEvmHandler, eth::map_eth_to_id, CollectionById, CollectionHandle,
+	CommonCollectionOperations,
 };
-pub use pallet_common::dispatch::CollectionDispatch;
-use pallet_fungible::{Pallet as PalletFungible, FungibleHandle};
-use pallet_balances_adapter::NativeFungibleHandle;
-use pallet_nonfungible::{Pallet as PalletNonfungible, NonfungibleHandle};
+use pallet_evm::{PrecompileHandle, PrecompileResult};
+use pallet_fungible::{FungibleHandle, Pallet as PalletFungible};
+use pallet_nonfungible::{NonfungibleHandle, Pallet as PalletNonfungible};
 use pallet_refungible::{
-	Pallet as PalletRefungible, RefungibleHandle, erc_token::RefungibleTokenHandle,
+	erc_token::RefungibleTokenHandle, Pallet as PalletRefungible, RefungibleHandle,
 };
+use sp_core::H160;
+use sp_runtime::DispatchError;
+use sp_std::{borrow::ToOwned, vec::Vec};
 use up_data_structs::{
-	CollectionMode, CreateCollectionData, MAX_DECIMAL_POINTS, mapping::TokenAddressMapping,
-	CollectionId,
+	mapping::TokenAddressMapping, CollectionId, CollectionMode, CreateCollectionData,
+	MAX_DECIMAL_POINTS,
 };
-
-#[cfg(not(feature = "refungible"))]
-use pallet_common::unsupported;
 
 pub enum CollectionDispatchT<T>
 where
modifiedruntime/common/ethereum/precompiles/mod.rsdiffbeforeafterboth
--- a/runtime/common/ethereum/precompiles/mod.rs
+++ b/runtime/common/ethereum/precompiles/mod.rs
@@ -14,11 +14,12 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use pallet_evm::{Precompile, PrecompileHandle, PrecompileResult, PrecompileSet, IsPrecompileResult};
+use pallet_evm::{
+	IsPrecompileResult, Precompile, PrecompileHandle, PrecompileResult, PrecompileSet,
+};
+use pallet_evm_precompile_simple::ECRecover;
 use sp_core::H160;
 use sp_std::marker::PhantomData;
-
-use pallet_evm_precompile_simple::{ECRecover};
 use sr25519::Sr25519Precompile;
 
 mod sr25519;
modifiedruntime/common/ethereum/precompiles/sr25519.rsdiffbeforeafterboth
--- a/runtime/common/ethereum/precompiles/sr25519.rs
+++ b/runtime/common/ethereum/precompiles/sr25519.rs
@@ -17,8 +17,7 @@
 use fp_evm::{Context, ExitSucceed, PrecompileHandle, PrecompileOutput};
 use pallet_evm::Precompile;
 use sp_core::{crypto::UncheckedFrom, sr25519, H256};
-use sp_std::marker::PhantomData;
-use sp_std::prelude::*;
+use sp_std::{marker::PhantomData, prelude::*};
 
 use super::utils::{Bytes, EvmDataReader, EvmDataWriter, EvmResult, FunctionModifier, Gasometer};
 
modifiedruntime/common/ethereum/precompiles/utils/data.rsdiffbeforeafterboth
--- a/runtime/common/ethereum/precompiles/utils/data.rs
+++ b/runtime/common/ethereum/precompiles/utils/data.rs
@@ -16,12 +16,12 @@
 // You should have received a copy of the GNU General Public License
 // along with Utils.  If not, see <http://www.gnu.org/licenses/>.
 
-use super::{EvmResult, Gasometer};
+use core::{any::type_name, ops::Range};
 
-use sp_std::borrow::ToOwned;
-use core::{any::type_name, ops::Range};
 use sp_core::{H160, H256, U256};
-use sp_std::{convert::TryInto, vec, vec::Vec};
+use sp_std::{borrow::ToOwned, convert::TryInto, vec, vec::Vec};
+
+use super::{EvmResult, Gasometer};
 
 /// The `address` type of Solidity.
 /// H160 could represent 2 types of data (bytes20 and address) that are not encoded the same way.
modifiedruntime/common/ethereum/precompiles/utils/macro/src/lib.rsdiffbeforeafterboth
--- a/runtime/common/ethereum/precompiles/utils/macro/src/lib.rs
+++ b/runtime/common/ethereum/precompiles/utils/macro/src/lib.rs
@@ -19,11 +19,12 @@
 #![crate_type = "proc-macro"]
 extern crate proc_macro;
 
+use std::convert::TryInto;
+
 use proc_macro::TokenStream;
 use proc_macro2::Literal;
 use quote::{quote, quote_spanned};
 use sha3::{Digest, Keccak256};
-use std::convert::TryInto;
 use syn::{parse_macro_input, spanned::Spanned, Expr, ExprLit, Ident, ItemEnum, Lit};
 
 /// This macro allows to associate to each variant of an enumeration a discriminant (of type u32
modifiedruntime/common/ethereum/precompiles/utils/mod.rsdiffbeforeafterboth
--- a/runtime/common/ethereum/precompiles/utils/mod.rs
+++ b/runtime/common/ethereum/precompiles/utils/mod.rs
@@ -16,10 +16,9 @@
 // You should have received a copy of the GNU General Public License
 // along with Utils.  If not, see <http://www.gnu.org/licenses/>.
 
-use sp_std::borrow::ToOwned;
 use fp_evm::{Context, ExitRevert, PrecompileFailure};
 use sp_core::U256;
-use sp_std::marker::PhantomData;
+use sp_std::{borrow::ToOwned, marker::PhantomData};
 
 mod data;
 
modifiedruntime/common/ethereum/self_contained_call.rsdiffbeforeafterboth
--- a/runtime/common/ethereum/self_contained_call.rs
+++ b/runtime/common/ethereum/self_contained_call.rs
@@ -16,11 +16,12 @@
 
 use sp_core::H160;
 use sp_runtime::{
-	traits::{Dispatchable, DispatchInfoOf, PostDispatchInfoOf},
-	transaction_validity::{TransactionValidityError, TransactionValidity, InvalidTransaction},
+	traits::{DispatchInfoOf, Dispatchable, PostDispatchInfoOf},
+	transaction_validity::{InvalidTransaction, TransactionValidity, TransactionValidityError},
 };
-use crate::{RuntimeOrigin, RuntimeCall, Maintenance};
 
+use crate::{Maintenance, RuntimeCall, RuntimeOrigin};
+
 impl fp_self_contained::SelfContainedCall for RuntimeCall {
 	type SignedInfo = H160;
 
modifiedruntime/common/ethereum/sponsoring.rsdiffbeforeafterboth
--- a/runtime/common/ethereum/sponsoring.rs
+++ b/runtime/common/ethereum/sponsoring.rs
@@ -17,35 +17,36 @@
 //! Implements EVM sponsoring logic via TransactionValidityHack
 
 use core::{convert::TryInto, marker::PhantomData};
-use evm_coder::{Call};
-use pallet_common::{CollectionHandle, eth::map_eth_to_id};
+
+use evm_coder::Call;
+use pallet_common::{eth::map_eth_to_id, CollectionHandle};
 use pallet_evm::account::CrossAccountId;
 use pallet_evm_transaction_payment::CallContext;
+use pallet_fungible::{
+	erc::{ERC20Call, UniqueFungibleCall},
+	Config as FungibleConfig,
+};
 use pallet_nonfungible::{
-	Config as NonfungibleConfig, Pallet as NonfungiblePallet, NonfungibleHandle,
 	erc::{
-		UniqueNFTCall, ERC721UniqueExtensionsCall, ERC721UniqueMintableCall, ERC721Call,
-		TokenPropertiesCall,
+		ERC721Call, ERC721UniqueExtensionsCall, ERC721UniqueMintableCall, TokenPropertiesCall,
+		UniqueNFTCall,
 	},
-};
-use pallet_fungible::{
-	Config as FungibleConfig,
-	erc::{UniqueFungibleCall, ERC20Call},
+	Config as NonfungibleConfig, NonfungibleHandle, Pallet as NonfungiblePallet,
 };
 use pallet_refungible::{
-	Config as RefungibleConfig,
 	erc::UniqueRefungibleCall,
 	erc_token::{RefungibleTokenHandle, UniqueRefungibleTokenCall},
-	RefungibleHandle,
+	Config as RefungibleConfig, RefungibleHandle,
 };
 use pallet_unique::Config as UniqueConfig;
 use sp_std::prelude::*;
 use up_data_structs::{
-	CollectionMode, CreateItemData, CreateNftData, mapping::TokenAddressMapping, TokenId,
+	mapping::TokenAddressMapping, CollectionMode, CreateItemData, CreateNftData, TokenId,
 };
 use up_sponsorship::SponsorshipHandler;
-use crate::{Runtime, runtime_common::sponsoring::*};
 
+use crate::{runtime_common::sponsoring::*, Runtime};
+
 mod refungible;
 
 pub type EvmSponsorshipHandler = (
@@ -206,9 +207,9 @@
 }
 
 mod common {
-	use super::*;
+	use pallet_common::erc::CollectionCall;
 
-	use pallet_common::erc::{CollectionCall};
+	use super::*;
 
 	pub fn collection_call_sponsor<T>(
 		call: CollectionCall<T>,
modifiedruntime/common/ethereum/sponsoring/refungible.rsdiffbeforeafterboth
--- a/runtime/common/ethereum/sponsoring/refungible.rs
+++ b/runtime/common/ethereum/sponsoring/refungible.rs
@@ -19,14 +19,7 @@
 use pallet_common::CollectionHandle;
 use pallet_evm::account::CrossAccountId;
 use pallet_fungible::Config as FungibleConfig;
-use pallet_refungible::Config as RefungibleConfig;
 use pallet_nonfungible::Config as NonfungibleConfig;
-use pallet_unique::Config as UniqueConfig;
-use up_data_structs::{CreateItemData, CreateNftData, TokenId};
-
-use super::common;
-use crate::runtime_common::sponsoring::*;
-
 use pallet_refungible::{
 	erc::{
 		ERC721BurnableCall, ERC721Call, ERC721EnumerableCall, ERC721MetadataCall,
@@ -37,7 +30,13 @@
 		ERC1633Call, ERC20Call, ERC20UniqueExtensionsCall, RefungibleTokenHandle,
 		UniqueRefungibleTokenCall,
 	},
+	Config as RefungibleConfig,
 };
+use pallet_unique::Config as UniqueConfig;
+use up_data_structs::{CreateItemData, CreateNftData, TokenId};
+
+use super::common;
+use crate::runtime_common::sponsoring::*;
 
 pub fn call_sponsor<T>(
 	call: UniqueRefungibleCall<T>,
modifiedruntime/common/identity.rsdiffbeforeafterboth
--- a/runtime/common/identity.rs
+++ b/runtime/common/identity.rs
@@ -14,18 +14,17 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
+use parity_scale_codec::{Decode, Encode};
 use scale_info::TypeInfo;
-use codec::{Encode, Decode};
-use up_common::types::AccountId;
-use crate::RuntimeCall;
-
+#[cfg(feature = "collator-selection")]
+use sp_runtime::transaction_validity::InvalidTransaction;
 use sp_runtime::{
 	traits::{DispatchInfoOf, SignedExtension},
-	transaction_validity::{TransactionValidity, ValidTransaction, TransactionValidityError},
+	transaction_validity::{TransactionValidity, TransactionValidityError, ValidTransaction},
 };
+use up_common::types::AccountId;
 
-#[cfg(feature = "collator-selection")]
-use sp_runtime::transaction_validity::InvalidTransaction;
+use crate::RuntimeCall;
 
 #[derive(Debug, Encode, Decode, PartialEq, Eq, Clone, TypeInfo)]
 pub struct DisableIdentityCalls;
modifiedruntime/common/instance.rsdiffbeforeafterboth
--- a/runtime/common/instance.rs
+++ b/runtime/common/instance.rs
@@ -1,9 +1,7 @@
-use crate::{
-	runtime_common::{config::ethereum::CrossAccountId},
-	Runtime,
-};
 use up_common::types::opaque::RuntimeInstance;
 
+use crate::{runtime_common::config::ethereum::CrossAccountId, Runtime};
+
 impl RuntimeInstance for Runtime {
 	type CrossAccountId = CrossAccountId;
 }
modifiedruntime/common/maintenance.rsdiffbeforeafterboth
--- a/runtime/common/maintenance.rs
+++ b/runtime/common/maintenance.rs
@@ -14,17 +14,17 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
+use parity_scale_codec::{Decode, Encode};
 use scale_info::TypeInfo;
-use codec::{Encode, Decode};
-use up_common::types::AccountId;
-use crate::{RuntimeCall, Maintenance};
-
 use sp_runtime::{
 	traits::{DispatchInfoOf, SignedExtension},
 	transaction_validity::{
-		TransactionValidity, ValidTransaction, InvalidTransaction, TransactionValidityError,
+		InvalidTransaction, TransactionValidity, TransactionValidityError, ValidTransaction,
 	},
 };
+use up_common::types::AccountId;
+
+use crate::{Maintenance, RuntimeCall};
 
 #[derive(Debug, Encode, Decode, PartialEq, Eq, Clone, TypeInfo)]
 pub struct CheckMaintenance;
modifiedruntime/common/mod.rsdiffbeforeafterboth
--- a/runtime/common/mod.rs
+++ b/runtime/common/mod.rs
@@ -33,26 +33,23 @@
 #[cfg(test)]
 pub mod tests;
 
-use sp_core::H160;
 use frame_support::{
-	traits::{Currency, OnUnbalanced, Imbalance},
+	traits::{Currency, Imbalance, OnUnbalanced},
 	weights::Weight,
 };
 use sp_runtime::{
-	generic,
+	generic, impl_opaque_keys,
 	traits::{BlakeTwo256, BlockNumberProvider},
-	impl_opaque_keys,
 };
 use sp_std::vec::Vec;
-
 #[cfg(feature = "std")]
 use sp_version::NativeVersion;
+use up_common::types::{AccountId, BlockNumber};
 
 use crate::{
-	Runtime, RuntimeCall, Balances, Treasury, Aura, Signature, AllPalletsWithSystem,
-	InherentDataExt,
+	AllPalletsWithSystem, Aura, Balances, InherentDataExt, Runtime, RuntimeCall, Signature,
+	Treasury,
 };
-use up_common::types::{AccountId, BlockNumber};
 
 #[macro_export]
 macro_rules! unsupported {
@@ -175,7 +172,7 @@
 	}
 }
 
-#[derive(codec::Encode, codec::Decode)]
+#[derive(parity_scale_codec::Encode, parity_scale_codec::Decode)]
 pub enum XCMPMessage<XAccountId, XBalance> {
 	/// Transfer tokens to the given account from the Parachain account.
 	TransferToken(XAccountId, XBalance),
@@ -186,9 +183,10 @@
 	fn on_runtime_upgrade() -> Weight {
 		#[cfg(feature = "collator-selection")]
 		{
-			use frame_support::{BoundedVec, storage::migration};
-			use sp_runtime::{traits::OpaqueKeys, RuntimeAppPublic};
+			use frame_support::{storage::migration, BoundedVec};
 			use pallet_session::SessionManager;
+			use sp_runtime::{traits::OpaqueKeys, RuntimeAppPublic};
+
 			use crate::config::pallets::MaxCollators;
 
 			let mut weight = <Runtime as frame_system::Config>::DbWeight::get().reads(1);
modifiedruntime/common/scheduler.rsdiffbeforeafterboth
--- a/runtime/common/scheduler.rs
+++ b/runtime/common/scheduler.rs
@@ -14,21 +14,20 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use frame_support::{
-	dispatch::{GetDispatchInfo, PostDispatchInfo, DispatchInfo},
-};
+use fp_self_contained::SelfContainedCall;
+use frame_support::dispatch::{DispatchInfo, GetDispatchInfo, PostDispatchInfo};
+use pallet_transaction_payment::ChargeTransactionPayment;
+use pallet_unique_scheduler_v2::DispatchCall;
+use parity_scale_codec::Encode;
 use sp_runtime::{
-	traits::{Dispatchable, Applyable, Member},
+	traits::{Applyable, Dispatchable, Member},
 	transaction_validity::TransactionValidityError,
 	DispatchErrorWithPostInfo,
 };
-use codec::Encode;
-use crate::{Runtime, RuntimeCall, RuntimeOrigin, maintenance};
 use up_common::types::AccountId;
-use fp_self_contained::SelfContainedCall;
-use pallet_unique_scheduler_v2::DispatchCall;
-use pallet_transaction_payment::ChargeTransactionPayment;
 
+use crate::{maintenance, Runtime, RuntimeCall, RuntimeOrigin};
+
 /// The SignedExtension to the basic transaction logic.
 pub type SignedExtraScheduler = (
 	frame_system::CheckWeight<Runtime>,
modifiedruntime/common/sponsoring.rsdiffbeforeafterboth
--- a/runtime/common/sponsoring.rs
+++ b/runtime/common/sponsoring.rs
@@ -15,25 +15,25 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use core::marker::PhantomData;
-use up_sponsorship::SponsorshipHandler;
-use frame_support::{
-	traits::{IsSubType},
-};
-use up_data_structs::{
-	CollectionId, FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, NFT_SPONSOR_TRANSFER_TIMEOUT,
-	REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, TokenId, CollectionMode, CreateItemData,
-};
-use sp_runtime::traits::Saturating;
-use pallet_common::{CollectionHandle};
+
+use frame_support::traits::IsSubType;
+use frame_system::pallet_prelude::*;
+use pallet_common::CollectionHandle;
 use pallet_evm::account::CrossAccountId;
-use pallet_unique::{
-	Call as UniqueCall, Config as UniqueConfig, FungibleApproveBasket, RefungibleApproveBasket,
-	NftApproveBasket, CreateItemBasket, ReFungibleTransferBasket, FungibleTransferBasket,
-	NftTransferBasket, TokenPropertyBasket,
-};
 use pallet_fungible::Config as FungibleConfig;
 use pallet_nonfungible::Config as NonfungibleConfig;
 use pallet_refungible::Config as RefungibleConfig;
+use pallet_unique::{
+	Call as UniqueCall, Config as UniqueConfig, CreateItemBasket, FungibleApproveBasket,
+	FungibleTransferBasket, NftApproveBasket, NftTransferBasket, ReFungibleTransferBasket,
+	RefungibleApproveBasket, TokenPropertyBasket,
+};
+use sp_runtime::traits::Saturating;
+use up_data_structs::{
+	CollectionId, CollectionMode, CreateItemData, TokenId, FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,
+	NFT_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,
+};
+use up_sponsorship::SponsorshipHandler;
 
 pub trait Config: UniqueConfig + FungibleConfig + NonfungibleConfig + RefungibleConfig {}
 impl<T> Config for T where T: UniqueConfig + FungibleConfig + NonfungibleConfig + RefungibleConfig {}
modifiedruntime/common/tests/mod.rsdiffbeforeafterboth
--- a/runtime/common/tests/mod.rs
+++ b/runtime/common/tests/mod.rs
@@ -14,12 +14,12 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
+use sp_core::{Pair, Public};
+pub use sp_runtime::AccountId32 as AccountId;
 use sp_runtime::{BuildStorage, Storage};
-use sp_core::{Public, Pair};
 use up_common::types::AuraId;
-use crate::{Runtime, GenesisConfig, ParachainInfoConfig, RuntimeEvent, System};
 
-pub use sp_runtime::AccountId32 as AccountId;
+use crate::{BuildGenesisConfig, ParachainInfoConfig, Runtime, RuntimeEvent, System};
 pub type Balance = u128;
 
 pub mod xcm;
@@ -62,10 +62,11 @@
 
 #[cfg(feature = "collator-selection")]
 fn make_basic_storage() -> Storage {
-	use sp_core::{sr25519};
+	use sp_core::sr25519;
 	use sp_runtime::traits::{IdentifyAccount, Verify};
-	use crate::{AccountId, Signature, SessionKeys, CollatorSelectionConfig, SessionConfig};
 
+	use crate::{AccountId, CollatorSelectionConfig, SessionConfig, SessionKeys, Signature};
+
 	type AccountPublic = <Signature as Verify>::Signer;
 
 	fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId
modifiedruntime/common/tests/xcm.rsdiffbeforeafterboth
--- a/runtime/common/tests/xcm.rs
+++ b/runtime/common/tests/xcm.rs
@@ -14,15 +14,16 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use xcm::{
-	VersionedXcm,
+use frame_support::pallet_prelude::Weight;
+use parity_scale_codec::Encode;
+use staging_xcm::{
 	latest::{prelude::*, Error},
+	VersionedXcm,
 };
-use codec::Encode;
-use crate::{Runtime, RuntimeCall, RuntimeOrigin, RuntimeEvent, PolkadotXcm};
-use super::{new_test_ext, last_events, AccountId};
-use frame_support::{pallet_prelude::Weight};
 
+use super::{last_events, new_test_ext, AccountId};
+use crate::{PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin};
+
 const ALICE: AccountId = AccountId::new([0u8; 32]);
 const BOB: AccountId = AccountId::new([1u8; 32]);
 
modifiedruntime/common/weights/mod.rsdiffbeforeafterboth
--- a/runtime/common/weights/mod.rs
+++ b/runtime/common/weights/mod.rs
@@ -15,20 +15,21 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use core::marker::PhantomData;
-use frame_support::{weights::Weight};
-use pallet_common::{CommonWeightInfo, dispatch::dispatch_weight, RefungibleExtensionsWeightInfo};
 
+use frame_support::weights::Weight;
 use pallet_balances_adapter::{
-	Config as NativeFungibleConfig, common::CommonWeights as NativeFungibleWeights,
+	common::CommonWeights as NativeFungibleWeights, Config as NativeFungibleConfig,
 };
-use pallet_fungible::{Config as FungibleConfig, common::CommonWeights as FungibleWeights};
-use pallet_nonfungible::{Config as NonfungibleConfig, common::CommonWeights as NonfungibleWeights};
-
+use pallet_common::{dispatch::dispatch_weight, CommonWeightInfo, RefungibleExtensionsWeightInfo};
+use pallet_fungible::{common::CommonWeights as FungibleWeights, Config as FungibleConfig};
+use pallet_nonfungible::{
+	common::CommonWeights as NonfungibleWeights, Config as NonfungibleConfig,
+};
 #[cfg(feature = "refungible")]
 use pallet_refungible::{
-	Config as RefungibleConfig, weights::WeightInfo, common::CommonWeights as RefungibleWeights,
+	common::CommonWeights as RefungibleWeights, weights::WeightInfo, Config as RefungibleConfig,
 };
-use up_data_structs::{CreateItemExData, CreateItemData};
+use up_data_structs::{CreateItemData, CreateItemExData};
 
 pub mod xcm;
 
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -27,14 +27,11 @@
 
 extern crate alloc;
 
+use ::staging_xcm::latest::NetworkId;
 use frame_support::parameter_types;
-
-use sp_version::RuntimeVersion;
 use sp_runtime::create_runtime_str;
-
+use sp_version::RuntimeVersion;
 use up_common::types::*;
-
-use ::xcm::latest::NetworkId;
 
 mod runtime_common;
 
modifiedruntime/opal/src/xcm_barrier.rsdiffbeforeafterboth
--- a/runtime/opal/src/xcm_barrier.rs
+++ b/runtime/opal/src/xcm_barrier.rs
@@ -16,7 +16,7 @@
 
 use frame_support::{match_types, traits::Everything};
 use xcm::latest::{Junctions::*, MultiLocation};
-use xcm_builder::{AllowTopLevelPaidExecutionFrom, TakeWeightCredit, AllowExplicitUnpaidExecutionFrom};
+use staging_xcm_builder::{AllowTopLevelPaidExecutionFrom, TakeWeightCredit, AllowExplicitUnpaidExecutionFrom};
 
 match_types! {
 	pub type ParentOnly: impl Contains<MultiLocation> = {
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -27,14 +27,11 @@
 
 extern crate alloc;
 
+use ::staging_xcm::latest::NetworkId;
 use frame_support::parameter_types;
-
-use sp_version::RuntimeVersion;
 use sp_runtime::create_runtime_str;
-
+use sp_version::RuntimeVersion;
 use up_common::types::*;
-
-use ::xcm::latest::NetworkId;
 
 mod runtime_common;
 
modifiedruntime/quartz/src/xcm_barrier.rsdiffbeforeafterboth
--- a/runtime/quartz/src/xcm_barrier.rs
+++ b/runtime/quartz/src/xcm_barrier.rs
@@ -15,8 +15,8 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use frame_support::{match_types, traits::Everything};
-use xcm::latest::{Junctions::*, MultiLocation};
-use xcm_builder::{
+use staging_xcm::latest::{Junctions::*, MultiLocation};
+use staging_xcm_builder::{
 	AllowKnownQueryResponses, AllowSubscriptionsFrom, TakeWeightCredit,
 	AllowTopLevelPaidExecutionFrom, AllowExplicitUnpaidExecutionFrom,
 };
modifiedruntime/tests/src/lib.rsdiffbeforeafterboth
--- a/runtime/tests/src/lib.rs
+++ b/runtime/tests/src/lib.rs
@@ -16,27 +16,26 @@
 
 #![allow(clippy::from_over_into)]
 
-use sp_core::{H160, H256, U256};
 use frame_support::{
+	pallet_prelude::Weight,
 	parameter_types,
-	traits::{Everything, ConstU32, ConstU64, fungible::Inspect},
+	traits::{fungible::Inspect, ConstU32, ConstU64, Everything},
 	weights::IdentityFee,
-	pallet_prelude::Weight,
 };
-use sp_runtime::{
-	traits::{BlakeTwo256, IdentityLookup},
-	testing::Header,
-};
-use pallet_transaction_payment::CurrencyAdapter;
 use frame_system as system;
+use pallet_ethereum::PostLogContent;
 use pallet_evm::{
-	AddressMapping, account::CrossAccountId, EnsureAddressNever, SubstrateBlockHashMapping,
-	BackwardsAddressMapping,
+	account::CrossAccountId, AddressMapping, BackwardsAddressMapping, EnsureAddressNever,
+	SubstrateBlockHashMapping,
 };
-use pallet_ethereum::PostLogContent;
-use codec::{Encode, Decode, MaxEncodedLen};
+use pallet_transaction_payment::CurrencyAdapter;
+use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
 use scale_info::TypeInfo;
-
+use sp_core::{H160, H256, U256};
+use sp_runtime::{
+	testing::Header,
+	traits::{BlakeTwo256, IdentityLookup},
+};
 use up_data_structs::mapping::{CrossTokenAddressMapping, EvmTokenAddressMapping};
 
 #[path = "../../common/dispatch.rs"]
modifiedruntime/tests/src/tests.rsdiffbeforeafterboth
--- a/runtime/tests/src/tests.rs
+++ b/runtime/tests/src/tests.rs
@@ -15,19 +15,22 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 // Tests to be written here
-use crate::{Test, TestCrossAccountId, CollectionCreationPrice, RuntimeOrigin, Unique, new_test_ext};
+use frame_support::{assert_err, assert_noop, assert_ok};
+use pallet_common::Error as CommonError;
+use pallet_evm::account::CrossAccountId;
+use pallet_unique::Error as UniqueError;
+use sp_std::convert::TryInto;
 use up_data_structs::{
-	COLLECTION_NUMBER_LIMIT, CollectionId, CreateItemData, CreateFungibleData, CreateNftData,
-	CreateReFungibleData, MAX_DECIMAL_POINTS, COLLECTION_ADMINS_LIMIT, TokenId,
-	MAX_TOKEN_OWNERSHIP, CreateCollectionData, CollectionMode, AccessMode, CollectionPermissions,
-	PropertyKeyPermission, PropertyPermission, Property, CollectionPropertiesVec,
-	CollectionPropertiesPermissionsVec,
+	AccessMode, CollectionId, CollectionMode, CollectionPermissions,
+	CollectionPropertiesPermissionsVec, CollectionPropertiesVec, CreateCollectionData,
+	CreateFungibleData, CreateItemData, CreateNftData, CreateReFungibleData, Property,
+	PropertyKeyPermission, PropertyPermission, TokenId, COLLECTION_ADMINS_LIMIT,
+	COLLECTION_NUMBER_LIMIT, MAX_DECIMAL_POINTS, MAX_TOKEN_OWNERSHIP,
+};
+
+use crate::{
+	new_test_ext, CollectionCreationPrice, RuntimeOrigin, Test, TestCrossAccountId, Unique,
 };
-use frame_support::{assert_noop, assert_ok, assert_err};
-use sp_std::convert::TryInto;
-use pallet_evm::account::CrossAccountId;
-use pallet_common::Error as CommonError;
-use pallet_unique::Error as UniqueError;
 
 fn add_balance(user: u64, value: u64) {
 	const DONOR_USER: u64 = 999;
@@ -2617,9 +2620,10 @@
 }
 
 mod check_token_permissions {
-	use super::*;
 	use pallet_common::LazyValue;
 
+	use super::*;
+
 	fn test<FTE: FnOnce() -> bool>(
 		i: usize,
 		test_case: &pallet_common::tests::TestCase,
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -27,14 +27,11 @@
 
 extern crate alloc;
 
+use ::staging_xcm::latest::NetworkId;
 use frame_support::parameter_types;
-
-use sp_version::RuntimeVersion;
 use sp_runtime::create_runtime_str;
-
+use sp_version::RuntimeVersion;
 use up_common::types::*;
-
-use ::xcm::latest::NetworkId;
 
 mod runtime_common;
 
modifiedruntime/unique/src/xcm_barrier.rsdiffbeforeafterboth
--- a/runtime/unique/src/xcm_barrier.rs
+++ b/runtime/unique/src/xcm_barrier.rs
@@ -15,8 +15,8 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use frame_support::{match_types, traits::Everything};
-use xcm::latest::{Junctions::*, MultiLocation};
-use xcm_builder::{
+use staging_xcm::latest::{Junctions::*, MultiLocation};
+use staging_xcm_builder::{
 	AllowKnownQueryResponses, AllowSubscriptionsFrom, TakeWeightCredit,
 	AllowTopLevelPaidExecutionFrom, AllowExplicitUnpaidExecutionFrom,
 };
modifiedtest-pallets/utils/src/lib.rsdiffbeforeafterboth
--- a/test-pallets/utils/src/lib.rs
+++ b/test-pallets/utils/src/lib.rs
@@ -16,18 +16,19 @@
 
 #![cfg_attr(not(feature = "std"), no_std)]
 
-pub use pallet::*;
 use frame_support::pallet_prelude::*;
 use frame_system::pallet_prelude::*;
+pub use pallet::*;
 
 #[frame_support::pallet(dev_mode)]
 pub mod pallet {
 	use frame_support::{
+		dispatch::{GetDispatchInfo, PostDispatchInfo},
 		pallet_prelude::*,
-		dispatch::{Dispatchable, GetDispatchInfo, PostDispatchInfo},
-		traits::{UnfilteredDispatchable, IsSubType, OriginTrait},
+		traits::{IsSubType, OriginTrait, UnfilteredDispatchable},
 	};
 	use frame_system::pallet_prelude::*;
+	use sp_runtime::traits::Dispatchable;
 	use sp_std::vec::Vec;
 
 	#[pallet::config]