git.delta.rocks / unique-network / refs/commits / 3fb62366cc89

difftreelog

Merge pull request #153 from usetech-llc/feature/NFTPAR-536_code_style

usetech-llc2021-07-08parents: #d08f396 #ad8b982.patch.diff
in: master
Enforce codestyle

117 files changed

modified.devcontainer/devcontainer.jsondiffbeforeafterboth
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -12,7 +12,8 @@
 		}
 	},
 	"extensions": [
-		"matklad.rust-analyzer"
+		"matklad.rust-analyzer",
+		"dbaeumer.vscode-eslint"
 	],
 	"remoteUser": "vscode"
 }
added.github/workflows/codestyle.ymldiffbeforeafterboth
--- /dev/null
+++ b/.github/workflows/codestyle.yml
@@ -0,0 +1,37 @@
+name: Code style
+
+on: [push]
+
+jobs:
+  rustfmt:
+    runs-on: ubuntu-20.04
+
+    steps:
+      - uses: actions/checkout@v1
+      - name: Install latest nightly
+        uses: actions-rs/toolchain@v1
+        with:
+            toolchain: nightly
+            default: true
+            target: wasm32-unknown-unknown
+            components: rustfmt, clippy
+      - name: Run cargo fmt
+        run: cargo fmt -- --check
+
+  clippy:
+    if: ${{ false }}
+    runs-on: ubuntu-20.04
+
+    steps:
+      - uses: actions/checkout@v1
+      - name: Install substrate dependencies
+        run: sudo apt-get install libssl-dev pkg-config libclang-dev clang
+      - name: Install latest nightly
+        uses: actions-rs/toolchain@v1
+        with:
+            toolchain: nightly
+            default: true
+            target: wasm32-unknown-unknown
+            components: rustfmt, clippy
+      - name: Run cargo check
+        run: cargo clippy -- -Dwarnings
added.github/workflows/tests_codestyle.ymldiffbeforeafterboth
--- /dev/null
+++ b/.github/workflows/tests_codestyle.yml
@@ -0,0 +1,14 @@
+name: Tests code style
+
+on: [push]
+
+jobs:
+  build:
+    runs-on: ubuntu-20.04
+
+    steps:
+    - uses: actions/checkout@v2
+    - name: Install modules
+      run: cd tests && yarn
+    - name: Run ESLint
+      run: cd tests && yarn eslint --ext .ts,.js src/
\ No newline at end of file
added.rustfmt.tomldiffbeforeafterboth
--- /dev/null
+++ b/.rustfmt.toml
@@ -0,0 +1,2 @@
+hard_tabs = true
+reorder_imports = false
\ No newline at end of file
added.vscode/extensions.jsondiffbeforeafterboth
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,5 @@
+{
+    "recommendations": [
+        "dbaeumer.vscode-eslint"
+    ]
+}
\ No newline at end of file
added.vscode/settings.jsondiffbeforeafterboth
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,9 @@
+{
+    "eslint.format.enable": true,
+    "[javascript]": {
+        "editor.defaultFormatter": "dbaeumer.vscode-eslint"
+    },
+    "[typescript]": {
+        "editor.defaultFormatter": "dbaeumer.vscode-eslint"
+    }
+}
\ No newline at end of file
modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5996,34 +5996,34 @@
 [[package]]
 name = "pallet-scheduler"
 version = "3.0.0"
-source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.3#c94e0cdfe5556680dca1996004751eeb114755d7"
 dependencies = [
  "frame-benchmarking",
  "frame-support",
  "frame-system",
  "log",
  "parity-scale-codec 2.1.3",
+ "serde",
+ "sp-core",
  "sp-io",
  "sp-runtime",
  "sp-std",
+ "substrate-test-utils",
+ "up-sponsorship",
 ]
 
 [[package]]
 name = "pallet-scheduler"
 version = "3.0.0"
+source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.3#c94e0cdfe5556680dca1996004751eeb114755d7"
 dependencies = [
  "frame-benchmarking",
  "frame-support",
  "frame-system",
  "log",
  "parity-scale-codec 2.1.3",
- "serde",
- "sp-core",
  "sp-io",
  "sp-runtime",
  "sp-std",
- "substrate-test-utils",
- "up-sponsorship",
 ]
 
 [[package]]
modifiedREADME.mddiffbeforeafterboth
--- a/README.md
+++ b/README.md
@@ -228,3 +228,26 @@
 ## Running Integration Tests
 
 See [tests/README.md](./tests/README.md).
+
+## Code Formatting
+
+### Get formatter and linter settings into your branch (if you forked before they were introduced)
+```bash
+git cherry-pick -n 8ff77c21b0d30b2a4648fa35dbf61dfa9d3948a7
+```
+
+### Apply formatting and clippy fixes
+```bash
+cargo clippy
+cargo fmt
+```
+
+### Format tests
+```bash
+pushd tests && yarn fix ; popd
+```
+
+### Check code style in tests
+```bash
+cd tests && yarn eslint --ext .ts,.js src/
+```
\ No newline at end of file
modifiedcrates/evm-coder-macros/src/lib.rsdiffbeforeafterboth
--- a/crates/evm-coder-macros/src/lib.rs
+++ b/crates/evm-coder-macros/src/lib.rs
@@ -1,3 +1,5 @@
+#![allow(dead_code)]
+
 use darling::FromMeta;
 use inflector::cases;
 use proc_macro::TokenStream;
modifiedcrates/evm-coder-macros/src/solidity_interface.rsdiffbeforeafterboth
--- a/crates/evm-coder-macros/src/solidity_interface.rs
+++ b/crates/evm-coder-macros/src/solidity_interface.rs
@@ -1,3 +1,5 @@
+#![allow(dead_code)]
+
 use quote::quote;
 use darling::FromMeta;
 use inflector::cases;
@@ -262,7 +264,7 @@
 			ReturnType::Type(_, ty) => ty,
 			_ => return Err(syn::Error::new(value.sig.output.span(), "interface method should return Result<value>\nif there is no value to return - specify void (which is alias to unit)")),
 		};
-		let result = parse_result_ok(&result)?;
+		let result = parse_result_ok(result)?;
 
 		let camel_name = info
 			.rename_selector
@@ -283,8 +285,8 @@
 		Ok(Self {
 			name: ident.clone(),
 			camel_name,
-			pascal_name: snake_ident_to_pascal(&ident),
-			screaming_name: snake_ident_to_screaming(&ident),
+			pascal_name: snake_ident_to_pascal(ident),
+			screaming_name: snake_ident_to_screaming(ident),
 			selector_str,
 			selector,
 			args,
@@ -431,7 +433,7 @@
 						found_error = true;
 					}
 				}
-				TraitItem::Method(method) => methods.push(Method::try_from(&method)?),
+				TraitItem::Method(method) => methods.push(Method::try_from(method)?),
 				_ => {}
 			}
 		}
@@ -545,6 +547,7 @@
 				#(
 					#call_inner
 				)*
+				#[allow(unreachable_code)] // In case of no inner calls
 				fn call(&mut self, c: Msg<#call_name>) -> ::core::result::Result<::evm_coder::abi::AbiWriter, Self::Error> {
 					use ::evm_coder::abi::AbiWrite;
 					type InternalCall = #call_name;
modifiedcrates/evm-coder-macros/src/to_log.rsdiffbeforeafterboth
--- a/crates/evm-coder-macros/src/to_log.rs
+++ b/crates/evm-coder-macros/src/to_log.rs
@@ -41,7 +41,7 @@
 impl Event {
 	fn try_from(variant: &Variant) -> syn::Result<Self> {
 		let name = &variant.ident;
-		let name_screaming = snake_ident_to_screaming(&name);
+		let name_screaming = snake_ident_to_screaming(name);
 
 		let named = match &variant.fields {
 			Fields::Named(named) => named,
@@ -54,7 +54,7 @@
 		};
 		let mut fields = Vec::new();
 		for field in &named.named {
-			fields.push(EventField::try_from(&field)?);
+			fields.push(EventField::try_from(field)?);
 		}
 		let mut selector_str = format!("{}(", name);
 		for (i, arg) in fields.iter().enumerate() {
modifiedcrates/evm-coder/src/abi.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/abi.rs
+++ b/crates/evm-coder/src/abi.rs
@@ -104,7 +104,7 @@
 	fn subresult(&mut self) -> Result<AbiReader<'i>> {
 		let offset = self.read_usize()?;
 		Ok(AbiReader {
-			buf: &self.buf,
+			buf: self.buf,
 			offset: offset + self.offset,
 		})
 	}
@@ -252,7 +252,7 @@
 impl_abi_writeable!(&str, string);
 impl AbiWrite for &string {
 	fn abi_write(&self, writer: &mut AbiWriter) {
-		writer.string(&self)
+		writer.string(self)
 	}
 }
 
modifiedcrates/evm-coder/tests/a.rsdiffbeforeafterboth
--- a/crates/evm-coder/tests/a.rs
+++ b/crates/evm-coder/tests/a.rs
@@ -1,3 +1,5 @@
+#![allow(dead_code)] // This test only checks that macros is not panicking
+
 use evm_coder::{solidity_interface, types::*, ToLog};
 use evm_coder_macros::solidity;
 
modifiednode/cli/Cargo.tomldiffbeforeafterboth
--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -3,7 +3,7 @@
 
 [build-dependencies.substrate-build-script-utils]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 ################################################################################
@@ -17,196 +17,196 @@
 
 [dependencies.frame-benchmarking]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.frame-benchmarking-cli]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-transaction-payment-rpc]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.substrate-prometheus-endpoint]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '0.9.0'
 
 [dependencies.sc-basic-authorship]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '0.9.0'
 
 [dependencies.sc-chain-spec]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sc-cli]
 features = ['wasmtime']
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '0.9.0'
 
 [dependencies.sc-client-api]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sc-consensus]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '0.9.0'
 
 [dependencies.sc-consensus-aura]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '0.9.0'
 
 [dependencies.sc-executor]
 features = ['wasmtime']
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '0.9.0'
 
 [dependencies.sc-finality-grandpa]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '0.9.0'
 
 [dependencies.sc-keystore]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sc-rpc]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sc-rpc-api]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '0.9.0'
 
 [dependencies.sc-service]
 features = ['wasmtime']
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '0.9.0'
 
 [dependencies.sc-telemetry]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sc-transaction-pool]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sc-tracing]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-block-builder]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-api]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-blockchain]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-consensus]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '0.9.0'
 
 [dependencies.sp-consensus-aura]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '0.9.0'
 
 [dependencies.sp-core]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-finality-grandpa]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-inherents]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-keystore]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '0.9.0'
 
 [dependencies.sp-offchain]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-runtime]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-session]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-timestamp]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-transaction-pool]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-trie]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.substrate-frame-rpc-system]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-contracts]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-contracts-rpc]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 
 [dependencies.sc-network]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '0.9.0'
 
 [dependencies.serde]
@@ -222,58 +222,58 @@
 
 [dependencies.cumulus-client-consensus-aura]
 git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 
 [dependencies.cumulus-client-consensus-common]
 git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 
 [dependencies.cumulus-client-collator]
 git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 
 [dependencies.cumulus-client-cli]
 git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 
 [dependencies.cumulus-client-network]
 git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 
 [dependencies.cumulus-primitives-core]
 git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 
 [dependencies.cumulus-primitives-parachain-inherent]
 git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 
 [dependencies.cumulus-client-service]
 git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 
 
 ################################################################################
 # Polkadot dependencies
 [dependencies.polkadot-primitives]
 git = "https://github.com/paritytech/polkadot"
-branch = 'release-v0.9.3'
+branch = 'release-v0.9.7'
 
 [dependencies.polkadot-service]
 git = "https://github.com/paritytech/polkadot"
-branch = 'release-v0.9.3'
+branch = 'release-v0.9.7'
 
 [dependencies.polkadot-cli]
 git = "https://github.com/paritytech/polkadot"
-branch = 'release-v0.9.3'
+branch = 'release-v0.9.7'
 
 [dependencies.polkadot-test-service]
 git = "https://github.com/paritytech/polkadot"
-branch = 'release-v0.9.3'
+branch = 'release-v0.9.7'
 
 [dependencies.polkadot-parachain]
 git = "https://github.com/paritytech/polkadot"
-branch = 'release-v0.9.3'
+branch = 'release-v0.9.7'
 
 
 ################################################################################
@@ -322,7 +322,7 @@
 fc-rpc = { version = "2.0.0-dev", git = "https://github.com/usetech-llc/frontier.git", branch = "injected-transactions-parachain" }
 fc-db = { version = "1.0.0", git = "https://github.com/usetech-llc/frontier.git", branch = "injected-transactions-parachain" }
 fp-rpc = { version = "2.0.0", git = "https://github.com/usetech-llc/frontier.git", branch = "injected-transactions-parachain" }
-pallet-ethereum = { version = "2.0.0-dev", git = "https://github.com/usetech-llc/frontier.git", branch = "injected-transactions-parachain" }
+pallet-ethereum = { version = "3.0.0-dev", git = "https://github.com/usetech-llc/frontier.git", branch = "injected-transactions-parachain" }
 
 nft-rpc = { path = "../rpc" }
 
modifiednode/cli/build.rsdiffbeforeafterboth
--- a/node/cli/build.rs
+++ b/node/cli/build.rs
@@ -6,7 +6,7 @@
 use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};
 
 fn main() {
-    generate_cargo_keys();
+	generate_cargo_keys();
 
-    rerun_if_git_head_changed();
+	rerun_if_git_head_changed();
 }
modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -64,20 +64,22 @@
 		// ID
 		"dev",
 		ChainType::Local,
-		move || testnet_genesis(
-			// Sudo account
-			get_account_id_from_seed::<sr25519::Public>("Alice"),
-			vec![
-				get_from_seed::<AuraId>("Alice"),
-				get_from_seed::<AuraId>("Bob"),
-			],
-			// Pre-funded accounts
-			vec![
+		move || {
+			testnet_genesis(
+				// Sudo account
 				get_account_id_from_seed::<sr25519::Public>("Alice"),
-				get_account_id_from_seed::<sr25519::Public>("Bob"),
-			],
-			id,
-		),
+				vec![
+					get_from_seed::<AuraId>("Alice"),
+					get_from_seed::<AuraId>("Bob"),
+				],
+				// Pre-funded accounts
+				vec![
+					get_account_id_from_seed::<sr25519::Public>("Alice"),
+					get_account_id_from_seed::<sr25519::Public>("Bob"),
+				],
+				id,
+			)
+		},
 		// Bootnodes
 		vec![],
 		// Telemetry
@@ -101,30 +103,32 @@
 		// ID
 		"local_testnet",
 		ChainType::Local,
-		move || testnet_genesis(
-			// Sudo account
-			get_account_id_from_seed::<sr25519::Public>("Alice"),
-			vec![
-				get_from_seed::<AuraId>("Alice"),
-				get_from_seed::<AuraId>("Bob"),
-			],
-			// Pre-funded accounts
-			vec![
+		move || {
+			testnet_genesis(
+				// Sudo account
 				get_account_id_from_seed::<sr25519::Public>("Alice"),
-				get_account_id_from_seed::<sr25519::Public>("Bob"),
-				get_account_id_from_seed::<sr25519::Public>("Charlie"),
-				get_account_id_from_seed::<sr25519::Public>("Dave"),
-				get_account_id_from_seed::<sr25519::Public>("Eve"),
-				get_account_id_from_seed::<sr25519::Public>("Ferdie"),
-				get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
-				get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
-				get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
-				get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
-				get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
-				get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
-			],
-			id,
-		),
+				vec![
+					get_from_seed::<AuraId>("Alice"),
+					get_from_seed::<AuraId>("Bob"),
+				],
+				// Pre-funded accounts
+				vec![
+					get_account_id_from_seed::<sr25519::Public>("Alice"),
+					get_account_id_from_seed::<sr25519::Public>("Bob"),
+					get_account_id_from_seed::<sr25519::Public>("Charlie"),
+					get_account_id_from_seed::<sr25519::Public>("Dave"),
+					get_account_id_from_seed::<sr25519::Public>("Eve"),
+					get_account_id_from_seed::<sr25519::Public>("Ferdie"),
+					get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
+					get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
+					get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
+					get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
+					get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
+					get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
+				],
+				id,
+			)
+		},
 		// Bootnodes
 		vec![],
 		// Telemetry
@@ -142,83 +146,82 @@
 }
 
 fn testnet_genesis(
-    root_key: AccountId,
+	root_key: AccountId,
 	initial_authorities: Vec<AuraId>,
-    endowed_accounts: Vec<AccountId>,
+	endowed_accounts: Vec<AccountId>,
 	id: ParaId,
 ) -> GenesisConfig {
-
-	let vested_accounts = vec![
-		get_account_id_from_seed::<sr25519::Public>("Bob"),
-	];
+	let vested_accounts = vec![get_account_id_from_seed::<sr25519::Public>("Bob")];
 
-    GenesisConfig {
+	GenesisConfig {
 		system: nft_runtime::SystemConfig {
 			code: nft_runtime::WASM_BINARY
 				.expect("WASM binary was not build, please build it!")
 				.to_vec(),
 			changes_trie_config: Default::default(),
 		},
-        pallet_balances: BalancesConfig {
-            balances: endowed_accounts
-                .iter()
-                .cloned()
-                .map(|k| (k, 1 << 70))
-                .collect(),
-        },
-		pallet_treasury: Default::default(),
-		pallet_sudo: SudoConfig { key: root_key },
-		pallet_vesting: VestingConfig {
-            vesting: vested_accounts
-                .iter()
-                .cloned()
-                .map(|k| (k, 1000, 100, 1 << 98))
-                .collect(),
-        },
-        pallet_nft: NftConfig {
-            collection_id: vec![(
-                1,
-                Collection {
-                    owner: get_account_id_from_seed::<sr25519::Public>("Alice"),
-                    mode: CollectionMode::NFT,
-                    access: AccessMode::Normal,
-                    decimal_points: 0,
-                    name: vec![],
-                    description: vec![],
-                    token_prefix: vec![],
-                    mint_mode: false,
+		balances: BalancesConfig {
+			balances: endowed_accounts
+				.iter()
+				.cloned()
+				.map(|k| (k, 1 << 70))
+				.collect(),
+		},
+		treasury: Default::default(),
+		sudo: SudoConfig { key: root_key },
+		vesting: VestingConfig {
+			vesting: vested_accounts
+				.iter()
+				.cloned()
+				.map(|k| (k, 1000, 100, 1 << 98))
+				.collect(),
+		},
+		nft: NftConfig {
+			collection_id: vec![(
+				1,
+				Collection {
+					owner: get_account_id_from_seed::<sr25519::Public>("Alice"),
+					mode: CollectionMode::NFT,
+					access: AccessMode::Normal,
+					decimal_points: 0,
+					name: vec![],
+					description: vec![],
+					token_prefix: vec![],
+					mint_mode: false,
 					offchain_schema: vec![],
 					schema_version: SchemaVersion::default(),
-                    sponsorship: SponsorshipState::Confirmed(get_account_id_from_seed::<sr25519::Public>("Alice")),
-                    const_on_chain_schema: vec![],
+					sponsorship: SponsorshipState::Confirmed(get_account_id_from_seed::<
+						sr25519::Public,
+					>("Alice")),
+					const_on_chain_schema: vec![],
 					variable_on_chain_schema: vec![],
-					limits: CollectionLimits::default()
-                },
-            )],
-            nft_item_id: vec![],
-            fungible_item_id: vec![],
-            refungible_item_id: vec![],
-            chain_limit: ChainLimits {
-                collection_numbers_limit: 100000,
-                account_token_ownership_limit: 1000000,
-                collections_admins_limit: 5,
-                custom_data_limit: 2048,
-                nft_sponsor_transfer_timeout: 15,
-                fungible_sponsor_transfer_timeout: 15,
+					limits: CollectionLimits::default(),
+				},
+			)],
+			nft_item_id: vec![],
+			fungible_item_id: vec![],
+			refungible_item_id: vec![],
+			chain_limit: ChainLimits {
+				collection_numbers_limit: 100000,
+				account_token_ownership_limit: 1000000,
+				collections_admins_limit: 5,
+				custom_data_limit: 2048,
+				nft_sponsor_transfer_timeout: 15,
+				fungible_sponsor_transfer_timeout: 15,
 				refungible_sponsor_transfer_timeout: 15,
 				offchain_schema_limit: 1024,
 				variable_on_chain_schema_limit: 1024,
 				const_on_chain_schema_limit: 1024,
-            },
-        },
+			},
+		},
 		parachain_info: nft_runtime::ParachainInfoConfig { parachain_id: id },
-		pallet_aura: nft_runtime::AuraConfig {
+		aura: nft_runtime::AuraConfig {
 			authorities: initial_authorities,
 		},
-		cumulus_pallet_aura_ext: Default::default(),
-		pallet_evm: EVMConfig {
+		aura_ext: Default::default(),
+		evm: EVMConfig {
 			accounts: BTreeMap::new(),
 		},
-		pallet_ethereum: EthereumConfig {},
-    }
+		ethereum: EthereumConfig {},
+	}
 }
modifiednode/cli/src/cli.rsdiffbeforeafterboth
--- a/node/cli/src/cli.rs
+++ b/node/cli/src/cli.rs
@@ -1,6 +1,4 @@
 use crate::chain_spec;
-use cumulus_client_cli;
-use sc_cli;
 use std::path::PathBuf;
 use structopt::StructOpt;
 
modifiednode/cli/src/command.rsdiffbeforeafterboth
--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -18,7 +18,7 @@
 use crate::{
 	chain_spec,
 	cli::{Cli, RelayChainCli, Subcommand},
-	service::{new_partial, ParachainRuntimeExecutor}
+	service::{new_partial, ParachainRuntimeExecutor},
 };
 use codec::Encode;
 use cumulus_primitives_core::ParaId;
@@ -31,7 +31,7 @@
 	NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli,
 };
 use sc_service::{
-	config::{BasePath, PrometheusConfig}
+	config::{BasePath, PrometheusConfig},
 };
 use sp_core::hexdisplay::HexDisplay;
 use sp_runtime::traits::Block as BlockT;
@@ -120,8 +120,7 @@
 	}
 
 	fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
-		polkadot_cli::Cli::from_iter([RelayChainCli::executable_name().to_string()].iter())
-			.load_spec(id)
+		polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id)
 	}
 
 	fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
@@ -129,6 +128,7 @@
 	}
 }
 
+#[allow(clippy::borrowed_box)]
 fn extract_genesis_wasm(chain_spec: &Box<dyn sc_service::ChainSpec>) -> Result<Vec<u8>> {
 	let mut storage = chain_spec.build_storage()?;
 
@@ -189,7 +189,7 @@
 			runner.sync_run(|config| {
 				let polkadot_cli = RelayChainCli::new(
 					&config,
-					[RelayChainCli::executable_name().to_string()]
+					[RelayChainCli::executable_name()]
 						.iter()
 						.chain(cli.relaychain_args.iter()),
 				);
@@ -251,7 +251,7 @@
 			}
 
 			Ok(())
-		},
+		}
 		Some(Subcommand::Benchmark(cmd)) => {
 			if cfg!(feature = "runtime-benchmarks") {
 				let runner = cli.create_runner(cmd)?;
@@ -259,22 +259,20 @@
 				runner.sync_run(|config| cmd.run::<Block, ParachainRuntimeExecutor>(config))
 			} else {
 				Err("Benchmarking wasn't enabled when building the node. \
-				You can enable it with `--features runtime-benchmarks`.".into())
+				You can enable it with `--features runtime-benchmarks`."
+					.into())
 			}
-		},
+		}
 		None => {
 			let runner = cli.create_runner(&cli.run.normalize())?;
 
 			runner.run_node_until_exit(|config| async move {
-				// TODO
-				let key = sp_core::Pair::generate().0;
-
 				let para_id =
 					chain_spec::Extensions::try_get(&*config.chain_spec).map(|e| e.para_id);
 
 				let polkadot_cli = RelayChainCli::new(
 					&config,
-					[RelayChainCli::executable_name().to_string()]
+					[RelayChainCli::executable_name()]
 						.iter()
 						.chain(cli.relaychain_args.iter()),
 				);
@@ -289,12 +287,9 @@
 				let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
 
 				let task_executor = config.task_executor.clone();
-				let polkadot_config = SubstrateCli::create_configuration(
-					&polkadot_cli,
-					&polkadot_cli,
-					task_executor,
-				)
-				.map_err(|err| format!("Relay chain argument error: {}", err))?;
+				let polkadot_config =
+					SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, task_executor)
+						.map_err(|err| format!("Relay chain argument error: {}", err))?;
 
 				info!("Parachain id: {:?}", id);
 				info!("Parachain Account: {}", parachain_account);
@@ -308,7 +303,7 @@
 					}
 				);
 
-				crate::service::start_node(config, key, polkadot_config, id)
+				crate::service::start_node(config, polkadot_config, id)
 					.await
 					.map(|r| r.0)
 					.map_err(Into::into)
@@ -443,4 +438,4 @@
 	) -> Result<Option<sc_telemetry::TelemetryEndpoints>> {
 		self.base.base.telemetry_endpoints(chain_spec)
 	}
-}
\ No newline at end of file
+}
modifiednode/cli/src/service.rsdiffbeforeafterboth
--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -15,9 +15,7 @@
 use nft_runtime::RuntimeApi;
 
 // Cumulus Imports
-use cumulus_client_consensus_aura::{
-	build_aura_consensus, BuildAuraConsensusParams, SlotProportion,
-};
+use cumulus_client_consensus_aura::{build_aura_consensus, BuildAuraConsensusParams, SlotProportion};
 use cumulus_client_consensus_common::ParachainConsensus;
 use cumulus_client_network::build_block_announce_validator;
 use cumulus_client_service::{
@@ -25,9 +23,6 @@
 };
 use cumulus_primitives_core::ParaId;
 
-// Polkadot Imports
-use polkadot_primitives::v1::CollatorPair;
-
 // Substrate Imports
 use sc_client_api::ExecutorProvider;
 pub use sc_executor::NativeExecutor;
@@ -59,20 +54,23 @@
 );
 
 pub fn open_frontier_backend(config: &Configuration) -> Result<Arc<fc_db::Backend<Block>>, String> {
-	let config_dir = config.base_path.as_ref()
+	let config_dir = config
+		.base_path
+		.as_ref()
 		.map(|base_path| base_path.config_dir(config.chain_spec.id()))
 		.unwrap_or_else(|| {
-			BasePath::from_project("", "", "nft")
-				.config_dir(config.chain_spec.id())
+			BasePath::from_project("", "", "nft").config_dir(config.chain_spec.id())
 		});
 	let database_dir = config_dir.join("frontier").join("db");
 
-	Ok(Arc::new(fc_db::Backend::<Block>::new(&fc_db::DatabaseSettings {
-		source: fc_db::DatabaseSettingsSrc::RocksDb {
-			path: database_dir,
-			cache_size: 0,
-		}
-	})?))
+	Ok(Arc::new(fc_db::Backend::<Block>::new(
+		&fc_db::DatabaseSettings {
+			source: fc_db::DatabaseSettingsSrc::RocksDb {
+				path: database_dir,
+				cache_size: 0,
+			},
+		},
+	)?))
 }
 
 type Executor = ParachainRuntimeExecutor;
@@ -85,6 +83,7 @@
 ///
 /// Use this macro if you don't actually need the full service, but just the builder in order to
 /// be able to perform chain operations.
+#[allow(clippy::type_complexity)]
 pub fn new_partial<BIQ>(
 	config: &Configuration,
 	build_import_queue: BIQ,
@@ -95,7 +94,13 @@
 		FullSelectChain,
 		sp_consensus::DefaultImportQueue<Block, FullClient>,
 		sc_transaction_pool::FullPool<Block, FullClient>,
-		(Option<Telemetry>, PendingTransactions, Option<FilterPool>, Arc<fc_db::Backend<Block>>, Option<TelemetryWorkerHandle>),
+		(
+			Option<Telemetry>,
+			PendingTransactions,
+			Option<FilterPool>,
+			Arc<fc_db::Backend<Block>>,
+			Option<TelemetryWorkerHandle>,
+		),
 	>,
 	sc_service::Error,
 >
@@ -107,12 +112,9 @@
 		&Configuration,
 		Option<TelemetryHandle>,
 		&TaskManager,
-	) -> Result<
-		sp_consensus::DefaultImportQueue<Block, FullClient>,
-		sc_service::Error,
-	>,
+	) -> Result<sp_consensus::DefaultImportQueue<Block, FullClient>, sc_service::Error>,
 {
-	let telemetry = config
+	let _telemetry = config
 		.telemetry_endpoints
 		.clone()
 		.filter(|x| !x.is_empty())
@@ -123,7 +125,9 @@
 		})
 		.transpose()?;
 
-	let telemetry = config.telemetry_endpoints.clone()
+	let telemetry = config
+		.telemetry_endpoints
+		.clone()
 		.filter(|x| !x.is_empty())
 		.map(|endpoints| -> Result<_, sc_telemetry::Error> {
 			let worker = TelemetryWorker::new(16)?;
@@ -134,7 +138,7 @@
 
 	let (client, backend, keystore_container, task_manager) =
 		sc_service::new_full_parts::<Block, RuntimeApi, Executor>(
-			&config,
+			config,
 			telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
 		)?;
 	let client = Arc::new(client);
@@ -152,14 +156,13 @@
 		config.transaction_pool.clone(),
 		config.role.is_authority().into(),
 		config.prometheus_registry(),
-		task_manager.spawn_handle(),
+		task_manager.spawn_essential_handle(),
 		client.clone(),
 	);
 
 	let pending_transactions: PendingTransactions = Some(Arc::new(Mutex::new(HashMap::new())));
 
-	let filter_pool: Option<FilterPool>
-		= Some(Arc::new(Mutex::new(BTreeMap::new())));
+	let filter_pool: Option<FilterPool> = Some(Arc::new(Mutex::new(BTreeMap::new())));
 
 	let frontier_backend = open_frontier_backend(config)?;
 
@@ -178,7 +181,13 @@
 		task_manager,
 		transaction_pool,
 		select_chain,
-		other: (telemetry, pending_transactions, filter_pool, frontier_backend, telemetry_worker_handle),
+		other: (
+			telemetry,
+			pending_transactions,
+			filter_pool,
+			frontier_backend,
+			telemetry_worker_handle,
+		),
 	};
 
 	Ok(params)
@@ -190,7 +199,6 @@
 #[sc_tracing::logging::prefix_logs_with("Parachain")]
 async fn start_node_impl<BIQ, BIC>(
 	parachain_config: Configuration,
-	collator_key: CollatorPair,
 	polkadot_config: Configuration,
 	id: ParaId,
 	build_import_queue: BIQ,
@@ -204,10 +212,7 @@
 		&Configuration,
 		Option<TelemetryHandle>,
 		&TaskManager,
-	) -> Result<
-		sp_consensus::DefaultImportQueue<Block, FullClient>,
-		sc_service::Error,
-	>,
+	) -> Result<sp_consensus::DefaultImportQueue<Block, FullClient>, sc_service::Error>,
 	BIC: FnOnce(
 		Arc<FullClient>,
 		Option<&Registry>,
@@ -227,18 +232,21 @@
 	let parachain_config = prepare_node_config(parachain_config);
 
 	let params = new_partial::<BIQ>(&parachain_config, build_import_queue)?;
-	let (mut telemetry, pending_transactions, filter_pool, frontier_backend, telemetry_worker_handle) = params.other;
-
-	let relay_chain_full_node = cumulus_client_service::build_polkadot_full_node(
-		polkadot_config,
-		collator_key.clone(),
+	let (
+		mut telemetry,
+		pending_transactions,
+		filter_pool,
+		frontier_backend,
 		telemetry_worker_handle,
-	)
-	.map_err(|e| match e {
-		polkadot_service::Error::Sub(x) => x,
-		s => format!("{}", s).into(),
-	})?;
+	) = params.other;
 
+	let relay_chain_full_node =
+		cumulus_client_service::build_polkadot_full_node(polkadot_config, telemetry_worker_handle)
+			.map_err(|e| match e {
+				polkadot_service::Error::Sub(x) => x,
+				s => format!("{}", s).into(),
+			})?;
+
 	let client = params.client.clone();
 	let backend = params.backend.clone();
 	let block_announce_validator = build_block_announce_validator(
@@ -254,7 +262,7 @@
 	let transaction_pool = params.transaction_pool.clone();
 	let mut task_manager = params.task_manager;
 	let import_queue = cumulus_client_service::SharedImportQueue::new(params.import_queue);
-	let (network, network_status_sinks, system_rpc_tx, start_network) =
+	let (network, system_rpc_tx, start_network) =
 		sc_service::build_network(sc_service::BuildNetworkParams {
 			config: &parachain_config,
 			client: client.clone(),
@@ -283,7 +291,7 @@
 			network: rpc_network.clone(),
 			pending_transactions: pending_transactions.clone(),
 			select_chain: select_chain.clone(),
-			is_authority: is_authority.clone(),
+			is_authority,
 			// TODO: Unhardcode
 			max_past_logs: 10000,
 		};
@@ -302,7 +310,6 @@
 		keystore: params.keystore_container.sync_keystore(),
 		backend: backend.clone(),
 		network: network.clone(),
-		network_status_sinks,
 		system_rpc_tx,
 		telemetry: telemetry.as_mut(),
 	})?;
@@ -333,7 +340,6 @@
 			announce_block,
 			client: client.clone(),
 			task_manager: &mut task_manager,
-			collator_key,
 			relay_chain_full_node,
 			spawner,
 			parachain_consensus,
@@ -364,15 +370,8 @@
 	config: &Configuration,
 	telemetry: Option<TelemetryHandle>,
 	task_manager: &TaskManager,
-) -> Result<
-	sp_consensus::DefaultImportQueue<
-		Block,
-		FullClient,
-	>,
-	sc_service::Error,
-> {
+) -> Result<sp_consensus::DefaultImportQueue<Block, FullClient>, sc_service::Error> {
 	let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
-
 
 	cumulus_client_consensus_aura::import_queue::<
 		sp_consensus_aura::sr25519::AuthorityPair,
@@ -383,7 +382,7 @@
 		_,
 		_,
 	>(cumulus_client_consensus_aura::ImportQueueParams {
-		block_import:  client.clone(),
+		block_import: client.clone(),
 		client: client.clone(),
 		create_inherent_data_providers: move |_, _| async move {
 			let time = sp_timestamp::InherentDataProvider::from_system_time();
@@ -396,7 +395,7 @@
 
 			Ok((time, slot))
 		},
-		registry: config.prometheus_registry().clone(),
+		registry: config.prometheus_registry(),
 		can_author_with: sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()),
 		spawner: &task_manager.spawn_essential_handle(),
 		telemetry,
@@ -407,13 +406,11 @@
 /// Start a normal parachain node.
 pub async fn start_node(
 	parachain_config: Configuration,
-	collator_key: CollatorPair,
 	polkadot_config: Configuration,
 	id: ParaId,
 ) -> sc_service::error::Result<(TaskManager, Arc<FullClient>)> {
 	start_node_impl::<_, _>(
 		parachain_config,
-		collator_key,
 		polkadot_config,
 		id,
 		parachain_build_import_queue,
@@ -432,7 +429,7 @@
 				task_manager.spawn_handle(),
 				client.clone(),
 				transaction_pool,
-				prometheus_registry.clone(),
+				prometheus_registry,
 				telemetry.clone(),
 			);
 
@@ -480,7 +477,7 @@
 				block_import: client.clone(),
 				relay_chain_client: relay_chain_node.client.clone(),
 				relay_chain_backend: relay_chain_node.backend.clone(),
-				para_client: client.clone(),
+				para_client: client,
 				backoff_authoring_blocks: Option::<()>::None,
 				sync_oracle,
 				keystore,
@@ -493,4 +490,4 @@
 		},
 	)
 	.await
-}
\ No newline at end of file
+}
modifiednode/rpc/Cargo.tomldiffbeforeafterboth
--- a/node/rpc/Cargo.toml
+++ b/node/rpc/Cargo.toml
@@ -13,33 +13,33 @@
 futures = { version = "0.3.1", features = ["compat"] }
 jsonrpc-core = "15.0.0"
 jsonrpc-pubsub = "15.0.0"
-pallet-contracts-rpc = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-pallet-transaction-payment-rpc = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-pallet-transaction-payment-rpc-runtime-api = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sc-client-api = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sc-consensus-aura = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sc-consensus-epochs = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sc-finality-grandpa = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sc-finality-grandpa-rpc = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sc-keystore = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sc-network = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sc-rpc-api = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sc-rpc = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sc-service = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-api = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-block-builder = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-blockchain = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-consensus = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-consensus-aura = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-core = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-offchain = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-runtime = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-storage = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-session = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-transaction-pool = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sc-transaction-pool = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sc-transaction-graph = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-substrate-frame-rpc-system = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
+pallet-contracts-rpc = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+pallet-transaction-payment-rpc = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+pallet-transaction-payment-rpc-runtime-api = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sc-client-api = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sc-consensus-aura = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sc-consensus-epochs = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sc-finality-grandpa = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sc-finality-grandpa-rpc = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sc-keystore = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sc-network = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sc-rpc-api = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sc-rpc = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sc-service = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-api = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-block-builder = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-blockchain = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-consensus = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-consensus-aura = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-core = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-offchain = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-runtime = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-storage = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-session = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-transaction-pool = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sc-transaction-pool = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sc-transaction-graph = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+substrate-frame-rpc-system = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
 tokio = { version = "0.2.13", features = ["macros", "sync"] }
 
 pallet-ethereum = { git = "https://github.com/usetech-llc/frontier.git", branch = "injected-transactions-parachain" }
modifiednode/rpc/src/lib.rsdiffbeforeafterboth
--- a/node/rpc/src/lib.rs
+++ b/node/rpc/src/lib.rs
@@ -189,7 +189,7 @@
 		pool.clone(),
 		nft_runtime::TransactionConverter,
 		network.clone(),
-		pending_transactions.clone(),
+		pending_transactions,
 		signers,
 		overrides.clone(),
 		backend,
@@ -200,8 +200,8 @@
 	if let Some(filter_pool) = filter_pool {
 		io.extend_with(EthFilterApiServer::to_delegate(EthFilterApi::new(
 			client.clone(),
-			filter_pool.clone(),
-			500 as usize, // max stored filters
+			filter_pool,
+			500_usize, // max stored filters
 			overrides.clone(),
 			max_past_logs,
 		)));
@@ -217,9 +217,9 @@
 	io.extend_with(Web3ApiServer::to_delegate(Web3Api::new(client.clone())));
 
 	io.extend_with(EthPubSubApiServer::to_delegate(EthPubSubApi::new(
-		pool.clone(),
-		client.clone(),
-		network.clone(),
+		pool,
+		client,
+		network,
 		SubscriptionManager::<HexEncodedIdProvider>::with_id_provider(
 			HexEncodedIdProvider::default(),
 			Arc::new(subscription_task_executor),
modifiedpallets/contract-helpers/Cargo.tomldiffbeforeafterboth
--- a/pallets/contract-helpers/Cargo.toml
+++ b/pallets/contract-helpers/Cargo.toml
@@ -15,11 +15,11 @@
 version = '0.1.0'
 
 [dependencies]
-frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-pallet-contracts = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
+frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+pallet-contracts = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
 
 [features]
 default = ["std"]
modifiedpallets/contract-helpers/src/lib.rsdiffbeforeafterboth
--- a/pallets/contract-helpers/src/lib.rs
+++ b/pallets/contract-helpers/src/lib.rs
@@ -15,11 +15,11 @@
 	use sp_std::vec::Vec;
 	use up_sponsorship::SponsorshipHandler;
 
-    #[pallet::error]
-    pub enum Error<T> {
-        /// Should be contract owner
-        NoPermission,
-    }
+	#[pallet::error]
+	pub enum Error<T> {
+		/// Should be contract owner
+		NoPermission,
+	}
 
 	#[pallet::config]
 	pub trait Config: frame_system::Config + pallet_contracts::Config {}
@@ -75,13 +75,16 @@
 	#[pallet::call]
 	impl<T: Config> Pallet<T> {
 		#[pallet::weight(0)]
-		fn toggle_sponsoring(
+		pub fn toggle_sponsoring(
 			origin: OriginFor<T>,
 			contract: T::AccountId,
 			sponsoring: bool,
 		) -> DispatchResult {
 			let sender = ensure_signed(origin)?;
-			ensure!(<Owner<T>>::get(&contract) == sender, <Error<T>>::NoPermission);
+			ensure!(
+				<Owner<T>>::get(&contract) == sender,
+				<Error<T>>::NoPermission
+			);
 
 			if sponsoring {
 				<SelfSponsoring<T>>::insert(contract, true);
@@ -92,13 +95,16 @@
 		}
 
 		#[pallet::weight(0)]
-		fn toggle_allowlist(
+		pub fn toggle_allowlist(
 			origin: OriginFor<T>,
 			contract: T::AccountId,
 			enabled: bool,
 		) -> DispatchResult {
 			let sender = ensure_signed(origin)?;
-			ensure!(<Owner<T>>::get(&contract) == sender, <Error<T>>::NoPermission);
+			ensure!(
+				<Owner<T>>::get(&contract) == sender,
+				<Error<T>>::NoPermission
+			);
 
 			if enabled {
 				<AllowlistEnabled<T>>::insert(contract, true);
@@ -109,14 +115,17 @@
 		}
 
 		#[pallet::weight(0)]
-		fn toggle_allowed(
+		pub fn toggle_allowed(
 			origin: OriginFor<T>,
 			contract: T::AccountId,
 			user: T::AccountId,
 			allowed: bool,
 		) -> DispatchResult {
 			let sender = ensure_signed(origin)?;
-			ensure!(<Owner<T>>::get(&contract) == sender, <Error<T>>::NoPermission);
+			ensure!(
+				<Owner<T>>::get(&contract) == sender,
+				<Error<T>>::NoPermission
+			);
 
 			if allowed {
 				<Allowlist<T>>::insert(contract, user, true);
@@ -127,13 +136,16 @@
 		}
 
 		#[pallet::weight(0)]
-		fn set_sponsoring_rate_limit(
+		pub fn set_sponsoring_rate_limit(
 			origin: OriginFor<T>,
 			contract: T::AccountId,
 			rate_limit: T::BlockNumber,
 		) -> DispatchResult {
 			let sender = ensure_signed(origin)?;
-			ensure!(<Owner<T>>::get(&contract) == sender, <Error<T>>::NoPermission);
+			ensure!(
+				<Owner<T>>::get(&contract) == sender,
+				<Error<T>>::NoPermission
+			);
 
 			<SponsoringRateLimit<T>>::insert(contract, rate_limit);
 			Ok(())
@@ -174,19 +186,17 @@
 			_info: &DispatchInfoOf<Self::Call>,
 			_len: usize,
 		) -> transaction_validity::TransactionValidity {
-			match IsSubType::<pallet_contracts::Call<T>>::is_sub_type(call) {
-				Some(pallet_contracts::Call::call(dest, _value, _gas_limit, _data)) => {
-					let called_contract: T::AccountId =
-						T::Lookup::lookup((*dest).clone()).unwrap_or(T::AccountId::default());
-					if <AllowlistEnabled<T>>::get(&called_contract) {
-						if !<Allowlist<T>>::get(&called_contract, who)
-							&& &<Owner<T>>::get(&called_contract) != who
-						{
-							return Err(transaction_validity::InvalidTransaction::Call.into());
-						}
-					}
+			if let Some(pallet_contracts::Call::call(dest, _value, _gas_limit, _data)) =
+				IsSubType::<pallet_contracts::Call<T>>::is_sub_type(call)
+			{
+				let called_contract: T::AccountId =
+					T::Lookup::lookup((*dest).clone()).unwrap_or_default();
+				if <AllowlistEnabled<T>>::get(&called_contract)
+					&& !<Allowlist<T>>::get(&called_contract, who)
+					&& &<Owner<T>>::get(&called_contract) != who
+				{
+					return Err(transaction_validity::InvalidTransaction::Call.into());
 				}
-				_ => {}
 			}
 			Ok(transaction_validity::ValidTransaction::default())
 		}
@@ -200,11 +210,11 @@
 		) -> Result<Self::Pre, TransactionValidityError> {
 			match IsSubType::<pallet_contracts::Call<T>>::is_sub_type(call) {
 				Some(pallet_contracts::Call::instantiate(_, _, code_hash, _, salt)) => {
-					Ok(Some((who.clone(), code_hash.clone(), salt.clone())))
+					Ok(Some((who.clone(), *code_hash, salt.clone())))
 				}
 				Some(pallet_contracts::Call::instantiate_with_code(_, _, code, _, salt)) => {
-					let code_hash = &T::Hashing::hash(&code);
-					Ok(Some((who.clone(), code_hash.clone(), salt.clone())))
+					let code_hash = &T::Hashing::hash(code);
+					Ok(Some((who.clone(), *code_hash, salt.clone())))
 				}
 				_ => Ok(None),
 			}
@@ -236,24 +246,22 @@
 		T::AccountId: AsRef<[u8]>,
 	{
 		fn get_sponsor(who: &T::AccountId, call: &C) -> Option<T::AccountId> {
-			match IsSubType::<pallet_contracts::Call<T>>::is_sub_type(call) {
-				Some(pallet_contracts::Call::call(dest, _value, _gas_limit, _data)) => {
-					let called_contract: T::AccountId =
-						T::Lookup::lookup((*dest).clone()).unwrap_or_default();
-					if <SelfSponsoring<T>>::get(&called_contract) {
-						let last_tx_block = SponsorBasket::<T>::get(&called_contract, &who);
-						let block_number =
-							<frame_system::Pallet<T>>::block_number() as T::BlockNumber;
-						let rate_limit = SponsoringRateLimit::<T>::get(&called_contract);
-						let limit_time = last_tx_block + rate_limit;
+			if let Some(pallet_contracts::Call::call(dest, _value, _gas_limit, _data)) =
+				IsSubType::<pallet_contracts::Call<T>>::is_sub_type(call)
+			{
+				let called_contract: T::AccountId =
+					T::Lookup::lookup((*dest).clone()).unwrap_or_default();
+				if <SelfSponsoring<T>>::get(&called_contract) {
+					let last_tx_block = SponsorBasket::<T>::get(&called_contract, &who);
+					let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;
+					let rate_limit = SponsoringRateLimit::<T>::get(&called_contract);
+					let limit_time = last_tx_block + rate_limit;
 
-						if block_number >= limit_time {
-							SponsorBasket::<T>::insert(&called_contract, who, block_number);
-							return Some(called_contract);
-						}
+					if block_number >= limit_time {
+						SponsorBasket::<T>::insert(&called_contract, who, block_number);
+						return Some(called_contract);
 					}
 				}
-				_ => {}
 			}
 			None
 		}
modifiedpallets/inflation/Cargo.tomldiffbeforeafterboth
--- a/pallets/inflation/Cargo.toml
+++ b/pallets/inflation/Cargo.toml
@@ -43,43 +43,43 @@
 default-features = false
 optional = true
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.frame-support]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.frame-system]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-balances]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-timestamp]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-randomness-collective-flip]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-std]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.serde]
@@ -90,18 +90,18 @@
 [dependencies.sp-runtime]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-core]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-io]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
modifiedpallets/inflation/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/inflation/src/benchmarking.rs
+++ b/pallets/inflation/src/benchmarking.rs
@@ -5,15 +5,15 @@
 
 use sp_std::prelude::*;
 use frame_system::RawOrigin;
-use frame_benchmarking::{benchmarks}; 
+use frame_benchmarking::{benchmarks};
 use frame_support::traits::OnInitialize;
 
 benchmarks! {
 
 	on_initialize {
-        let block1: T::BlockNumber = T::BlockNumber::from(1u32);
-        let block2: T::BlockNumber = T::BlockNumber::from(2u32);
-        Inflation::<T>::on_initialize(block1); // Create Treasury account
+		let block1: T::BlockNumber = T::BlockNumber::from(1u32);
+		let block2: T::BlockNumber = T::BlockNumber::from(2u32);
+		Inflation::<T>::on_initialize(block1); // Create Treasury account
 	}: { Inflation::<T>::on_initialize(block2); } // Benchmark deposit_into_existing path
 
 }
modifiedpallets/inflation/src/lib.rsdiffbeforeafterboth
--- a/pallets/inflation/src/lib.rs
+++ b/pallets/inflation/src/lib.rs
@@ -4,7 +4,6 @@
 //
 
 #![recursion_limit = "1024"]
-
 #![cfg_attr(not(feature = "std"), no_std)]
 
 #[cfg(feature = "std")]
@@ -19,8 +18,7 @@
 mod tests;
 
 pub use frame_support::{
-	construct_runtime, decl_module, decl_storage,
-	ensure,
+	construct_runtime, decl_module, decl_storage, ensure,
 	traits::{
 		Currency, ExistenceRequirement, Get, Imbalance, KeyOwnerProofSystem, OnUnbalanced,
 		Randomness, IsSubType, WithdrawReasons,
@@ -30,8 +28,7 @@
 		DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,
 		WeightToFeePolynomial, DispatchClass,
 	},
-	StorageValue,
-	transactional,
+	StorageValue, transactional,
 };
 
 // #[cfg(feature = "runtime-benchmarks")]
@@ -39,7 +36,7 @@
 
 use sp_runtime::{
 	Perbill,
-	traits::{Zero}
+	traits::{Zero},
 };
 use sp_std::convert::TryInto;
 
@@ -71,13 +68,13 @@
 }
 
 decl_module! {
-	pub struct Module<T: Config> for enum Call 
-	where 
+	pub struct Module<T: Config> for enum Call
+	where
 		origin: T::Origin,
 	{
 		const InflationBlockInterval: T::BlockNumber = T::InflationBlockInterval::get();
 
-		fn on_initialize(now: T::BlockNumber) -> Weight 
+		fn on_initialize(now: T::BlockNumber) -> Weight
 		{
 			let mut consumed_weight = 0;
 			let mut add_weight = |reads, writes, weight| {
@@ -95,14 +92,14 @@
 
 				if current_year <= TOTAL_YEARS_UNTIL_FLAT {
 					let amount: BalanceOf<T> = Perbill::from_rational(
-						block_interval * (START_INFLATION_PERCENT * TOTAL_YEARS_UNTIL_FLAT - current_year * (START_INFLATION_PERCENT - END_INFLATION_PERCENT)), 
+						block_interval * (START_INFLATION_PERCENT * TOTAL_YEARS_UNTIL_FLAT - current_year * (START_INFLATION_PERCENT - END_INFLATION_PERCENT)),
 						YEAR * TOTAL_YEARS_UNTIL_FLAT
 					) * ( one_percent * T::Currency::total_issuance() );
 					<BlockInflation<T>>::put(amount);
 				}
 				else {
 					let amount: BalanceOf<T> = Perbill::from_rational(
-						block_interval * END_INFLATION_PERCENT, 
+						block_interval * END_INFLATION_PERCENT,
 						YEAR
 					) * (one_percent * T::Currency::total_issuance());
 					<BlockInflation<T>>::put(amount);
modifiedpallets/inflation/src/tests.rsdiffbeforeafterboth
--- a/pallets/inflation/src/tests.rs
+++ b/pallets/inflation/src/tests.rs
@@ -1,241 +1,242 @@
-#[cfg(test)]
-mod tests {
-	use crate as pallet_inflation;
+#![cfg(test)]
+#![allow(clippy::from_over_into)]
+use crate as pallet_inflation;
 
-	use frame_system;
-	use frame_support::{traits::{Currency}, parameter_types};
-	use frame_support::{traits::OnInitialize};
-	use sp_core::H256;
-	use sp_runtime::{traits::{BlakeTwo256, IdentityLookup}, testing::Header};
+use frame_support::{
+	traits::{Currency},
+	parameter_types,
+};
+use frame_support::{traits::OnInitialize};
+use sp_core::H256;
+use sp_runtime::{
+	traits::{BlakeTwo256, IdentityLookup},
+	testing::Header,
+};
 
-	type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
-	type Block = frame_system::mocking::MockBlock<Test>;
+type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
+type Block = frame_system::mocking::MockBlock<Test>;
 
-	const YEAR: u64 = 5_259_600;
+const YEAR: u64 = 5_259_600;
 
-	parameter_types! {
-		pub const ExistentialDeposit: u64 = 1;
-		pub const MaxLocks: u32 = 50;
-	}
-	
-	impl pallet_balances::Config for Test {
-		type AccountStore = System;
-		type Balance = u64;
-		type DustRemoval = ();
-		type Event = ();
-		type ExistentialDeposit = ExistentialDeposit;
-		type WeightInfo = ();
-		type MaxLocks = MaxLocks;
-	}
-	
-	frame_support::construct_runtime!(
-		pub enum Test where
-			Block = Block,
-			NodeBlock = Block,
-			UncheckedExtrinsic = UncheckedExtrinsic,
-		{
-			Balances: pallet_balances::{Module, Call, Storage},
-			System: frame_system::{Module, Call, Config, Storage, Event<T>},
-			Inflation: pallet_inflation::{Module, Call, Storage},
-		}
-	);
+parameter_types! {
+	pub const ExistentialDeposit: u64 = 1;
+	pub const MaxLocks: u32 = 50;
+}
 
-	parameter_types! {
-		pub const BlockHashCount: u64 = 250;
-		pub BlockWeights: frame_system::limits::BlockWeights =
-			frame_system::limits::BlockWeights::simple_max(1024);
-		pub const SS58Prefix: u8 = 42;
-	}
+impl pallet_balances::Config for Test {
+	type AccountStore = System;
+	type Balance = u64;
+	type DustRemoval = ();
+	type Event = ();
+	type ExistentialDeposit = ExistentialDeposit;
+	type WeightInfo = ();
+	type MaxLocks = MaxLocks;
+}
 
-	impl frame_system::Config for Test {
-		type BaseCallFilter = ();
-		type BlockWeights = ();
-		type BlockLength = ();
-		type DbWeight = ();
-		type Origin = Origin;
-		type Call = Call;
-		type Index = u64;
-		type BlockNumber = u64;
-		type Hash = H256;
-		type Hashing = BlakeTwo256;
-		type AccountId = u64;
-		type Lookup = IdentityLookup<Self::AccountId>;
-		type Header = Header;
-		type Event = ();
-		type BlockHashCount = BlockHashCount;
-		type Version = ();
-		type PalletInfo = PalletInfo;
-		type AccountData = pallet_balances::AccountData<u64>;
-		type OnNewAccount = ();
-		type OnKilledAccount = ();
-		type SystemWeightInfo = ();
-		type SS58Prefix = SS58Prefix;
+frame_support::construct_runtime!(
+	pub enum Test where
+		Block = Block,
+		NodeBlock = Block,
+		UncheckedExtrinsic = UncheckedExtrinsic,
+	{
+		Balances: pallet_balances::{Pallet, Call, Storage},
+		System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
+		Inflation: pallet_inflation::{Pallet, Call, Storage},
 	}
+);
 
-	parameter_types! {
-		pub TreasuryAccountId: u64 = 1234;
-		pub const InflationBlockInterval: u32 = 100; // every time per how many blocks inflation is applied
-	}
-		
-	impl pallet_inflation::Config for Test {
-		type Currency = Balances;
-		type TreasuryAccountId = TreasuryAccountId;
-		type InflationBlockInterval = InflationBlockInterval;
-	}
+parameter_types! {
+	pub const BlockHashCount: u64 = 250;
+	pub BlockWeights: frame_system::limits::BlockWeights =
+		frame_system::limits::BlockWeights::simple_max(1024);
+	pub const SS58Prefix: u8 = 42;
+}
 
-	// Build genesis storage according to the mock runtime.
-	pub fn new_test_ext() -> sp_io::TestExternalities {
-		frame_system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
-	}
+impl frame_system::Config for Test {
+	type BaseCallFilter = ();
+	type BlockWeights = ();
+	type BlockLength = ();
+	type DbWeight = ();
+	type Origin = Origin;
+	type Call = Call;
+	type Index = u64;
+	type BlockNumber = u64;
+	type Hash = H256;
+	type Hashing = BlakeTwo256;
+	type AccountId = u64;
+	type Lookup = IdentityLookup<Self::AccountId>;
+	type Header = Header;
+	type Event = ();
+	type BlockHashCount = BlockHashCount;
+	type Version = ();
+	type PalletInfo = PalletInfo;
+	type AccountData = pallet_balances::AccountData<u64>;
+	type OnNewAccount = ();
+	type OnKilledAccount = ();
+	type SystemWeightInfo = ();
+	type SS58Prefix = SS58Prefix;
+	type OnSetCode = ();
+}
 
-	#[test]
-	fn inflation_works() {
-		new_test_ext().execute_with(|| {
-			// Total issuance = 1_000_000_000
-			let initial_issuance: u64 = 1_000_000_000;
-			let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
-			assert_eq!(Balances::free_balance(1234), initial_issuance);
+parameter_types! {
+	pub TreasuryAccountId: u64 = 1234;
+	pub const InflationBlockInterval: u32 = 100; // every time per how many blocks inflation is applied
+}
 
-			// BlockInflation should be set after 1st block and 
-			// first inflation deposit should be equal to BlockInflation
-			Inflation::on_initialize(1);
-			assert!(Inflation::block_inflation() > 0);
-			assert_eq!(Balances::free_balance(1234) - initial_issuance, Inflation::block_inflation());
-		});
-	}
+impl pallet_inflation::Config for Test {
+	type Currency = Balances;
+	type TreasuryAccountId = TreasuryAccountId;
+	type InflationBlockInterval = InflationBlockInterval;
+}
 
-	#[test]
-	fn inflation_second_deposit() {
-		new_test_ext().execute_with(|| {
-			// Total issuance = 1_000_000_000
-			let initial_issuance: u64 = 1_000_000_000;
-			let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
-			assert_eq!(Balances::free_balance(1234), initial_issuance);
-			Inflation::on_initialize(1);
+// Build genesis storage according to the mock runtime.
+pub fn new_test_ext() -> sp_io::TestExternalities {
+	frame_system::GenesisConfig::default()
+		.build_storage::<Test>()
+		.unwrap()
+		.into()
+}
 
-			// Next inflation deposit happens when block is multiple of InflationBlockInterval
-			let mut block: u32 = 2;
-			let balance_before: u64 = Balances::free_balance(1234);
-			while block % InflationBlockInterval::get() != 0 {
-				Inflation::on_initialize(block as u64);
-				block += 1;
-			}
-			let balance_just_before: u64 = Balances::free_balance(1234);
-			assert_eq!(balance_before, balance_just_before);
+#[test]
+fn inflation_works() {
+	new_test_ext().execute_with(|| {
+		// Total issuance = 1_000_000_000
+		let initial_issuance: u64 = 1_000_000_000;
+		let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
+		assert_eq!(Balances::free_balance(1234), initial_issuance);
 
-			// The block with inflation
+		// BlockInflation should be set after 1st block and
+		// first inflation deposit should be equal to BlockInflation
+		Inflation::on_initialize(1);
+		assert!(Inflation::block_inflation() > 0);
+		assert_eq!(
+			Balances::free_balance(1234) - initial_issuance,
+			Inflation::block_inflation()
+		);
+	});
+}
+
+#[test]
+fn inflation_second_deposit() {
+	new_test_ext().execute_with(|| {
+		// Total issuance = 1_000_000_000
+		let initial_issuance: u64 = 1_000_000_000;
+		let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
+		assert_eq!(Balances::free_balance(1234), initial_issuance);
+		Inflation::on_initialize(1);
+
+		// Next inflation deposit happens when block is multiple of InflationBlockInterval
+		let mut block: u32 = 2;
+		let balance_before: u64 = Balances::free_balance(1234);
+		while block % InflationBlockInterval::get() != 0 {
 			Inflation::on_initialize(block as u64);
-			let balance_after: u64 = Balances::free_balance(1234);
-			assert_eq!(balance_after - balance_just_before, Inflation::block_inflation());
-		});
-	}
+			block += 1;
+		}
+		let balance_just_before: u64 = Balances::free_balance(1234);
+		assert_eq!(balance_before, balance_just_before);
 
-	#[test]
-	fn inflation_in_1_year() {
-		new_test_ext().execute_with(|| {
-			// Total issuance = 1_000_000_000
-			let initial_issuance: u64 = 1_000_000_000;
-			let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
-			assert_eq!(Balances::free_balance(1234), initial_issuance);
-			Inflation::on_initialize(1);
-			let block_inflation_year_0 = Inflation::block_inflation();
+		// The block with inflation
+		Inflation::on_initialize(block as u64);
+		let balance_after: u64 = Balances::free_balance(1234);
+		assert_eq!(
+			balance_after - balance_just_before,
+			Inflation::block_inflation()
+		);
+	});
+}
 
-			Inflation::on_initialize(YEAR);
-			let block_inflation_year_1 = Inflation::block_inflation();
+#[test]
+fn inflation_in_1_year() {
+	new_test_ext().execute_with(|| {
+		// Total issuance = 1_000_000_000
+		let initial_issuance: u64 = 1_000_000_000;
+		let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
+		assert_eq!(Balances::free_balance(1234), initial_issuance);
+		Inflation::on_initialize(1);
+		let block_inflation_year_0 = Inflation::block_inflation();
 
-			// Assert that year 1 inflation is less than year 0
-			assert!(block_inflation_year_0 > block_inflation_year_1);
-		});
-	}
+		Inflation::on_initialize(YEAR);
+		let block_inflation_year_1 = Inflation::block_inflation();
 
-	#[test]
-	fn inflation_in_1_to_9_years() {
-		new_test_ext().execute_with(|| {
-			// Total issuance = 1_000_000_000
-			let initial_issuance: u64 = 1_000_000_000;
-			let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
-			assert_eq!(Balances::free_balance(1234), initial_issuance);
-			Inflation::on_initialize(1);
+		// Assert that year 1 inflation is less than year 0
+		assert!(block_inflation_year_0 > block_inflation_year_1);
+	});
+}
 
-			for year in 1..=9 {
-				let block_inflation_year_before = Inflation::block_inflation();
-				Inflation::on_initialize(YEAR * year);
-				let block_inflation_year_after = Inflation::block_inflation();
+#[test]
+fn inflation_in_1_to_9_years() {
+	new_test_ext().execute_with(|| {
+		// Total issuance = 1_000_000_000
+		let initial_issuance: u64 = 1_000_000_000;
+		let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
+		assert_eq!(Balances::free_balance(1234), initial_issuance);
+		Inflation::on_initialize(1);
 
-				// Assert that next year inflation is less than previous year inflation
-				assert!(block_inflation_year_before > block_inflation_year_after);
-			}
+		for year in 1..=9 {
+			let block_inflation_year_before = Inflation::block_inflation();
+			Inflation::on_initialize(YEAR * year);
+			let block_inflation_year_after = Inflation::block_inflation();
 
-		});
-	}
+			// Assert that next year inflation is less than previous year inflation
+			assert!(block_inflation_year_before > block_inflation_year_after);
+		}
+	});
+}
 
-	#[test]
-	fn inflation_after_year_10_is_flat() {
-		new_test_ext().execute_with(|| {
-			// Total issuance = 1_000_000_000
-			let initial_issuance: u64 = 1_000_000_000;
-			let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
-			assert_eq!(Balances::free_balance(1234), initial_issuance);
-			Inflation::on_initialize(YEAR * 9);
+#[test]
+fn inflation_after_year_10_is_flat() {
+	new_test_ext().execute_with(|| {
+		// Total issuance = 1_000_000_000
+		let initial_issuance: u64 = 1_000_000_000;
+		let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
+		assert_eq!(Balances::free_balance(1234), initial_issuance);
+		Inflation::on_initialize(YEAR * 9);
 
-			for year in 10..=20 {
-				let block_inflation_year_before = Inflation::block_inflation();
-				Inflation::on_initialize(YEAR * year);
-				let block_inflation_year_after = Inflation::block_inflation();
+		for year in 10..=20 {
+			let block_inflation_year_before = Inflation::block_inflation();
+			Inflation::on_initialize(YEAR * year);
+			let block_inflation_year_after = Inflation::block_inflation();
 
-				// Assert that next year inflation is equal to previous year inflation
-				assert_eq!(block_inflation_year_before, block_inflation_year_after);
-			}
-		});
-	}
+			// Assert that next year inflation is equal to previous year inflation
+			assert_eq!(block_inflation_year_before, block_inflation_year_after);
+		}
+	});
+}
 
-	#[test]
-	fn inflation_rate_by_year() {
-		new_test_ext().execute_with(|| {
-			let payouts: u64 = YEAR / InflationBlockInterval::get() as u64;
+#[test]
+fn inflation_rate_by_year() {
+	new_test_ext().execute_with(|| {
+		let payouts: u64 = YEAR / InflationBlockInterval::get() as u64;
 
-			// Inflation starts at 10% and does down by 2/3% every year until year 9 (included), 
-			// then it is flat.
-			let payout_by_year: [u64; 11] = [
-				1000,
-				933,
-				867,
-				800,
-				733,
-				667,
-				600,
-				533,
-				467,
-				400,
-				400
-			];
+		// Inflation starts at 10% and does down by 2/3% every year until year 9 (included),
+		// then it is flat.
+		let payout_by_year: [u64; 11] = [1000, 933, 867, 800, 733, 667, 600, 533, 467, 400, 400];
 
-			// For accuracy total issuance = payout0 * payouts * 10;
-			let initial_issuance: u64 = payout_by_year[0] * payouts * 10;
-			let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
-			assert_eq!(Balances::free_balance(1234), initial_issuance);
+		// For accuracy total issuance = payout0 * payouts * 10;
+		let initial_issuance: u64 = payout_by_year[0] * payouts * 10;
+		let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
+		assert_eq!(Balances::free_balance(1234), initial_issuance);
 
-			for year in 0..=10 {
-				// Year first block
-				Inflation::on_initialize(year*YEAR);
-				let mut actual_payout = Inflation::block_inflation();
-				assert_eq!(actual_payout, payout_by_year[year as usize]);
+		for year in 0..=10 {
+			// Year first block
+			Inflation::on_initialize(year * YEAR);
+			let mut actual_payout = Inflation::block_inflation();
+			assert_eq!(actual_payout, payout_by_year[year as usize]);
 
-				// Year second block
-				Inflation::on_initialize(year*YEAR+1);
-				actual_payout = Inflation::block_inflation();
-				assert_eq!(actual_payout, payout_by_year[year as usize]);
+			// Year second block
+			Inflation::on_initialize(year * YEAR + 1);
+			actual_payout = Inflation::block_inflation();
+			assert_eq!(actual_payout, payout_by_year[year as usize]);
 
-				// Year middle block
-				Inflation::on_initialize(year*YEAR + YEAR/2);
-				actual_payout = Inflation::block_inflation();
-				assert_eq!(actual_payout, payout_by_year[year as usize]);
+			// Year middle block
+			Inflation::on_initialize(year * YEAR + YEAR / 2);
+			actual_payout = Inflation::block_inflation();
+			assert_eq!(actual_payout, payout_by_year[year as usize]);
 
-				// Year last block
-				Inflation::on_initialize((year + 1)*YEAR-1);
-				actual_payout = Inflation::block_inflation();
-				assert_eq!(actual_payout, payout_by_year[year as usize]);
-			}
-		});
-	}
+			// Year last block
+			Inflation::on_initialize((year + 1) * YEAR - 1);
+			actual_payout = Inflation::block_inflation();
+			assert_eq!(actual_payout, payout_by_year[year as usize]);
+		}
+	});
 }
modifiedpallets/nft-charge-transaction/Cargo.tomldiffbeforeafterboth
--- a/pallets/nft-charge-transaction/Cargo.toml
+++ b/pallets/nft-charge-transaction/Cargo.toml
@@ -20,15 +20,15 @@
 
 [dependencies]
 serde = { version = "1.0.119", default-features = false }
-frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-pallet-balances = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-pallet-transaction-payment = { default-features = false, version = "3.0.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-frame-benchmarking = { default-features = false, version = "3.0.0", optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-core = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-io = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
+frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+pallet-balances = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+pallet-transaction-payment = { default-features = false, version = "3.0.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+frame-benchmarking = { default-features = false, version = "3.0.0", optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-core = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-io = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
 
 pallet-nft-transaction-payment = { default-features = false, path="../nft-transaction-payment" }
 
modifiedpallets/nft-charge-transaction/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft-charge-transaction/src/lib.rs
+++ b/pallets/nft-charge-transaction/src/lib.rs
@@ -11,47 +11,38 @@
 #[cfg(feature = "std")]
 pub use serde::*;
 
-#[cfg(feature = "runtime-benchmarks")]
-mod benchmarking;
-
 use codec::{Decode, Encode};
 use frame_support::traits::Get;
 use frame_support::{
 	decl_module, decl_storage,
-	weights::{
-		DispatchInfo, PostDispatchInfo, DispatchClass
-	}
+	weights::{DispatchInfo, PostDispatchInfo, DispatchClass},
 };
 use sp_runtime::{
-	traits::{ 
-		DispatchInfoOf, Dispatchable, PostDispatchInfoOf, Saturating, SaturatedConversion, SignedExtension, Zero,
+	traits::{
+		DispatchInfoOf, Dispatchable, PostDispatchInfoOf, Saturating, SaturatedConversion,
+		SignedExtension, Zero,
 	},
-	transaction_validity::{ 
+	transaction_validity::{
 		TransactionPriority, TransactionValidity, TransactionValidityError, ValidTransaction,
 	},
-	FixedPointOperand, DispatchResult
+	FixedPointOperand, DispatchResult,
 };
 use pallet_transaction_payment::OnChargeTransaction;
 use sp_std::prelude::*;
 
-
-pub trait Config: frame_system::Config + 
-    pallet_nft_transaction_payment::Config
-{
-
-}
+pub trait Config: frame_system::Config + pallet_nft_transaction_payment::Config {}
 
 decl_storage! {
-    trait Store for Module<T: Config> as NftTransactionPayment
-    {}
+	trait Store for Module<T: Config> as NftTransactionPayment
+	{}
 }
 
 decl_module! {
 
-	pub struct Module<T: Config> for enum Call 
-    where 
+	pub struct Module<T: Config> for enum Call
+	where
 		origin: T::Origin,
-    {}
+	{}
 }
 
 type BalanceOf<T> = <<T as pallet_transaction_payment::Config>::OnChargeTransaction as pallet_transaction_payment::OnChargeTransaction<T>>::Balance;
@@ -61,9 +52,7 @@
 #[derive(Encode, Decode, Clone, Eq, PartialEq)]
 pub struct ChargeTransactionPayment<T: Config>(#[codec(compact)] BalanceOf<T>);
 
-impl<T: Config + Send + Sync> sp_std::fmt::Debug 
-    for ChargeTransactionPayment<T>
-{
+impl<T: Config + Send + Sync> sp_std::fmt::Debug for ChargeTransactionPayment<T> {
 	#[cfg(feature = "std")]
 	fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
 		write!(f, "ChargeTransactionPayment<{:?}>", self.0)
@@ -76,32 +65,37 @@
 
 impl<T: Config> ChargeTransactionPayment<T>
 where
-	T::Call: Dispatchable<Info=DispatchInfo, PostInfo=PostDispatchInfo>,
-    BalanceOf<T>: Send + Sync + From<u64> + FixedPointOperand,
+	T::Call: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
+	BalanceOf<T>: Send + Sync + From<u64> + FixedPointOperand,
 {
-    fn traditional_fee(
-        len: usize,
-        info: &DispatchInfoOf<T::Call>,
-        tip: BalanceOf<T>,
-    ) -> BalanceOf<T>
-    where
-        T::Call: Dispatchable<Info = DispatchInfo>,
-    {
-        <pallet_transaction_payment::Module<T>>::compute_fee(len as u32, info, tip)
-    }
+	fn traditional_fee(
+		len: usize,
+		info: &DispatchInfoOf<T::Call>,
+		tip: BalanceOf<T>,
+	) -> BalanceOf<T>
+	where
+		T::Call: Dispatchable<Info = DispatchInfo>,
+	{
+		<pallet_transaction_payment::Module<T>>::compute_fee(len as u32, info, tip)
+	}
 
-	fn get_priority(len: usize, info: &DispatchInfoOf<T::Call>, final_fee: BalanceOf<T>) -> TransactionPriority {
-        let weight_saturation = T::BlockWeights::get().max_block / info.weight.max(1);
-        let max_block_length = *T::BlockLength::get().max.get(DispatchClass::Normal);
-        let len_saturation = max_block_length as u64 / (len as u64).max(1);
-        let coefficient: BalanceOf<T> = weight_saturation
-            .min(len_saturation)
-            .saturated_into::<BalanceOf<T>>();
-        final_fee
-            .saturating_mul(coefficient)
-            .saturated_into::<TransactionPriority>()
-    }
+	fn get_priority(
+		len: usize,
+		info: &DispatchInfoOf<T::Call>,
+		final_fee: BalanceOf<T>,
+	) -> TransactionPriority {
+		let weight_saturation = T::BlockWeights::get().max_block / info.weight.max(1);
+		let max_block_length = *T::BlockLength::get().max.get(DispatchClass::Normal);
+		let len_saturation = max_block_length as u64 / (len as u64).max(1);
+		let coefficient: BalanceOf<T> = weight_saturation
+			.min(len_saturation)
+			.saturated_into::<BalanceOf<T>>();
+		final_fee
+			.saturating_mul(coefficient)
+			.saturated_into::<TransactionPriority>()
+	}
 
+	#[allow(clippy::type_complexity)]
     fn withdraw_fee(
         &self,
         who: &T::AccountId,
@@ -114,39 +108,38 @@
 			<<T as pallet_transaction_payment::Config>::OnChargeTransaction as pallet_transaction_payment::OnChargeTransaction<T>>::LiquidityInfo,
 		),
 		TransactionValidityError,
-	> {
-        let tip = self.0;
+	>{
+		let tip = self.0;
 
-        let fee = Self::traditional_fee(len, info, tip);
+		let fee = Self::traditional_fee(len, info, tip);
 
-        // Only mess with balances if fee is not zero.
-        if fee.is_zero() {
-            return <<T as pallet_transaction_payment::Config>::OnChargeTransaction as pallet_transaction_payment::OnChargeTransaction<T>>::withdraw_fee(who, call, info, fee, tip)
+		// Only mess with balances if fee is not zero.
+		if fee.is_zero() {
+			return <<T as pallet_transaction_payment::Config>::OnChargeTransaction as pallet_transaction_payment::OnChargeTransaction<T>>::withdraw_fee(who, call, info, fee, tip)
 			.map(|i| (fee, i));
-        }
+		}
 
-        // Determine who is paying transaction fee based on ecnomic model
-		// Parse call to extract collection ID and access collection sponsor	
+		// Determine who is paying transaction fee based on ecnomic model
+		// Parse call to extract collection ID and access collection sponsor
 		let sponsor = <pallet_nft_transaction_payment::Module<T>>::withdraw_type(who, call);
 
-        let who_pays_fee = sponsor.unwrap_or_else(|| who.clone());
+		let who_pays_fee = sponsor.unwrap_or_else(|| who.clone());
 
 		<<T as pallet_transaction_payment::Config>::OnChargeTransaction as pallet_transaction_payment::OnChargeTransaction<T>>::withdraw_fee(&who_pays_fee, call, info, fee, tip)
 			.map(|i| (fee, i))
-    }
+	}
 }
 
-impl<T: Config + Send + Sync> SignedExtension
-    for ChargeTransactionPayment<T>
+impl<T: Config + Send + Sync> SignedExtension for ChargeTransactionPayment<T>
 where
-    BalanceOf<T>: Send + Sync + From<u64> + FixedPointOperand,
-	T::Call: Dispatchable<Info=DispatchInfo, PostInfo=PostDispatchInfo>,
+	BalanceOf<T>: Send + Sync + From<u64> + FixedPointOperand,
+	T::Call: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
 {
-    const IDENTIFIER: &'static str = "ChargeTransactionPayment";
-    type AccountId = T::AccountId;
-    type Call = T::Call;
-    type AdditionalSigned = ();
-    type Pre = (
+	const IDENTIFIER: &'static str = "ChargeTransactionPayment";
+	type AccountId = T::AccountId;
+	type Call = T::Call;
+	type AdditionalSigned = ();
+	type Pre = (
         // tip
         BalanceOf<T>,
         // who pays fee
@@ -154,50 +147,49 @@
 		// imbalance resulting from withdrawing the fee
 		<<T as pallet_transaction_payment::Config>::OnChargeTransaction as pallet_transaction_payment::OnChargeTransaction<T>>::LiquidityInfo,
     );
-    fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> {
-        Ok(())
-    }
+	fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> {
+		Ok(())
+	}
 
-    fn validate(
-        &self,
-        who: &Self::AccountId,
-        call: &Self::Call,
-        info: &DispatchInfoOf<Self::Call>,
-        len: usize,
-    ) -> TransactionValidity {
+	fn validate(
+		&self,
+		who: &Self::AccountId,
+		call: &Self::Call,
+		info: &DispatchInfoOf<Self::Call>,
+		len: usize,
+	) -> TransactionValidity {
 		let (fee, _) = self.withdraw_fee(who, call, info, len)?;
 		Ok(ValidTransaction {
 			priority: Self::get_priority(len, info, fee),
 			..Default::default()
 		})
-    }
+	}
 
-    fn pre_dispatch(
-        self,
-        who: &Self::AccountId,
-        call: &Self::Call,
-        info: &DispatchInfoOf<Self::Call>,
-        len: usize,
-    ) -> Result<Self::Pre, TransactionValidityError> {
-        let (_fee, imbalance) = self.withdraw_fee(who, call, info, len)?;
-        Ok((self.0, who.clone(), imbalance))
-    }
+	fn pre_dispatch(
+		self,
+		who: &Self::AccountId,
+		call: &Self::Call,
+		info: &DispatchInfoOf<Self::Call>,
+		len: usize,
+	) -> Result<Self::Pre, TransactionValidityError> {
+		let (_fee, imbalance) = self.withdraw_fee(who, call, info, len)?;
+		Ok((self.0, who.clone(), imbalance))
+	}
 
-    fn post_dispatch(
-        pre: Self::Pre,
-        info: &DispatchInfoOf<Self::Call>,
-        post_info: &PostDispatchInfoOf<Self::Call>,
-        len: usize,
-        _result: &DispatchResult,
-    ) -> Result<(), TransactionValidityError> {
+	fn post_dispatch(
+		pre: Self::Pre,
+		info: &DispatchInfoOf<Self::Call>,
+		post_info: &PostDispatchInfoOf<Self::Call>,
+		len: usize,
+		_result: &DispatchResult,
+	) -> Result<(), TransactionValidityError> {
 		let (tip, who, imbalance) = pre;
 		let actual_fee = pallet_transaction_payment::Pallet::<T>::compute_actual_fee(
-			len as u32,
-			info,
-			post_info,
-			tip,
+			len as u32, info, post_info, tip,
 		);
-		<T as pallet_transaction_payment::Config>::OnChargeTransaction::correct_and_deposit_fee(&who, info, post_info, actual_fee, tip, imbalance)?;
+		<T as pallet_transaction_payment::Config>::OnChargeTransaction::correct_and_deposit_fee(
+			&who, info, post_info, actual_fee, tip, imbalance,
+		)?;
 		Ok(())
-    }
-}
\ No newline at end of file
+	}
+}
modifiedpallets/nft-transaction-payment/Cargo.tomldiffbeforeafterboth
--- a/pallets/nft-transaction-payment/Cargo.toml
+++ b/pallets/nft-transaction-payment/Cargo.toml
@@ -20,14 +20,14 @@
 
 [dependencies]
 serde = { version = "1.0.119", default-features = false }
-frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-pallet-transaction-payment = { default-features = false, version = "3.0.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-frame-benchmarking = { default-features = false, version = "3.0.0", optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-core = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-io = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
+frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+pallet-transaction-payment = { default-features = false, version = "3.0.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+frame-benchmarking = { default-features = false, version = "3.0.0", optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-core = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-io = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
 
 up-sponsorship = { default-features = false, path = "../../primitives/sponsorship", version = "0.1.0" }
 
modifiedpallets/nft-transaction-payment/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/nft-transaction-payment/src/benchmarking.rs
+++ b/pallets/nft-transaction-payment/src/benchmarking.rs
@@ -4,15 +4,15 @@
 
 use sp_std::prelude::*;
 use frame_system::RawOrigin;
-use frame_benchmarking::{benchmarks}; 
+use frame_benchmarking::{benchmarks};
 use frame_support::traits::OnInitialize;
 
 benchmarks! {
 
 	// on_initialize {
-        // let block1: T::BlockNumber = T::BlockNumber::from(1u32);
-        // let block2: T::BlockNumber = T::BlockNumber::from(2u32);
-        // Inflation::<T>::on_initialize(block1); // Create Treasury account
+		// let block1: T::BlockNumber = T::BlockNumber::from(1u32);
+		// let block2: T::BlockNumber = T::BlockNumber::from(2u32);
+		// Inflation::<T>::on_initialize(block1); // Create Treasury account
 	// }: { Inflation::<T>::on_initialize(block2); } // Benchmark deposit_into_existing path
 
 }
modifiedpallets/nft-transaction-payment/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft-transaction-payment/src/lib.rs
+++ b/pallets/nft-transaction-payment/src/lib.rs
@@ -28,18 +28,15 @@
 }
 
 decl_module! {
-	pub struct Module<T: Config> for enum Call 
-    where 
+	pub struct Module<T: Config> for enum Call
+	where
 		origin: T::Origin,
-    {
+	{
 	}
 }
 
 impl<T: Config> Module<T> {
-	pub fn withdraw_type(
-		who: &T::AccountId,
-		call: &T::Call
-	) -> Option<T::AccountId> {
+	pub fn withdraw_type(who: &T::AccountId, call: &T::Call) -> Option<T::AccountId> {
 		T::SponsorshipHandler::get_sponsor(who, call)
 	}
-}
\ No newline at end of file
+}
modifiedpallets/nft/Cargo.tomldiffbeforeafterboth
--- a/pallets/nft/Cargo.toml
+++ b/pallets/nft/Cargo.toml
@@ -56,55 +56,55 @@
 default-features = false
 optional = true
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.frame-support]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.frame-system]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-balances]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-timestamp]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-randomness-collective-flip]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-std]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-contracts]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-transaction-payment]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.serde]
@@ -115,19 +115,19 @@
 [dependencies.sp-runtime]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-core]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-io]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 
@@ -149,12 +149,12 @@
 ethereum-tx-sign = { version = "3.0.4", optional = true }
 ethereum = { default-features = false, version = "0.7.1" }
 rlp = { default-features = false, version = "0.5.0" }
-sp-api = { default-features = false, version = '3.0.0', git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.3" }
+sp-api = { default-features = false, version = '3.0.0', git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.7" }
 
 evm-coder = { default-features = false, path = "../../crates/evm-coder" }
 primitive-types = { version = "0.9.0", default-features = false, features = ["serde_no_std"] }
 
-pallet-evm = { default-features = false, version = "4.0.0-dev", git = "https://github.com/usetech-llc/frontier.git", branch = "injected-transactions-parachain" }
-pallet-ethereum = { default-features = false, version = "2.0.0-dev", git = "https://github.com/usetech-llc/frontier.git", branch = "injected-transactions-parachain" }
+pallet-evm = { default-features = false, version = "5.0.0-dev", git = "https://github.com/usetech-llc/frontier.git", branch = "injected-transactions-parachain" }
+pallet-ethereum = { default-features = false, version = "3.0.0-dev", git = "https://github.com/usetech-llc/frontier.git", branch = "injected-transactions-parachain" }
 fp-evm = { default-features = false, version = '2.0.0', git = "https://github.com/usetech-llc/frontier.git", branch = "injected-transactions-parachain" }
 hex-literal = "0.3.1"
\ No newline at end of file
modifiedpallets/nft/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/nft/src/benchmarking.rs
+++ b/pallets/nft/src/benchmarking.rs
@@ -5,415 +5,415 @@
 
 use sp_std::prelude::*;
 use frame_system::RawOrigin;
-use frame_benchmarking::{benchmarks, account, whitelisted_caller};  // , TrackedStorageKey, 
+use frame_benchmarking::{benchmarks, account, whitelisted_caller}; // , TrackedStorageKey,
 
 const SEED: u32 = 1;
 /*
 fn default_nft_data() -> CreateItemData {
-    CreateItemData::NFT(CreateNftData { const_data: vec![1, 2, 3], variable_data: vec![3, 2, 1] })
+	CreateItemData::NFT(CreateNftData { const_data: vec![1, 2, 3], variable_data: vec![3, 2, 1] })
 }
 
 fn default_fungible_data () -> CreateItemData {
-    CreateItemData::Fungible(CreateFungibleData { })
+	CreateItemData::Fungible(CreateFungibleData { })
 }
 
 fn default_re_fungible_data () -> CreateItemData {
-    CreateItemData::ReFungible(CreateReFungibleData { const_data: vec![1, 2, 3], variable_data: vec![3, 2, 1] })
+	CreateItemData::ReFungible(CreateReFungibleData { const_data: vec![1, 2, 3], variable_data: vec![3, 2, 1] })
 }
 */
 
 benchmarks! {
 
-    create_collection {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = account("caller", 0, SEED);
-    }: _(RawOrigin::Signed(caller.clone()), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode)
+	create_collection {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = account("caller", 0, SEED);
+	}: _(RawOrigin::Signed(caller.clone()), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode)
 /*
-    verify {
-        assert_eq!(Nft::<T>::collection_id(2).owner, caller);
-    }
-    destroy_collection {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-    }: _(RawOrigin::Signed(caller.clone()), 2)
+	verify {
+		assert_eq!(Nft::<T>::collection_id(2).owner, caller);
+	}
+	destroy_collection {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+	}: _(RawOrigin::Signed(caller.clone()), 2)
 
-    add_to_white_list {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        let whitelist_account: T::AccountId = account("admin", 0, SEED);
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-    }: add_to_white_list(RawOrigin::Signed(caller.clone()), 2, whitelist_account)
+	add_to_white_list {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		let whitelist_account: T::AccountId = account("admin", 0, SEED);
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+	}: add_to_white_list(RawOrigin::Signed(caller.clone()), 2, whitelist_account)
 
-    remove_from_white_list {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        let whitelist_account: T::AccountId = account("admin", 0, SEED);
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        Nft::<T>::add_to_white_list(RawOrigin::Signed(caller.clone()).into(), 2, whitelist_account.clone())?;
-    }: remove_from_white_list(RawOrigin::Signed(caller.clone()), 2, whitelist_account)
+	remove_from_white_list {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		let whitelist_account: T::AccountId = account("admin", 0, SEED);
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		Nft::<T>::add_to_white_list(RawOrigin::Signed(caller.clone()).into(), 2, whitelist_account.clone())?;
+	}: remove_from_white_list(RawOrigin::Signed(caller.clone()), 2, whitelist_account)
 
-    set_public_access_mode {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-    }: set_public_access_mode(RawOrigin::Signed(caller.clone()), 2, AccessMode::WhiteList)
+	set_public_access_mode {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+	}: set_public_access_mode(RawOrigin::Signed(caller.clone()), 2, AccessMode::WhiteList)
 
-    set_mint_permission {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-    }: set_mint_permission(RawOrigin::Signed(caller.clone()), 2, true)
+	set_mint_permission {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+	}: set_mint_permission(RawOrigin::Signed(caller.clone()), 2, true)
 
-    change_collection_owner {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        let new_owner: T::AccountId = account("admin", 0, SEED);
-    }: change_collection_owner(RawOrigin::Signed(caller.clone()), 2, new_owner)
+	change_collection_owner {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		let new_owner: T::AccountId = account("admin", 0, SEED);
+	}: change_collection_owner(RawOrigin::Signed(caller.clone()), 2, new_owner)
 
-    add_collection_admin {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        let new_admin: T::AccountId = account("admin", 0, SEED);
-    }: add_collection_admin(RawOrigin::Signed(caller.clone()), 2, new_admin)
+	add_collection_admin {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		let new_admin: T::AccountId = account("admin", 0, SEED);
+	}: add_collection_admin(RawOrigin::Signed(caller.clone()), 2, new_admin)
 
-    remove_collection_admin {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        let new_admin: T::AccountId = account("admin", 0, SEED);
-        Nft::<T>::add_collection_admin(RawOrigin::Signed(caller.clone()).into(), 2, new_admin.clone())?;
-    }: remove_collection_admin(RawOrigin::Signed(caller.clone()), 2, new_admin)
+	remove_collection_admin {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		let new_admin: T::AccountId = account("admin", 0, SEED);
+		Nft::<T>::add_collection_admin(RawOrigin::Signed(caller.clone()).into(), 2, new_admin.clone())?;
+	}: remove_collection_admin(RawOrigin::Signed(caller.clone()), 2, new_admin)
 
-    set_collection_sponsor {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-    }: set_collection_sponsor(RawOrigin::Signed(caller.clone()), 2, caller.clone())
+	set_collection_sponsor {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+	}: set_collection_sponsor(RawOrigin::Signed(caller.clone()), 2, caller.clone())
 
-    confirm_sponsorship {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        Nft::<T>::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone())?;
-    }: confirm_sponsorship(RawOrigin::Signed(caller.clone()), 2)
+	confirm_sponsorship {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		Nft::<T>::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone())?;
+	}: confirm_sponsorship(RawOrigin::Signed(caller.clone()), 2)
 
-    remove_collection_sponsor {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        Nft::<T>::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone())?;
-        Nft::<T>::confirm_sponsorship(RawOrigin::Signed(caller.clone()).into(), 2)?;
-    }: remove_collection_sponsor(RawOrigin::Signed(caller.clone()), 2)
+	remove_collection_sponsor {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		Nft::<T>::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone())?;
+		Nft::<T>::confirm_sponsorship(RawOrigin::Signed(caller.clone()).into(), 2)?;
+	}: remove_collection_sponsor(RawOrigin::Signed(caller.clone()), 2)
 
-    // nft item
-    create_item_nft {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        let data = default_nft_data();
-        
-    }: create_item(RawOrigin::Signed(caller.clone()), 2, caller.clone(), data)
+	// nft item
+	create_item_nft {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		let data = default_nft_data();
 
-    #[extra]
-    create_item_nft_large {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        let mut nft_data = CreateNftData {
-            const_data: vec![],
-            variable_data: vec![]
-        };
-        for i in 0..1998 {
-            nft_data.const_data.push(10);
-            nft_data.variable_data.push(10);
-        }
-        let data = CreateItemData::NFT(nft_data);
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+	}: create_item(RawOrigin::Signed(caller.clone()), 2, caller.clone(), data)
+
+	#[extra]
+	create_item_nft_large {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		let mut nft_data = CreateNftData {
+			const_data: vec![],
+			variable_data: vec![]
+		};
+		for i in 0..1998 {
+			nft_data.const_data.push(10);
+			nft_data.variable_data.push(10);
+		}
+		let data = CreateItemData::NFT(nft_data);
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+
+	}: create_item(RawOrigin::Signed(caller.clone()), 2, caller.clone(), data)
 
-    }: create_item(RawOrigin::Signed(caller.clone()), 2, caller.clone(), data)
+	// fungible item
+	create_item_fungible {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::Fungible(3);
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		let data = default_fungible_data();
+
+	}: create_item(RawOrigin::Signed(caller.clone()), 2, caller.clone(), data)
+
+	// refungible item
+	create_item_refungible {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::ReFungible(3);
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		let data = default_re_fungible_data();
 
-    // fungible item
-    create_item_fungible {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::Fungible(3);
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        let data = default_fungible_data();
+	}: create_item(RawOrigin::Signed(caller.clone()), 2, caller.clone(), data)
 
-    }: create_item(RawOrigin::Signed(caller.clone()), 2, caller.clone(), data)
+	burn_item {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		let data = default_nft_data();
+		Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
 
-    // refungible item
-    create_item_refungible {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::ReFungible(3);
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        let data = default_re_fungible_data();
+	}: burn_item(RawOrigin::Signed(caller.clone()), 2, 1)
 
-    }: create_item(RawOrigin::Signed(caller.clone()), 2, caller.clone(), data)
+	transfer_nft {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let recipient: T::AccountId = account("recipient", 0, SEED);
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		let data = default_nft_data();
+		Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
 
-    burn_item {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        let data = default_nft_data();
-        Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
+	}: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1)
 
-    }: burn_item(RawOrigin::Signed(caller.clone()), 2, 1)
+	transfer_fungible {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::Fungible(3);
+		let recipient: T::AccountId = account("recipient", 0, SEED);
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		let data = default_fungible_data();
+		Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
 
-    transfer_nft {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let recipient: T::AccountId = account("recipient", 0, SEED);
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        let data = default_nft_data();
-        Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
+	}: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1)
 
-    }: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1)
-    
-    transfer_fungible {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::Fungible(3);
-        let recipient: T::AccountId = account("recipient", 0, SEED);
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        let data = default_fungible_data();
-        Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
+	transfer_refungible {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::ReFungible(3);
+		let recipient: T::AccountId = account("recipient", 0, SEED);
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		let data = default_re_fungible_data();
+		Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
 
-    }: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1)
+	}: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1)
 
-    transfer_refungible {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::ReFungible(3);
-        let recipient: T::AccountId = account("recipient", 0, SEED);
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        let data = default_re_fungible_data();
-        Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
+	approve {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::ReFungible(3);
+		let recipient: T::AccountId = account("recipient", 0, SEED);
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		let data = default_re_fungible_data();
+		Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
 
-    }: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1)
+	}: approve(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1)
 
-    approve {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::ReFungible(3);
-        let recipient: T::AccountId = account("recipient", 0, SEED);
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        let data = default_re_fungible_data();
-        Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
+	// Nft
+	transfer_from_nft {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let recipient: T::AccountId = account("recipient", 0, SEED);
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		let data = default_nft_data();
+		Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
+		Nft::<T>::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?;
 
-    }: approve(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1)
+	}: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1)
 
-    // Nft
-    transfer_from_nft {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let recipient: T::AccountId = account("recipient", 0, SEED);
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        let data = default_nft_data();
-        Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
-        Nft::<T>::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?;
+	// Fungible
+	transfer_from_fungible {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::Fungible(3);
+		let recipient: T::AccountId = account("recipient", 0, SEED);
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		let data = default_fungible_data();
+		Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
+		Nft::<T>::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?;
 
-    }: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1)
+	}: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1)
 
-    // Fungible
-    transfer_from_fungible {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::Fungible(3);
-        let recipient: T::AccountId = account("recipient", 0, SEED);
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        let data = default_fungible_data();
-        Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
-        Nft::<T>::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?;
+	// ReFungible
+	transfer_from_refungible {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::ReFungible(3);
+		let recipient: T::AccountId = account("recipient", 0, SEED);
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		let data = default_re_fungible_data();
+		Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
+		Nft::<T>::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?;
 
-    }: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1)
+	}: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1)
 
-    // ReFungible
-    transfer_from_refungible {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::ReFungible(3);
-        let recipient: T::AccountId = account("recipient", 0, SEED);
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        let data = default_re_fungible_data();
-        Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
-        Nft::<T>::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?;
+	enable_contract_sponsoring {
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
 
-    }: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1)
+	}: enable_contract_sponsoring(RawOrigin::Signed(caller.clone()), caller.clone(), true)
 
-    enable_contract_sponsoring {
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+	set_offchain_schema {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::ReFungible(3);
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
 
-    }: enable_contract_sponsoring(RawOrigin::Signed(caller.clone()), caller.clone(), true)
+	}: set_offchain_schema(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec())
 
-    set_offchain_schema {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::ReFungible(3);
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+	set_const_on_chain_schema {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::ReFungible(3);
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+	}: set_const_on_chain_schema(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec())
 
-    }: set_offchain_schema(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec())
+	set_variable_on_chain_schema {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::ReFungible(3);
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+	}: set_variable_on_chain_schema(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec())
 
-    set_const_on_chain_schema {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::ReFungible(3);
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-    }: set_const_on_chain_schema(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec())
-    
-    set_variable_on_chain_schema {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::ReFungible(3);
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-    }: set_variable_on_chain_schema(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec())
+	set_variable_meta_data {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		let data = default_nft_data();
+		Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
 
-    set_variable_meta_data {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        let data = default_nft_data();
-        Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
+	}: set_variable_meta_data(RawOrigin::Signed(caller.clone()), 2, 1, [1, 2, 3].to_vec())
 
-    }: set_variable_meta_data(RawOrigin::Signed(caller.clone()), 2, 1, [1, 2, 3].to_vec())
+	set_schema_version {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+	}: set_schema_version(RawOrigin::Signed(caller.clone()), 2, SchemaVersion::Unique)
 
-    set_schema_version {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-    }: set_schema_version(RawOrigin::Signed(caller.clone()), 2, SchemaVersion::Unique)
+	set_chain_limits {
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		let limits = ChainLimits {
+			collection_numbers_limit: 0,
+			account_token_ownership_limit: 0,
+			collections_admins_limit: 0,
+			custom_data_limit: 0,
+			nft_sponsor_transfer_timeout: 0,
+			fungible_sponsor_transfer_timeout: 0,
+			refungible_sponsor_transfer_timeout: 0
+		};
+	}: set_chain_limits(RawOrigin::Signed(caller.clone()), limits)
 
-    set_chain_limits {
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        let limits = ChainLimits { 
-            collection_numbers_limit: 0,
-            account_token_ownership_limit: 0,
-            collections_admins_limit: 0,
-            custom_data_limit: 0,
-            nft_sponsor_transfer_timeout: 0,
-            fungible_sponsor_transfer_timeout: 0,
-            refungible_sponsor_transfer_timeout: 0
-        };
-    }: set_chain_limits(RawOrigin::Signed(caller.clone()), limits)
+	set_contract_sponsoring_rate_limit {
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+		let block_number: T::BlockNumber = 0.into();
+	}: set_contract_sponsoring_rate_limit(RawOrigin::Signed(caller.clone()), caller.clone(), block_number)
 
-    set_contract_sponsoring_rate_limit {
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-        let block_number: T::BlockNumber = 0.into();   
-    }: set_contract_sponsoring_rate_limit(RawOrigin::Signed(caller.clone()), caller.clone(), block_number)
+	set_collection_limits{
+		let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+		let mode: CollectionMode = CollectionMode::NFT;
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
 
-    set_collection_limits{
-        let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-        let mode: CollectionMode = CollectionMode::NFT;
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
-    
-        let cl = CollectionLimits {
-            account_token_ownership_limit: 0,
-            sponsored_data_size: 0,
-            token_limit: 0,
-            sponsor_transfer_timeout: 0
-        };
+		let cl = CollectionLimits {
+			account_token_ownership_limit: 0,
+			sponsored_data_size: 0,
+			token_limit: 0,
+			sponsor_transfer_timeout: 0
+		};
 
-    }: set_collection_limits(RawOrigin::Signed(caller.clone()), 2, cl)
+	}: set_collection_limits(RawOrigin::Signed(caller.clone()), 2, cl)
 
-    add_to_contract_white_list{
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-    }: add_to_contract_white_list(RawOrigin::Signed(caller.clone()), caller.clone(), caller.clone())
+	add_to_contract_white_list{
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+	}: add_to_contract_white_list(RawOrigin::Signed(caller.clone()), caller.clone(), caller.clone())
 
-    remove_from_contract_white_list{
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-        Nft::<T>::add_to_contract_white_list(RawOrigin::Signed(caller.clone()).into(), caller.clone(), caller.clone())?;
-    }: remove_from_contract_white_list(RawOrigin::Signed(caller.clone()), caller.clone(), caller.clone())
+	remove_from_contract_white_list{
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+		Nft::<T>::add_to_contract_white_list(RawOrigin::Signed(caller.clone()).into(), caller.clone(), caller.clone())?;
+	}: remove_from_contract_white_list(RawOrigin::Signed(caller.clone()), caller.clone(), caller.clone())
 
-    toggle_contract_white_list{
-        let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
-    }: toggle_contract_white_list(RawOrigin::Signed(caller.clone()), caller.clone(), true)
+	toggle_contract_white_list{
+		let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+	}: toggle_contract_white_list(RawOrigin::Signed(caller.clone()), caller.clone(), true)
 */
 }
modifiedpallets/nft/src/default_weights.rsdiffbeforeafterboth
--- a/pallets/nft/src/default_weights.rs
+++ b/pallets/nft/src/default_weights.rs
@@ -2,154 +2,154 @@
 
 impl crate::WeightInfo for () {
 	fn create_collection() -> Weight {
-		(70_000_000 as Weight)
-			.saturating_add(DbWeight::get().reads(7 as Weight))
-			.saturating_add(DbWeight::get().writes(5 as Weight))
+		70_000_000_u64
+			.saturating_add(DbWeight::get().reads(7_u64))
+			.saturating_add(DbWeight::get().writes(5_u64))
 	}
 	fn destroy_collection() -> Weight {
-		(90_000_000 as Weight)
-			.saturating_add(DbWeight::get().reads(2 as Weight))
-			.saturating_add(DbWeight::get().writes(5 as Weight))
+		90_000_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(5_u64))
 	}
 	fn add_to_white_list() -> Weight {
-		(30_000_000 as Weight)
-			.saturating_add(DbWeight::get().reads(3 as Weight))
-			.saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn remove_from_white_list() -> Weight {
-		(35_000_000 as Weight)
-			.saturating_add(DbWeight::get().reads(3 as Weight))
-			.saturating_add(DbWeight::get().writes(1 as Weight))
+		30_000_000_u64
+			.saturating_add(DbWeight::get().reads(3_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn remove_from_white_list() -> Weight {
+		35_000_000_u64
+			.saturating_add(DbWeight::get().reads(3_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
 	}
 	fn set_public_access_mode() -> Weight {
-		(27_000_000 as Weight)
-			.saturating_add(DbWeight::get().reads(1 as Weight))
-			.saturating_add(DbWeight::get().writes(1 as Weight))
+		27_000_000_u64
+			.saturating_add(DbWeight::get().reads(1_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
 	}
 	fn set_mint_permission() -> Weight {
-		(27_000_000 as Weight)
-			.saturating_add(DbWeight::get().reads(1 as Weight))
-			.saturating_add(DbWeight::get().writes(1 as Weight))
+		27_000_000_u64
+			.saturating_add(DbWeight::get().reads(1_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
 	}
 	fn change_collection_owner() -> Weight {
-		(27_000_000 as Weight)
-			.saturating_add(DbWeight::get().reads(1 as Weight))
-			.saturating_add(DbWeight::get().writes(1 as Weight))
+		27_000_000_u64
+			.saturating_add(DbWeight::get().reads(1_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
 	}
 	fn add_collection_admin() -> Weight {
-        (32_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(3 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
+		32_000_000_u64
+			.saturating_add(DbWeight::get().reads(3_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
 	}
 	fn remove_collection_admin() -> Weight {
-		(50_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(2 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn set_collection_sponsor() -> Weight {
-		(32_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(2 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }  
-    fn confirm_sponsorship() -> Weight {
-		(22_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(1 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }  
-    fn remove_collection_sponsor() -> Weight {
-		(24_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(1 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }  
-    fn create_item(s: usize, ) -> Weight {
-        (130_000_000 as Weight)
-            .saturating_add((2135 as Weight).saturating_mul(s as Weight).saturating_mul(500 as Weight)) // 500 is temporary multiplier, fee for storage
-            .saturating_add(DbWeight::get().reads(10 as Weight))
-            .saturating_add(DbWeight::get().writes(8 as Weight))
-    }  
-    fn burn_item() -> Weight {
-		(170_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(9 as Weight))
-            .saturating_add(DbWeight::get().writes(7 as Weight))
-    }  
-    fn transfer() -> Weight {
-        (125_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(7 as Weight))
-            .saturating_add(DbWeight::get().writes(7 as Weight))
-    }  
-    fn approve() -> Weight {
-        (45_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(3 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn transfer_from() -> Weight {
-        (150_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(9 as Weight))
-            .saturating_add(DbWeight::get().writes(8 as Weight))
-    }
-    fn set_offchain_schema() -> Weight {
-        (33_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(2 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn set_const_on_chain_schema() -> Weight {
-        (11_100_000 as Weight)
-            .saturating_add(DbWeight::get().reads(2 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn set_variable_on_chain_schema() -> Weight {
-        (11_100_000 as Weight)
-            .saturating_add(DbWeight::get().reads(2 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn set_variable_meta_data() -> Weight {
-        (17_500_000 as Weight)
-            .saturating_add(DbWeight::get().reads(2 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn enable_contract_sponsoring() -> Weight {
-        (13_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(1 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn set_schema_version() -> Weight {
-        (8_500_000 as Weight)
-            .saturating_add(DbWeight::get().reads(2 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn set_chain_limits() -> Weight {
-        (1_300_000 as Weight)
-            .saturating_add(DbWeight::get().reads(0 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn set_contract_sponsoring_rate_limit() -> Weight {
-        (3_500_000 as Weight)
-            .saturating_add(DbWeight::get().reads(0 as Weight))
-            .saturating_add(DbWeight::get().writes(2 as Weight))
-    }    
-    fn set_variable_meta_data_sponsoring_rate_limit() -> Weight {
-        (3_500_000 as Weight)
-            .saturating_add(DbWeight::get().reads(2 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn toggle_contract_white_list() -> Weight {
-        (3_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(0 as Weight))
-            .saturating_add(DbWeight::get().writes(2 as Weight))
-    }    
-    fn add_to_contract_white_list() -> Weight {
-        (3_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(0 as Weight))
-            .saturating_add(DbWeight::get().writes(2 as Weight))
-    }    
-    fn remove_from_contract_white_list() -> Weight {
-        (3_200_000 as Weight)
-            .saturating_add(DbWeight::get().reads(0 as Weight))
-            .saturating_add(DbWeight::get().writes(2 as Weight))
-    }
-    fn set_collection_limits() -> Weight {
-        (8_900_000 as Weight)
-            .saturating_add(DbWeight::get().reads(2 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
+		50_000_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn set_collection_sponsor() -> Weight {
+		32_000_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn confirm_sponsorship() -> Weight {
+		22_000_000_u64
+			.saturating_add(DbWeight::get().reads(1_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn remove_collection_sponsor() -> Weight {
+		24_000_000_u64
+			.saturating_add(DbWeight::get().reads(1_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn create_item(s: usize) -> Weight {
+		130_000_000_u64
+			.saturating_add(2135_u64.saturating_mul(s as Weight).saturating_mul(500_u64)) // 500 is temporary multiplier, fee for storage
+			.saturating_add(DbWeight::get().reads(10_u64))
+			.saturating_add(DbWeight::get().writes(8_u64))
+	}
+	fn burn_item() -> Weight {
+		170_000_000_u64
+			.saturating_add(DbWeight::get().reads(9_u64))
+			.saturating_add(DbWeight::get().writes(7_u64))
+	}
+	fn transfer() -> Weight {
+		125_000_000_u64
+			.saturating_add(DbWeight::get().reads(7_u64))
+			.saturating_add(DbWeight::get().writes(7_u64))
+	}
+	fn approve() -> Weight {
+		45_000_000_u64
+			.saturating_add(DbWeight::get().reads(3_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn transfer_from() -> Weight {
+		150_000_000_u64
+			.saturating_add(DbWeight::get().reads(9_u64))
+			.saturating_add(DbWeight::get().writes(8_u64))
+	}
+	fn set_offchain_schema() -> Weight {
+		33_000_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn set_const_on_chain_schema() -> Weight {
+		11_100_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn set_variable_on_chain_schema() -> Weight {
+		11_100_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn set_variable_meta_data() -> Weight {
+		17_500_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn enable_contract_sponsoring() -> Weight {
+		13_000_000_u64
+			.saturating_add(DbWeight::get().reads(1_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn set_schema_version() -> Weight {
+		8_500_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn set_chain_limits() -> Weight {
+		1_300_000_u64
+			.saturating_add(DbWeight::get().reads(0_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn set_contract_sponsoring_rate_limit() -> Weight {
+		3_500_000_u64
+			.saturating_add(DbWeight::get().reads(0_u64))
+			.saturating_add(DbWeight::get().writes(2_u64))
+	}
+	fn set_variable_meta_data_sponsoring_rate_limit() -> Weight {
+		3_500_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn toggle_contract_white_list() -> Weight {
+		3_000_000_u64
+			.saturating_add(DbWeight::get().reads(0_u64))
+			.saturating_add(DbWeight::get().writes(2_u64))
+	}
+	fn add_to_contract_white_list() -> Weight {
+		3_000_000_u64
+			.saturating_add(DbWeight::get().reads(0_u64))
+			.saturating_add(DbWeight::get().writes(2_u64))
+	}
+	fn remove_from_contract_white_list() -> Weight {
+		3_200_000_u64
+			.saturating_add(DbWeight::get().reads(0_u64))
+			.saturating_add(DbWeight::get().writes(2_u64))
+	}
+	fn set_collection_limits() -> Weight {
+		8_900_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
 }
modifiedpallets/nft/src/eth/account.rsdiffbeforeafterboth
--- a/pallets/nft/src/eth/account.rs
+++ b/pallets/nft/src/eth/account.rs
@@ -8,128 +8,129 @@
 use sp_std::vec::Vec;
 use sp_std::clone::Clone;
 
-pub trait CrossAccountId<AccountId>: 
-    Encode + EncodeLike + Decode + 
-    Clone + PartialEq + Ord + core::fmt::Debug // + 
-    // Serialize + Deserialize<'static> 
+pub trait CrossAccountId<AccountId>:
+	Encode + EncodeLike + Decode + Clone + PartialEq + Ord + core::fmt::Debug
+// +
+// Serialize + Deserialize<'static>
 {
-    fn as_sub(&self) -> &AccountId;
-    fn as_eth(&self) -> &H160;
+	fn as_sub(&self) -> &AccountId;
+	fn as_eth(&self) -> &H160;
 
-    fn from_sub(account: AccountId) -> Self;
-    fn from_eth(account: H160) -> Self;
+	fn from_sub(account: AccountId) -> Self;
+	fn from_eth(account: H160) -> Self;
 }
 
-#[derive(Eq)]
-#[derive(Serialize, Deserialize)]
+#[derive(Eq, Serialize, Deserialize)]
 pub struct BasicCrossAccountId<T: Config> {
-    /// If true - then ethereum is canonical encoding
-    from_ethereum: bool,
-    substrate: T::AccountId,
-    ethereum: H160,
+	/// If true - then ethereum is canonical encoding
+	from_ethereum: bool,
+	substrate: T::AccountId,
+	ethereum: H160,
 }
 
 impl<T: Config> core::fmt::Debug for BasicCrossAccountId<T> {
-    fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
-        if self.from_ethereum {
-            fmt.debug_tuple("CrossAccountId::Ethereum")
-                .field(&self.ethereum)
-                .finish()
-        } else {
-            fmt.debug_tuple("CrossAccountId::Substrate")
-                .field(&self.substrate)
-                .finish()
-        }
-    }
+	fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
+		if self.from_ethereum {
+			fmt.debug_tuple("CrossAccountId::Ethereum")
+				.field(&self.ethereum)
+				.finish()
+		} else {
+			fmt.debug_tuple("CrossAccountId::Substrate")
+				.field(&self.substrate)
+				.finish()
+		}
+	}
 }
 
 impl<T: Config> PartialOrd for BasicCrossAccountId<T> {
-    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
-        Some(self.substrate.cmp(&other.substrate))
-    }
+	fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
+		Some(self.substrate.cmp(&other.substrate))
+	}
 }
 
 impl<T: Config> Ord for BasicCrossAccountId<T> {
-    fn cmp(&self, other: &Self) -> Ordering {
-        self.partial_cmp(other).expect("substrate account is total ordered")
-    }
+	fn cmp(&self, other: &Self) -> Ordering {
+		self.partial_cmp(other)
+			.expect("substrate account is total ordered")
+	}
 }
 
 impl<T: Config> PartialEq for BasicCrossAccountId<T> {
-    fn eq(&self, other: &Self) -> bool {
-        if self.from_ethereum == other.from_ethereum {
-            self.substrate == other.substrate && self.ethereum == other.ethereum
-        } else if self.from_ethereum {
-            // ethereum is canonical encoding, but we need to compare derived address
-            self.substrate == other.substrate
-        } else {
-            self.ethereum == other.ethereum
-        }
-    }
+	fn eq(&self, other: &Self) -> bool {
+		if self.from_ethereum == other.from_ethereum {
+			self.substrate == other.substrate && self.ethereum == other.ethereum
+		} else if self.from_ethereum {
+			// ethereum is canonical encoding, but we need to compare derived address
+			self.substrate == other.substrate
+		} else {
+			self.ethereum == other.ethereum
+		}
+	}
 }
 impl<T: Config> Clone for BasicCrossAccountId<T> {
-    fn clone(&self) -> Self {
-        Self {
-            from_ethereum: self.from_ethereum,
-            substrate: self.substrate.clone(),
-            ethereum: self.ethereum,
-        }
-    }
+	fn clone(&self) -> Self {
+		Self {
+			from_ethereum: self.from_ethereum,
+			substrate: self.substrate.clone(),
+			ethereum: self.ethereum,
+		}
+	}
 }
 impl<T: Config> Encode for BasicCrossAccountId<T> {
-    fn encode(&self) -> Vec<u8> {
-        let as_result = if !self.from_ethereum {
-            Ok(self.substrate.clone())
-        } else {
-            Err(self.ethereum)
-        };
-        as_result.encode()
-    }
+	fn encode(&self) -> Vec<u8> {
+		let as_result = if !self.from_ethereum {
+			Ok(self.substrate.clone())
+		} else {
+			Err(self.ethereum)
+		};
+		as_result.encode()
+	}
 }
 impl<T: Config> EncodeLike for BasicCrossAccountId<T> {}
 impl<T: Config> Decode for BasicCrossAccountId<T> {
-    fn decode<I>(input: &mut I) -> Result<Self, codec::Error>
-        where I: codec::Input
-    {
-        Ok(match <Result<T::AccountId, H160>>::decode(input)? {
-            Ok(s) => Self::from_sub(s),
-            Err(e) => Self::from_eth(e),
-        })
-    }
+	fn decode<I>(input: &mut I) -> Result<Self, codec::Error>
+	where
+		I: codec::Input,
+	{
+		Ok(match <Result<T::AccountId, H160>>::decode(input)? {
+			Ok(s) => Self::from_sub(s),
+			Err(e) => Self::from_eth(e),
+		})
+	}
 }
 impl<T: Config> CrossAccountId<T::AccountId> for BasicCrossAccountId<T> {
-    fn as_sub(&self) -> &T::AccountId {
-        &self.substrate
-    }
-    fn as_eth(&self) -> &H160 {
-        &self.ethereum
-    }
-    fn from_sub(substrate: T::AccountId) -> Self {
-        Self {
-            ethereum: T::EvmBackwardsAddressMapping::from_account_id(substrate.clone()),
-            substrate,
-            from_ethereum: false,
-        }
-    }
-    fn from_eth(ethereum: H160) -> Self {
-        Self {
-            ethereum,
-            substrate: T::EvmAddressMapping::into_account_id(ethereum),
-            from_ethereum: true,
-        }
-    }
+	fn as_sub(&self) -> &T::AccountId {
+		&self.substrate
+	}
+	fn as_eth(&self) -> &H160 {
+		&self.ethereum
+	}
+	fn from_sub(substrate: T::AccountId) -> Self {
+		Self {
+			ethereum: T::EvmBackwardsAddressMapping::from_account_id(substrate.clone()),
+			substrate,
+			from_ethereum: false,
+		}
+	}
+	fn from_eth(ethereum: H160) -> Self {
+		Self {
+			ethereum,
+			substrate: T::EvmAddressMapping::into_account_id(ethereum),
+			from_ethereum: true,
+		}
+	}
 }
 
 pub trait EvmBackwardsAddressMapping<AccountId> {
-    fn from_account_id(account_id: AccountId) -> H160;
+	fn from_account_id(account_id: AccountId) -> H160;
 }
 
 /// Should have same mapping as EnsureAddressTruncated
 pub struct MapBackwardsAddressTruncated;
 impl EvmBackwardsAddressMapping<AccountId32> for MapBackwardsAddressTruncated {
-    fn from_account_id(account_id: AccountId32) -> H160 {
-        let mut out = [0; 20];
-        out.copy_from_slice(&(account_id.as_ref() as &[u8])[0..20]);
-        H160(out)
-    }
-}
\ No newline at end of file
+	fn from_account_id(account_id: AccountId32) -> H160 {
+		let mut out = [0; 20];
+		out.copy_from_slice(&(account_id.as_ref() as &[u8])[0..20]);
+		H160(out)
+	}
+}
modifiedpallets/nft/src/eth/erc.rsdiffbeforeafterboth
--- a/pallets/nft/src/eth/erc.rs
+++ b/pallets/nft/src/eth/erc.rs
@@ -3,132 +3,199 @@
 
 #[solidity_interface]
 pub trait InlineNameSymbol {
-    type Error;
+	type Error;
 
-    fn name(&self) -> Result<string, Self::Error>;
-    fn symbol(&self) -> Result<string, Self::Error>;
+	fn name(&self) -> Result<string, Self::Error>;
+	fn symbol(&self) -> Result<string, Self::Error>;
 }
 
 #[solidity_interface]
 pub trait InlineTotalSupply {
-    type Error;
+	type Error;
 
-    fn total_supply(&self) -> Result<uint256, Self::Error>;
+	fn total_supply(&self) -> Result<uint256, Self::Error>;
 }
 
 #[solidity_interface]
 pub trait ERC165 {
-    type Error;
+	type Error;
 
-    fn supports_interface(&self, interface_id: bytes4) -> Result<bool, Self::Error>;
+	fn supports_interface(&self, interface_id: bytes4) -> Result<bool, Self::Error>;
 }
 
 #[solidity_interface(inline_is(InlineNameSymbol))]
 pub trait ERC721Metadata {
-    type Error;
+	type Error;
 
-    #[solidity(rename_selector = "tokenURI")]
-    fn token_uri(&self, token_id: uint256) -> Result<string, Self::Error>;
+	#[solidity(rename_selector = "tokenURI")]
+	fn token_uri(&self, token_id: uint256) -> Result<string, Self::Error>;
 }
 
 #[solidity_interface(inline_is(InlineTotalSupply))]
 pub trait ERC721Enumerable {
-    type Error;
+	type Error;
 
-    fn token_by_index(&self, index: uint256) -> Result<uint256, Self::Error>;
-    fn token_of_owner_by_index(&self, owner: address, index: uint256) -> Result<uint256, Self::Error>;
+	fn token_by_index(&self, index: uint256) -> Result<uint256, Self::Error>;
+	fn token_of_owner_by_index(
+		&self,
+		owner: address,
+		index: uint256,
+	) -> Result<uint256, Self::Error>;
 }
 
-
 #[derive(ToLog)]
 pub enum ERC721Events {
-    Transfer {
-        #[indexed] from: address,
-        #[indexed] to: address,
-        #[indexed] token_id: uint256,
-    },
-    Approval {
-        #[indexed] owner: address,
-        #[indexed] approved: address,
-        #[indexed] token_id: uint256,
-    },
-    #[allow(dead_code)]
-    ApprovalForAll {
-        #[indexed] owner: address,
-        #[indexed] operator: address,
-        approved: bool,
-    }
+	Transfer {
+		#[indexed]
+		from: address,
+		#[indexed]
+		to: address,
+		#[indexed]
+		token_id: uint256,
+	},
+	Approval {
+		#[indexed]
+		owner: address,
+		#[indexed]
+		approved: address,
+		#[indexed]
+		token_id: uint256,
+	},
+	#[allow(dead_code)]
+	ApprovalForAll {
+		#[indexed]
+		owner: address,
+		#[indexed]
+		operator: address,
+		approved: bool,
+	},
 }
 
 #[solidity_interface(is(ERC165), events(ERC721Events))]
 pub trait ERC721 {
-    type Error;
+	type Error;
 
-    fn balance_of(&self, owner: address) -> Result<uint256, Self::Error>;
-    fn owner_of(&self, token_id: uint256) -> Result<address, Self::Error>;
+	fn balance_of(&self, owner: address) -> Result<uint256, Self::Error>;
+	fn owner_of(&self, token_id: uint256) -> Result<address, Self::Error>;
 
-    #[solidity(rename_selector = "safeTransferFrom")]
-    fn safe_transfer_from_with_data(&mut self, from: address, to: address, token_id: uint256, data: bytes, value: value) -> Result<void, Self::Error>;
-    fn safe_transfer_from(&mut self, from: address, to: address, token_id: uint256, value: value) -> Result<void, Self::Error>;
+	#[solidity(rename_selector = "safeTransferFrom")]
+	fn safe_transfer_from_with_data(
+		&mut self,
+		from: address,
+		to: address,
+		token_id: uint256,
+		data: bytes,
+		value: value,
+	) -> Result<void, Self::Error>;
+	fn safe_transfer_from(
+		&mut self,
+		from: address,
+		to: address,
+		token_id: uint256,
+		value: value,
+	) -> Result<void, Self::Error>;
 
-    fn transfer_from(&mut self, caller: caller, from: address, to: address, token_id: uint256, value: value) -> Result<void, Self::Error>;
-    fn approve(&mut self, caller: caller, approved: address, token_id: uint256, value: value) -> Result<void, Self::Error>;
-    fn set_approval_for_all(&mut self, caller: caller, operator: address, approved: bool) -> Result<void, Self::Error>;
+	fn transfer_from(
+		&mut self,
+		caller: caller,
+		from: address,
+		to: address,
+		token_id: uint256,
+		value: value,
+	) -> Result<void, Self::Error>;
+	fn approve(
+		&mut self,
+		caller: caller,
+		approved: address,
+		token_id: uint256,
+		value: value,
+	) -> Result<void, Self::Error>;
+	fn set_approval_for_all(
+		&mut self,
+		caller: caller,
+		operator: address,
+		approved: bool,
+	) -> Result<void, Self::Error>;
 
-    fn get_approved(&self, token_id: uint256) -> Result<address, Self::Error>;
-    fn is_approved_for_all(&self, owner: address, operator: address) -> Result<address, Self::Error>;
+	fn get_approved(&self, token_id: uint256) -> Result<address, Self::Error>;
+	fn is_approved_for_all(
+		&self,
+		owner: address,
+		operator: address,
+	) -> Result<address, Self::Error>;
 }
 
 #[solidity_interface]
 pub trait ERC721UniqueExtensions {
-    type Error;
+	type Error;
 
-    fn transfer(&mut self, caller: caller, to: address, token_id: uint256, value: value) -> Result<void, Self::Error>;
+	fn transfer(
+		&mut self,
+		caller: caller,
+		to: address,
+		token_id: uint256,
+		value: value,
+	) -> Result<void, Self::Error>;
 }
 
-#[solidity_interface(is(ERC165, ERC721, ERC721Metadata, ERC721Enumerable, ERC721UniqueExtensions))]
+#[solidity_interface(is(
+	ERC165,
+	ERC721,
+	ERC721Metadata,
+	ERC721Enumerable,
+	ERC721UniqueExtensions
+))]
 pub trait UniqueNFT {
-    type Error;
+	type Error;
 }
 
 #[derive(ToLog)]
 pub enum ERC20Events {
-    Transfer {
-        #[indexed] from: address,
-        #[indexed] to: address,
-        value: uint256,
-    },
-    Approval {
-        #[indexed] owner: address,
-        #[indexed] spender: address,
-        value: uint256,
-    }
+	Transfer {
+		#[indexed]
+		from: address,
+		#[indexed]
+		to: address,
+		value: uint256,
+	},
+	Approval {
+		#[indexed]
+		owner: address,
+		#[indexed]
+		spender: address,
+		value: uint256,
+	},
 }
 
 #[solidity_interface(inline_is(InlineNameSymbol, InlineTotalSupply), events(ERC20Events))]
 pub trait ERC20 {
-    type Error;
-    
-    fn decimals(&self) -> Result<uint8, Self::Error>;
-    fn balance_of(&self, owner: address) -> Result<uint256, Self::Error>;
-    fn transfer(&mut self, caller: caller, to: address, value: uint256) -> Result<bool, Self::Error>;
-    fn transfer_from(&mut self, caller: caller, from: address, to: address, value: uint256) -> Result<bool, Self::Error>;
-    fn approve(&mut self, caller: caller, spender: address, value: uint256) -> Result<bool, Self::Error>;
-    fn allowance(&self, owner: address, spender: address) -> Result<uint256, Self::Error>;
+	type Error;
+
+	fn decimals(&self) -> Result<uint8, Self::Error>;
+	fn balance_of(&self, owner: address) -> Result<uint256, Self::Error>;
+	fn transfer(
+		&mut self,
+		caller: caller,
+		to: address,
+		value: uint256,
+	) -> Result<bool, Self::Error>;
+	fn transfer_from(
+		&mut self,
+		caller: caller,
+		from: address,
+		to: address,
+		value: uint256,
+	) -> Result<bool, Self::Error>;
+	fn approve(
+		&mut self,
+		caller: caller,
+		spender: address,
+		value: uint256,
+	) -> Result<bool, Self::Error>;
+	fn allowance(&self, owner: address, spender: address) -> Result<uint256, Self::Error>;
 }
 
 #[solidity_interface(is(ERC165, ERC20))]
 pub trait UniqueFungible {
-    type Error;
+	type Error;
 }
-
-/// Runtime metadata like helpers for evm
-#[solidity_interface]
-trait UniqueHelpers {
-    type Error;
-
-    /// Returns interface for NFT collections
-    fn nft_interface(&self) -> Result<string, Self::Error>;
-    /// Returns interface for Fungible collections
-    fn fungible_interface(&self) -> Result<string, Self::Error>;
-}
\ No newline at end of file
modifiedpallets/nft/src/eth/erc_impl.rsdiffbeforeafterboth
--- a/pallets/nft/src/eth/erc_impl.rs
+++ b/pallets/nft/src/eth/erc_impl.rs
@@ -56,7 +56,7 @@
 		Ok(index)
 	}
 
-	fn token_of_owner_by_index(&self, owner: address, index: uint256) -> Result<uint256> {
+	fn token_of_owner_by_index(&self, _owner: address, _index: uint256) -> Result<uint256> {
 		// TODO: Not implemetable
 		Err("not implemented".into())
 	}
@@ -77,7 +77,7 @@
 	fn owner_of(&self, token_id: uint256) -> Result<address> {
 		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
 		let token = <NftItemList<T>>::get(self.id, token_id).ok_or("unknown token")?;
-		Ok(token.owner.as_eth().clone())
+		Ok(*token.owner.as_eth())
 	}
 	fn safe_transfer_from_with_data(
 		&mut self,
@@ -114,7 +114,7 @@
 		let to = T::CrossAccountId::from_eth(to);
 		let token_id = token_id.try_into().map_err(|_| "token_id overflow")?;
 
-		<Module<T>>::transfer_from_internal(&caller, &from, &to, &self, token_id, 1)
+		<Module<T>>::transfer_from_internal(&caller, &from, &to, self, token_id, 1)
 			.map_err(|_| "transferFrom error")?;
 		Ok(())
 	}
@@ -130,7 +130,7 @@
 		let approved = T::CrossAccountId::from_eth(approved);
 		let token_id = token_id.try_into().map_err(|_| "token_id overflow")?;
 
-		<Module<T>>::approve_internal(&caller, &approved, &self, token_id, 1)
+		<Module<T>>::approve_internal(&caller, &approved, self, token_id, 1)
 			.map_err(|_| "approve internal")?;
 		Ok(())
 	}
@@ -170,13 +170,13 @@
 		caller: caller,
 		to: address,
 		token_id: uint256,
-		value: value,
+		_value: value,
 	) -> Result<void> {
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = T::CrossAccountId::from_eth(to);
 		let token_id = token_id.try_into().map_err(|_| "amount overflow")?;
 
-		<Module<T>>::transfer_internal(&caller, &to, &self, token_id, 1)
+		<Module<T>>::transfer_internal(&caller, &to, self, token_id, 1)
 			.map_err(|_| "transfer error")?;
 		Ok(())
 	}
@@ -226,7 +226,7 @@
 		let to = T::CrossAccountId::from_eth(to);
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
 
-		<Module<T>>::transfer_internal(&caller, &to, &self, 1, amount)
+		<Module<T>>::transfer_internal(&caller, &to, self, 1, amount)
 			.map_err(|_| "transfer error")?;
 		Ok(true)
 	}
@@ -242,7 +242,7 @@
 		let to = T::CrossAccountId::from_eth(to);
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
 
-		<Module<T>>::transfer_from_internal(&caller, &from, &to, &self, 1, amount)
+		<Module<T>>::transfer_from_internal(&caller, &from, &to, self, 1, amount)
 			.map_err(|_| "transferFrom error")?;
 		Ok(true)
 	}
@@ -251,7 +251,7 @@
 		let spender = T::CrossAccountId::from_eth(spender);
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
 
-		<Module<T>>::approve_internal(&caller, &spender, &self, 1, amount)
+		<Module<T>>::approve_internal(&caller, &spender, self, 1, amount)
 			.map_err(|_| "approve internal")?;
 		Ok(true)
 	}
modifiedpallets/nft/src/eth/log.rsdiffbeforeafterboth
--- a/pallets/nft/src/eth/log.rs
+++ b/pallets/nft/src/eth/log.rs
@@ -1,19 +1,19 @@
 use sp_std::cell::RefCell;
 use sp_std::vec::Vec;
-use sp_core::{H160, H256};
+
 use ethereum::Log;
 
 #[derive(Default)]
 pub struct LogRecorder(RefCell<Vec<Log>>);
 
 impl LogRecorder {
-    pub fn is_empty(&self) -> bool {
-        self.0.borrow().is_empty()
-    }
-    pub fn log(&self, log: Log) {
-        self.0.borrow_mut().push(log);
-    }
-    pub fn retrieve_logs(self) -> Vec<Log> {
-        self.0.into_inner()
-    }
+	pub fn is_empty(&self) -> bool {
+		self.0.borrow().is_empty()
+	}
+	pub fn log(&self, log: Log) {
+		self.0.borrow_mut().push(log);
+	}
+	pub fn retrieve_logs(self) -> Vec<Log> {
+		self.0.into_inner()
+	}
 }
modifiedpallets/nft/src/eth/mod.rsdiffbeforeafterboth
--- a/pallets/nft/src/eth/mod.rs
+++ b/pallets/nft/src/eth/mod.rs
@@ -28,7 +28,7 @@
 ];
 
 fn map_eth_to_id(eth: &H160) -> Option<CollectionId> {
-	if &eth[0..16] != ETH_ACCOUNT_PREFIX {
+	if eth[0..16] != ETH_ACCOUNT_PREFIX {
 		return None;
 	}
 	let mut id_bytes = [0; 4];
@@ -92,12 +92,9 @@
 				},
 			)?))
 		}
-		_ => {
-			return Err(StringError::from(
-				"erc calls only supported to fungible and nft collections for now",
-			)
-			.into())
-		}
+		_ => Err(StringError::from(
+			"erc calls only supported to fungible and nft collections for now",
+		)),
 	}
 }
 
@@ -111,7 +108,7 @@
 			.unwrap_or(false)
 	}
 	fn get_code(target: &H160) -> Option<Vec<u8>> {
-		map_eth_to_id(&target)
+		map_eth_to_id(target)
 			.and_then(<CollectionById<T>>::get)
 			.map(|collection| {
 				match collection.mode {
@@ -130,7 +127,7 @@
 		input: &[u8],
 		value: U256,
 	) -> Option<PrecompileOutput> {
-		let mut collection = map_eth_to_id(&target)
+		let mut collection = map_eth_to_id(target)
 			.and_then(|id| <CollectionHandle<T>>::get_with_gas_limit(id, gas_limit))?;
 		let (method_id, input) = AbiReader::new_call(input).unwrap();
 		let result = call_internal(&mut collection, *source, method_id, input, value);
@@ -156,11 +153,10 @@
 
 // TODO: This function is slow, and output can be memoized
 pub fn generate_transaction(collection_id: u32, chain_id: u64) -> ethereum::Transaction {
-	let contract = collection_id_to_address(collection_id);
-
 	// FIXME: Can be done on wasm runtime with https://github.com/paritytech/substrate/pull/8728
 	#[cfg(feature = "std")]
 	{
+		let contract = collection_id_to_address(collection_id);
 		let signed = ethereum_tx_sign::RawTransaction {
 			nonce: 0.into(),
 			to: Some(contract.0.into()),
@@ -183,6 +179,6 @@
 	}
 	#[cfg(not(feature = "std"))]
 	{
-		panic!("transaction generation not yet supported by wasm runtime")
+		panic!("transaction generation not yet supported by wasm runtime while generating transaction for collection_id {}, chain_id {}", collection_id, chain_id)
 	}
 }
modifiedpallets/nft/src/eth/sponsoring.rsdiffbeforeafterboth
--- a/pallets/nft/src/eth/sponsoring.rs
+++ b/pallets/nft/src/eth/sponsoring.rs
@@ -1,142 +1,170 @@
 //! Implements EVM sponsoring logic via OnChargeEVMTransaction
 
-use crate::{Collection, ChainLimit, CollectionById, Config, NftTransferBasket, FungibleTransferBasket, eth::account::EvmBackwardsAddressMapping};
+use crate::{
+	Collection, ChainLimit, CollectionById, Config, NftTransferBasket, FungibleTransferBasket,
+	eth::account::EvmBackwardsAddressMapping,
+};
 use evm_coder::abi::AbiReader;
-use frame_support::{storage::{StorageMap, StorageDoubleMap, StorageValue}, traits::Currency};
+use frame_support::{
+	storage::{StorageMap, StorageDoubleMap, StorageValue},
+	traits::Currency,
+};
 use pallet_evm::{EVMCurrencyAdapter, WithdrawReason};
 use sp_core::{H160, U256};
 use sp_std::prelude::*;
-use super::{account::CrossAccountId, erc::{UniqueFungibleCall, UniqueNFTCall, ERC721Call, ERC20Call, ERC721UniqueExtensionsCall}};
+use super::{
+	account::CrossAccountId,
+	erc::{UniqueFungibleCall, UniqueNFTCall, ERC721Call, ERC20Call, ERC721UniqueExtensionsCall},
+};
 use core::convert::TryInto;
 
 type NegativeImbalanceOf<C, T> =
-    <C as Currency<<T as frame_system::Config>::AccountId>>::NegativeImbalance;
+	<C as Currency<<T as frame_system::Config>::AccountId>>::NegativeImbalance;
 
 pub struct ChargeEvmTransaction;
 pub struct ChargeEvmLiquidityInfo<T>
 where
-    T: Config,
-    T: pallet_evm::Config,
+	T: Config,
+	T: pallet_evm::Config,
 {
-    who: H160,
-    negative_imbalance: NegativeImbalanceOf<<T as Config>::Currency, T>,
+	who: H160,
+	negative_imbalance: NegativeImbalanceOf<<T as Config>::Currency, T>,
 }
 
 struct AnyError;
 
-fn try_sponsor<T: Config>(caller: &H160, collection_id: u32, collection: &Collection<T>, call: &[u8]) -> Result<(), AnyError> {
-    let (method_id, mut reader) = AbiReader::new_call(call).map_err(|_| AnyError)?;
-    match &collection.mode {
-        crate::CollectionMode::NFT => {
-            let call: UniqueNFTCall = UniqueNFTCall::parse(method_id, &mut reader).map_err(|_| AnyError)?.ok_or(AnyError)?;
-            match call {
-                UniqueNFTCall::ERC721UniqueExtensions(ERC721UniqueExtensionsCall::Transfer {token_id, ..}) | UniqueNFTCall::ERC721(ERC721Call::TransferFrom {token_id, ..})  => {
-                    let token_id: u32 = token_id.try_into().map_err(|_| AnyError)?;
-                    let block_number = <frame_system::Module<T>>::block_number() as T::BlockNumber;
-                    let collection_limits = &collection.limits;
-                    let limit: u32 = if collection_limits.sponsor_transfer_timeout > 0 {
-                        collection_limits.sponsor_transfer_timeout
-                    } else {
-                        ChainLimit::get().nft_sponsor_transfer_timeout
-                    };
+fn try_sponsor<T: Config>(
+	caller: &H160,
+	collection_id: u32,
+	collection: &Collection<T>,
+	call: &[u8],
+) -> Result<(), AnyError> {
+	let (method_id, mut reader) = AbiReader::new_call(call).map_err(|_| AnyError)?;
+	match &collection.mode {
+		crate::CollectionMode::NFT => {
+			let call: UniqueNFTCall = UniqueNFTCall::parse(method_id, &mut reader)
+				.map_err(|_| AnyError)?
+				.ok_or(AnyError)?;
+			match call {
+				UniqueNFTCall::ERC721UniqueExtensions(ERC721UniqueExtensionsCall::Transfer {
+					token_id,
+					..
+				})
+				| UniqueNFTCall::ERC721(ERC721Call::TransferFrom { token_id, .. }) => {
+					let token_id: u32 = token_id.try_into().map_err(|_| AnyError)?;
+					let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;
+					let collection_limits = &collection.limits;
+					let limit: u32 = if collection_limits.sponsor_transfer_timeout > 0 {
+						collection_limits.sponsor_transfer_timeout
+					} else {
+						ChainLimit::get().nft_sponsor_transfer_timeout
+					};
 
-                    let mut sponsor = true;
-                    if <NftTransferBasket<T>>::contains_key(collection_id, token_id) {
-                        let last_tx_block = <NftTransferBasket<T>>::get(collection_id, token_id);
-                        let limit_time = last_tx_block + limit.into();
-                        if block_number <= limit_time {
-                            sponsor = false;
-                        }
-                    }
-                    if sponsor {
-                        <NftTransferBasket<T>>::insert(collection_id, token_id, block_number);
-                        return Ok(())
-                    }
-                },
-                _ => {},
-            }
-        },
-        crate::CollectionMode::Fungible(_) => {
-            let call: UniqueFungibleCall = UniqueFungibleCall::parse(method_id, &mut reader).map_err(|_| AnyError)?.ok_or(AnyError)?;
-            match call {
-                UniqueFungibleCall::ERC20(ERC20Call::Transfer {..})  => {
-                    let who = T::CrossAccountId::from_eth(caller.clone());
-                    let collection_limits = &collection.limits;
-                    let limit: u32 = if collection_limits.sponsor_transfer_timeout > 0 {
-                        collection_limits.sponsor_transfer_timeout
-                    } else {
-                        ChainLimit::get().fungible_sponsor_transfer_timeout
-                    };
+					let mut sponsor = true;
+					if <NftTransferBasket<T>>::contains_key(collection_id, token_id) {
+						let last_tx_block = <NftTransferBasket<T>>::get(collection_id, token_id);
+						let limit_time = last_tx_block + limit.into();
+						if block_number <= limit_time {
+							sponsor = false;
+						}
+					}
+					if sponsor {
+						<NftTransferBasket<T>>::insert(collection_id, token_id, block_number);
+						return Ok(());
+					}
+				}
+				_ => {}
+			}
+		}
+		crate::CollectionMode::Fungible(_) => {
+			let call: UniqueFungibleCall = UniqueFungibleCall::parse(method_id, &mut reader)
+				.map_err(|_| AnyError)?
+				.ok_or(AnyError)?;
+			#[allow(clippy::single_match)]
+			match call {
+				UniqueFungibleCall::ERC20(ERC20Call::Transfer { .. }) => {
+					let who = T::CrossAccountId::from_eth(*caller);
+					let collection_limits = &collection.limits;
+					let limit: u32 = if collection_limits.sponsor_transfer_timeout > 0 {
+						collection_limits.sponsor_transfer_timeout
+					} else {
+						ChainLimit::get().fungible_sponsor_transfer_timeout
+					};
 
-                    let block_number = <frame_system::Module<T>>::block_number() as T::BlockNumber;
-                    let mut sponsored = true;
-                    if <FungibleTransferBasket<T>>::contains_key(collection_id, who.as_sub()) {
-                        let last_tx_block = <FungibleTransferBasket<T>>::get(collection_id, who.as_sub());
-                        let limit_time = last_tx_block + limit.into();
-                        if block_number <= limit_time {
-                            sponsored = false;
-                        }
-                    }
-                    if sponsored {
-                        <FungibleTransferBasket<T>>::insert(collection_id, who.as_sub(), block_number);
-                        return Ok(())
-                    }
-                },
-                _ => {},
-            }
-        },
-        _ => {},
-    }
-    return Err(AnyError)
+					let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;
+					let mut sponsored = true;
+					if <FungibleTransferBasket<T>>::contains_key(collection_id, who.as_sub()) {
+						let last_tx_block =
+							<FungibleTransferBasket<T>>::get(collection_id, who.as_sub());
+						let limit_time = last_tx_block + limit.into();
+						if block_number <= limit_time {
+							sponsored = false;
+						}
+					}
+					if sponsored {
+						<FungibleTransferBasket<T>>::insert(
+							collection_id,
+							who.as_sub(),
+							block_number,
+						);
+						return Ok(());
+					}
+				}
+				_ => {}
+			}
+		}
+		_ => {}
+	}
+	Err(AnyError)
 }
 
 impl<T> pallet_evm::OnChargeEVMTransaction<T> for ChargeEvmTransaction
 where
-    T: Config,
-    T: pallet_evm::Config,
+	T: Config,
+	T: pallet_evm::Config,
 {
-    type LiquidityInfo = Option<ChargeEvmLiquidityInfo<T>>;
+	type LiquidityInfo = Option<ChargeEvmLiquidityInfo<T>>;
 
-    fn withdraw_fee(
-        who: &H160,
-        reason: WithdrawReason,
-        fee: U256,
-    ) -> Result<Self::LiquidityInfo, pallet_evm::Error<T>> {
-        let mut who_pays_fee = *who;
-        if let WithdrawReason::Call { target, input } = &reason {
-            if let Some(collection_id) = crate::eth::map_eth_to_id(&target) {
-                if let Some(collection) = <CollectionById<T>>::get(collection_id) {
-                    if let Some(sponsor) = collection.sponsorship.sponsor() {
-                        if try_sponsor(who, collection_id, &collection, &input).is_ok() {
-                            who_pays_fee =
-                                T::EvmBackwardsAddressMapping::from_account_id(sponsor.clone());
-                        }
-                    }
-                }
-            }
-        }
+	fn withdraw_fee(
+		who: &H160,
+		reason: WithdrawReason,
+		fee: U256,
+	) -> Result<Self::LiquidityInfo, pallet_evm::Error<T>> {
+		let mut who_pays_fee = *who;
+		if let WithdrawReason::Call { target, input } = &reason {
+			if let Some(collection_id) = crate::eth::map_eth_to_id(target) {
+				if let Some(collection) = <CollectionById<T>>::get(collection_id) {
+					if let Some(sponsor) = collection.sponsorship.sponsor() {
+						if try_sponsor(who, collection_id, &collection, input).is_ok() {
+							who_pays_fee =
+								T::EvmBackwardsAddressMapping::from_account_id(sponsor.clone());
+						}
+					}
+				}
+			}
+		}
 
-        // TODO: Pay fee from substrate address
-        let negative_imbalance = EVMCurrencyAdapter::<<T as Config>::Currency, ()>::withdraw_fee(
-            &who_pays_fee,
-            reason,
-            fee,
-        )?;
-        Ok(negative_imbalance.map(|i| ChargeEvmLiquidityInfo {
-            who: who_pays_fee,
-            negative_imbalance: i,
-        }))
-    }
+		// TODO: Pay fee from substrate address
+		let negative_imbalance = EVMCurrencyAdapter::<<T as Config>::Currency, ()>::withdraw_fee(
+			&who_pays_fee,
+			reason,
+			fee,
+		)?;
+		Ok(negative_imbalance.map(|i| ChargeEvmLiquidityInfo {
+			who: who_pays_fee,
+			negative_imbalance: i,
+		}))
+	}
 
-    fn correct_and_deposit_fee(
-        who: &H160,
-        corrected_fee: U256,
-        already_withdrawn: Self::LiquidityInfo,
-    ) -> Result<(), pallet_evm::Error<T>> {
-        EVMCurrencyAdapter::<<T as Config>::Currency, ()>::correct_and_deposit_fee(
-            &already_withdrawn.as_ref().map(|e| e.who).unwrap_or(*who),
-            corrected_fee,
-            already_withdrawn.map(|e| e.negative_imbalance),
-        )
-    }
+	fn correct_and_deposit_fee(
+		who: &H160,
+		corrected_fee: U256,
+		already_withdrawn: Self::LiquidityInfo,
+	) -> Result<(), pallet_evm::Error<T>> {
+		EVMCurrencyAdapter::<<T as Config>::Currency, ()>::correct_and_deposit_fee(
+			&already_withdrawn.as_ref().map(|e| e.who).unwrap_or(*who),
+			corrected_fee,
+			already_withdrawn.map(|e| e.negative_imbalance),
+		)
+	}
 }
modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -4,41 +4,44 @@
 //
 
 #![recursion_limit = "1024"]
-
 #![cfg_attr(not(feature = "std"), no_std)]
+#![allow(
+	clippy::too_many_arguments,
+	clippy::unnecessary_mut_passed,
+	clippy::unused_unit
+)]
 
 extern crate alloc;
 
 pub use serde::{Serialize, Deserialize};
 
 pub use frame_support::{
-    construct_runtime, decl_event, decl_module, decl_storage, decl_error,
-    dispatch::DispatchResult,
-    ensure, fail, parameter_types,
-    traits::{
-        Currency, ExistenceRequirement, Get, Imbalance, KeyOwnerProofSystem, OnUnbalanced,
-        Randomness, IsSubType, WithdrawReasons,
-    },
-    weights::{
-        constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
-        DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,
-        WeightToFeePolynomial, DispatchClass,
-    },
-    StorageValue,
-    transactional,
+	construct_runtime, decl_event, decl_module, decl_storage, decl_error,
+	dispatch::DispatchResult,
+	ensure, fail, parameter_types,
+	traits::{
+		Currency, ExistenceRequirement, Get, Imbalance, KeyOwnerProofSystem, OnUnbalanced,
+		Randomness, IsSubType, WithdrawReasons,
+	},
+	weights::{
+		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
+		DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,
+		WeightToFeePolynomial, DispatchClass,
+	},
+	StorageValue, transactional,
 };
 
 use frame_system::{self as system, ensure_signed, ensure_root};
 use sp_core::H160;
+use sp_std::vec;
 use sp_runtime::sp_std::prelude::Vec;
 use core::ops::{Deref, DerefMut};
 use core::cell::RefCell;
 use nft_data_structs::{
-    MAX_DECIMAL_POINTS, MAX_SPONSOR_TIMEOUT, MAX_TOKEN_OWNERSHIP, MAX_REFUNGIBLE_PIECES,
-	AccessMode, ChainLimits, Collection, CreateItemData, CollectionLimits,
-    CollectionId, CollectionMode, TokenId, 
-    SchemaVersion, SponsorshipState, Ownership,
-    NftItemType, FungibleItemType, ReFungibleItemType
+	MAX_DECIMAL_POINTS, MAX_SPONSOR_TIMEOUT, MAX_TOKEN_OWNERSHIP, MAX_REFUNGIBLE_PIECES,
+	AccessMode, ChainLimits, Collection, CreateItemData, CollectionLimits, CollectionId,
+	CollectionMode, TokenId, SchemaVersion, SponsorshipState, Ownership, NftItemType,
+	FungibleItemType, ReFungibleItemType,
 };
 use pallet_ethereum::EthereumTransactionSender;
 
@@ -65,186 +68,186 @@
 	fn destroy_collection() -> Weight;
 	fn add_to_white_list() -> Weight;
 	fn remove_from_white_list() -> Weight;
-    fn set_public_access_mode() -> Weight;
-    fn set_mint_permission() -> Weight;
-    fn change_collection_owner() -> Weight;
-    fn add_collection_admin() -> Weight;
-    fn remove_collection_admin() -> Weight;
-    fn set_collection_sponsor() -> Weight;
-    fn confirm_sponsorship() -> Weight;
-    fn remove_collection_sponsor() -> Weight;
-    fn create_item(s: usize) -> Weight;
-    fn burn_item() -> Weight;
-    fn transfer() -> Weight;
-    fn approve() -> Weight;
-    fn transfer_from() -> Weight;
-    fn set_offchain_schema() -> Weight;
-    fn set_const_on_chain_schema() -> Weight;
-    fn set_variable_on_chain_schema() -> Weight;
-    fn set_variable_meta_data() -> Weight;
-    fn enable_contract_sponsoring() -> Weight;
-    fn set_schema_version() -> Weight;
-    fn set_chain_limits() -> Weight;
-    fn set_contract_sponsoring_rate_limit() -> Weight;
-    fn set_variable_meta_data_sponsoring_rate_limit() -> Weight;
-    fn toggle_contract_white_list() -> Weight;
-    fn add_to_contract_white_list() -> Weight;
-    fn remove_from_contract_white_list() -> Weight;
-    fn set_collection_limits() -> Weight;
+	fn set_public_access_mode() -> Weight;
+	fn set_mint_permission() -> Weight;
+	fn change_collection_owner() -> Weight;
+	fn add_collection_admin() -> Weight;
+	fn remove_collection_admin() -> Weight;
+	fn set_collection_sponsor() -> Weight;
+	fn confirm_sponsorship() -> Weight;
+	fn remove_collection_sponsor() -> Weight;
+	fn create_item(s: usize) -> Weight;
+	fn burn_item() -> Weight;
+	fn transfer() -> Weight;
+	fn approve() -> Weight;
+	fn transfer_from() -> Weight;
+	fn set_offchain_schema() -> Weight;
+	fn set_const_on_chain_schema() -> Weight;
+	fn set_variable_on_chain_schema() -> Weight;
+	fn set_variable_meta_data() -> Weight;
+	fn enable_contract_sponsoring() -> Weight;
+	fn set_schema_version() -> Weight;
+	fn set_chain_limits() -> Weight;
+	fn set_contract_sponsoring_rate_limit() -> Weight;
+	fn set_variable_meta_data_sponsoring_rate_limit() -> Weight;
+	fn toggle_contract_white_list() -> Weight;
+	fn add_to_contract_white_list() -> Weight;
+	fn remove_from_contract_white_list() -> Weight;
+	fn set_collection_limits() -> Weight;
 }
 
 decl_error! {
 	/// Error for non-fungible-token module.
 	pub enum Error for Module<T: Config> {
-        /// Total collections bound exceeded.
-        TotalCollectionsLimitExceeded,
+		/// Total collections bound exceeded.
+		TotalCollectionsLimitExceeded,
 		/// Decimal_points parameter must be lower than MAX_DECIMAL_POINTS constant, currently it is 30.
-        CollectionDecimalPointLimitExceeded, 
-        /// Collection name can not be longer than 63 char.
-        CollectionNameLimitExceeded, 
-        /// Collection description can not be longer than 255 char.
-        CollectionDescriptionLimitExceeded, 
-        /// Token prefix can not be longer than 15 char.
-        CollectionTokenPrefixLimitExceeded,
-        /// This collection does not exist.
-        CollectionNotFound,
-        /// Item not exists.
-        TokenNotFound,
-        /// Admin not found
-        AdminNotFound,
-        /// Arithmetic calculation overflow.
-        NumOverflow,       
-        /// Account already has admin role.
-        AlreadyAdmin,  
-        /// You do not own this collection.
-        NoPermission,
-        /// This address is not set as sponsor, use setCollectionSponsor first.
-        ConfirmUnsetSponsorFail,
-        /// Collection is not in mint mode.
-        PublicMintingNotAllowed,
-        /// Sender parameter and item owner must be equal.
-        MustBeTokenOwner,
-        /// Item balance not enough.
-        TokenValueTooLow,
-        /// Size of item is too large.
-        NftSizeLimitExceeded,
-        /// No approve found
-        ApproveNotFound,
-        /// Requested value more than approved.
-        TokenValueNotEnough,
-        /// Only approved addresses can call this method.
-        ApproveRequired,
-        /// Address is not in white list.
-        AddresNotInWhiteList,
-        /// Number of collection admins bound exceeded.
-        CollectionAdminsLimitExceeded,
-        /// Owned tokens by a single address bound exceeded.
-        AddressOwnershipLimitExceeded,
-        /// Length of items properties must be greater than 0.
-        EmptyArgument,
-        /// const_data exceeded data limit.
-        TokenConstDataLimitExceeded,
-        /// variable_data exceeded data limit.
-        TokenVariableDataLimitExceeded,
-        /// Not NFT item data used to mint in NFT collection.
-        NotNftDataUsedToMintNftCollectionToken,
-        /// Not Fungible item data used to mint in Fungible collection.
-        NotFungibleDataUsedToMintFungibleCollectionToken,
-        /// Not Re Fungible item data used to mint in Re Fungible collection.
-        NotReFungibleDataUsedToMintReFungibleCollectionToken,
-        /// Unexpected collection type.
-        UnexpectedCollectionType,
-        /// Can't store metadata in fungible tokens.
-        CantStoreMetadataInFungibleTokens,
-        /// Collection token limit exceeded
-        CollectionTokenLimitExceeded,
-        /// Account token limit exceeded per collection
-        AccountTokenLimitExceeded,
-        /// Collection limit bounds per collection exceeded
-        CollectionLimitBoundsExceeded,
-        /// Tried to enable permissions which are only permitted to be disabled
-        OwnerPermissionsCantBeReverted,
-        /// Schema data size limit bound exceeded
-        SchemaDataLimitExceeded,
-        /// Maximum refungibility exceeded
-        WrongRefungiblePieces,
-        /// createRefungible should be called with one owner
-        BadCreateRefungibleCall,
-        /// Gas limit exceeded
-        OutOfGas,
+		CollectionDecimalPointLimitExceeded,
+		/// Collection name can not be longer than 63 char.
+		CollectionNameLimitExceeded,
+		/// Collection description can not be longer than 255 char.
+		CollectionDescriptionLimitExceeded,
+		/// Token prefix can not be longer than 15 char.
+		CollectionTokenPrefixLimitExceeded,
+		/// This collection does not exist.
+		CollectionNotFound,
+		/// Item not exists.
+		TokenNotFound,
+		/// Admin not found
+		AdminNotFound,
+		/// Arithmetic calculation overflow.
+		NumOverflow,
+		/// Account already has admin role.
+		AlreadyAdmin,
+		/// You do not own this collection.
+		NoPermission,
+		/// This address is not set as sponsor, use setCollectionSponsor first.
+		ConfirmUnsetSponsorFail,
+		/// Collection is not in mint mode.
+		PublicMintingNotAllowed,
+		/// Sender parameter and item owner must be equal.
+		MustBeTokenOwner,
+		/// Item balance not enough.
+		TokenValueTooLow,
+		/// Size of item is too large.
+		NftSizeLimitExceeded,
+		/// No approve found
+		ApproveNotFound,
+		/// Requested value more than approved.
+		TokenValueNotEnough,
+		/// Only approved addresses can call this method.
+		ApproveRequired,
+		/// Address is not in white list.
+		AddresNotInWhiteList,
+		/// Number of collection admins bound exceeded.
+		CollectionAdminsLimitExceeded,
+		/// Owned tokens by a single address bound exceeded.
+		AddressOwnershipLimitExceeded,
+		/// Length of items properties must be greater than 0.
+		EmptyArgument,
+		/// const_data exceeded data limit.
+		TokenConstDataLimitExceeded,
+		/// variable_data exceeded data limit.
+		TokenVariableDataLimitExceeded,
+		/// Not NFT item data used to mint in NFT collection.
+		NotNftDataUsedToMintNftCollectionToken,
+		/// Not Fungible item data used to mint in Fungible collection.
+		NotFungibleDataUsedToMintFungibleCollectionToken,
+		/// Not Re Fungible item data used to mint in Re Fungible collection.
+		NotReFungibleDataUsedToMintReFungibleCollectionToken,
+		/// Unexpected collection type.
+		UnexpectedCollectionType,
+		/// Can't store metadata in fungible tokens.
+		CantStoreMetadataInFungibleTokens,
+		/// Collection token limit exceeded
+		CollectionTokenLimitExceeded,
+		/// Account token limit exceeded per collection
+		AccountTokenLimitExceeded,
+		/// Collection limit bounds per collection exceeded
+		CollectionLimitBoundsExceeded,
+		/// Tried to enable permissions which are only permitted to be disabled
+		OwnerPermissionsCantBeReverted,
+		/// Schema data size limit bound exceeded
+		SchemaDataLimitExceeded,
+		/// Maximum refungibility exceeded
+		WrongRefungiblePieces,
+		/// createRefungible should be called with one owner
+		BadCreateRefungibleCall,
+		/// Gas limit exceeded
+		OutOfGas,
 	}
 }
 
 pub struct CollectionHandle<T: Config> {
-    pub id: CollectionId,
-    collection: Collection<T>,
-    logs: eth::log::LogRecorder,
-    evm_address: H160,
-    gas_limit: RefCell<u64>,
+	pub id: CollectionId,
+	collection: Collection<T>,
+	logs: eth::log::LogRecorder,
+	evm_address: H160,
+	gas_limit: RefCell<u64>,
 }
 impl<T: Config> CollectionHandle<T> {
 	pub fn get_with_gas_limit(id: CollectionId, gas_limit: u64) -> Option<Self> {
-		<CollectionById<T>>::get(id)
-			.map(|collection| Self {
-				id,
-				collection,
-                logs: eth::log::LogRecorder::default(),
-                evm_address: eth::collection_id_to_address(id),
-                gas_limit: RefCell::new(gas_limit),
-			})
+		<CollectionById<T>>::get(id).map(|collection| Self {
+			id,
+			collection,
+			logs: eth::log::LogRecorder::default(),
+			evm_address: eth::collection_id_to_address(id),
+			gas_limit: RefCell::new(gas_limit),
+		})
+	}
+	pub fn get(id: CollectionId) -> Option<Self> {
+		Self::get_with_gas_limit(id, u64::MAX)
+	}
+	pub fn gas_left(&self) -> u64 {
+		*self.gas_limit.borrow()
+	}
+	pub fn consume_gas(&self, gas: u64) -> DispatchResult {
+		let mut gas_limit = self.gas_limit.borrow_mut();
+		if *gas_limit < gas {
+			fail!(Error::<T>::OutOfGas);
+		}
+		*gas_limit -= gas;
+		Ok(())
+	}
+	pub fn log(&self, log: impl evm_coder::ToLog) {
+		self.logs.log(log.to_log(self.evm_address))
+	}
+	pub fn into_inner(self) -> Collection<T> {
+		self.collection
 	}
-    pub fn get(id: CollectionId) -> Option<Self> {
-        Self::get_with_gas_limit(id, u64::MAX)
-    }
-    pub fn gas_left(&self) -> u64 {
-        *self.gas_limit.borrow()
-    }
-    pub fn consume_gas(&self, gas: u64) -> DispatchResult {
-        let mut gas_limit = self.gas_limit.borrow_mut();
-        if *gas_limit < gas {
-            fail!(Error::<T>::OutOfGas);
-        }
-        *gas_limit -= gas;
-        Ok(())
-    }
-    pub fn log(&self, log: impl evm_coder::ToLog) {
-        self.logs.log(log.to_log(self.evm_address))
-    }
-    pub fn into_inner(self) -> Collection<T> {
-        self.collection.clone()
-    }
 }
 impl<T: Config> Deref for CollectionHandle<T> {
-    type Target = Collection<T>;
+	type Target = Collection<T>;
 
-    fn deref(&self) -> &Self::Target {
-        &self.collection
-    }
+	fn deref(&self) -> &Self::Target {
+		&self.collection
+	}
 }
 
 impl<T: Config> DerefMut for CollectionHandle<T> {
-    fn deref_mut(&mut self) -> &mut Self::Target {
-        &mut self.collection
-    }
+	fn deref_mut(&mut self) -> &mut Self::Target {
+		&mut self.collection
+	}
 }
 
 pub trait Config: system::Config + Sized {
-    type Event: From<Event<Self>> + Into<<Self as system::Config>::Event>;
+	type Event: From<Event<Self>> + Into<<Self as system::Config>::Event>;
 
-    /// Weight information for extrinsics in this pallet.
+	/// Weight information for extrinsics in this pallet.
 	type WeightInfo: WeightInfo;
 
-    type EvmAddressMapping: pallet_evm::AddressMapping<Self::AccountId>;
-    type EvmBackwardsAddressMapping: EvmBackwardsAddressMapping<Self::AccountId>;
-    type EvmWithdrawOrigin: pallet_evm::EnsureAddressOrigin<Self::Origin, Success = Self::AccountId>;
+	type EvmAddressMapping: pallet_evm::AddressMapping<Self::AccountId>;
+	type EvmBackwardsAddressMapping: EvmBackwardsAddressMapping<Self::AccountId>;
 
 	type CrossAccountId: CrossAccountId<Self::AccountId>;
-    type Currency: Currency<Self::AccountId>;
-    type CollectionCreationPrice: Get<<<Self as Config>::Currency as Currency<Self::AccountId>>::Balance>;
-    type TreasuryAccountId: Get<Self::AccountId>;
+	type Currency: Currency<Self::AccountId>;
+	type CollectionCreationPrice: Get<
+		<<Self as Config>::Currency as Currency<Self::AccountId>>::Balance,
+	>;
+	type TreasuryAccountId: Get<Self::AccountId>;
 
-    type EthereumChainId: Get<u64>;
-    type EthereumTransactionSender: pallet_ethereum::EthereumTransactionSender;
+	type EthereumChainId: Get<u64>;
+	type EthereumTransactionSender: pallet_ethereum::EthereumTransactionSender;
 }
 
 // # Used definitions
@@ -270,1094 +273,1128 @@
 // ?3 - real -> controlled
 //      no confirmation required, so addresses can be easily generated
 decl_storage! {
-    trait Store for Module<T: Config> as Nft {
+	trait Store for Module<T: Config> as Nft {
 
-        //#region Private members
-        /// Id of next collection
-        CreatedCollectionCount: u32;
-        /// Used for migrations
-        ChainVersion: u64;
-        /// Id of last collection token
-        /// Collection id (controlled?1)
-        ItemListIndex: map hasher(blake2_128_concat) CollectionId => TokenId;
-        //#endregion
+		//#region Private members
+		/// Id of next collection
+		CreatedCollectionCount: u32;
+		/// Used for migrations
+		ChainVersion: u64;
+		/// Id of last collection token
+		/// Collection id (controlled?1)
+		ItemListIndex: map hasher(blake2_128_concat) CollectionId => TokenId;
+		//#endregion
 
-        //#region Chain limits struct
-        pub ChainLimit get(fn chain_limit) config(): ChainLimits;
-        //#endregion
+		//#region Chain limits struct
+		pub ChainLimit get(fn chain_limit) config(): ChainLimits;
+		//#endregion
 
-        //#region Bound counters
-        /// Amount of collections destroyed, used for total amount tracking with
-        /// CreatedCollectionCount
-        DestroyedCollectionCount: u32;
-        /// Total amount of account owned tokens (NFTs + RFTs + unique fungibles)
-        /// Account id (real)
-        pub AccountItemCount get(fn account_item_count): map hasher(twox_64_concat) T::AccountId => u32;
-        //#endregion
+		//#region Bound counters
+		/// Amount of collections destroyed, used for total amount tracking with
+		/// CreatedCollectionCount
+		DestroyedCollectionCount: u32;
+		/// Total amount of account owned tokens (NFTs + RFTs + unique fungibles)
+		/// Account id (real)
+		pub AccountItemCount get(fn account_item_count): map hasher(twox_64_concat) T::AccountId => u32;
+		//#endregion
 
-        //#region Basic collections
-        /// Collection info
-        /// Collection id (controlled?1)
-        pub CollectionById get(fn collection_id) config(): map hasher(blake2_128_concat) CollectionId => Option<Collection<T>> = None;
-        /// List of collection admins
-        /// Collection id (controlled?2)
-        pub AdminList get(fn admin_list_collection): map hasher(blake2_128_concat) CollectionId => Vec<T::CrossAccountId>;
-        /// Whitelisted collection users
-        /// Collection id (controlled?2), user id (controlled?3)
-        pub WhiteList get(fn white_list): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) T::AccountId => bool;
-        //#endregion
+		//#region Basic collections
+		/// Collection info
+		/// Collection id (controlled?1)
+		pub CollectionById get(fn collection_id) config(): map hasher(blake2_128_concat) CollectionId => Option<Collection<T>> = None;
+		/// List of collection admins
+		/// Collection id (controlled?2)
+		pub AdminList get(fn admin_list_collection): map hasher(blake2_128_concat) CollectionId => Vec<T::CrossAccountId>;
+		/// Whitelisted collection users
+		/// Collection id (controlled?2), user id (controlled?3)
+		pub WhiteList get(fn white_list): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) T::AccountId => bool;
+		//#endregion
 
-        /// How many of collection items user have
-        /// Collection id (controlled?2), account id (real)
-        pub Balance get(fn balance_count): double_map hasher(blake2_128_concat) CollectionId, hasher(twox_64_concat) T::AccountId => u128;
+		/// How many of collection items user have
+		/// Collection id (controlled?2), account id (real)
+		pub Balance get(fn balance_count): double_map hasher(blake2_128_concat) CollectionId, hasher(twox_64_concat) T::AccountId => u128;
 
-        /// Amount of items which spender can transfer out of owners account (via transferFrom)
-        /// Collection id (controlled?2), (token id (controlled ?2) + owner account id (real) + spender account id (controlled?3))
-        /// TODO: Off chain worker should remove from this map when token gets removed
-        pub Allowances get(fn approved): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) (TokenId, T::AccountId, T::AccountId) => u128;
+		/// Amount of items which spender can transfer out of owners account (via transferFrom)
+		/// Collection id (controlled?2), (token id (controlled ?2) + owner account id (real) + spender account id (controlled?3))
+		/// TODO: Off chain worker should remove from this map when token gets removed
+		pub Allowances get(fn approved): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) (TokenId, T::AccountId, T::AccountId) => u128;
 
-        //#region Item collections
-        /// Collection id (controlled?2), token id (controlled?1)
-        pub NftItemList get(fn nft_item_id) config(): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<NftItemType<T::CrossAccountId>>;
-        /// Collection id (controlled?2), owner (controlled?2)
-        pub FungibleItemList get(fn fungible_item_id) config(): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) T::AccountId => FungibleItemType;
-        /// Collection id (controlled?2), token id (controlled?1)
-        pub ReFungibleItemList get(fn refungible_item_id) config(): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<ReFungibleItemType<T::CrossAccountId>>;
-        //#endregion
+		//#region Item collections
+		/// Collection id (controlled?2), token id (controlled?1)
+		pub NftItemList get(fn nft_item_id) config(): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<NftItemType<T::CrossAccountId>>;
+		/// Collection id (controlled?2), owner (controlled?2)
+		pub FungibleItemList get(fn fungible_item_id) config(): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) T::AccountId => FungibleItemType;
+		/// Collection id (controlled?2), token id (controlled?1)
+		pub ReFungibleItemList get(fn refungible_item_id) config(): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<ReFungibleItemType<T::CrossAccountId>>;
+		//#endregion
 
-        //#region Index list
-        /// Collection id (controlled?2), tokens owner (controlled?2)
-        pub AddressTokens get(fn address_tokens): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) T::AccountId => Vec<TokenId>;
-        //#endregion
+		//#region Index list
+		/// Collection id (controlled?2), tokens owner (controlled?2)
+		pub AddressTokens get(fn address_tokens): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) T::AccountId => Vec<TokenId>;
+		//#endregion
 
-        //#region Tokens transfer rate limit baskets
-        /// (Collection id (controlled?2), who created (real))
-        /// TODO: Off chain worker should remove from this map when collection gets removed
-        pub CreateItemBasket get(fn create_item_basket): map hasher(blake2_128_concat) (CollectionId, T::AccountId) => T::BlockNumber;
-        /// Collection id (controlled?2), token id (controlled?2)
-        pub NftTransferBasket get(fn nft_transfer_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => T::BlockNumber;
-        /// Collection id (controlled?2), owning user (real)
-        pub FungibleTransferBasket get(fn fungible_transfer_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(twox_64_concat) T::AccountId => T::BlockNumber;
-        /// Collection id (controlled?2), token id (controlled?2)
-        pub ReFungibleTransferBasket get(fn refungible_transfer_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => T::BlockNumber;
-        //#endregion
+		//#region Tokens transfer rate limit baskets
+		/// (Collection id (controlled?2), who created (real))
+		/// TODO: Off chain worker should remove from this map when collection gets removed
+		pub CreateItemBasket get(fn create_item_basket): map hasher(blake2_128_concat) (CollectionId, T::AccountId) => T::BlockNumber;
+		/// Collection id (controlled?2), token id (controlled?2)
+		pub NftTransferBasket get(fn nft_transfer_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => T::BlockNumber;
+		/// Collection id (controlled?2), owning user (real)
+		pub FungibleTransferBasket get(fn fungible_transfer_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(twox_64_concat) T::AccountId => T::BlockNumber;
+		/// Collection id (controlled?2), token id (controlled?2)
+		pub ReFungibleTransferBasket get(fn refungible_transfer_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => T::BlockNumber;
+		//#endregion
 
-        /// Variable metadata sponsoring
-        /// Collection id (controlled?2), token id (controlled?2)
-        pub VariableMetaDataBasket get(fn variable_meta_data_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<T::BlockNumber> = None;
-    }
-    add_extra_genesis {
-        build(|config: &GenesisConfig<T>| {
-            // Modification of storage
-            for (_num, _c) in &config.collection_id {
-                <Module<T>>::init_collection(_c);
-            }
+		/// Variable metadata sponsoring
+		/// Collection id (controlled?2), token id (controlled?2)
+		pub VariableMetaDataBasket get(fn variable_meta_data_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<T::BlockNumber> = None;
+	}
+	add_extra_genesis {
+		build(|config: &GenesisConfig<T>| {
+			// Modification of storage
+			for (_num, _c) in &config.collection_id {
+				<Module<T>>::init_collection(_c);
+			}
 
-            for (_num, _c, _i) in &config.nft_item_id {
-                <Module<T>>::init_nft_token(*_c, _i);
-            }
+			for (_num, _c, _i) in &config.nft_item_id {
+				<Module<T>>::init_nft_token(*_c, _i);
+			}
 
-            for (collection_id, account_id, fungible_item) in &config.fungible_item_id {
-                <Module<T>>::init_fungible_token(*collection_id, &T::CrossAccountId::from_sub(account_id.clone()), fungible_item);
-            }
+			for (collection_id, account_id, fungible_item) in &config.fungible_item_id {
+				<Module<T>>::init_fungible_token(*collection_id, &T::CrossAccountId::from_sub(account_id.clone()), fungible_item);
+			}
 
-            for (_num, _c, _i) in &config.refungible_item_id {
-                <Module<T>>::init_refungible_token(*_c, _i);
-            }
-        })
-    }
+			for (_num, _c, _i) in &config.refungible_item_id {
+				<Module<T>>::init_refungible_token(*_c, _i);
+			}
+		})
+	}
 }
 
 decl_event!(
-    pub enum Event<T>
-    where
-        AccountId = <T as frame_system::Config>::AccountId,
-        CrossAccountId = <T as Config>::CrossAccountId,
-    {
-        /// New collection was created
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id: Globally unique identifier of newly created collection.
-        /// 
-        /// * mode: [CollectionMode] converted into u8.
-        /// 
-        /// * account_id: Collection owner.
-        CollectionCreated(CollectionId, u8, AccountId),
+	pub enum Event<T>
+	where
+		AccountId = <T as frame_system::Config>::AccountId,
+		CrossAccountId = <T as Config>::CrossAccountId,
+	{
+		/// New collection was created
+		///
+		/// # Arguments
+		///
+		/// * collection_id: Globally unique identifier of newly created collection.
+		///
+		/// * mode: [CollectionMode] converted into u8.
+		///
+		/// * account_id: Collection owner.
+		CollectionCreated(CollectionId, u8, AccountId),
 
-        /// New item was created.
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id: Id of the collection where item was created.
-        /// 
-        /// * item_id: Id of an item. Unique within the collection.
-        ///
-        /// * recipient: Owner of newly created item 
-        ItemCreated(CollectionId, TokenId, CrossAccountId),
+		/// New item was created.
+		///
+		/// # Arguments
+		///
+		/// * collection_id: Id of the collection where item was created.
+		///
+		/// * item_id: Id of an item. Unique within the collection.
+		///
+		/// * recipient: Owner of newly created item
+		ItemCreated(CollectionId, TokenId, CrossAccountId),
 
-        /// Collection item was burned.
-        /// 
-        /// # Arguments
-        /// 
-        /// collection_id.
-        /// 
-        /// item_id: Identifier of burned NFT.
-        ItemDestroyed(CollectionId, TokenId),
+		/// Collection item was burned.
+		///
+		/// # Arguments
+		///
+		/// collection_id.
+		///
+		/// item_id: Identifier of burned NFT.
+		ItemDestroyed(CollectionId, TokenId),
 
-        /// Item was transferred
-        ///
-        /// * collection_id: Id of collection to which item is belong
-        ///
-        /// * item_id: Id of an item
-        ///
-        /// * sender: Original owner of item
-        ///
-        /// * recipient: New owner of item
-        ///
-        /// * amount: Always 1 for NFT
-        Transfer(CollectionId, TokenId, CrossAccountId, CrossAccountId, u128),
+		/// Item was transferred
+		///
+		/// * collection_id: Id of collection to which item is belong
+		///
+		/// * item_id: Id of an item
+		///
+		/// * sender: Original owner of item
+		///
+		/// * recipient: New owner of item
+		///
+		/// * amount: Always 1 for NFT
+		Transfer(CollectionId, TokenId, CrossAccountId, CrossAccountId, u128),
 
-        /// * collection_id
-        ///
-        /// * item_id
-        ///
-        /// * sender
-        ///
-        /// * spender
-        ///
-        /// * amount
-        Approved(CollectionId, TokenId, CrossAccountId, CrossAccountId, u128),
-    }
+		/// * collection_id
+		///
+		/// * item_id
+		///
+		/// * sender
+		///
+		/// * spender
+		///
+		/// * amount
+		Approved(CollectionId, TokenId, CrossAccountId, CrossAccountId, u128),
+	}
 );
 
 decl_module! {
-    pub struct Module<T: Config> for enum Call 
-    where 
-        origin: T::Origin
-    {
-        fn deposit_event() = default;
-        type Error = Error<T>;
+	pub struct Module<T: Config> for enum Call
+	where
+		origin: T::Origin
+	{
+		fn deposit_event() = default;
+		type Error = Error<T>;
 
-        fn on_initialize(_now: T::BlockNumber) -> Weight {
-            0
-        }
+		fn on_initialize(_now: T::BlockNumber) -> Weight {
+			0
+		}
 
-        /// This method creates a Collection of NFTs. Each Token may have multiple properties encoded as an array of bytes of certain length. The initial owner and admin of the collection are set to the address that signed the transaction. Both addresses can be changed later.
-        /// 
-        /// # Permissions
-        /// 
-        /// * Anyone.
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_name: UTF-16 string with collection name (limit 64 characters), will be stored as zero-terminated.
-        /// 
-        /// * collection_description: UTF-16 string with collection description (limit 256 characters), will be stored as zero-terminated.
-        /// 
-        /// * token_prefix: UTF-8 string with token prefix.
-        /// 
-        /// * mode: [CollectionMode] collection type and type dependent data.
-        // returns collection ID
-        #[weight = <T as Config>::WeightInfo::create_collection()]
-        #[transactional]
-        pub fn create_collection(origin,
-                                 collection_name: Vec<u16>,
-                                 collection_description: Vec<u16>,
-                                 token_prefix: Vec<u8>,
-                                 mode: CollectionMode) -> DispatchResult {
+		/// This method creates a Collection of NFTs. Each Token may have multiple properties encoded as an array of bytes of certain length. The initial owner and admin of the collection are set to the address that signed the transaction. Both addresses can be changed later.
+		///
+		/// # Permissions
+		///
+		/// * Anyone.
+		///
+		/// # Arguments
+		///
+		/// * collection_name: UTF-16 string with collection name (limit 64 characters), will be stored as zero-terminated.
+		///
+		/// * collection_description: UTF-16 string with collection description (limit 256 characters), will be stored as zero-terminated.
+		///
+		/// * token_prefix: UTF-8 string with token prefix.
+		///
+		/// * mode: [CollectionMode] collection type and type dependent data.
+		// returns collection ID
+		#[weight = <T as Config>::WeightInfo::create_collection()]
+		#[transactional]
+		pub fn create_collection(origin,
+								 collection_name: Vec<u16>,
+								 collection_description: Vec<u16>,
+								 token_prefix: Vec<u8>,
+								 mode: CollectionMode) -> DispatchResult {
 
-            // Anyone can create a collection
-            let who = ensure_signed(origin)?;
+			// Anyone can create a collection
+			let who = ensure_signed(origin)?;
 
-            // Take a (non-refundable) deposit of collection creation
-            let mut imbalance = <<<T as Config>::Currency as Currency<T::AccountId>>::PositiveImbalance>::zero();
-            imbalance.subsume(<<T as Config>::Currency as Currency<T::AccountId>>::deposit_creating(
-                &T::TreasuryAccountId::get(),
-                T::CollectionCreationPrice::get(),
-            ));
-            <T as Config>::Currency::settle(
-                &who,
-                imbalance,
-                WithdrawReasons::TRANSFER,
-                ExistenceRequirement::KeepAlive,
-            ).map_err(|_| Error::<T>::NoPermission)?;
+			// Take a (non-refundable) deposit of collection creation
+			let mut imbalance = <<<T as Config>::Currency as Currency<T::AccountId>>::PositiveImbalance>::zero();
+			imbalance.subsume(<<T as Config>::Currency as Currency<T::AccountId>>::deposit_creating(
+				&T::TreasuryAccountId::get(),
+				T::CollectionCreationPrice::get(),
+			));
+			<T as Config>::Currency::settle(
+				&who,
+				imbalance,
+				WithdrawReasons::TRANSFER,
+				ExistenceRequirement::KeepAlive,
+			).map_err(|_| Error::<T>::NoPermission)?;
 
-            let decimal_points = match mode {
-                CollectionMode::Fungible(points) => points,
-                _ => 0
-            };
+			let decimal_points = match mode {
+				CollectionMode::Fungible(points) => points,
+				_ => 0
+			};
 
-            let chain_limit = ChainLimit::get();
+			let chain_limit = ChainLimit::get();
 
-            let created_count = CreatedCollectionCount::get();
-            let destroyed_count = DestroyedCollectionCount::get();
+			let created_count = CreatedCollectionCount::get();
+			let destroyed_count = DestroyedCollectionCount::get();
 
-            // bound Total number of collections
-            ensure!(created_count - destroyed_count < chain_limit.collection_numbers_limit, Error::<T>::TotalCollectionsLimitExceeded);
+			// bound Total number of collections
+			ensure!(created_count - destroyed_count < chain_limit.collection_numbers_limit, Error::<T>::TotalCollectionsLimitExceeded);
 
-            // check params
-            ensure!(decimal_points <= MAX_DECIMAL_POINTS, Error::<T>::CollectionDecimalPointLimitExceeded);
-            ensure!(collection_name.len() <= 64, Error::<T>::CollectionNameLimitExceeded);
-            ensure!(collection_description.len() <= 256, Error::<T>::CollectionDescriptionLimitExceeded);
-            ensure!(token_prefix.len() <= 16, Error::<T>::CollectionTokenPrefixLimitExceeded);
+			// check params
+			ensure!(decimal_points <= MAX_DECIMAL_POINTS, Error::<T>::CollectionDecimalPointLimitExceeded);
+			ensure!(collection_name.len() <= 64, Error::<T>::CollectionNameLimitExceeded);
+			ensure!(collection_description.len() <= 256, Error::<T>::CollectionDescriptionLimitExceeded);
+			ensure!(token_prefix.len() <= 16, Error::<T>::CollectionTokenPrefixLimitExceeded);
 
-            // Generate next collection ID
-            let next_id = created_count
-                .checked_add(1)
-                .ok_or(Error::<T>::NumOverflow)?;
+			// Generate next collection ID
+			let next_id = created_count
+				.checked_add(1)
+				.ok_or(Error::<T>::NumOverflow)?;
 
-            CreatedCollectionCount::put(next_id);
+			CreatedCollectionCount::put(next_id);
 
-            let limits = CollectionLimits {
-                sponsored_data_size: chain_limit.custom_data_limit,
-                ..Default::default()
-            };
+			let limits = CollectionLimits {
+				sponsored_data_size: chain_limit.custom_data_limit,
+				..Default::default()
+			};
 
-            // Create new collection
-            let new_collection = Collection {
-                owner: who.clone(),
-                name: collection_name,
-                mode: mode.clone(),
-                mint_mode: false,
-                access: AccessMode::Normal,
-                description: collection_description,
-                decimal_points: decimal_points,
-                token_prefix: token_prefix,
-                offchain_schema: Vec::new(),
-                schema_version: SchemaVersion::ImageURL,
-                sponsorship: SponsorshipState::Disabled,
-                variable_on_chain_schema: Vec::new(),
-                const_on_chain_schema: Vec::new(),
-                limits,
-            };
+			// Create new collection
+			let new_collection = Collection {
+				owner: who.clone(),
+				name: collection_name,
+				mode: mode.clone(),
+				mint_mode: false,
+				access: AccessMode::Normal,
+				description: collection_description,
+				decimal_points,
+				token_prefix,
+				offchain_schema: Vec::new(),
+				schema_version: SchemaVersion::ImageURL,
+				sponsorship: SponsorshipState::Disabled,
+				variable_on_chain_schema: Vec::new(),
+				const_on_chain_schema: Vec::new(),
+				limits,
+			};
 
-            // Add new collection to map
-            <CollectionById<T>>::insert(next_id, new_collection);
+			// Add new collection to map
+			<CollectionById<T>>::insert(next_id, new_collection);
 
-            // call event
-            Self::deposit_event(RawEvent::CollectionCreated(next_id, mode.into(), who));
+			// call event
+			Self::deposit_event(RawEvent::CollectionCreated(next_id, mode.id(), who));
 
-            Ok(())
-        }
+			Ok(())
+		}
 
-        /// **DANGEROUS**: Destroys collection and all NFTs within this collection. Users irrecoverably lose their assets and may lose real money.
-        /// 
-        /// # Permissions
-        /// 
-        /// * Collection Owner.
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id: collection to destroy.
-        #[weight = <T as Config>::WeightInfo::destroy_collection()]
-        #[transactional]
-        pub fn destroy_collection(origin, collection_id: CollectionId) -> DispatchResult {
+		/// **DANGEROUS**: Destroys collection and all NFTs within this collection. Users irrecoverably lose their assets and may lose real money.
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner.
+		///
+		/// # Arguments
+		///
+		/// * collection_id: collection to destroy.
+		#[weight = <T as Config>::WeightInfo::destroy_collection()]
+		#[transactional]
+		pub fn destroy_collection(origin, collection_id: CollectionId) -> DispatchResult {
 
-            let sender = ensure_signed(origin)?;
-            let collection = Self::get_collection(collection_id)?;
-            Self::check_owner_permissions(&collection, &sender)?;
-            if !collection.limits.owner_can_destroy {
-                fail!(Error::<T>::NoPermission);
-            }
+			let sender = ensure_signed(origin)?;
+			let collection = Self::get_collection(collection_id)?;
+			Self::check_owner_permissions(&collection, &sender)?;
+			if !collection.limits.owner_can_destroy {
+				fail!(Error::<T>::NoPermission);
+			}
 
-            <AddressTokens<T>>::remove_prefix(collection_id);
-            <Allowances<T>>::remove_prefix(collection_id);
-            <Balance<T>>::remove_prefix(collection_id);
-            <ItemListIndex>::remove(collection_id);
-            <AdminList<T>>::remove(collection_id);
-            <CollectionById<T>>::remove(collection_id);
-            <WhiteList<T>>::remove_prefix(collection_id);
+			<AddressTokens<T>>::remove_prefix(collection_id);
+			<Allowances<T>>::remove_prefix(collection_id);
+			<Balance<T>>::remove_prefix(collection_id);
+			<ItemListIndex>::remove(collection_id);
+			<AdminList<T>>::remove(collection_id);
+			<CollectionById<T>>::remove(collection_id);
+			<WhiteList<T>>::remove_prefix(collection_id);
 
-            <NftItemList<T>>::remove_prefix(collection_id);
-            <FungibleItemList<T>>::remove_prefix(collection_id);
-            <ReFungibleItemList<T>>::remove_prefix(collection_id);
+			<NftItemList<T>>::remove_prefix(collection_id);
+			<FungibleItemList<T>>::remove_prefix(collection_id);
+			<ReFungibleItemList<T>>::remove_prefix(collection_id);
 
-            <NftTransferBasket<T>>::remove_prefix(collection_id);
-            <FungibleTransferBasket<T>>::remove_prefix(collection_id);
-            <ReFungibleTransferBasket<T>>::remove_prefix(collection_id);
+			<NftTransferBasket<T>>::remove_prefix(collection_id);
+			<FungibleTransferBasket<T>>::remove_prefix(collection_id);
+			<ReFungibleTransferBasket<T>>::remove_prefix(collection_id);
 
-            <VariableMetaDataBasket<T>>::remove_prefix(collection_id);
+			<VariableMetaDataBasket<T>>::remove_prefix(collection_id);
 
-            DestroyedCollectionCount::put(DestroyedCollectionCount::get()
-                .checked_add(1)
-                .ok_or(Error::<T>::NumOverflow)?);
+			DestroyedCollectionCount::put(DestroyedCollectionCount::get()
+				.checked_add(1)
+				.ok_or(Error::<T>::NumOverflow)?);
 
-            Ok(())
-        }
+			Ok(())
+		}
 
-        /// Add an address to white list.
-        /// 
-        /// # Permissions
-        /// 
-        /// * Collection Owner
-        /// * Collection Admin
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id.
-        /// 
-        /// * address.
-        #[weight = <T as Config>::WeightInfo::add_to_white_list()]
-        #[transactional]
-        pub fn add_to_white_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{
+		/// Add an address to white list.
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner
+		/// * Collection Admin
+		///
+		/// # Arguments
+		///
+		/// * collection_id.
+		///
+		/// * address.
+		#[weight = <T as Config>::WeightInfo::add_to_white_list()]
+		#[transactional]
+		pub fn add_to_white_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{
 
-            let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-            let collection = Self::get_collection(collection_id)?;
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+			let collection = Self::get_collection(collection_id)?;
 
-            Self::toggle_white_list_internal(
-                &sender,
-                &collection,
-                &address,
-                true,
-            )?;
+			Self::toggle_white_list_internal(
+				&sender,
+				&collection,
+				&address,
+				true,
+			)?;
 
-            Ok(())
-        }
+			Ok(())
+		}
 
-        /// Remove an address from white list.
-        /// 
-        /// # Permissions
-        /// 
-        /// * Collection Owner
-        /// * Collection Admin
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id.
-        /// 
-        /// * address.
-        #[weight = <T as Config>::WeightInfo::remove_from_white_list()]
-        #[transactional]
-        pub fn remove_from_white_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{
+		/// Remove an address from white list.
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner
+		/// * Collection Admin
+		///
+		/// # Arguments
+		///
+		/// * collection_id.
+		///
+		/// * address.
+		#[weight = <T as Config>::WeightInfo::remove_from_white_list()]
+		#[transactional]
+		pub fn remove_from_white_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{
 
-            let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-            let collection = Self::get_collection(collection_id)?;
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+			let collection = Self::get_collection(collection_id)?;
 
-            Self::toggle_white_list_internal(
-                &sender,
-                &collection,
-                &address,
-                false,
-            )?;
+			Self::toggle_white_list_internal(
+				&sender,
+				&collection,
+				&address,
+				false,
+			)?;
 
-            Ok(())
-        }
+			Ok(())
+		}
 
-        /// Toggle between normal and white list access for the methods with access for `Anyone`.
-        /// 
-        /// # Permissions
-        /// 
-        /// * Collection Owner.
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id.
-        /// 
-        /// * mode: [AccessMode]
-        #[weight = <T as Config>::WeightInfo::set_public_access_mode()]
-        #[transactional]
-        pub fn set_public_access_mode(origin, collection_id: CollectionId, mode: AccessMode) -> DispatchResult
-        {
-            let sender = ensure_signed(origin)?;
+		/// Toggle between normal and white list access for the methods with access for `Anyone`.
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner.
+		///
+		/// # Arguments
+		///
+		/// * collection_id.
+		///
+		/// * mode: [AccessMode]
+		#[weight = <T as Config>::WeightInfo::set_public_access_mode()]
+		#[transactional]
+		pub fn set_public_access_mode(origin, collection_id: CollectionId, mode: AccessMode) -> DispatchResult
+		{
+			let sender = ensure_signed(origin)?;
 
-            let mut target_collection = Self::get_collection(collection_id)?;
-            Self::check_owner_permissions(&target_collection, &sender)?;
-            target_collection.access = mode;
-            Self::save_collection(target_collection);
+			let mut target_collection = Self::get_collection(collection_id)?;
+			Self::check_owner_permissions(&target_collection, &sender)?;
+			target_collection.access = mode;
+			Self::save_collection(target_collection);
 
-            Ok(())
-        }
+			Ok(())
+		}
 
-        /// Allows Anyone to create tokens if:
-        /// * White List is enabled, and
-        /// * Address is added to white list, and
-        /// * This method was called with True parameter
-        /// 
-        /// # Permissions
-        /// * Collection Owner
-        ///
-        /// # Arguments
-        /// 
-        /// * collection_id.
-        /// 
-        /// * mint_permission: Boolean parameter. If True, allows minting to Anyone with conditions above.
-        #[weight = <T as Config>::WeightInfo::set_mint_permission()]
-        #[transactional]
-        pub fn set_mint_permission(origin, collection_id: CollectionId, mint_permission: bool) -> DispatchResult
-        {
-            let sender = ensure_signed(origin)?;
+		/// Allows Anyone to create tokens if:
+		/// * White List is enabled, and
+		/// * Address is added to white list, and
+		/// * This method was called with True parameter
+		///
+		/// # Permissions
+		/// * Collection Owner
+		///
+		/// # Arguments
+		///
+		/// * collection_id.
+		///
+		/// * mint_permission: Boolean parameter. If True, allows minting to Anyone with conditions above.
+		#[weight = <T as Config>::WeightInfo::set_mint_permission()]
+		#[transactional]
+		pub fn set_mint_permission(origin, collection_id: CollectionId, mint_permission: bool) -> DispatchResult
+		{
+			let sender = ensure_signed(origin)?;
 
-            let mut target_collection = Self::get_collection(collection_id)?;
-            Self::check_owner_permissions(&target_collection, &sender)?;
-            target_collection.mint_mode = mint_permission;
-            Self::save_collection(target_collection);
+			let mut target_collection = Self::get_collection(collection_id)?;
+			Self::check_owner_permissions(&target_collection, &sender)?;
+			target_collection.mint_mode = mint_permission;
+			Self::save_collection(target_collection);
 
-            Ok(())
-        }
+			Ok(())
+		}
 
-        /// Change the owner of the collection.
-        /// 
-        /// # Permissions
-        /// 
-        /// * Collection Owner.
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id.
-        /// 
-        /// * new_owner.
-        #[weight = <T as Config>::WeightInfo::change_collection_owner()]
-        #[transactional]
-        pub fn change_collection_owner(origin, collection_id: CollectionId, new_owner: T::AccountId) -> DispatchResult {
+		/// Change the owner of the collection.
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner.
+		///
+		/// # Arguments
+		///
+		/// * collection_id.
+		///
+		/// * new_owner.
+		#[weight = <T as Config>::WeightInfo::change_collection_owner()]
+		#[transactional]
+		pub fn change_collection_owner(origin, collection_id: CollectionId, new_owner: T::AccountId) -> DispatchResult {
 
-            let sender = ensure_signed(origin)?;
-            let mut target_collection = Self::get_collection(collection_id)?;
-            Self::check_owner_permissions(&target_collection, &sender)?;
-            target_collection.owner = new_owner;
-            Self::save_collection(target_collection);
+			let sender = ensure_signed(origin)?;
+			let mut target_collection = Self::get_collection(collection_id)?;
+			Self::check_owner_permissions(&target_collection, &sender)?;
+			target_collection.owner = new_owner;
+			Self::save_collection(target_collection);
 
-            Ok(())
-        }
+			Ok(())
+		}
 
-        /// Adds an admin of the Collection.
-        /// NFT Collection can be controlled by multiple admin addresses (some which can also be servers, for example). Admins can issue and burn NFTs, as well as add and remove other admins, but cannot change NFT or Collection ownership. 
-        /// 
-        /// # Permissions
-        /// 
-        /// * Collection Owner.
-        /// * Collection Admin.
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id: ID of the Collection to add admin for.
-        /// 
-        /// * new_admin_id: Address of new admin to add.
-        #[weight = <T as Config>::WeightInfo::add_collection_admin()]
-        #[transactional]
-        pub fn add_collection_admin(origin, collection_id: CollectionId, new_admin_id: T::CrossAccountId) -> DispatchResult {
-            let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-            let collection = Self::get_collection(collection_id)?;
-            Self::check_owner_or_admin_permissions(&collection, &sender)?;
-            let mut admin_arr = <AdminList<T>>::get(collection_id);
+		/// Adds an admin of the Collection.
+		/// NFT Collection can be controlled by multiple admin addresses (some which can also be servers, for example). Admins can issue and burn NFTs, as well as add and remove other admins, but cannot change NFT or Collection ownership.
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner.
+		/// * Collection Admin.
+		///
+		/// # Arguments
+		///
+		/// * collection_id: ID of the Collection to add admin for.
+		///
+		/// * new_admin_id: Address of new admin to add.
+		#[weight = <T as Config>::WeightInfo::add_collection_admin()]
+		#[transactional]
+		pub fn add_collection_admin(origin, collection_id: CollectionId, new_admin_id: T::CrossAccountId) -> DispatchResult {
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+			let collection = Self::get_collection(collection_id)?;
+			Self::check_owner_or_admin_permissions(&collection, &sender)?;
+			let mut admin_arr = <AdminList<T>>::get(collection_id);
 
-            match admin_arr.binary_search(&new_admin_id) {
-                Ok(_) => {},
-                Err(idx) => {
-                    let limits = ChainLimit::get();
-                    ensure!(admin_arr.len() < limits.collections_admins_limit as usize, Error::<T>::CollectionAdminsLimitExceeded);
-                    admin_arr.insert(idx, new_admin_id);
-                    <AdminList<T>>::insert(collection_id, admin_arr);
-                }
-            }
-            Ok(())
-        }
+			match admin_arr.binary_search(&new_admin_id) {
+				Ok(_) => {},
+				Err(idx) => {
+					let limits = ChainLimit::get();
+					ensure!(admin_arr.len() < limits.collections_admins_limit as usize, Error::<T>::CollectionAdminsLimitExceeded);
+					admin_arr.insert(idx, new_admin_id);
+					<AdminList<T>>::insert(collection_id, admin_arr);
+				}
+			}
+			Ok(())
+		}
 
-        /// Remove admin address of the Collection. An admin address can remove itself. List of admins may become empty, in which case only Collection Owner will be able to add an Admin.
-        ///
-        /// # Permissions
-        /// 
-        /// * Collection Owner.
-        /// * Collection Admin.
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id: ID of the Collection to remove admin for.
-        /// 
-        /// * account_id: Address of admin to remove.
-        #[weight = <T as Config>::WeightInfo::remove_collection_admin()]
-        #[transactional]
-        pub fn remove_collection_admin(origin, collection_id: CollectionId, account_id: T::CrossAccountId) -> DispatchResult {
-            let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-            let collection = Self::get_collection(collection_id)?;
-            Self::check_owner_or_admin_permissions(&collection, &sender)?;
-            let mut admin_arr = <AdminList<T>>::get(collection_id);
+		/// Remove admin address of the Collection. An admin address can remove itself. List of admins may become empty, in which case only Collection Owner will be able to add an Admin.
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner.
+		/// * Collection Admin.
+		///
+		/// # Arguments
+		///
+		/// * collection_id: ID of the Collection to remove admin for.
+		///
+		/// * account_id: Address of admin to remove.
+		#[weight = <T as Config>::WeightInfo::remove_collection_admin()]
+		#[transactional]
+		pub fn remove_collection_admin(origin, collection_id: CollectionId, account_id: T::CrossAccountId) -> DispatchResult {
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+			let collection = Self::get_collection(collection_id)?;
+			Self::check_owner_or_admin_permissions(&collection, &sender)?;
+			let mut admin_arr = <AdminList<T>>::get(collection_id);
 
-            match admin_arr.binary_search(&account_id) {
-                Ok(idx) => {
-                    admin_arr.remove(idx);
-                    <AdminList<T>>::insert(collection_id, admin_arr);
-                },
-                Err(_) => {}
-            }
-            Ok(())
-        }
+			if let Ok(idx) = admin_arr.binary_search(&account_id) {
+				admin_arr.remove(idx);
+				<AdminList<T>>::insert(collection_id, admin_arr);
+			}
+			Ok(())
+		}
 
-        /// # Permissions
-        /// 
-        /// * Collection Owner
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id.
-        /// 
-        /// * new_sponsor.
-        #[weight = <T as Config>::WeightInfo::set_collection_sponsor()]
-        #[transactional]
-        pub fn set_collection_sponsor(origin, collection_id: CollectionId, new_sponsor: T::AccountId) -> DispatchResult {
-            let sender = ensure_signed(origin)?;
-            let mut target_collection = Self::get_collection(collection_id)?;
-            Self::check_owner_permissions(&target_collection, &sender)?;
+		/// # Permissions
+		///
+		/// * Collection Owner
+		///
+		/// # Arguments
+		///
+		/// * collection_id.
+		///
+		/// * new_sponsor.
+		#[weight = <T as Config>::WeightInfo::set_collection_sponsor()]
+		#[transactional]
+		pub fn set_collection_sponsor(origin, collection_id: CollectionId, new_sponsor: T::AccountId) -> DispatchResult {
+			let sender = ensure_signed(origin)?;
+			let mut target_collection = Self::get_collection(collection_id)?;
+			Self::check_owner_permissions(&target_collection, &sender)?;
 
-            target_collection.sponsorship = SponsorshipState::Unconfirmed(new_sponsor);
-            Self::save_collection(target_collection);
+			target_collection.sponsorship = SponsorshipState::Unconfirmed(new_sponsor);
+			Self::save_collection(target_collection);
 
-            Ok(())
-        }
+			Ok(())
+		}
 
-        /// # Permissions
-        /// 
-        /// * Sponsor.
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id.
-        #[weight = <T as Config>::WeightInfo::confirm_sponsorship()]
-        #[transactional]
-        pub fn confirm_sponsorship(origin, collection_id: CollectionId) -> DispatchResult {
-            let sender = ensure_signed(origin)?;
+		/// # Permissions
+		///
+		/// * Sponsor.
+		///
+		/// # Arguments
+		///
+		/// * collection_id.
+		#[weight = <T as Config>::WeightInfo::confirm_sponsorship()]
+		#[transactional]
+		pub fn confirm_sponsorship(origin, collection_id: CollectionId) -> DispatchResult {
+			let sender = ensure_signed(origin)?;
 
-            let mut target_collection = Self::get_collection(collection_id)?;
-            ensure!(
-                target_collection.sponsorship.pending_sponsor() == Some(&sender),
-                Error::<T>::ConfirmUnsetSponsorFail
-            );
+			let mut target_collection = Self::get_collection(collection_id)?;
+			ensure!(
+				target_collection.sponsorship.pending_sponsor() == Some(&sender),
+				Error::<T>::ConfirmUnsetSponsorFail
+			);
 
-            target_collection.sponsorship = SponsorshipState::Confirmed(sender);
-            Self::save_collection(target_collection);
+			target_collection.sponsorship = SponsorshipState::Confirmed(sender);
+			Self::save_collection(target_collection);
 
-            Ok(())
-        }
+			Ok(())
+		}
 
-        /// Switch back to pay-per-own-transaction model.
-        ///
-        /// # Permissions
-        ///
-        /// * Collection owner.
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id.
-        #[weight = <T as Config>::WeightInfo::remove_collection_sponsor()]
-        #[transactional]
-        pub fn remove_collection_sponsor(origin, collection_id: CollectionId) -> DispatchResult {
-            let sender = ensure_signed(origin)?;
+		/// Switch back to pay-per-own-transaction model.
+		///
+		/// # Permissions
+		///
+		/// * Collection owner.
+		///
+		/// # Arguments
+		///
+		/// * collection_id.
+		#[weight = <T as Config>::WeightInfo::remove_collection_sponsor()]
+		#[transactional]
+		pub fn remove_collection_sponsor(origin, collection_id: CollectionId) -> DispatchResult {
+			let sender = ensure_signed(origin)?;
 
-            let mut target_collection = Self::get_collection(collection_id)?;
-            Self::check_owner_permissions(&target_collection, &sender)?;
+			let mut target_collection = Self::get_collection(collection_id)?;
+			Self::check_owner_permissions(&target_collection, &sender)?;
 
-            target_collection.sponsorship = SponsorshipState::Disabled;
-            Self::save_collection(target_collection);
+			target_collection.sponsorship = SponsorshipState::Disabled;
+			Self::save_collection(target_collection);
 
-            Ok(())
-        }
+			Ok(())
+		}
 
-        /// This method creates a concrete instance of NFT Collection created with CreateCollection method.
-        /// 
-        /// # Permissions
-        /// 
-        /// * Collection Owner.
-        /// * Collection Admin.
-        /// * Anyone if
-        ///     * White List is enabled, and
-        ///     * Address is added to white list, and
-        ///     * MintPermission is enabled (see SetMintPermission method)
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id: ID of the collection.
-        /// 
-        /// * owner: Address, initial owner of the NFT.
-        ///
-        /// * data: Token data to store on chain.
-        // #[weight =
-        // (130_000_000 as Weight)
-        // .saturating_add((2135 as Weight).saturating_mul((properties.len() as u64) as Weight))
-        // .saturating_add(RocksDbWeight::get().reads(10 as Weight))
-        // .saturating_add(RocksDbWeight::get().writes(8 as Weight))]
+		/// This method creates a concrete instance of NFT Collection created with CreateCollection method.
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner.
+		/// * Collection Admin.
+		/// * Anyone if
+		///     * White List is enabled, and
+		///     * Address is added to white list, and
+		///     * MintPermission is enabled (see SetMintPermission method)
+		///
+		/// # Arguments
+		///
+		/// * collection_id: ID of the collection.
+		///
+		/// * owner: Address, initial owner of the NFT.
+		///
+		/// * data: Token data to store on chain.
+		// #[weight =
+		// (130_000_000 as Weight)
+		// .saturating_add((2135 as Weight).saturating_mul((properties.len() as u64) as Weight))
+		// .saturating_add(RocksDbWeight::get().reads(10 as Weight))
+		// .saturating_add(RocksDbWeight::get().writes(8 as Weight))]
 
-        #[weight = <T as Config>::WeightInfo::create_item(data.len())]
-        #[transactional]
-        pub fn create_item(origin, collection_id: CollectionId, owner: T::CrossAccountId, data: CreateItemData) -> DispatchResult {
-            let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-            let collection = Self::get_collection(collection_id)?;
+		#[weight = <T as Config>::WeightInfo::create_item(data.data_size())]
+		#[transactional]
+		pub fn create_item(origin, collection_id: CollectionId, owner: T::CrossAccountId, data: CreateItemData) -> DispatchResult {
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+			let collection = Self::get_collection(collection_id)?;
 
-            Self::create_item_internal(&sender, &collection, &owner, data)?;
+			Self::create_item_internal(&sender, &collection, &owner, data)?;
 
-            Self::submit_logs(collection)?;
-            Ok(())
-        }
+			Self::submit_logs(collection)?;
+			Ok(())
+		}
 
-        /// This method creates multiple items in a collection created with CreateCollection method.
-        /// 
-        /// # Permissions
-        /// 
-        /// * Collection Owner.
-        /// * Collection Admin.
-        /// * Anyone if
-        ///     * White List is enabled, and
-        ///     * Address is added to white list, and
-        ///     * MintPermission is enabled (see SetMintPermission method)
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id: ID of the collection.
-        /// 
-        /// * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].
-        /// 
-        /// * owner: Address, initial owner of the NFT.
-        #[weight = <T as Config>::WeightInfo::create_item(items_data.into_iter()
-                               .map(|data| { data.len() })
-                               .sum())]
-        #[transactional]
-        pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResult {
+		/// This method creates multiple items in a collection created with CreateCollection method.
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner.
+		/// * Collection Admin.
+		/// * Anyone if
+		///     * White List is enabled, and
+		///     * Address is added to white list, and
+		///     * MintPermission is enabled (see SetMintPermission method)
+		///
+		/// # Arguments
+		///
+		/// * collection_id: ID of the collection.
+		///
+		/// * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].
+		///
+		/// * owner: Address, initial owner of the NFT.
+		#[weight = <T as Config>::WeightInfo::create_item(items_data.iter()
+							   .map(|data| { data.data_size() })
+							   .sum())]
+		#[transactional]
+		pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResult {
 
-            ensure!(items_data.len() > 0, Error::<T>::EmptyArgument);
-            let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-            let collection = Self::get_collection(collection_id)?;
+			ensure!(!items_data.is_empty(), Error::<T>::EmptyArgument);
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+			let collection = Self::get_collection(collection_id)?;
 
-            Self::create_multiple_items_internal(&sender, &collection, &owner, items_data)?;
+			Self::create_multiple_items_internal(&sender, &collection, &owner, items_data)?;
 
-            Self::submit_logs(collection)?;
-            Ok(())
-        }
+			Self::submit_logs(collection)?;
+			Ok(())
+		}
 
-        /// Destroys a concrete instance of NFT.
-        /// 
-        /// # Permissions
-        /// 
-        /// * Collection Owner.
-        /// * Collection Admin.
-        /// * Current NFT Owner.
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id: ID of the collection.
-        /// 
-        /// * item_id: ID of NFT to burn.
-        #[weight = <T as Config>::WeightInfo::burn_item()]
-        #[transactional]
-        pub fn burn_item(origin, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResult {
+		/// Destroys a concrete instance of NFT.
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner.
+		/// * Collection Admin.
+		/// * Current NFT Owner.
+		///
+		/// # Arguments
+		///
+		/// * collection_id: ID of the collection.
+		///
+		/// * item_id: ID of NFT to burn.
+		#[weight = <T as Config>::WeightInfo::burn_item()]
+		#[transactional]
+		pub fn burn_item(origin, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResult {
 
-            let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-            let target_collection = Self::get_collection(collection_id)?;
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+			let target_collection = Self::get_collection(collection_id)?;
 
-            Self::burn_item_internal(&sender, &target_collection, item_id, value)?;
+			Self::burn_item_internal(&sender, &target_collection, item_id, value)?;
 
-            Self::submit_logs(target_collection)?;
-            Ok(())
-        }
+			Self::submit_logs(target_collection)?;
+			Ok(())
+		}
 
-        /// Change ownership of the token.
-        /// 
-        /// # Permissions
-        /// 
-        /// * Collection Owner
-        /// * Collection Admin
-        /// * Current NFT owner
-        ///
-        /// # Arguments
-        /// 
-        /// * recipient: Address of token recipient.
-        /// 
-        /// * collection_id.
-        /// 
-        /// * item_id: ID of the item
-        ///     * Non-Fungible Mode: Required.
-        ///     * Fungible Mode: Ignored.
-        ///     * Re-Fungible Mode: Required.
-        /// 
-        /// * value: Amount to transfer.
-        ///     * Non-Fungible Mode: Ignored
-        ///     * Fungible Mode: Must specify transferred amount
-        ///     * Re-Fungible Mode: Must specify transferred portion (between 0 and 1)
-        #[weight = <T as Config>::WeightInfo::transfer()]
-        #[transactional]
-        pub fn transfer(origin, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResult {
-            let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-            let collection = Self::get_collection(collection_id)?;
+		/// Change ownership of the token.
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner
+		/// * Collection Admin
+		/// * Current NFT owner
+		///
+		/// # Arguments
+		///
+		/// * recipient: Address of token recipient.
+		///
+		/// * collection_id.
+		///
+		/// * item_id: ID of the item
+		///     * Non-Fungible Mode: Required.
+		///     * Fungible Mode: Ignored.
+		///     * Re-Fungible Mode: Required.
+		///
+		/// * value: Amount to transfer.
+		///     * Non-Fungible Mode: Ignored
+		///     * Fungible Mode: Must specify transferred amount
+		///     * Re-Fungible Mode: Must specify transferred portion (between 0 and 1)
+		#[weight = <T as Config>::WeightInfo::transfer()]
+		#[transactional]
+		pub fn transfer(origin, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResult {
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+			let collection = Self::get_collection(collection_id)?;
 
-            Self::transfer_internal(&sender, &recipient, &collection, item_id, value)?;
+			Self::transfer_internal(&sender, &recipient, &collection, item_id, value)?;
 
-            Self::submit_logs(collection)?;
-            Ok(())
-        }
+			Self::submit_logs(collection)?;
+			Ok(())
+		}
 
-        /// Set, change, or remove approved address to transfer the ownership of the NFT.
-        /// 
-        /// # Permissions
-        /// 
-        /// * Collection Owner
-        /// * Collection Admin
-        /// * Current NFT owner
-        /// 
-        /// # Arguments
-        /// 
-        /// * approved: Address that is approved to transfer this NFT or zero (if needed to remove approval).
-        /// 
-        /// * collection_id.
-        /// 
-        /// * item_id: ID of the item.
-        #[weight = <T as Config>::WeightInfo::approve()]
-        #[transactional]
-        pub fn approve(origin, spender: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, amount: u128) -> DispatchResult {
-            let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-            let collection = Self::get_collection(collection_id)?;
+		/// Set, change, or remove approved address to transfer the ownership of the NFT.
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner
+		/// * Collection Admin
+		/// * Current NFT owner
+		///
+		/// # Arguments
+		///
+		/// * approved: Address that is approved to transfer this NFT or zero (if needed to remove approval).
+		///
+		/// * collection_id.
+		///
+		/// * item_id: ID of the item.
+		#[weight = <T as Config>::WeightInfo::approve()]
+		#[transactional]
+		pub fn approve(origin, spender: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, amount: u128) -> DispatchResult {
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+			let collection = Self::get_collection(collection_id)?;
 
-            Self::approve_internal(&sender, &spender, &collection, item_id, amount)?;
+			Self::approve_internal(&sender, &spender, &collection, item_id, amount)?;
 
-            Self::submit_logs(collection)?;
-            Ok(())
-        }
-        
-        /// Change ownership of a NFT on behalf of the owner. See Approve method for additional information. After this method executes, the approval is removed so that the approved address will not be able to transfer this NFT again from this owner.
-        /// 
-        /// # Permissions
-        /// * Collection Owner
-        /// * Collection Admin
-        /// * Current NFT owner
-        /// * Address approved by current NFT owner
-        /// 
-        /// # Arguments
-        /// 
-        /// * from: Address that owns token.
-        /// 
-        /// * recipient: Address of token recipient.
-        /// 
-        /// * collection_id.
-        /// 
-        /// * item_id: ID of the item.
-        /// 
-        /// * value: Amount to transfer.
-        #[weight = <T as Config>::WeightInfo::transfer_from()]
-        #[transactional]
-        pub fn transfer_from(origin, from: T::CrossAccountId, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128 ) -> DispatchResult {
-            let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-            let collection = Self::get_collection(collection_id)?;
+			Self::submit_logs(collection)?;
+			Ok(())
+		}
 
-            Self::transfer_from_internal(&sender, &from, &recipient, &collection, item_id, value)?;
+		/// Change ownership of a NFT on behalf of the owner. See Approve method for additional information. After this method executes, the approval is removed so that the approved address will not be able to transfer this NFT again from this owner.
+		///
+		/// # Permissions
+		/// * Collection Owner
+		/// * Collection Admin
+		/// * Current NFT owner
+		/// * Address approved by current NFT owner
+		///
+		/// # Arguments
+		///
+		/// * from: Address that owns token.
+		///
+		/// * recipient: Address of token recipient.
+		///
+		/// * collection_id.
+		///
+		/// * item_id: ID of the item.
+		///
+		/// * value: Amount to transfer.
+		#[weight = <T as Config>::WeightInfo::transfer_from()]
+		#[transactional]
+		pub fn transfer_from(origin, from: T::CrossAccountId, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128 ) -> DispatchResult {
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+			let collection = Self::get_collection(collection_id)?;
 
-            Self::submit_logs(collection)?;
-            Ok(())
-        }
-        // #[weight = 0]
-        //     // let no_perm_mes = "You do not have permissions to modify this collection";
-        //     // ensure!(<ApprovedList<T>>::contains_key((collection_id, item_id)), no_perm_mes);
-        //     // let list_itm = <ApprovedList<T>>::get((collection_id, item_id));
-        //     // ensure!(list_itm.contains(&new_owner.clone()), no_perm_mes);
+			Self::transfer_from_internal(&sender, &from, &recipient, &collection, item_id, value)?;
 
-        //     // // on_nft_received  call
+			Self::submit_logs(collection)?;
+			Ok(())
+		}
+		// #[weight = 0]
+		//     // let no_perm_mes = "You do not have permissions to modify this collection";
+		//     // ensure!(<ApprovedList<T>>::contains_key((collection_id, item_id)), no_perm_mes);
+		//     // let list_itm = <ApprovedList<T>>::get((collection_id, item_id));
+		//     // ensure!(list_itm.contains(&new_owner.clone()), no_perm_mes);
 
-        //     // Self::transfer(origin, collection_id, item_id, new_owner)?;
+		//     // // on_nft_received  call
 
-        //     Ok(())
-        // }
+		//     // Self::transfer(origin, collection_id, item_id, new_owner)?;
 
-        /// Set off-chain data schema.
-        /// 
-        /// # Permissions
-        /// 
-        /// * Collection Owner
-        /// * Collection Admin
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id.
-        /// 
-        /// * schema: String representing the offchain data schema.
-        #[weight = <T as Config>::WeightInfo::set_variable_meta_data()]
-        #[transactional]
-        pub fn set_variable_meta_data (
-            origin,
-            collection_id: CollectionId,
-            item_id: TokenId,
-            data: Vec<u8>
-        ) -> DispatchResult {
-            let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-            
-            let collection = Self::get_collection(collection_id)?;
+		//     Ok(())
+		// }
 
-            Self::set_variable_meta_data_internal(&sender, &collection, item_id, data)?;
+		/// Set off-chain data schema.
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner
+		/// * Collection Admin
+		///
+		/// # Arguments
+		///
+		/// * collection_id.
+		///
+		/// * schema: String representing the offchain data schema.
+		#[weight = <T as Config>::WeightInfo::set_variable_meta_data()]
+		#[transactional]
+		pub fn set_variable_meta_data (
+			origin,
+			collection_id: CollectionId,
+			item_id: TokenId,
+			data: Vec<u8>
+		) -> DispatchResult {
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 
-            Ok(())
-        }
- 
-        /// Set schema standard
-        /// ImageURL
-        /// Unique
-        /// 
-        /// # Permissions
-        /// 
-        /// * Collection Owner
-        /// * Collection Admin
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id.
-        /// 
-        /// * schema: SchemaVersion: enum
-        #[weight = <T as Config>::WeightInfo::set_schema_version()]
-        #[transactional]
-        pub fn set_schema_version(
-            origin,
-            collection_id: CollectionId,
-            version: SchemaVersion
-        ) -> DispatchResult {
-            let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-            let mut target_collection = Self::get_collection(collection_id)?;
-            Self::check_owner_or_admin_permissions(&target_collection, &sender)?;
-            target_collection.schema_version = version;
-            Self::save_collection(target_collection);
+			let collection = Self::get_collection(collection_id)?;
 
-            Ok(())
-        }
+			Self::set_variable_meta_data_internal(&sender, &collection, item_id, data)?;
 
-        /// Set off-chain data schema.
-        /// 
-        /// # Permissions
-        /// 
-        /// * Collection Owner
-        /// * Collection Admin
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id.
-        /// 
-        /// * schema: String representing the offchain data schema.
-        #[weight = <T as Config>::WeightInfo::set_offchain_schema()]
-        #[transactional]
-        pub fn set_offchain_schema(
-            origin,
-            collection_id: CollectionId,
-            schema: Vec<u8>
-        ) -> DispatchResult {
-            let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-            let mut target_collection = Self::get_collection(collection_id)?;
-            Self::check_owner_or_admin_permissions(&target_collection, &sender)?;
+			Ok(())
+		}
 
-            // check schema limit
-            ensure!(schema.len() as u32 <= ChainLimit::get().offchain_schema_limit, "");
+		/// Set schema standard
+		/// ImageURL
+		/// Unique
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner
+		/// * Collection Admin
+		///
+		/// # Arguments
+		///
+		/// * collection_id.
+		///
+		/// * schema: SchemaVersion: enum
+		#[weight = <T as Config>::WeightInfo::set_schema_version()]
+		#[transactional]
+		pub fn set_schema_version(
+			origin,
+			collection_id: CollectionId,
+			version: SchemaVersion
+		) -> DispatchResult {
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+			let mut target_collection = Self::get_collection(collection_id)?;
+			Self::check_owner_or_admin_permissions(&target_collection, &sender)?;
+			target_collection.schema_version = version;
+			Self::save_collection(target_collection);
 
-            target_collection.offchain_schema = schema;
-            Self::save_collection(target_collection);
+			Ok(())
+		}
 
-            Ok(())
-        }
+		/// Set off-chain data schema.
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner
+		/// * Collection Admin
+		///
+		/// # Arguments
+		///
+		/// * collection_id.
+		///
+		/// * schema: String representing the offchain data schema.
+		#[weight = <T as Config>::WeightInfo::set_offchain_schema()]
+		#[transactional]
+		pub fn set_offchain_schema(
+			origin,
+			collection_id: CollectionId,
+			schema: Vec<u8>
+		) -> DispatchResult {
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+			let mut target_collection = Self::get_collection(collection_id)?;
+			Self::check_owner_or_admin_permissions(&target_collection, &sender)?;
+
+			// check schema limit
+			ensure!(schema.len() as u32 <= ChainLimit::get().offchain_schema_limit, "");
 
-        /// Set const on-chain data schema.
-        /// 
-        /// # Permissions
-        /// 
-        /// * Collection Owner
-        /// * Collection Admin
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id.
-        /// 
-        /// * schema: String representing the const on-chain data schema.
-        #[weight = <T as Config>::WeightInfo::set_const_on_chain_schema()]
-        #[transactional]
-        pub fn set_const_on_chain_schema (
-            origin,
-            collection_id: CollectionId,
-            schema: Vec<u8>
-        ) -> DispatchResult {
-            let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-            let mut target_collection = Self::get_collection(collection_id)?;
-            Self::check_owner_or_admin_permissions(&target_collection, &sender)?;
+			target_collection.offchain_schema = schema;
+			Self::save_collection(target_collection);
+
+			Ok(())
+		}
+
+		/// Set const on-chain data schema.
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner
+		/// * Collection Admin
+		///
+		/// # Arguments
+		///
+		/// * collection_id.
+		///
+		/// * schema: String representing the const on-chain data schema.
+		#[weight = <T as Config>::WeightInfo::set_const_on_chain_schema()]
+		#[transactional]
+		pub fn set_const_on_chain_schema (
+			origin,
+			collection_id: CollectionId,
+			schema: Vec<u8>
+		) -> DispatchResult {
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+			let mut target_collection = Self::get_collection(collection_id)?;
+			Self::check_owner_or_admin_permissions(&target_collection, &sender)?;
 
-            // check schema limit
-            ensure!(schema.len() as u32 <= ChainLimit::get().const_on_chain_schema_limit, "");
+			// check schema limit
+			ensure!(schema.len() as u32 <= ChainLimit::get().const_on_chain_schema_limit, "");
 
-            target_collection.const_on_chain_schema = schema;
-            Self::save_collection(target_collection);
+			target_collection.const_on_chain_schema = schema;
+			Self::save_collection(target_collection);
 
-            Ok(())
-        }
+			Ok(())
+		}
 
-        /// Set variable on-chain data schema.
-        /// 
-        /// # Permissions
-        /// 
-        /// * Collection Owner
-        /// * Collection Admin
-        /// 
-        /// # Arguments
-        /// 
-        /// * collection_id.
-        /// 
-        /// * schema: String representing the variable on-chain data schema.
-        #[weight = <T as Config>::WeightInfo::set_const_on_chain_schema()]
-        #[transactional]
-        pub fn set_variable_on_chain_schema (
-            origin,
-            collection_id: CollectionId,
-            schema: Vec<u8>
-        ) -> DispatchResult {
-            let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-            let mut target_collection = Self::get_collection(collection_id)?;
-            Self::check_owner_or_admin_permissions(&target_collection, &sender)?;
+		/// Set variable on-chain data schema.
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner
+		/// * Collection Admin
+		///
+		/// # Arguments
+		///
+		/// * collection_id.
+		///
+		/// * schema: String representing the variable on-chain data schema.
+		#[weight = <T as Config>::WeightInfo::set_const_on_chain_schema()]
+		#[transactional]
+		pub fn set_variable_on_chain_schema (
+			origin,
+			collection_id: CollectionId,
+			schema: Vec<u8>
+		) -> DispatchResult {
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+			let mut target_collection = Self::get_collection(collection_id)?;
+			Self::check_owner_or_admin_permissions(&target_collection, &sender)?;
 
-            // check schema limit
-            ensure!(schema.len() as u32 <= ChainLimit::get().variable_on_chain_schema_limit, "");
+			// check schema limit
+			ensure!(schema.len() as u32 <= ChainLimit::get().variable_on_chain_schema_limit, "");
 
-            target_collection.variable_on_chain_schema = schema;
-            Self::save_collection(target_collection);
+			target_collection.variable_on_chain_schema = schema;
+			Self::save_collection(target_collection);
 
-            Ok(())
-        }
+			Ok(())
+		}
 
-        // Sudo permissions function
-        #[weight = <T as Config>::WeightInfo::set_chain_limits()]
-        #[transactional]
-        pub fn set_chain_limits(
-            origin,
-            limits: ChainLimits
-        ) -> DispatchResult {
+		// Sudo permissions function
+		#[weight = <T as Config>::WeightInfo::set_chain_limits()]
+		#[transactional]
+		pub fn set_chain_limits(
+			origin,
+			limits: ChainLimits
+		) -> DispatchResult {
 
-            #[cfg(not(feature = "runtime-benchmarks"))]
-            ensure_root(origin)?;
+			#[cfg(not(feature = "runtime-benchmarks"))]
+			ensure_root(origin)?;
 
-            <ChainLimit>::put(limits);
-            Ok(())
-        }
+			<ChainLimit>::put(limits);
+			Ok(())
+		}
 
-        #[weight = <T as Config>::WeightInfo::set_collection_limits()]
-        #[transactional]
-        pub fn set_collection_limits(
-            origin,
-            collection_id: u32,
-            new_limits: CollectionLimits<T::BlockNumber>,
-        ) -> DispatchResult {
-            let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-            let mut target_collection = Self::get_collection(collection_id)?;
-            Self::check_owner_permissions(&target_collection, &sender.as_sub())?;
-            let old_limits = &target_collection.limits;
-            let chain_limits = ChainLimit::get();
+		#[weight = <T as Config>::WeightInfo::set_collection_limits()]
+		#[transactional]
+		pub fn set_collection_limits(
+			origin,
+			collection_id: u32,
+			new_limits: CollectionLimits<T::BlockNumber>,
+		) -> DispatchResult {
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+			let mut target_collection = Self::get_collection(collection_id)?;
+			Self::check_owner_permissions(&target_collection, sender.as_sub())?;
+			let old_limits = &target_collection.limits;
+			let chain_limits = ChainLimit::get();
 
-            // collection bounds
-            ensure!(new_limits.sponsor_transfer_timeout <= MAX_SPONSOR_TIMEOUT &&
-                new_limits.account_token_ownership_limit <= MAX_TOKEN_OWNERSHIP && 
-                new_limits.sponsored_data_size <= chain_limits.custom_data_limit,
-                Error::<T>::CollectionLimitBoundsExceeded);
+			// collection bounds
+			ensure!(new_limits.sponsor_transfer_timeout <= MAX_SPONSOR_TIMEOUT &&
+				new_limits.account_token_ownership_limit <= MAX_TOKEN_OWNERSHIP &&
+				new_limits.sponsored_data_size <= chain_limits.custom_data_limit,
+				Error::<T>::CollectionLimitBoundsExceeded);
 
-            // token_limit   check  prev
-            ensure!(old_limits.token_limit >= new_limits.token_limit, Error::<T>::CollectionTokenLimitExceeded);
-            ensure!(new_limits.token_limit > 0, Error::<T>::CollectionTokenLimitExceeded);
+			// token_limit   check  prev
+			ensure!(old_limits.token_limit >= new_limits.token_limit, Error::<T>::CollectionTokenLimitExceeded);
+			ensure!(new_limits.token_limit > 0, Error::<T>::CollectionTokenLimitExceeded);
 
-            ensure!(
-                (old_limits.owner_can_transfer || !new_limits.owner_can_transfer) &&
-                (old_limits.owner_can_destroy || !new_limits.owner_can_destroy),
-                Error::<T>::OwnerPermissionsCantBeReverted,
-            );
+			ensure!(
+				(old_limits.owner_can_transfer || !new_limits.owner_can_transfer) &&
+				(old_limits.owner_can_destroy || !new_limits.owner_can_destroy),
+				Error::<T>::OwnerPermissionsCantBeReverted,
+			);
 
-            target_collection.limits = new_limits;
-            Self::save_collection(target_collection);
+			target_collection.limits = new_limits;
+			Self::save_collection(target_collection);
 
-            Ok(())
-        } 
-    }
+			Ok(())
+		}
+	}
 }
 
 impl<T: Config> Module<T> {
-    pub fn create_item_internal(sender: &T::CrossAccountId, collection: &CollectionHandle<T>, owner: &T::CrossAccountId, data: CreateItemData) -> DispatchResult {
-        Self::can_create_items_in_collection(&collection, &sender, &owner, 1)?;
-        Self::validate_create_item_args(&collection, &data)?;
-        Self::create_item_no_validation(&collection, owner, data)?;
+	pub fn create_item_internal(
+		sender: &T::CrossAccountId,
+		collection: &CollectionHandle<T>,
+		owner: &T::CrossAccountId,
+		data: CreateItemData,
+	) -> DispatchResult {
+		Self::can_create_items_in_collection(collection, sender, owner, 1)?;
+		Self::validate_create_item_args(collection, &data)?;
+		Self::create_item_no_validation(collection, owner, data)?;
 
-        Ok(())
-    }
+		Ok(())
+	}
 
-    pub fn transfer_internal(sender: &T::CrossAccountId, recipient: &T::CrossAccountId, target_collection: &CollectionHandle<T>, item_id: TokenId, value: u128) -> DispatchResult {
-        target_collection.consume_gas(2000000)?;
-        // Limits check
-        Self::is_correct_transfer(target_collection, &recipient)?;
+	pub fn transfer_internal(
+		sender: &T::CrossAccountId,
+		recipient: &T::CrossAccountId,
+		target_collection: &CollectionHandle<T>,
+		item_id: TokenId,
+		value: u128,
+	) -> DispatchResult {
+		target_collection.consume_gas(2000000)?;
+		// Limits check
+		Self::is_correct_transfer(target_collection, recipient)?;
 
-        // Transfer permissions check
-        ensure!(Self::is_item_owner(&sender, target_collection, item_id) ||
-            Self::is_owner_or_admin_permissions(target_collection, &sender),
-            Error::<T>::NoPermission);
+		// Transfer permissions check
+		ensure!(
+			Self::is_item_owner(sender, target_collection, item_id)
+				|| Self::is_owner_or_admin_permissions(target_collection, sender),
+			Error::<T>::NoPermission
+		);
 
-        if target_collection.access == AccessMode::WhiteList {
-            Self::check_white_list(target_collection, &sender)?;
-            Self::check_white_list(target_collection, &recipient)?;
-        }
+		if target_collection.access == AccessMode::WhiteList {
+			Self::check_white_list(target_collection, sender)?;
+			Self::check_white_list(target_collection, recipient)?;
+		}
 
-        match target_collection.mode
-        {
-            CollectionMode::NFT => Self::transfer_nft(target_collection, item_id, sender.clone(), recipient.clone())?,
-            CollectionMode::Fungible(_)  => Self::transfer_fungible(target_collection, value, &sender, &recipient)?,
-            CollectionMode::ReFungible  => Self::transfer_refungible(target_collection, item_id, value, sender.clone(), recipient.clone())?,
-            _ => ()
-        };
+		match target_collection.mode {
+			CollectionMode::NFT => Self::transfer_nft(
+				target_collection,
+				item_id,
+				sender.clone(),
+				recipient.clone(),
+			)?,
+			CollectionMode::Fungible(_) => {
+				Self::transfer_fungible(target_collection, value, sender, recipient)?
+			}
+			CollectionMode::ReFungible => Self::transfer_refungible(
+				target_collection,
+				item_id,
+				value,
+				sender.clone(),
+				recipient.clone(),
+			)?,
+			_ => (),
+		};
 
-        Self::deposit_event(RawEvent::Transfer(target_collection.id, item_id, sender.clone(), recipient.clone(), value));
+		Self::deposit_event(RawEvent::Transfer(
+			target_collection.id,
+			item_id,
+			sender.clone(),
+			recipient.clone(),
+			value,
+		));
 
-        Ok(())
-    }
+		Ok(())
+	}
 
 	pub fn approve_internal(
 		sender: &T::CrossAccountId,
 		spender: &T::CrossAccountId,
 		collection: &CollectionHandle<T>,
 		item_id: TokenId,
-		amount: u128
+		amount: u128,
 	) -> DispatchResult {
-        collection.consume_gas(2000000)?;
-		Self::token_exists(&collection, item_id)?;
+		collection.consume_gas(2000000)?;
+		Self::token_exists(collection, item_id)?;
 
 		// Transfer permissions check
-		let bypasses_limits = collection.limits.owner_can_transfer &&
-			Self::is_owner_or_admin_permissions(
-				&collection,
-				&sender,
-			);
+		let bypasses_limits = collection.limits.owner_can_transfer
+			&& Self::is_owner_or_admin_permissions(collection, sender);
 
 		let allowance_limit = if bypasses_limits {
 			None
-		} else if let Some(amount) = Self::owned_amount(
-			&sender,
-			&collection,
-			item_id,
-		) {
+		} else if let Some(amount) = Self::owned_amount(sender, collection, item_id) {
 			Some(amount)
 		} else {
 			fail!(Error::<T>::NoPermission);
 		};
 
 		if collection.access == AccessMode::WhiteList {
-			Self::check_white_list(&collection, &sender)?;
-			Self::check_white_list(&collection, &spender)?;
+			Self::check_white_list(collection, sender)?;
+			Self::check_white_list(collection, spender)?;
 		}
 
 		let allowance: u128 = amount
-			.checked_add(<Allowances<T>>::get(collection.id, (item_id, sender.as_sub(), spender.as_sub())))
+			.checked_add(<Allowances<T>>::get(
+				collection.id,
+				(item_id, sender.as_sub(), spender.as_sub()),
+			))
 			.ok_or(Error::<T>::NumOverflow)?;
 		if let Some(limit) = allowance_limit {
 			ensure!(limit >= allowance, Error::<T>::TokenValueTooLow);
 		}
-		<Allowances<T>>::insert(collection.id, (item_id, sender.as_sub(), spender.as_sub()), allowance);
+		<Allowances<T>>::insert(
+			collection.id,
+			(item_id, sender.as_sub(), spender.as_sub()),
+			allowance,
+		);
 
 		if matches!(collection.mode, CollectionMode::NFT) {
 			// TODO: NFT: only one owner may exist for token in ERC721
 			collection.log(ERC721Events::Approval {
-                owner: *sender.as_eth(),
-                approved: *spender.as_eth(),
-                token_id: item_id.into(),
-            });
+				owner: *sender.as_eth(),
+				approved: *spender.as_eth(),
+				token_id: item_id.into(),
+			});
 		}
 
 		if matches!(collection.mode, CollectionMode::Fungible(_)) {
 			// TODO: NFT: only one owner may exist for token in ERC20
 			collection.log(ERC20Events::Approval {
-                owner: *sender.as_eth(),
-                spender: *spender.as_eth(),
-                value: allowance.into()
-            });
+				owner: *sender.as_eth(),
+				spender: *spender.as_eth(),
+				value: allowance.into(),
+			});
 		}
 
-		Self::deposit_event(RawEvent::Approved(collection.id, item_id, sender.clone(), spender.clone(), allowance));
+		Self::deposit_event(RawEvent::Approved(
+			collection.id,
+			item_id,
+			sender.clone(),
+			spender.clone(),
+			allowance,
+		));
 		Ok(())
 	}
 
@@ -1369,879 +1406,981 @@
 		item_id: TokenId,
 		amount: u128,
 	) -> DispatchResult {
-        collection.consume_gas(2000000)?;
+		collection.consume_gas(2000000)?;
 		// Check approval
-		let approval: u128 = <Allowances<T>>::get(collection.id, (item_id, from.as_sub(), sender.as_sub()));
+		let approval: u128 =
+			<Allowances<T>>::get(collection.id, (item_id, from.as_sub(), sender.as_sub()));
 
 		// Limits check
-		Self::is_correct_transfer(&collection, &recipient)?;
+		Self::is_correct_transfer(collection, recipient)?;
 
 		// Transfer permissions check
 		ensure!(
-			approval >= amount || 
-			(
-				collection.limits.owner_can_transfer &&
-				Self::is_owner_or_admin_permissions(&collection, &sender)
-			),
+			approval >= amount
+				|| (collection.limits.owner_can_transfer
+					&& Self::is_owner_or_admin_permissions(collection, sender)),
 			Error::<T>::NoPermission
 		);
 
 		if collection.access == AccessMode::WhiteList {
-			Self::check_white_list(&collection, &sender)?;
-			Self::check_white_list(&collection, &recipient)?;
+			Self::check_white_list(collection, sender)?;
+			Self::check_white_list(collection, recipient)?;
 		}
 
 		// Reduce approval by transferred amount or remove if remaining approval drops to 0
 		let allowance = approval.saturating_sub(amount);
 		if allowance > 0 {
-			<Allowances<T>>::insert(collection.id, (item_id, from.as_sub(), sender.as_sub()), allowance);
+			<Allowances<T>>::insert(
+				collection.id,
+				(item_id, from.as_sub(), sender.as_sub()),
+				allowance,
+			);
 		} else {
 			<Allowances<T>>::remove(collection.id, (item_id, from.as_sub(), sender.as_sub()));
 		}
 
 		match collection.mode {
 			CollectionMode::NFT => {
-				Self::transfer_nft(&collection, item_id, from.clone(), recipient.clone())?
+				Self::transfer_nft(collection, item_id, from.clone(), recipient.clone())?
 			}
 			CollectionMode::Fungible(_) => {
-				Self::transfer_fungible(&collection, amount, &from, &recipient)?
-			}
-			CollectionMode::ReFungible => {
-				Self::transfer_refungible(&collection, item_id, amount, from.clone(), recipient.clone())?
+				Self::transfer_fungible(collection, amount, from, recipient)?
 			}
-			_ => ()
+			CollectionMode::ReFungible => Self::transfer_refungible(
+				collection,
+				item_id,
+				amount,
+				from.clone(),
+				recipient.clone(),
+			)?,
+			_ => (),
 		};
 
 		if matches!(collection.mode, CollectionMode::Fungible(_)) {
 			collection.log(ERC20Events::Approval {
-                owner: *from.as_eth(),
-                spender: *sender.as_eth(),
-                value: allowance.into()
-            });
+				owner: *from.as_eth(),
+				spender: *sender.as_eth(),
+				value: allowance.into(),
+			});
 		}
 
 		Ok(())
 	}
 
-    pub fn set_variable_meta_data_internal(
-        sender: &T::CrossAccountId,
-        collection: &CollectionHandle<T>, 
-        item_id: TokenId,
-        data: Vec<u8>,
-    ) -> DispatchResult {
-        Self::token_exists(&collection, item_id)?;
+	pub fn set_variable_meta_data_internal(
+		sender: &T::CrossAccountId,
+		collection: &CollectionHandle<T>,
+		item_id: TokenId,
+		data: Vec<u8>,
+	) -> DispatchResult {
+		Self::token_exists(collection, item_id)?;
 
-        ensure!(ChainLimit::get().custom_data_limit >= data.len() as u32, Error::<T>::TokenVariableDataLimitExceeded);
+		ensure!(
+			ChainLimit::get().custom_data_limit >= data.len() as u32,
+			Error::<T>::TokenVariableDataLimitExceeded
+		);
 
-        // Modify permissions check
-        ensure!(Self::is_item_owner(&sender, &collection, item_id) ||
-            Self::is_owner_or_admin_permissions(&collection, &sender),
-            Error::<T>::NoPermission);
+		// Modify permissions check
+		ensure!(
+			Self::is_item_owner(sender, collection, item_id)
+				|| Self::is_owner_or_admin_permissions(collection, sender),
+			Error::<T>::NoPermission
+		);
 
-        match collection.mode
-        {
-            CollectionMode::NFT => Self::set_nft_variable_data(&collection, item_id, data)?,
-            CollectionMode::ReFungible  => Self::set_re_fungible_variable_data(&collection, item_id, data)?,
-            CollectionMode::Fungible(_) => fail!(Error::<T>::CantStoreMetadataInFungibleTokens),
-            _ => fail!(Error::<T>::UnexpectedCollectionType)
-        };
+		match collection.mode {
+			CollectionMode::NFT => Self::set_nft_variable_data(collection, item_id, data)?,
+			CollectionMode::ReFungible => {
+				Self::set_re_fungible_variable_data(collection, item_id, data)?
+			}
+			CollectionMode::Fungible(_) => fail!(Error::<T>::CantStoreMetadataInFungibleTokens),
+			_ => fail!(Error::<T>::UnexpectedCollectionType),
+		};
 
-        Ok(())
-    }
+		Ok(())
+	}
 
-    pub fn create_multiple_items_internal(
-        sender: &T::CrossAccountId,
-        collection: &CollectionHandle<T>,
-        owner: &T::CrossAccountId,
-        items_data: Vec<CreateItemData>,
-    ) -> DispatchResult {
-        Self::can_create_items_in_collection(&collection, &sender, &owner, items_data.len() as u32)?;
+	pub fn create_multiple_items_internal(
+		sender: &T::CrossAccountId,
+		collection: &CollectionHandle<T>,
+		owner: &T::CrossAccountId,
+		items_data: Vec<CreateItemData>,
+	) -> DispatchResult {
+		Self::can_create_items_in_collection(collection, sender, owner, items_data.len() as u32)?;
 
-        for data in &items_data {
-            Self::validate_create_item_args(&collection, data)?;
-        }
-        for data in &items_data {
-            Self::create_item_no_validation(&collection, owner, data.clone())?;
-        }
+		for data in &items_data {
+			Self::validate_create_item_args(collection, data)?;
+		}
+		for data in &items_data {
+			Self::create_item_no_validation(collection, owner, data.clone())?;
+		}
 
-        Ok(())
-    }
+		Ok(())
+	}
 
-    pub fn burn_item_internal(
-        sender: &T::CrossAccountId,
-        collection: &CollectionHandle<T>,
-        item_id: TokenId,
-        value: u128,
-    ) -> DispatchResult {
-        ensure!(
-            Self::is_item_owner(&sender, &collection, item_id) ||
-            (
-                collection.limits.owner_can_transfer &&
-                Self::is_owner_or_admin_permissions(&collection, &sender)
-            ),
-            Error::<T>::NoPermission
-        );
+	pub fn burn_item_internal(
+		sender: &T::CrossAccountId,
+		collection: &CollectionHandle<T>,
+		item_id: TokenId,
+		value: u128,
+	) -> DispatchResult {
+		ensure!(
+			Self::is_item_owner(sender, collection, item_id)
+				|| (collection.limits.owner_can_transfer
+					&& Self::is_owner_or_admin_permissions(collection, sender)),
+			Error::<T>::NoPermission
+		);
 
-        if collection.access == AccessMode::WhiteList {
-            Self::check_white_list(&collection, &sender)?;
-        }
+		if collection.access == AccessMode::WhiteList {
+			Self::check_white_list(collection, sender)?;
+		}
 
-        match collection.mode
-        {
-            CollectionMode::NFT => Self::burn_nft_item(&collection, item_id)?,
-            CollectionMode::Fungible(_)  => Self::burn_fungible_item(&sender, &collection, value)?,
-            CollectionMode::ReFungible  => Self::burn_refungible_item(&collection, item_id, &sender)?,
-            _ => ()
-        };
+		match collection.mode {
+			CollectionMode::NFT => Self::burn_nft_item(collection, item_id)?,
+			CollectionMode::Fungible(_) => Self::burn_fungible_item(sender, collection, value)?,
+			CollectionMode::ReFungible => Self::burn_refungible_item(collection, item_id, sender)?,
+			_ => (),
+		};
 
-        Ok(())
-    }
+		Ok(())
+	}
 
-    pub fn toggle_white_list_internal(
-        sender: &T::CrossAccountId,
-        collection: &CollectionHandle<T>,
-        address: &T::CrossAccountId,
-        whitelisted: bool,
-    ) -> DispatchResult {
-        Self::check_owner_or_admin_permissions(&collection, &sender)?;
+	pub fn toggle_white_list_internal(
+		sender: &T::CrossAccountId,
+		collection: &CollectionHandle<T>,
+		address: &T::CrossAccountId,
+		whitelisted: bool,
+	) -> DispatchResult {
+		Self::check_owner_or_admin_permissions(collection, sender)?;
 
-        if whitelisted {
-            <WhiteList<T>>::insert(collection.id, address.as_sub(), true);
-        } else {
-            <WhiteList<T>>::remove(collection.id, address.as_sub());
-        }
+		if whitelisted {
+			<WhiteList<T>>::insert(collection.id, address.as_sub(), true);
+		} else {
+			<WhiteList<T>>::remove(collection.id, address.as_sub());
+		}
 
-        Ok(())
-    }
+		Ok(())
+	}
 
-    fn is_correct_transfer(collection: &CollectionHandle<T>, recipient: &T::CrossAccountId) -> DispatchResult {
-        let collection_id = collection.id;
+	fn is_correct_transfer(
+		collection: &CollectionHandle<T>,
+		recipient: &T::CrossAccountId,
+	) -> DispatchResult {
+		let collection_id = collection.id;
 
-        // check token limit and account token limit
-        let account_items: u32 = <AddressTokens<T>>::get(collection_id, recipient.as_sub()).len() as u32;
-        ensure!(collection.limits.account_token_ownership_limit > account_items,  Error::<T>::AccountTokenLimitExceeded);
-        
-        Ok(())
-    }
+		// check token limit and account token limit
+		let account_items: u32 =
+			<AddressTokens<T>>::get(collection_id, recipient.as_sub()).len() as u32;
+		ensure!(
+			collection.limits.account_token_ownership_limit > account_items,
+			Error::<T>::AccountTokenLimitExceeded
+		);
 
-    fn can_create_items_in_collection(collection: &CollectionHandle<T>, sender: &T::CrossAccountId, owner: &T::CrossAccountId, amount: u32) -> DispatchResult {
-        let collection_id = collection.id;
+		Ok(())
+	}
 
-        // check token limit and account token limit
-        let total_items: u32 = ItemListIndex::get(collection_id)
-            .checked_add(amount)
-            .ok_or(Error::<T>::CollectionTokenLimitExceeded)?;
-        let account_items: u32 = (<AddressTokens<T>>::get(collection_id, owner.as_sub()).len() as u32)
-            .checked_add(amount)
-            .ok_or(Error::<T>::AccountTokenLimitExceeded)?;
-        ensure!(collection.limits.token_limit >= total_items,  Error::<T>::CollectionTokenLimitExceeded);
-        ensure!(collection.limits.account_token_ownership_limit >= account_items,  Error::<T>::AccountTokenLimitExceeded);
+	fn can_create_items_in_collection(
+		collection: &CollectionHandle<T>,
+		sender: &T::CrossAccountId,
+		owner: &T::CrossAccountId,
+		amount: u32,
+	) -> DispatchResult {
+		let collection_id = collection.id;
 
-        if !Self::is_owner_or_admin_permissions(collection, &sender) {
-            ensure!(collection.mint_mode == true, Error::<T>::PublicMintingNotAllowed);
-            Self::check_white_list(collection, owner)?;
-            Self::check_white_list(collection, sender)?;
-        }
+		// check token limit and account token limit
+		let total_items: u32 = ItemListIndex::get(collection_id)
+			.checked_add(amount)
+			.ok_or(Error::<T>::CollectionTokenLimitExceeded)?;
+		let account_items: u32 = (<AddressTokens<T>>::get(collection_id, owner.as_sub()).len()
+			as u32)
+			.checked_add(amount)
+			.ok_or(Error::<T>::AccountTokenLimitExceeded)?;
+		ensure!(
+			collection.limits.token_limit >= total_items,
+			Error::<T>::CollectionTokenLimitExceeded
+		);
+		ensure!(
+			collection.limits.account_token_ownership_limit >= account_items,
+			Error::<T>::AccountTokenLimitExceeded
+		);
 
-        Ok(())
-    }
+		if !Self::is_owner_or_admin_permissions(collection, sender) {
+			ensure!(collection.mint_mode, Error::<T>::PublicMintingNotAllowed);
+			Self::check_white_list(collection, owner)?;
+			Self::check_white_list(collection, sender)?;
+		}
 
-    fn validate_create_item_args(target_collection: &CollectionHandle<T>, data: &CreateItemData) -> DispatchResult {
-        match target_collection.mode
-        {
-            CollectionMode::NFT => {
-                if let CreateItemData::NFT(data) = data {
-                    // check sizes
-                    ensure!(ChainLimit::get().custom_data_limit >= data.const_data.len() as u32, Error::<T>::TokenConstDataLimitExceeded);
-                    ensure!(ChainLimit::get().custom_data_limit >= data.variable_data.len() as u32, Error::<T>::TokenVariableDataLimitExceeded);
-                } else {
-                    fail!(Error::<T>::NotNftDataUsedToMintNftCollectionToken);
-                }
-            },
-            CollectionMode::Fungible(_) => {
-                if let CreateItemData::Fungible(_) = data {
-                } else {
-                    fail!(Error::<T>::NotFungibleDataUsedToMintFungibleCollectionToken);
-                }
-            },
-            CollectionMode::ReFungible => {
-                if let CreateItemData::ReFungible(data) = data {
+		Ok(())
+	}
 
-                    // check sizes
-                    ensure!(ChainLimit::get().custom_data_limit >= data.const_data.len() as u32, Error::<T>::TokenConstDataLimitExceeded);
-                    ensure!(ChainLimit::get().custom_data_limit >= data.variable_data.len() as u32, Error::<T>::TokenVariableDataLimitExceeded);
+	fn validate_create_item_args(
+		target_collection: &CollectionHandle<T>,
+		data: &CreateItemData,
+	) -> DispatchResult {
+		match target_collection.mode {
+			CollectionMode::NFT => {
+				if let CreateItemData::NFT(data) = data {
+					// check sizes
+					ensure!(
+						ChainLimit::get().custom_data_limit >= data.const_data.len() as u32,
+						Error::<T>::TokenConstDataLimitExceeded
+					);
+					ensure!(
+						ChainLimit::get().custom_data_limit >= data.variable_data.len() as u32,
+						Error::<T>::TokenVariableDataLimitExceeded
+					);
+				} else {
+					fail!(Error::<T>::NotNftDataUsedToMintNftCollectionToken);
+				}
+			}
+			CollectionMode::Fungible(_) => {
+				if let CreateItemData::Fungible(_) = data {
+				} else {
+					fail!(Error::<T>::NotFungibleDataUsedToMintFungibleCollectionToken);
+				}
+			}
+			CollectionMode::ReFungible => {
+				if let CreateItemData::ReFungible(data) = data {
+					// check sizes
+					ensure!(
+						ChainLimit::get().custom_data_limit >= data.const_data.len() as u32,
+						Error::<T>::TokenConstDataLimitExceeded
+					);
+					ensure!(
+						ChainLimit::get().custom_data_limit >= data.variable_data.len() as u32,
+						Error::<T>::TokenVariableDataLimitExceeded
+					);
 
-                    // Check refungibility limits
-                    ensure!(data.pieces <= MAX_REFUNGIBLE_PIECES, Error::<T>::WrongRefungiblePieces);
-                    ensure!(data.pieces > 0, Error::<T>::WrongRefungiblePieces);
-                } else {
-                    fail!(Error::<T>::NotReFungibleDataUsedToMintReFungibleCollectionToken);
-                }
-            },
-            _ => { fail!(Error::<T>::UnexpectedCollectionType); }
-        };
+					// Check refungibility limits
+					ensure!(
+						data.pieces <= MAX_REFUNGIBLE_PIECES,
+						Error::<T>::WrongRefungiblePieces
+					);
+					ensure!(data.pieces > 0, Error::<T>::WrongRefungiblePieces);
+				} else {
+					fail!(Error::<T>::NotReFungibleDataUsedToMintReFungibleCollectionToken);
+				}
+			}
+			_ => {
+				fail!(Error::<T>::UnexpectedCollectionType);
+			}
+		};
 
-        Ok(())
-    }
+		Ok(())
+	}
 
-    fn create_item_no_validation(collection: &CollectionHandle<T>, owner: &T::CrossAccountId, data: CreateItemData) -> DispatchResult {
-        match data
-        {
-            CreateItemData::NFT(data) => {
-                let item = NftItemType {
-                    owner: owner.clone(),
-                    const_data: data.const_data,
-                    variable_data: data.variable_data
-                };
+	fn create_item_no_validation(
+		collection: &CollectionHandle<T>,
+		owner: &T::CrossAccountId,
+		data: CreateItemData,
+	) -> DispatchResult {
+		match data {
+			CreateItemData::NFT(data) => {
+				let item = NftItemType {
+					owner: owner.clone(),
+					const_data: data.const_data,
+					variable_data: data.variable_data,
+				};
 
-                Self::add_nft_item(collection, item)?;
-            },
-            CreateItemData::Fungible(data) => {
-                Self::add_fungible_item(collection, &owner, data.value)?;
-            },
-            CreateItemData::ReFungible(data) => {
-                let mut owner_list = Vec::new();
-                owner_list.push(Ownership {owner: owner.clone(), fraction: data.pieces});
+				Self::add_nft_item(collection, item)?;
+			}
+			CreateItemData::Fungible(data) => {
+				Self::add_fungible_item(collection, owner, data.value)?;
+			}
+			CreateItemData::ReFungible(data) => {
+				let owner_list = vec![Ownership {
+					owner: owner.clone(),
+					fraction: data.pieces,
+				}];
 
-                let item = ReFungibleItemType {
-                    owner: owner_list,
-                    const_data: data.const_data,
-                    variable_data: data.variable_data
-                };
+				let item = ReFungibleItemType {
+					owner: owner_list,
+					const_data: data.const_data,
+					variable_data: data.variable_data,
+				};
 
-                Self::add_refungible_item(collection, item)?;
-            }
-        };
+				Self::add_refungible_item(collection, item)?;
+			}
+		};
 
-        Ok(())
-    }
+		Ok(())
+	}
 
-    fn add_fungible_item(collection: &CollectionHandle<T>, owner: &T::CrossAccountId, value: u128) -> DispatchResult {
-        let collection_id = collection.id;
+	fn add_fungible_item(
+		collection: &CollectionHandle<T>,
+		owner: &T::CrossAccountId,
+		value: u128,
+	) -> DispatchResult {
+		let collection_id = collection.id;
 
-        // Does new owner already have an account?
-        let balance: u128 = <FungibleItemList<T>>::get(collection_id, owner.as_sub()).value;
+		// Does new owner already have an account?
+		let balance: u128 = <FungibleItemList<T>>::get(collection_id, owner.as_sub()).value;
 
-        // Mint 
-        let item = FungibleItemType {
-            value: balance.checked_add(value).ok_or(Error::<T>::NumOverflow)?,
-        };
-        <FungibleItemList<T>>::insert(collection_id, owner.as_sub(), item);
+		// Mint
+		let item = FungibleItemType {
+			value: balance.checked_add(value).ok_or(Error::<T>::NumOverflow)?,
+		};
+		<FungibleItemList<T>>::insert(collection_id, owner.as_sub(), item);
 
-        // Update balance
-        let new_balance = <Balance<T>>::get(collection_id, owner.as_sub())
-            .checked_add(value)
-            .ok_or(Error::<T>::NumOverflow)?;
-        <Balance<T>>::insert(collection_id, owner.as_sub(), new_balance);
+		// Update balance
+		let new_balance = <Balance<T>>::get(collection_id, owner.as_sub())
+			.checked_add(value)
+			.ok_or(Error::<T>::NumOverflow)?;
+		<Balance<T>>::insert(collection_id, owner.as_sub(), new_balance);
 
-        Self::deposit_event(RawEvent::ItemCreated(collection_id, 0, owner.clone()));
-        Ok(())
-    }
+		Self::deposit_event(RawEvent::ItemCreated(collection_id, 0, owner.clone()));
+		Ok(())
+	}
 
-    fn add_refungible_item(collection: &CollectionHandle<T>, item: ReFungibleItemType<T::CrossAccountId>) -> DispatchResult {
-        let collection_id = collection.id;
+	fn add_refungible_item(
+		collection: &CollectionHandle<T>,
+		item: ReFungibleItemType<T::CrossAccountId>,
+	) -> DispatchResult {
+		let collection_id = collection.id;
 
-        let current_index = <ItemListIndex>::get(collection_id)
-            .checked_add(1)
-            .ok_or(Error::<T>::NumOverflow)?;
-        let itemcopy = item.clone();
+		let current_index = <ItemListIndex>::get(collection_id)
+			.checked_add(1)
+			.ok_or(Error::<T>::NumOverflow)?;
+		let itemcopy = item.clone();
 
-        ensure!(
-            item.owner.len() == 1,
-            Error::<T>::BadCreateRefungibleCall,
-        );
-        let item_owner = item.owner.first().expect("only one owner is defined");
+		ensure!(item.owner.len() == 1, Error::<T>::BadCreateRefungibleCall,);
+		let item_owner = item.owner.first().expect("only one owner is defined");
 
-        let value = item_owner.fraction;
-        let owner = item_owner.owner.clone();
+		let value = item_owner.fraction;
+		let owner = item_owner.owner.clone();
 
-        Self::add_token_index(collection_id, current_index, &owner)?;
+		Self::add_token_index(collection_id, current_index, &owner)?;
 
-        <ItemListIndex>::insert(collection_id, current_index);
-        <ReFungibleItemList<T>>::insert(collection_id, current_index, itemcopy);
+		<ItemListIndex>::insert(collection_id, current_index);
+		<ReFungibleItemList<T>>::insert(collection_id, current_index, itemcopy);
 
-        // Update balance
-        let new_balance = <Balance<T>>::get(collection_id, owner.as_sub())
-            .checked_add(value)
-            .ok_or(Error::<T>::NumOverflow)?;
-        <Balance<T>>::insert(collection_id, owner.as_sub(), new_balance);
+		// Update balance
+		let new_balance = <Balance<T>>::get(collection_id, owner.as_sub())
+			.checked_add(value)
+			.ok_or(Error::<T>::NumOverflow)?;
+		<Balance<T>>::insert(collection_id, owner.as_sub(), new_balance);
 
-        Self::deposit_event(RawEvent::ItemCreated(collection_id, current_index, owner));
-        Ok(())
-    }
+		Self::deposit_event(RawEvent::ItemCreated(collection_id, current_index, owner));
+		Ok(())
+	}
 
-    fn add_nft_item(collection: &CollectionHandle<T>, item: NftItemType<T::CrossAccountId>) -> DispatchResult {
-        let collection_id = collection.id;
+	fn add_nft_item(
+		collection: &CollectionHandle<T>,
+		item: NftItemType<T::CrossAccountId>,
+	) -> DispatchResult {
+		let collection_id = collection.id;
 
-        let current_index = <ItemListIndex>::get(collection_id)
-            .checked_add(1)
-            .ok_or(Error::<T>::NumOverflow)?;
+		let current_index = <ItemListIndex>::get(collection_id)
+			.checked_add(1)
+			.ok_or(Error::<T>::NumOverflow)?;
 
-        let item_owner = item.owner.clone();
-        Self::add_token_index(collection_id, current_index, &item.owner)?;
+		let item_owner = item.owner.clone();
+		Self::add_token_index(collection_id, current_index, &item.owner)?;
 
-        <ItemListIndex>::insert(collection_id, current_index);
-        <NftItemList<T>>::insert(collection_id, current_index, item);
+		<ItemListIndex>::insert(collection_id, current_index);
+		<NftItemList<T>>::insert(collection_id, current_index, item);
 
-        // Update balance
-        let new_balance = <Balance<T>>::get(collection_id, item_owner.as_sub())
-            .checked_add(1)
-            .ok_or(Error::<T>::NumOverflow)?;
-        <Balance<T>>::insert(collection_id, item_owner.as_sub(), new_balance);
+		// Update balance
+		let new_balance = <Balance<T>>::get(collection_id, item_owner.as_sub())
+			.checked_add(1)
+			.ok_or(Error::<T>::NumOverflow)?;
+		<Balance<T>>::insert(collection_id, item_owner.as_sub(), new_balance);
 
-        collection.log(ERC721Events::Transfer {
-            from: H160::default(),
-            to: *item_owner.as_eth(),
-            token_id: current_index.into(),
-        });
-        Self::deposit_event(RawEvent::ItemCreated(collection_id, current_index, item_owner));
-        Ok(())
-    }
+		collection.log(ERC721Events::Transfer {
+			from: H160::default(),
+			to: *item_owner.as_eth(),
+			token_id: current_index.into(),
+		});
+		Self::deposit_event(RawEvent::ItemCreated(
+			collection_id,
+			current_index,
+			item_owner,
+		));
+		Ok(())
+	}
 
-    fn burn_refungible_item(
-        collection: &CollectionHandle<T>,
-        item_id: TokenId,
-        owner: &T::CrossAccountId,
-    ) -> DispatchResult {
-        let collection_id = collection.id;
+	fn burn_refungible_item(
+		collection: &CollectionHandle<T>,
+		item_id: TokenId,
+		owner: &T::CrossAccountId,
+	) -> DispatchResult {
+		let collection_id = collection.id;
 
-        let mut token = <ReFungibleItemList<T>>::get(collection_id, item_id)
-            .ok_or(Error::<T>::TokenNotFound)?;
-        let rft_balance = token
-            .owner
-            .iter()
-            .find(|&i| i.owner == *owner)
-            .ok_or(Error::<T>::TokenNotFound)?;
-        Self::remove_token_index(collection_id, item_id, owner)?;
+		let mut token = <ReFungibleItemList<T>>::get(collection_id, item_id)
+			.ok_or(Error::<T>::TokenNotFound)?;
+		let rft_balance = token
+			.owner
+			.iter()
+			.find(|&i| i.owner == *owner)
+			.ok_or(Error::<T>::TokenNotFound)?;
+		Self::remove_token_index(collection_id, item_id, owner)?;
 
-        // update balance
-        let new_balance = <Balance<T>>::get(collection_id, rft_balance.owner.as_sub())
-            .checked_sub(rft_balance.fraction)
-            .ok_or(Error::<T>::NumOverflow)?;
-        <Balance<T>>::insert(collection_id, rft_balance.owner.as_sub(), new_balance);
+		// update balance
+		let new_balance = <Balance<T>>::get(collection_id, rft_balance.owner.as_sub())
+			.checked_sub(rft_balance.fraction)
+			.ok_or(Error::<T>::NumOverflow)?;
+		<Balance<T>>::insert(collection_id, rft_balance.owner.as_sub(), new_balance);
 
-        // Re-create owners list with sender removed
-        let index = token
-            .owner
-            .iter()
-            .position(|i| i.owner == *owner)
-            .expect("owned item is exists");
-        token.owner.remove(index);
-        let owner_count = token.owner.len();
+		// Re-create owners list with sender removed
+		let index = token
+			.owner
+			.iter()
+			.position(|i| i.owner == *owner)
+			.expect("owned item is exists");
+		token.owner.remove(index);
+		let owner_count = token.owner.len();
 
-        // Burn the token completely if this was the last (only) owner
-        if owner_count == 0 {
-            <ReFungibleItemList<T>>::remove(collection_id, item_id);
-            <VariableMetaDataBasket<T>>::remove(collection_id, item_id);
-        }
-        else {
-            <ReFungibleItemList<T>>::insert(collection_id, item_id, token);
-        }
+		// Burn the token completely if this was the last (only) owner
+		if owner_count == 0 {
+			<ReFungibleItemList<T>>::remove(collection_id, item_id);
+			<VariableMetaDataBasket<T>>::remove(collection_id, item_id);
+		} else {
+			<ReFungibleItemList<T>>::insert(collection_id, item_id, token);
+		}
 
-        Ok(())
-    }
+		Ok(())
+	}
 
-    fn burn_nft_item(collection: &CollectionHandle<T>, item_id: TokenId) -> DispatchResult {
-        let collection_id = collection.id;
+	fn burn_nft_item(collection: &CollectionHandle<T>, item_id: TokenId) -> DispatchResult {
+		let collection_id = collection.id;
 
-        let item = <NftItemList<T>>::get(collection_id, item_id)
-            .ok_or(Error::<T>::TokenNotFound)?;
-        Self::remove_token_index(collection_id, item_id, &item.owner)?;
+		let item =
+			<NftItemList<T>>::get(collection_id, item_id).ok_or(Error::<T>::TokenNotFound)?;
+		Self::remove_token_index(collection_id, item_id, &item.owner)?;
 
-        // update balance
-        let new_balance = <Balance<T>>::get(collection_id, item.owner.as_sub())
-            .checked_sub(1)
-            .ok_or(Error::<T>::NumOverflow)?;
-        <Balance<T>>::insert(collection_id, item.owner.as_sub(), new_balance);
-        <NftItemList<T>>::remove(collection_id, item_id);
-        <VariableMetaDataBasket<T>>::remove(collection_id, item_id);
+		// update balance
+		let new_balance = <Balance<T>>::get(collection_id, item.owner.as_sub())
+			.checked_sub(1)
+			.ok_or(Error::<T>::NumOverflow)?;
+		<Balance<T>>::insert(collection_id, item.owner.as_sub(), new_balance);
+		<NftItemList<T>>::remove(collection_id, item_id);
+		<VariableMetaDataBasket<T>>::remove(collection_id, item_id);
 
-        Self::deposit_event(RawEvent::ItemDestroyed(collection.id, item_id));
-        Ok(())
-    }
+		Self::deposit_event(RawEvent::ItemDestroyed(collection.id, item_id));
+		Ok(())
+	}
 
-    fn burn_fungible_item(owner: &T::CrossAccountId, collection: &CollectionHandle<T>, value: u128) -> DispatchResult {
-        let collection_id = collection.id;
+	fn burn_fungible_item(
+		owner: &T::CrossAccountId,
+		collection: &CollectionHandle<T>,
+		value: u128,
+	) -> DispatchResult {
+		let collection_id = collection.id;
 
-        let mut balance = <FungibleItemList<T>>::get(collection_id, owner.as_sub());
-        ensure!(balance.value >= value, Error::<T>::TokenValueNotEnough);
+		let mut balance = <FungibleItemList<T>>::get(collection_id, owner.as_sub());
+		ensure!(balance.value >= value, Error::<T>::TokenValueNotEnough);
 
-        // update balance
-        let new_balance = <Balance<T>>::get(collection_id, owner.as_sub())
-            .checked_sub(value)
-            .ok_or(Error::<T>::NumOverflow)?;
-        <Balance<T>>::insert(collection_id, owner.as_sub(), new_balance);
+		// update balance
+		let new_balance = <Balance<T>>::get(collection_id, owner.as_sub())
+			.checked_sub(value)
+			.ok_or(Error::<T>::NumOverflow)?;
+		<Balance<T>>::insert(collection_id, owner.as_sub(), new_balance);
 
-        if balance.value - value > 0 {
-            balance.value -= value;
-            <FungibleItemList<T>>::insert(collection_id, owner.as_sub(), balance);
-        }
-        else {
-            <FungibleItemList<T>>::remove(collection_id, owner.as_sub());
-        }
+		if balance.value - value > 0 {
+			balance.value -= value;
+			<FungibleItemList<T>>::insert(collection_id, owner.as_sub(), balance);
+		} else {
+			<FungibleItemList<T>>::remove(collection_id, owner.as_sub());
+		}
 
-        collection.log(ERC20Events::Transfer {
-            from: *owner.as_eth(),
-            to: H160::default(),
-            value: value.into(),
-        });
-        Ok(())
-    }
+		collection.log(ERC20Events::Transfer {
+			from: *owner.as_eth(),
+			to: H160::default(),
+			value: value.into(),
+		});
+		Ok(())
+	}
 
-    pub fn get_collection(collection_id: CollectionId) -> Result<CollectionHandle<T>, sp_runtime::DispatchError> {
-        Ok(<CollectionHandle<T>>::get(collection_id)
-            .ok_or(Error::<T>::CollectionNotFound)?)
-    }
+	pub fn get_collection(
+		collection_id: CollectionId,
+	) -> Result<CollectionHandle<T>, sp_runtime::DispatchError> {
+		Ok(<CollectionHandle<T>>::get(collection_id).ok_or(Error::<T>::CollectionNotFound)?)
+	}
 
-    fn save_collection(collection: CollectionHandle<T>) {
-        <CollectionById<T>>::insert(collection.id, collection.into_inner());
-    }
+	fn save_collection(collection: CollectionHandle<T>) {
+		<CollectionById<T>>::insert(collection.id, collection.into_inner());
+	}
 
-    pub fn submit_logs(collection: CollectionHandle<T>) -> DispatchResult {
-        if collection.logs.is_empty() {
-            return Ok(())
-        }
-        T::EthereumTransactionSender::submit_logs_transaction(
-            eth::generate_transaction(collection.id, T::EthereumChainId::get()),
-            collection.logs.retrieve_logs(),
-        )
-    }
+	pub fn submit_logs(collection: CollectionHandle<T>) -> DispatchResult {
+		if collection.logs.is_empty() {
+			return Ok(());
+		}
+		T::EthereumTransactionSender::submit_logs_transaction(
+			eth::generate_transaction(collection.id, T::EthereumChainId::get()),
+			collection.logs.retrieve_logs(),
+		)
+	}
 
-    fn check_owner_permissions(target_collection: &CollectionHandle<T>, subject: &T::AccountId) -> DispatchResult {
-        ensure!(
-            *subject == target_collection.owner,
-            Error::<T>::NoPermission
-        );
+	fn check_owner_permissions(
+		target_collection: &CollectionHandle<T>,
+		subject: &T::AccountId,
+	) -> DispatchResult {
+		ensure!(
+			*subject == target_collection.owner,
+			Error::<T>::NoPermission
+		);
 
-        Ok(())
-    }
+		Ok(())
+	}
 
-    fn is_owner_or_admin_permissions(collection: &CollectionHandle<T>, subject: &T::CrossAccountId) -> bool {
-        *subject.as_sub() == collection.owner || <AdminList<T>>::get(collection.id).contains(&subject)
-    }
+	fn is_owner_or_admin_permissions(
+		collection: &CollectionHandle<T>,
+		subject: &T::CrossAccountId,
+	) -> bool {
+		*subject.as_sub() == collection.owner
+			|| <AdminList<T>>::get(collection.id).contains(subject)
+	}
 
-    fn check_owner_or_admin_permissions(
-        collection: &CollectionHandle<T>,
-        subject: &T::CrossAccountId,
-    ) -> DispatchResult {
-        ensure!(Self::is_owner_or_admin_permissions(collection, subject), Error::<T>::NoPermission);
+	fn check_owner_or_admin_permissions(
+		collection: &CollectionHandle<T>,
+		subject: &T::CrossAccountId,
+	) -> DispatchResult {
+		ensure!(
+			Self::is_owner_or_admin_permissions(collection, subject),
+			Error::<T>::NoPermission
+		);
 
-        Ok(())
-    }
+		Ok(())
+	}
 
-    fn owned_amount(
-        subject: &T::CrossAccountId,
-        target_collection: &CollectionHandle<T>,
-        item_id: TokenId,
-    ) -> Option<u128> {
-        let collection_id = target_collection.id;
+	fn owned_amount(
+		subject: &T::CrossAccountId,
+		target_collection: &CollectionHandle<T>,
+		item_id: TokenId,
+	) -> Option<u128> {
+		let collection_id = target_collection.id;
 
-        match target_collection.mode {
-            CollectionMode::NFT => (<NftItemList<T>>::get(collection_id, item_id)?.owner == *subject)
-                .then(|| 1),
-            CollectionMode::Fungible(_) => Some(<FungibleItemList<T>>::get(collection_id, &subject.as_sub())
-                .value),
-            CollectionMode::ReFungible => <ReFungibleItemList<T>>::get(collection_id, item_id)?
-                .owner
-                .iter()
-                .find(|i| i.owner == *subject)
-                .map(|i| i.fraction),
-            CollectionMode::Invalid => None,
-        }
-    }
+		match target_collection.mode {
+			CollectionMode::NFT => {
+				(<NftItemList<T>>::get(collection_id, item_id)?.owner == *subject).then(|| 1)
+			}
+			CollectionMode::Fungible(_) => {
+				Some(<FungibleItemList<T>>::get(collection_id, &subject.as_sub()).value)
+			}
+			CollectionMode::ReFungible => <ReFungibleItemList<T>>::get(collection_id, item_id)?
+				.owner
+				.iter()
+				.find(|i| i.owner == *subject)
+				.map(|i| i.fraction),
+			CollectionMode::Invalid => None,
+		}
+	}
 
-    fn is_item_owner(subject: &T::CrossAccountId, target_collection: &CollectionHandle<T>, item_id: TokenId) -> bool {
-        match target_collection.mode {
-            CollectionMode::Fungible(_) => true,
-            _ => Self::owned_amount(&subject, target_collection, item_id).is_some(),
-        }
-    }
+	fn is_item_owner(
+		subject: &T::CrossAccountId,
+		target_collection: &CollectionHandle<T>,
+		item_id: TokenId,
+	) -> bool {
+		match target_collection.mode {
+			CollectionMode::Fungible(_) => true,
+			_ => Self::owned_amount(subject, target_collection, item_id).is_some(),
+		}
+	}
 
-    fn check_white_list(collection: &CollectionHandle<T>, address: &T::CrossAccountId) -> DispatchResult {
-        let collection_id = collection.id;
+	fn check_white_list(
+		collection: &CollectionHandle<T>,
+		address: &T::CrossAccountId,
+	) -> DispatchResult {
+		let collection_id = collection.id;
 
-        let mes = Error::<T>::AddresNotInWhiteList;
-        ensure!(<WhiteList<T>>::contains_key(collection_id, address.as_sub()), mes);
+		let mes = Error::<T>::AddresNotInWhiteList;
+		ensure!(
+			<WhiteList<T>>::contains_key(collection_id, address.as_sub()),
+			mes
+		);
 
-        Ok(())
-    }
+		Ok(())
+	}
 
-    /// Check if token exists. In case of Fungible, check if there is an entry for 
-    /// the owner in fungible balances double map
-    fn token_exists(
-        target_collection: &CollectionHandle<T>,
-        item_id: TokenId,
-    ) -> DispatchResult {
-        let collection_id = target_collection.id;
-        let exists = match target_collection.mode
-        {
-            CollectionMode::NFT => <NftItemList<T>>::contains_key(collection_id, item_id),
-            CollectionMode::Fungible(_)  => true,
-            CollectionMode::ReFungible  => <ReFungibleItemList<T>>::contains_key(collection_id, item_id),
-            _ => false
-        };
+	/// Check if token exists. In case of Fungible, check if there is an entry for
+	/// the owner in fungible balances double map
+	fn token_exists(target_collection: &CollectionHandle<T>, item_id: TokenId) -> DispatchResult {
+		let collection_id = target_collection.id;
+		let exists = match target_collection.mode {
+			CollectionMode::NFT => <NftItemList<T>>::contains_key(collection_id, item_id),
+			CollectionMode::Fungible(_) => true,
+			CollectionMode::ReFungible => {
+				<ReFungibleItemList<T>>::contains_key(collection_id, item_id)
+			}
+			_ => false,
+		};
 
-        ensure!(exists == true, Error::<T>::TokenNotFound);
-        Ok(())
-    }
+		ensure!(exists, Error::<T>::TokenNotFound);
+		Ok(())
+	}
 
-    fn transfer_fungible(
-        collection: &CollectionHandle<T>,
-        value: u128,
-        owner: &T::CrossAccountId,
-        recipient: &T::CrossAccountId,
-    ) -> DispatchResult {
-        let collection_id = collection.id;
+	fn transfer_fungible(
+		collection: &CollectionHandle<T>,
+		value: u128,
+		owner: &T::CrossAccountId,
+		recipient: &T::CrossAccountId,
+	) -> DispatchResult {
+		let collection_id = collection.id;
 
-        let mut balance = <FungibleItemList<T>>::get(collection_id, owner.as_sub());
-        ensure!(balance.value >= value, Error::<T>::TokenValueTooLow);
+		let mut balance = <FungibleItemList<T>>::get(collection_id, owner.as_sub());
+		ensure!(balance.value >= value, Error::<T>::TokenValueTooLow);
 
-        // Send balance to recipient (updates balanceOf of recipient)
-        Self::add_fungible_item(collection, recipient, value)?;
+		// Send balance to recipient (updates balanceOf of recipient)
+		Self::add_fungible_item(collection, recipient, value)?;
 
-        // update balanceOf of sender
-        <Balance<T>>::insert(collection_id, owner.as_sub(), balance.value - value);
+		// update balanceOf of sender
+		<Balance<T>>::insert(collection_id, owner.as_sub(), balance.value - value);
 
-        // Reduce or remove sender
-        if balance.value == value {
-            <FungibleItemList<T>>::remove(collection_id, owner.as_sub());
-        }
-        else {
-            balance.value -= value;
-            <FungibleItemList<T>>::insert(collection_id, owner.as_sub(), balance);
-        }
+		// Reduce or remove sender
+		if balance.value == value {
+			<FungibleItemList<T>>::remove(collection_id, owner.as_sub());
+		} else {
+			balance.value -= value;
+			<FungibleItemList<T>>::insert(collection_id, owner.as_sub(), balance);
+		}
 
-        collection.log(ERC20Events::Transfer {
-            from: *owner.as_eth(),
-            to: *recipient.as_eth(),
-            value: value.into(),
-        });
-        Self::deposit_event(RawEvent::Transfer(collection.id, 1, owner.clone(), recipient.clone(), value));
+		collection.log(ERC20Events::Transfer {
+			from: *owner.as_eth(),
+			to: *recipient.as_eth(),
+			value: value.into(),
+		});
+		Self::deposit_event(RawEvent::Transfer(
+			collection.id,
+			1,
+			owner.clone(),
+			recipient.clone(),
+			value,
+		));
 
-        Ok(())
-    }
+		Ok(())
+	}
 
-    fn transfer_refungible(
-        collection: &CollectionHandle<T>,
-        item_id: TokenId,
-        value: u128,
-        owner: T::CrossAccountId,
-        new_owner: T::CrossAccountId,
-    ) -> DispatchResult {
-        let collection_id = collection.id;
-        let full_item = <ReFungibleItemList<T>>::get(collection_id, item_id)
-            .ok_or(Error::<T>::TokenNotFound)?;
+	fn transfer_refungible(
+		collection: &CollectionHandle<T>,
+		item_id: TokenId,
+		value: u128,
+		owner: T::CrossAccountId,
+		new_owner: T::CrossAccountId,
+	) -> DispatchResult {
+		let collection_id = collection.id;
+		let full_item = <ReFungibleItemList<T>>::get(collection_id, item_id)
+			.ok_or(Error::<T>::TokenNotFound)?;
 
-        let item = full_item
-            .owner
-            .iter()
-            .filter(|i| i.owner == owner)
-            .next()
-            .ok_or(Error::<T>::TokenNotFound)?;
-        let amount = item.fraction;
+		let item = full_item
+			.owner
+			.iter()
+			.find(|i| i.owner == owner)
+			.ok_or(Error::<T>::TokenNotFound)?;
+		let amount = item.fraction;
 
-        ensure!(amount >= value, Error::<T>::TokenValueTooLow);
+		ensure!(amount >= value, Error::<T>::TokenValueTooLow);
 
-        // update balance
-        let balance_old_owner = <Balance<T>>::get(collection_id, item.owner.as_sub())
-            .checked_sub(value)
-            .ok_or(Error::<T>::NumOverflow)?;
-        <Balance<T>>::insert(collection_id, item.owner.as_sub(), balance_old_owner);
+		// update balance
+		let balance_old_owner = <Balance<T>>::get(collection_id, item.owner.as_sub())
+			.checked_sub(value)
+			.ok_or(Error::<T>::NumOverflow)?;
+		<Balance<T>>::insert(collection_id, item.owner.as_sub(), balance_old_owner);
 
-        let balance_new_owner = <Balance<T>>::get(collection_id, new_owner.as_sub())
-            .checked_add(value)
-            .ok_or(Error::<T>::NumOverflow)?;
-        <Balance<T>>::insert(collection_id, new_owner.as_sub(), balance_new_owner);
+		let balance_new_owner = <Balance<T>>::get(collection_id, new_owner.as_sub())
+			.checked_add(value)
+			.ok_or(Error::<T>::NumOverflow)?;
+		<Balance<T>>::insert(collection_id, new_owner.as_sub(), balance_new_owner);
 
-        let old_owner = item.owner.clone();
-        let new_owner_has_account = full_item.owner.iter().any(|i| i.owner == new_owner);
+		let old_owner = item.owner.clone();
+		let new_owner_has_account = full_item.owner.iter().any(|i| i.owner == new_owner);
 
-        // transfer
-        if amount == value && !new_owner_has_account {
-            // change owner
-            // new owner do not have account
-            let mut new_full_item = full_item.clone();
-            new_full_item
-                .owner
-                .iter_mut()
-                .find(|i| i.owner == owner)
-                .expect("old owner does present in refungible")
-                .owner = new_owner.clone();
-            <ReFungibleItemList<T>>::insert(collection_id, item_id, new_full_item);
+		let mut new_full_item = full_item.clone();
+		// transfer
+		if amount == value && !new_owner_has_account {
+			// change owner
+			// new owner do not have account
+			new_full_item
+				.owner
+				.iter_mut()
+				.find(|i| i.owner == owner)
+				.expect("old owner does present in refungible")
+				.owner = new_owner.clone();
+			<ReFungibleItemList<T>>::insert(collection_id, item_id, new_full_item);
 
-            // update index collection
-            Self::move_token_index(collection_id, item_id, &old_owner, &new_owner)?;
-        } else {
-            let mut new_full_item = full_item.clone();
-            new_full_item
-                .owner
-                .iter_mut()
-                .find(|i| i.owner == owner)
-                .expect("old owner does present in refungible")
-                .fraction -= value;
+			// update index collection
+			Self::move_token_index(collection_id, item_id, &old_owner, &new_owner)?;
+		} else {
+			new_full_item
+				.owner
+				.iter_mut()
+				.find(|i| i.owner == owner)
+				.expect("old owner does present in refungible")
+				.fraction -= value;
 
-            // separate amount
-            if new_owner_has_account {
-                // new owner has account
-                new_full_item
-                    .owner
-                    .iter_mut()
-                    .find(|i| i.owner == new_owner)
-                    .expect("new owner has account")
-                    .fraction += value;
-            } else {
-                // new owner do not have account
-                new_full_item.owner.push(Ownership {
-                    owner: new_owner.clone(),
-                    fraction: value,
-                });
-                Self::add_token_index(collection_id, item_id, &new_owner)?;
-            }
+			// separate amount
+			if new_owner_has_account {
+				// new owner has account
+				new_full_item
+					.owner
+					.iter_mut()
+					.find(|i| i.owner == new_owner)
+					.expect("new owner has account")
+					.fraction += value;
+			} else {
+				// new owner do not have account
+				new_full_item.owner.push(Ownership {
+					owner: new_owner.clone(),
+					fraction: value,
+				});
+				Self::add_token_index(collection_id, item_id, &new_owner)?;
+			}
 
-            <ReFungibleItemList<T>>::insert(collection_id, item_id, new_full_item);
-        }
+			<ReFungibleItemList<T>>::insert(collection_id, item_id, new_full_item);
+		}
 
-        Self::deposit_event(RawEvent::Transfer(collection.id, item_id, owner, new_owner, amount));
+		Self::deposit_event(RawEvent::Transfer(
+			collection.id,
+			item_id,
+			owner,
+			new_owner,
+			amount,
+		));
 
-        Ok(())
-    }
+		Ok(())
+	}
 
-    fn transfer_nft(
-        collection: &CollectionHandle<T>,
-        item_id: TokenId,
-        sender: T::CrossAccountId,
-        new_owner: T::CrossAccountId,
-    ) -> DispatchResult {
-        let collection_id = collection.id;
-        let mut item = <NftItemList<T>>::get(collection_id, item_id)
-            .ok_or(Error::<T>::TokenNotFound)?;
+	fn transfer_nft(
+		collection: &CollectionHandle<T>,
+		item_id: TokenId,
+		sender: T::CrossAccountId,
+		new_owner: T::CrossAccountId,
+	) -> DispatchResult {
+		let collection_id = collection.id;
+		let mut item =
+			<NftItemList<T>>::get(collection_id, item_id).ok_or(Error::<T>::TokenNotFound)?;
 
-        ensure!(
-            sender == item.owner,
-            Error::<T>::MustBeTokenOwner
-        );
+		ensure!(sender == item.owner, Error::<T>::MustBeTokenOwner);
 
-        // update balance
-        let balance_old_owner = <Balance<T>>::get(collection_id, item.owner.as_sub())
-            .checked_sub(1)
-            .ok_or(Error::<T>::NumOverflow)?;
-        <Balance<T>>::insert(collection_id, item.owner.as_sub(), balance_old_owner);
+		// update balance
+		let balance_old_owner = <Balance<T>>::get(collection_id, item.owner.as_sub())
+			.checked_sub(1)
+			.ok_or(Error::<T>::NumOverflow)?;
+		<Balance<T>>::insert(collection_id, item.owner.as_sub(), balance_old_owner);
 
-        let balance_new_owner = <Balance<T>>::get(collection_id, new_owner.as_sub())
-            .checked_add(1)
-            .ok_or(Error::<T>::NumOverflow)?;
-        <Balance<T>>::insert(collection_id, new_owner.as_sub(), balance_new_owner);
+		let balance_new_owner = <Balance<T>>::get(collection_id, new_owner.as_sub())
+			.checked_add(1)
+			.ok_or(Error::<T>::NumOverflow)?;
+		<Balance<T>>::insert(collection_id, new_owner.as_sub(), balance_new_owner);
 
-        // change owner
-        let old_owner = item.owner.clone();
-        item.owner = new_owner.clone();
-        <NftItemList<T>>::insert(collection_id, item_id, item);
+		// change owner
+		let old_owner = item.owner.clone();
+		item.owner = new_owner.clone();
+		<NftItemList<T>>::insert(collection_id, item_id, item);
 
-        // update index collection
-        Self::move_token_index(collection_id, item_id, &old_owner, &new_owner)?;
+		// update index collection
+		Self::move_token_index(collection_id, item_id, &old_owner, &new_owner)?;
 
-        collection.log(ERC721Events::Transfer {
-            from: *sender.as_eth(),
-            to: *new_owner.as_eth(),
-            token_id: item_id.into(),
-        });
-        Self::deposit_event(RawEvent::Transfer(collection.id, item_id, sender, new_owner, 1));
+		collection.log(ERC721Events::Transfer {
+			from: *sender.as_eth(),
+			to: *new_owner.as_eth(),
+			token_id: item_id.into(),
+		});
+		Self::deposit_event(RawEvent::Transfer(
+			collection.id,
+			item_id,
+			sender,
+			new_owner,
+			1,
+		));
 
-        Ok(())
-    }
-    
-    fn set_re_fungible_variable_data(
-        collection: &CollectionHandle<T>,
-        item_id: TokenId,
-        data: Vec<u8>
-    ) -> DispatchResult {
-        let collection_id = collection.id;
-        let mut item = <ReFungibleItemList<T>>::get(collection_id, item_id)
-            .ok_or(Error::<T>::TokenNotFound)?;
+		Ok(())
+	}
 
-        item.variable_data = data;
+	fn set_re_fungible_variable_data(
+		collection: &CollectionHandle<T>,
+		item_id: TokenId,
+		data: Vec<u8>,
+	) -> DispatchResult {
+		let collection_id = collection.id;
+		let mut item = <ReFungibleItemList<T>>::get(collection_id, item_id)
+			.ok_or(Error::<T>::TokenNotFound)?;
 
-        <ReFungibleItemList<T>>::insert(collection_id, item_id, item);
+		item.variable_data = data;
 
-        Ok(())
-    }
+		<ReFungibleItemList<T>>::insert(collection_id, item_id, item);
 
-    fn set_nft_variable_data(
-        collection: &CollectionHandle<T>,
-        item_id: TokenId,
-        data: Vec<u8>
-    ) -> DispatchResult {
-        let collection_id = collection.id;
-        let mut item = <NftItemList<T>>::get(collection_id, item_id)
-            .ok_or(Error::<T>::TokenNotFound)?;
-        
-        item.variable_data = data;
+		Ok(())
+	}
 
-        <NftItemList<T>>::insert(collection_id, item_id, item);
-        
-        Ok(())
-    }
+	fn set_nft_variable_data(
+		collection: &CollectionHandle<T>,
+		item_id: TokenId,
+		data: Vec<u8>,
+	) -> DispatchResult {
+		let collection_id = collection.id;
+		let mut item =
+			<NftItemList<T>>::get(collection_id, item_id).ok_or(Error::<T>::TokenNotFound)?;
 
-    #[allow(dead_code)]
-    fn init_collection(item: &Collection<T>) {
-        // check params
-        assert!(
-            item.decimal_points <= MAX_DECIMAL_POINTS,
-            "decimal_points parameter must be lower than MAX_DECIMAL_POINTS"
-        );
-        assert!(
-            item.name.len() <= 64,
-            "Collection name can not be longer than 63 char"
-        );
-        assert!(
-            item.name.len() <= 256,
-            "Collection description can not be longer than 255 char"
-        );
-        assert!(
-            item.token_prefix.len() <= 16,
-            "Token prefix can not be longer than 15 char"
-        );
+		item.variable_data = data;
 
-        // Generate next collection ID
-        let next_id = CreatedCollectionCount::get()
-            .checked_add(1)
-            .unwrap();
+		<NftItemList<T>>::insert(collection_id, item_id, item);
 
-        CreatedCollectionCount::put(next_id);
-    }
+		Ok(())
+	}
 
-    #[allow(dead_code)]
-    fn init_nft_token(collection_id: CollectionId, item: &NftItemType<T::CrossAccountId>) {
-        let current_index = <ItemListIndex>::get(collection_id)
-            .checked_add(1)
-            .unwrap();
+	#[allow(dead_code)]
+	fn init_collection(item: &Collection<T>) {
+		// check params
+		assert!(
+			item.decimal_points <= MAX_DECIMAL_POINTS,
+			"decimal_points parameter must be lower than MAX_DECIMAL_POINTS"
+		);
+		assert!(
+			item.name.len() <= 64,
+			"Collection name can not be longer than 63 char"
+		);
+		assert!(
+			item.name.len() <= 256,
+			"Collection description can not be longer than 255 char"
+		);
+		assert!(
+			item.token_prefix.len() <= 16,
+			"Token prefix can not be longer than 15 char"
+		);
 
-        Self::add_token_index(collection_id, current_index, &item.owner).unwrap();
+		// Generate next collection ID
+		let next_id = CreatedCollectionCount::get().checked_add(1).unwrap();
 
-        <ItemListIndex>::insert(collection_id, current_index);
+		CreatedCollectionCount::put(next_id);
+	}
 
-        // Update balance
-        let new_balance = <Balance<T>>::get(collection_id, item.owner.as_sub())
-            .checked_add(1)
-            .unwrap();
-        <Balance<T>>::insert(collection_id, item.owner.as_sub(), new_balance);
-    }
+	#[allow(dead_code)]
+	fn init_nft_token(collection_id: CollectionId, item: &NftItemType<T::CrossAccountId>) {
+		let current_index = <ItemListIndex>::get(collection_id).checked_add(1).unwrap();
 
-    #[allow(dead_code)]
-    fn init_fungible_token(collection_id: CollectionId, owner: &T::CrossAccountId, item: &FungibleItemType) {
-        let current_index = <ItemListIndex>::get(collection_id)
-            .checked_add(1)
-            .unwrap();
+		Self::add_token_index(collection_id, current_index, &item.owner).unwrap();
 
-        Self::add_token_index(collection_id, current_index, owner).unwrap();
+		<ItemListIndex>::insert(collection_id, current_index);
 
-        <ItemListIndex>::insert(collection_id, current_index);
+		// Update balance
+		let new_balance = <Balance<T>>::get(collection_id, item.owner.as_sub())
+			.checked_add(1)
+			.unwrap();
+		<Balance<T>>::insert(collection_id, item.owner.as_sub(), new_balance);
+	}
 
-        // Update balance
-        let new_balance = <Balance<T>>::get(collection_id, owner.as_sub())
-            .checked_add(item.value)
-            .unwrap();
-        <Balance<T>>::insert(collection_id, owner.as_sub(), new_balance);
-    }
+	#[allow(dead_code)]
+	fn init_fungible_token(
+		collection_id: CollectionId,
+		owner: &T::CrossAccountId,
+		item: &FungibleItemType,
+	) {
+		let current_index = <ItemListIndex>::get(collection_id).checked_add(1).unwrap();
 
-    #[allow(dead_code)]
-    fn init_refungible_token(collection_id: CollectionId, item: &ReFungibleItemType<T::CrossAccountId>) {
-        let current_index = <ItemListIndex>::get(collection_id)
-            .checked_add(1)
-            .unwrap();
+		Self::add_token_index(collection_id, current_index, owner).unwrap();
 
-        let value = item.owner.first().unwrap().fraction;
-        let owner = item.owner.first().unwrap().owner.clone();
+		<ItemListIndex>::insert(collection_id, current_index);
 
-        Self::add_token_index(collection_id, current_index, &owner).unwrap();
+		// Update balance
+		let new_balance = <Balance<T>>::get(collection_id, owner.as_sub())
+			.checked_add(item.value)
+			.unwrap();
+		<Balance<T>>::insert(collection_id, owner.as_sub(), new_balance);
+	}
 
-        <ItemListIndex>::insert(collection_id, current_index);
+	#[allow(dead_code)]
+	fn init_refungible_token(
+		collection_id: CollectionId,
+		item: &ReFungibleItemType<T::CrossAccountId>,
+	) {
+		let current_index = <ItemListIndex>::get(collection_id).checked_add(1).unwrap();
 
-        // Update balance
-        let new_balance = <Balance<T>>::get(collection_id, &owner.as_sub())
-            .checked_add(value)
-            .unwrap();
-        <Balance<T>>::insert(collection_id, owner.as_sub(), new_balance);
-    }
+		let value = item.owner.first().unwrap().fraction;
+		let owner = item.owner.first().unwrap().owner.clone();
 
-    fn add_token_index(collection_id: CollectionId, item_index: TokenId, owner: &T::CrossAccountId) -> DispatchResult {
-        // add to account limit
-        if <AccountItemCount<T>>::contains_key(owner.as_sub()) {
+		Self::add_token_index(collection_id, current_index, &owner).unwrap();
 
-            // bound Owned tokens by a single address
-            let count = <AccountItemCount<T>>::get(owner.as_sub());
-            ensure!(count < ChainLimit::get().account_token_ownership_limit, Error::<T>::AddressOwnershipLimitExceeded);
+		<ItemListIndex>::insert(collection_id, current_index);
 
-            <AccountItemCount<T>>::insert(owner.as_sub(), count
-                .checked_add(1)
-                .ok_or(Error::<T>::NumOverflow)?);
-        }
-        else {
-            <AccountItemCount<T>>::insert(owner.as_sub(), 1);
-        }
+		// Update balance
+		let new_balance = <Balance<T>>::get(collection_id, &owner.as_sub())
+			.checked_add(value)
+			.unwrap();
+		<Balance<T>>::insert(collection_id, owner.as_sub(), new_balance);
+	}
 
-        let list_exists = <AddressTokens<T>>::contains_key(collection_id, owner.as_sub());
-        if list_exists {
-            let mut list = <AddressTokens<T>>::get(collection_id, owner.as_sub());
-            let item_contains = list.contains(&item_index.clone());
+	fn add_token_index(
+		collection_id: CollectionId,
+		item_index: TokenId,
+		owner: &T::CrossAccountId,
+	) -> DispatchResult {
+		// add to account limit
+		if <AccountItemCount<T>>::contains_key(owner.as_sub()) {
+			// bound Owned tokens by a single address
+			let count = <AccountItemCount<T>>::get(owner.as_sub());
+			ensure!(
+				count < ChainLimit::get().account_token_ownership_limit,
+				Error::<T>::AddressOwnershipLimitExceeded
+			);
 
-            if !item_contains {
-                list.push(item_index.clone());
-            }
+			<AccountItemCount<T>>::insert(
+				owner.as_sub(),
+				count.checked_add(1).ok_or(Error::<T>::NumOverflow)?,
+			);
+		} else {
+			<AccountItemCount<T>>::insert(owner.as_sub(), 1);
+		}
 
-            <AddressTokens<T>>::insert(collection_id, owner.as_sub(), list);
-        } else {
-            let mut itm = Vec::new();
-            itm.push(item_index.clone());
-            <AddressTokens<T>>::insert(collection_id, owner.as_sub(), itm);
-        }
+		let list_exists = <AddressTokens<T>>::contains_key(collection_id, owner.as_sub());
+		if list_exists {
+			let mut list = <AddressTokens<T>>::get(collection_id, owner.as_sub());
+			let item_contains = list.contains(&item_index.clone());
 
-        Ok(())
-    }
+			if !item_contains {
+				list.push(item_index);
+			}
 
-    fn remove_token_index(
-        collection_id: CollectionId,
-        item_index: TokenId,
-        owner: &T::CrossAccountId,
-    ) -> DispatchResult {
+			<AddressTokens<T>>::insert(collection_id, owner.as_sub(), list);
+		} else {
+			let itm = vec![item_index];
+			<AddressTokens<T>>::insert(collection_id, owner.as_sub(), itm);
+		}
 
-        // update counter
-        <AccountItemCount<T>>::insert(owner.as_sub(), 
-            <AccountItemCount<T>>::get(owner.as_sub())
-            .checked_sub(1)
-            .ok_or(Error::<T>::NumOverflow)?);
+		Ok(())
+	}
 
+	fn remove_token_index(
+		collection_id: CollectionId,
+		item_index: TokenId,
+		owner: &T::CrossAccountId,
+	) -> DispatchResult {
+		// update counter
+		<AccountItemCount<T>>::insert(
+			owner.as_sub(),
+			<AccountItemCount<T>>::get(owner.as_sub())
+				.checked_sub(1)
+				.ok_or(Error::<T>::NumOverflow)?,
+		);
 
-        let list_exists = <AddressTokens<T>>::contains_key(collection_id, owner.as_sub());
-        if list_exists {
-            let mut list = <AddressTokens<T>>::get(collection_id, owner.as_sub());
-            let item_contains = list.contains(&item_index.clone());
+		let list_exists = <AddressTokens<T>>::contains_key(collection_id, owner.as_sub());
+		if list_exists {
+			let mut list = <AddressTokens<T>>::get(collection_id, owner.as_sub());
+			let item_contains = list.contains(&item_index.clone());
 
-            if item_contains {
-                list.retain(|&item| item != item_index);
-                <AddressTokens<T>>::insert(collection_id, owner.as_sub(), list);
-            }
-        }
+			if item_contains {
+				list.retain(|&item| item != item_index);
+				<AddressTokens<T>>::insert(collection_id, owner.as_sub(), list);
+			}
+		}
 
-        Ok(())
-    }
+		Ok(())
+	}
 
-    fn move_token_index(
-        collection_id: CollectionId,
-        item_index: TokenId,
-        old_owner: &T::CrossAccountId,
-        new_owner: &T::CrossAccountId,
-    ) -> DispatchResult {
-        Self::remove_token_index(collection_id, item_index, old_owner)?;
-        Self::add_token_index(collection_id, item_index, new_owner)?;
+	fn move_token_index(
+		collection_id: CollectionId,
+		item_index: TokenId,
+		old_owner: &T::CrossAccountId,
+		new_owner: &T::CrossAccountId,
+	) -> DispatchResult {
+		Self::remove_token_index(collection_id, item_index, old_owner)?;
+		Self::add_token_index(collection_id, item_index, new_owner)?;
 
-        Ok(())
-    }
+		Ok(())
+	}
 }
 
 sp_api::decl_runtime_apis! {
-    pub trait NftApi {
-        /// Used for ethereum integration
-        fn eth_contract_code(account: H160) -> Option<Vec<u8>>;
-    }
-}
\ No newline at end of file
+	pub trait NftApi {
+		/// Used for ethereum integration
+		fn eth_contract_code(account: H160) -> Option<Vec<u8>>;
+	}
+}
modifiedpallets/nft/src/mock.rsdiffbeforeafterboth
--- a/pallets/nft/src/mock.rs
+++ b/pallets/nft/src/mock.rs
@@ -1,19 +1,21 @@
+#![allow(clippy::from_over_into)]
+
 use crate as pallet_template;
 use sp_core::H256;
-use frame_support::{ 
-	parameter_types,
-	weights::IdentityFee,
-};
+use frame_support::{parameter_types, weights::IdentityFee};
 use sp_runtime::{
-	traits::{BlakeTwo256, IdentityLookup}, 
-	testing::Header, 
+	traits::{BlakeTwo256, IdentityLookup},
+	testing::Header,
 	Perbill,
 };
-use pallet_transaction_payment::{ CurrencyAdapter};
+use pallet_transaction_payment::{CurrencyAdapter};
 use frame_system as system;
+use pallet_evm::AddressMapping;
+use crate::{EvmBackwardsAddressMapping, CrossAccountId};
+use codec::{Encode, Decode};
 
 type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
-type Block = frame_system::mocking::MockBlock<Test>; 
+type Block = frame_system::mocking::MockBlock<Test>;
 
 // Configure a mock runtime to test the pallet.
 frame_support::construct_runtime!(
@@ -22,9 +24,9 @@
 		NodeBlock = Block,
 		UncheckedExtrinsic = UncheckedExtrinsic,
 	{
-		System: frame_system::{Module, Call, Config, Storage, Event<T>},
-		TemplateModule: pallet_template::{Module, Call, Storage},
-		Balances: pallet_balances::{Module, Call, Storage},
+		System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
+		TemplateModule: pallet_template::{Pallet, Call, Storage},
+		Balances: pallet_balances::{Pallet, Call, Storage},
 	}
 );
 
@@ -56,6 +58,7 @@
 	type OnKilledAccount = ();
 	type SystemWeightInfo = ();
 	type SS58Prefix = SS58Prefix;
+	type OnSetCode = ();
 }
 
 parameter_types! {
@@ -64,10 +67,10 @@
 }
 //frame_system::Module<Test>;
 impl pallet_balances::Config for Test {
-    type AccountStore = System;
-    type Balance = u64;
-    type DustRemoval = ();
-    type Event = ();
+	type AccountStore = System;
+	type Balance = u64;
+	type DustRemoval = ();
+	type Event = ();
 	type ExistentialDeposit = ExistentialDeposit;
 	type WeightInfo = ();
 	type MaxLocks = MaxLocks;
@@ -78,7 +81,7 @@
 }
 
 impl pallet_transaction_payment::Config for Test {
-	type OnChargeTransaction = CurrencyAdapter<pallet_balances::Module<Test>, ()>;
+	type OnChargeTransaction = CurrencyAdapter<pallet_balances::Pallet<Test>, ()>;
 	type TransactionByteFee = TransactionByteFee;
 	type WeightToFee = IdentityFee<u64>;
 	type FeeMultiplierUpdate = ();
@@ -94,27 +97,26 @@
 	type WeightInfo = ();
 }
 
-type Timestamp = pallet_timestamp::Module<Test>;
-type Randomness = pallet_randomness_collective_flip::Module<Test>;
+type Timestamp = pallet_timestamp::Pallet<Test>;
+type Randomness = pallet_randomness_collective_flip::Pallet<Test>;
 
 parameter_types! {
 	pub const TombstoneDeposit: u64 = 1;
 	pub const DepositPerContract: u64 = 1;
 	pub const DepositPerStorageByte: u64 = 1;
 	pub const DepositPerStorageItem: u64 = 1;
-	pub RentFraction: Perbill = Perbill::from_rational_approximation(1u32, 30 * 24 * 60 * 10);
+	pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * 24 * 60 * 10);
 	pub const SurchargeReward: u64 = 1;
 	pub const SignedClaimHandicap: u32 = 2;
-	pub const MaxDepth: u32 = 32;
-	pub const MaxValueSize: u32 = 16 * 1024;
 	pub DeletionWeightLimit: u64 = u64::MAX;//Perbill::from_percent(10);
 	pub DeletionQueueDepth: u32 = 10;
+	pub Schedule: pallet_contracts::Schedule<Test> = Default::default();
 }
 
 impl pallet_contracts::Config for Test {
 	type Time = Timestamp;
 	type Randomness = Randomness;
-	type Currency = pallet_balances::Module<Test>;
+	type Currency = pallet_balances::Pallet<Test>;
 	type Event = ();
 	type RentPayment = ();
 	type SignedClaimHandicap = SignedClaimHandicap;
@@ -125,29 +127,80 @@
 	type RentFraction = RentFraction;
 	type SurchargeReward = SurchargeReward;
 	type DeletionWeightLimit = DeletionWeightLimit;
-	type MaxDepth = MaxDepth;
 	type DeletionQueueDepth = DeletionQueueDepth;
-	type MaxValueSize = MaxValueSize;
 	type ChainExtension = ();
-	type MaxCodeSize = ();
 	type WeightPrice = ();
 	type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;
+	type Schedule = Schedule;
+	type CallStack = [pallet_contracts::Frame<Self>; 31];
 }
 
 parameter_types! {
 	pub const CollectionCreationPrice: u32 = 0;
-    pub TreasuryAccountId: u64 = 1234;
+	pub TreasuryAccountId: u64 = 1234;
+	pub EthereumChainId: u32 = 1111;
 }
 
+pub struct TestEvmAddressMapping;
+impl AddressMapping<u64> for TestEvmAddressMapping {
+	fn into_account_id(_addr: sp_core::H160) -> u64 {
+		unimplemented!()
+	}
+}
+
+pub struct TestEvmBackwardsAddressMapping;
+impl EvmBackwardsAddressMapping<u64> for TestEvmBackwardsAddressMapping {
+	fn from_account_id(_account_id: u64) -> sp_core::H160 {
+		unimplemented!()
+	}
+}
+
+#[derive(Encode, Decode, Clone, PartialEq, Eq, PartialOrd, Ord, Debug)]
+pub struct TestCrossAccountId(u64, sp_core::H160);
+impl CrossAccountId<u64> for TestCrossAccountId {
+	fn from_sub(sub: u64) -> Self {
+		let mut eth = [0; 20];
+		eth[12..20].copy_from_slice(&sub.to_be_bytes());
+		Self(sub, sp_core::H160(eth))
+	}
+	fn as_sub(&self) -> &u64 {
+		&self.0
+	}
+	fn from_eth(_eth: sp_core::H160) -> Self {
+		unimplemented!()
+	}
+	fn as_eth(&self) -> &sp_core::H160 {
+		&self.1
+	}
+}
+
+pub struct TestEtheremTransactionSender;
+impl pallet_ethereum::EthereumTransactionSender for TestEtheremTransactionSender {
+	fn submit_logs_transaction(
+		_tx: pallet_ethereum::Transaction,
+		_logs: Vec<pallet_ethereum::Log>,
+	) -> Result<(), sp_runtime::DispatchError> {
+		Ok(())
+	}
+}
+
 impl pallet_template::Config for Test {
 	type Event = ();
 	type WeightInfo = ();
 	type CollectionCreationPrice = CollectionCreationPrice;
-    type Currency = pallet_balances::Module<Test>;
-    type TreasuryAccountId = TreasuryAccountId;
+	type Currency = pallet_balances::Pallet<Test>;
+	type TreasuryAccountId = TreasuryAccountId;
+	type EvmAddressMapping = TestEvmAddressMapping;
+	type EvmBackwardsAddressMapping = TestEvmBackwardsAddressMapping;
+	type CrossAccountId = TestCrossAccountId;
+	type EthereumChainId = EthereumChainId;
+	type EthereumTransactionSender = TestEtheremTransactionSender;
 }
 
 // Build genesis storage according to the mock runtime.
 pub fn new_test_ext() -> sp_io::TestExternalities {
-	system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
-}
\ No newline at end of file
+	system::GenesisConfig::default()
+		.build_storage::<Test>()
+		.unwrap()
+		.into()
+}
modifiedpallets/nft/src/sponsorship.rsdiffbeforeafterboth
--- a/pallets/nft/src/sponsorship.rs
+++ b/pallets/nft/src/sponsorship.rs
@@ -1,4 +1,8 @@
-use crate::{Config, Call, CollectionById, CreateItemBasket, VariableMetaDataBasket, ReFungibleTransferBasket, FungibleTransferBasket, NftTransferBasket, ChainLimit, CreateItemData, CollectionMode};
+use crate::{
+	Config, Call, CollectionById, CreateItemBasket, VariableMetaDataBasket,
+	ReFungibleTransferBasket, FungibleTransferBasket, NftTransferBasket, ChainLimit,
+	CreateItemData, CollectionMode,
+};
 use core::marker::PhantomData;
 use up_sponsorship::SponsorshipHandler;
 use frame_support::{
@@ -6,7 +10,6 @@
 	storage::{StorageMap, StorageDoubleMap, StorageValue},
 };
 use nft_data_structs::{TokenId, CollectionId};
-use alloc::vec::Vec;
 
 pub struct NftSponsorshipHandler<T>(PhantomData<T>);
 impl<T: Config> NftSponsorshipHandler<T> {
@@ -15,7 +18,6 @@
 		collection_id: &CollectionId,
 		_properties: &CreateItemData,
 	) -> Option<T::AccountId> {
-	
 		let collection = CollectionById::<T>::get(collection_id)?;
 
 		// sponsor timeout
@@ -32,9 +34,8 @@
 		CreateItemBasket::<T>::insert((collection_id, who.clone()), block_number);
 
 		// check free create limit
-		if collection.limits.sponsored_data_size >= (_properties.len() as u32) {
-			collection.sponsorship.sponsor()
-				.cloned()
+		if collection.limits.sponsored_data_size >= (_properties.data_size() as u32) {
+			collection.sponsorship.sponsor().cloned()
 		} else {
 			None
 		}
@@ -45,13 +46,11 @@
 		collection_id: &CollectionId,
 		item_id: &TokenId,
 	) -> Option<T::AccountId> {
-
 		let collection = CollectionById::<T>::get(collection_id)?;
 		let limits = ChainLimit::get();
 
 		let mut sponsor_transfer = false;
 		if collection.sponsorship.confirmed() {
-
 			let collection_limits = collection.limits.clone();
 			let collection_mode = collection.mode.clone();
 
@@ -59,7 +58,6 @@
 			let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;
 			sponsor_transfer = match collection_mode {
 				CollectionMode::NFT => {
-
 					// get correct limit
 					let limit: u32 = if collection_limits.sponsor_transfer_timeout > 0 {
 						collection_limits.sponsor_transfer_timeout
@@ -82,7 +80,6 @@
 					sponsored
 				}
 				CollectionMode::Fungible(_) => {
-
 					// get correct limit
 					let limit: u32 = if collection_limits.sponsor_transfer_timeout > 0 {
 						collection_limits.sponsor_transfer_timeout
@@ -106,7 +103,6 @@
 					sponsored
 				}
 				CollectionMode::ReFungible => {
-
 					// get correct limit
 					let limit: u32 = if collection_limits.sponsor_transfer_timeout > 0 {
 						collection_limits.sponsor_transfer_timeout
@@ -116,7 +112,8 @@
 
 					let mut sponsored = true;
 					if ReFungibleTransferBasket::<T>::contains_key(collection_id, item_id) {
-						let last_tx_block = ReFungibleTransferBasket::<T>::get(collection_id, item_id);
+						let last_tx_block =
+							ReFungibleTransferBasket::<T>::get(collection_id, item_id);
 						let limit_time = last_tx_block + limit.into();
 						if block_number <= limit_time {
 							sponsored = false;
@@ -128,32 +125,27 @@
 
 					sponsored
 				}
-				_ => {
-					false
-				},
+				_ => false,
 			};
 		}
 
 		if !sponsor_transfer {
 			None
 		} else {
-			collection.sponsorship.sponsor()
-				.cloned()
+			collection.sponsorship.sponsor().cloned()
 		}
 	}
-	
+
 	pub fn withdraw_set_variable_meta_data(
 		collection_id: &CollectionId,
 		item_id: &TokenId,
-		data: &Vec<u8>,
+		data: &[u8],
 	) -> Option<T::AccountId> {
-
 		let mut sponsor_metadata_changes = false;
 
 		let collection = CollectionById::<T>::get(collection_id)?;
 
-		if
-			collection.sponsorship.confirmed() &&
+		if collection.sponsorship.confirmed() &&
 			// Can't sponsor fungible collection, this tx will be rejected
 			// as invalid
 			!matches!(collection.mode, CollectionMode::Fungible(_)) &&
@@ -164,7 +156,7 @@
 
 				if VariableMetaDataBasket::<T>::get(collection_id, item_id)
 					.map(|last_block| block_number - last_block > rate_limit)
-					.unwrap_or(true) 
+					.unwrap_or(true)
 				{
 					sponsor_metadata_changes = true;
 					VariableMetaDataBasket::<T>::insert(collection_id, item_id, block_number);
@@ -177,27 +169,26 @@
 		} else {
 			collection.sponsorship.sponsor().cloned()
 		}
-
 	}
 }
 
 impl<T, C> SponsorshipHandler<T::AccountId, C> for NftSponsorshipHandler<T>
-where 
-    T: Config,
-    C: IsSubType<Call<T>>
+where
+	T: Config,
+	C: IsSubType<Call<T>>,
 {
-    fn get_sponsor(who: &T::AccountId, call: &C) -> Option<T::AccountId> {
-        match IsSubType::<Call<T>>::is_sub_type(call)? {
-            Call::create_item(collection_id, _owner, _properties) => {
-                Self::withdraw_create_item(who, collection_id, &_properties)
-            },
-            Call::transfer(_new_owner, collection_id, item_id, _value) => {
-                Self::withdraw_transfer(who, collection_id, item_id)
-            },
-            Call::set_variable_meta_data(collection_id, item_id, data) => {
-                Self::withdraw_set_variable_meta_data(collection_id, item_id, &data)
-			},
+	fn get_sponsor(who: &T::AccountId, call: &C) -> Option<T::AccountId> {
+		match IsSubType::<Call<T>>::is_sub_type(call)? {
+			Call::create_item(collection_id, _owner, properties) => {
+				Self::withdraw_create_item(who, collection_id, properties)
+			}
+			Call::transfer(_new_owner, collection_id, item_id, _value) => {
+				Self::withdraw_transfer(who, collection_id, item_id)
+			}
+			Call::set_variable_meta_data(collection_id, item_id, data) => {
+				Self::withdraw_set_variable_meta_data(collection_id, item_id, data)
+			}
 			_ => None,
-        }
-    }
-}
\ No newline at end of file
+		}
+	}
+}
modifiedpallets/nft/src/tests.rsdiffbeforeafterboth
--- a/pallets/nft/src/tests.rs
+++ b/pallets/nft/src/tests.rs
@@ -1,81 +1,109 @@
 // Tests to be written here
 use super::*;
 use crate::mock::*;
-use crate::{AccessMode, CollectionMode,
-    Ownership, ChainLimits, CreateItemData, CreateNftData, CreateFungibleData, CreateReFungibleData,
-    CollectionId, TokenId, MAX_DECIMAL_POINTS};
+use crate::{AccessMode, CollectionMode, Ownership, ChainLimits, CreateItemData};
+use nft_data_structs::{
+	CreateNftData, CreateFungibleData, CreateReFungibleData, CollectionId, TokenId,
+	MAX_DECIMAL_POINTS,
+};
 use frame_support::{assert_noop, assert_ok};
-use frame_system::{ RawOrigin };
+use frame_system::{RawOrigin};
 
 fn default_collection_numbers_limit() -> u32 {
-    10
+	10
 }
 
 fn default_limits() {
-    assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits {
-            collection_numbers_limit: default_collection_numbers_limit(),
-            account_token_ownership_limit: 10,
-            collections_admins_limit: 5,
-            custom_data_limit: 2048,
-            nft_sponsor_transfer_timeout: 15,
-            fungible_sponsor_transfer_timeout: 15,
-            refungible_sponsor_transfer_timeout: 15,
-            const_on_chain_schema_limit: 1024,
-            offchain_schema_limit: 1024,
-            variable_on_chain_schema_limit: 1024,
-        }));
+	assert_ok!(TemplateModule::set_chain_limits(
+		RawOrigin::Root.into(),
+		ChainLimits {
+			collection_numbers_limit: default_collection_numbers_limit(),
+			account_token_ownership_limit: 10,
+			collections_admins_limit: 5,
+			custom_data_limit: 2048,
+			nft_sponsor_transfer_timeout: 15,
+			fungible_sponsor_transfer_timeout: 15,
+			refungible_sponsor_transfer_timeout: 15,
+			const_on_chain_schema_limit: 1024,
+			offchain_schema_limit: 1024,
+			variable_on_chain_schema_limit: 1024,
+		}
+	));
 }
 
 fn default_nft_data() -> CreateNftData {
-    CreateNftData { const_data: vec![1, 2, 3], variable_data: vec![3, 2, 1] }
+	CreateNftData {
+		const_data: vec![1, 2, 3],
+		variable_data: vec![3, 2, 1],
+	}
 }
 
-fn default_fungible_data () -> CreateFungibleData {
-    CreateFungibleData { value: 5 }
+fn default_fungible_data() -> CreateFungibleData {
+	CreateFungibleData { value: 5 }
 }
 
-fn default_re_fungible_data () -> CreateReFungibleData {
-    CreateReFungibleData { const_data: vec![1, 2, 3], variable_data: vec![3, 2, 1], pieces: 1023 }
+fn default_re_fungible_data() -> CreateReFungibleData {
+	CreateReFungibleData {
+		const_data: vec![1, 2, 3],
+		variable_data: vec![3, 2, 1],
+		pieces: 1023,
+	}
 }
 
-fn create_test_collection_for_owner(mode: &CollectionMode, owner: u64, id: CollectionId) -> CollectionId {
-    let col_name1: Vec<u16> = "Test1\0".encode_utf16().collect::<Vec<u16>>();
-    let col_desc1: Vec<u16> = "TestDescription1\0".encode_utf16().collect::<Vec<u16>>();
-    let token_prefix1: Vec<u8> = b"token_prefix1\0".to_vec();
+fn create_test_collection_for_owner(
+	mode: &CollectionMode,
+	owner: u64,
+	id: CollectionId,
+) -> CollectionId {
+	let col_name1: Vec<u16> = "Test1\0".encode_utf16().collect::<Vec<u16>>();
+	let col_desc1: Vec<u16> = "TestDescription1\0".encode_utf16().collect::<Vec<u16>>();
+	let token_prefix1: Vec<u8> = b"token_prefix1\0".to_vec();
 
-    let origin1 = Origin::signed(owner);
-    assert_ok!(TemplateModule::create_collection(
-            origin1.clone(),
-            col_name1.clone(),
-            col_desc1.clone(),
-            token_prefix1.clone(),
-            mode.clone()
-        ));
+	let origin1 = Origin::signed(owner);
+	assert_ok!(TemplateModule::create_collection(
+		origin1,
+		col_name1,
+		col_desc1,
+		token_prefix1,
+		mode.clone()
+	));
 
-    let saved_col_name: Vec<u16> = "Test1\0".encode_utf16().collect::<Vec<u16>>();
-    let saved_description: Vec<u16> = "TestDescription1\0".encode_utf16().collect::<Vec<u16>>();
-    let saved_prefix: Vec<u8> = b"token_prefix1\0".to_vec();
-    assert_eq!(TemplateModule::collection_id(id).unwrap().owner, owner);
-    assert_eq!(TemplateModule::collection_id(id).unwrap().name, saved_col_name);
-    assert_eq!(TemplateModule::collection_id(id).unwrap().mode, *mode);
-    assert_eq!(TemplateModule::collection_id(id).unwrap().description, saved_description);
-    assert_eq!(TemplateModule::collection_id(id).unwrap().token_prefix, saved_prefix);
-    id
+	let saved_col_name: Vec<u16> = "Test1\0".encode_utf16().collect::<Vec<u16>>();
+	let saved_description: Vec<u16> = "TestDescription1\0".encode_utf16().collect::<Vec<u16>>();
+	let saved_prefix: Vec<u8> = b"token_prefix1\0".to_vec();
+	assert_eq!(TemplateModule::collection_id(id).unwrap().owner, owner);
+	assert_eq!(
+		TemplateModule::collection_id(id).unwrap().name,
+		saved_col_name
+	);
+	assert_eq!(TemplateModule::collection_id(id).unwrap().mode, *mode);
+	assert_eq!(
+		TemplateModule::collection_id(id).unwrap().description,
+		saved_description
+	);
+	assert_eq!(
+		TemplateModule::collection_id(id).unwrap().token_prefix,
+		saved_prefix
+	);
+	id
 }
 
 fn create_test_collection(mode: &CollectionMode, id: CollectionId) -> CollectionId {
-    create_test_collection_for_owner(&mode, 1, id)
+	create_test_collection_for_owner(&mode, 1, id)
 }
 
 fn create_test_item(collection_id: CollectionId, data: &CreateItemData) {
-    let origin1 = Origin::signed(1);
-    assert_ok!(TemplateModule::create_item(
-            origin1.clone(),
-            collection_id,
-            1,
-            data.clone()
-        ));
+	let origin1 = Origin::signed(1);
+	assert_ok!(TemplateModule::create_item(
+		origin1,
+		collection_id,
+		account(1),
+		data.clone()
+	));
+}
 
+fn account(sub: u64) -> TestCrossAccountId {
+	TestCrossAccountId::from_sub(sub)
 }
 
 // Use cases tests region
@@ -83,149 +111,166 @@
 
 #[test]
 fn set_version_schema() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        let origin1 = Origin::signed(1);
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
-        
-        assert_ok!(TemplateModule::set_schema_version(origin1, collection_id, SchemaVersion::Unique));
-        assert_eq!(TemplateModule::collection_id(collection_id).unwrap().schema_version, SchemaVersion::Unique);
-    });
+	new_test_ext().execute_with(|| {
+		default_limits();
+		let origin1 = Origin::signed(1);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+
+		assert_ok!(TemplateModule::set_schema_version(
+			origin1,
+			collection_id,
+			SchemaVersion::Unique
+		));
+		assert_eq!(
+			TemplateModule::collection_id(collection_id)
+				.unwrap()
+				.schema_version,
+			SchemaVersion::Unique
+		);
+	});
 }
 
 #[test]
 fn create_fungible_collection_fails_with_large_decimal_numbers() {
-    new_test_ext().execute_with(|| {
-        default_limits();
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let col_name1: Vec<u16> = "Test1\0".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1\0".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1\0".to_vec();
+		let col_name1: Vec<u16> = "Test1\0".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1\0".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1\0".to_vec();
 
-        let origin1 = Origin::signed(1);
-        assert_noop!(TemplateModule::create_collection(
-            origin1,
-            col_name1,
-            col_desc1,
-            token_prefix1,
-            CollectionMode::Fungible(MAX_DECIMAL_POINTS + 1)
-        ), Error::<Test>::CollectionDecimalPointLimitExceeded);
-    });    
+		let origin1 = Origin::signed(1);
+		assert_noop!(
+			TemplateModule::create_collection(
+				origin1,
+				col_name1,
+				col_desc1,
+				token_prefix1,
+				CollectionMode::Fungible(MAX_DECIMAL_POINTS + 1)
+			),
+			Error::<Test>::CollectionDecimalPointLimitExceeded
+		);
+	});
 }
 
 #[test]
 fn create_nft_item() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
-        
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.clone().into());
-        let item = TemplateModule::nft_item_id(collection_id, 1).unwrap();
-        assert_eq!(item.const_data, data.const_data);
-        assert_eq!(item.variable_data, data.variable_data);
-    });
+	new_test_ext().execute_with(|| {
+		default_limits();
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.clone().into());
+		let item = TemplateModule::nft_item_id(collection_id, 1).unwrap();
+		assert_eq!(item.const_data, data.const_data);
+		assert_eq!(item.variable_data, data.variable_data);
+	});
 }
 
 // Use cases tests region
 // #region
 #[test]
 fn create_nft_multiple_items() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
+		create_test_collection(&CollectionMode::NFT, 1);
 
-        let items_data = vec![default_nft_data(), default_nft_data(), default_nft_data()];
+		let origin1 = Origin::signed(1);
 
-        assert_ok!(TemplateModule::create_multiple_items(
-            origin1.clone(),
-            1,
-            1,
-            items_data.clone().into_iter().map(|d| { d.into() }).collect()
-        ));
-        for (index, data) in items_data.iter().enumerate() {
-            let item = TemplateModule::nft_item_id(1, (index + 1) as TokenId).unwrap(); 
-            assert_eq!(item.const_data.to_vec(), data.const_data);
-            assert_eq!(item.variable_data.to_vec(), data.variable_data);
-        }
-    });
+		let items_data = vec![default_nft_data(), default_nft_data(), default_nft_data()];
+
+		assert_ok!(TemplateModule::create_multiple_items(
+			origin1,
+			1,
+			account(1),
+			items_data
+				.clone()
+				.into_iter()
+				.map(|d| { d.into() })
+				.collect()
+		));
+		for (index, data) in items_data.iter().enumerate() {
+			let item = TemplateModule::nft_item_id(1, (index + 1) as TokenId).unwrap();
+			assert_eq!(item.const_data.to_vec(), data.const_data);
+			assert_eq!(item.variable_data.to_vec(), data.variable_data);
+		}
+	});
 }
 
 #[test]
 fn create_refungible_item() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        let collection_id = create_test_collection(&CollectionMode::ReFungible, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
+		let collection_id = create_test_collection(&CollectionMode::ReFungible, 1);
 
-        let data = default_re_fungible_data();
-        create_test_item(collection_id, &data.clone().into());
-        let item = TemplateModule::refungible_item_id(collection_id, 1).unwrap();
-        assert_eq!(
-            item.const_data,
-            data.const_data
-        );
-        assert_eq!(
-            item.variable_data,
-            data.variable_data
-        );
-        assert_eq!(
-            item.owner[0],
-            Ownership {
-                owner: 1,
-                fraction: 1023
-            }
-        );
-    });
+		let data = default_re_fungible_data();
+		create_test_item(collection_id, &data.clone().into());
+		let item = TemplateModule::refungible_item_id(collection_id, 1).unwrap();
+		assert_eq!(item.const_data, data.const_data);
+		assert_eq!(item.variable_data, data.variable_data);
+		assert_eq!(
+			item.owner[0],
+			Ownership {
+				owner: account(1),
+				fraction: 1023
+			}
+		);
+	});
 }
 
 #[test]
 fn create_multiple_refungible_items() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        create_test_collection(&CollectionMode::ReFungible, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
+		create_test_collection(&CollectionMode::ReFungible, 1);
 
-        let items_data = vec![default_re_fungible_data(), default_re_fungible_data(), default_re_fungible_data()];
+		let origin1 = Origin::signed(1);
 
-        assert_ok!(TemplateModule::create_multiple_items(
-            origin1.clone(),
-            1,
-            1,
-            items_data.clone().into_iter().map(|d| { d.into() }).collect()
-        ));
-        for (index, data) in items_data.iter().enumerate() {
+		let items_data = vec![
+			default_re_fungible_data(),
+			default_re_fungible_data(),
+			default_re_fungible_data(),
+		];
 
-            let item = TemplateModule::refungible_item_id(1, (index + 1) as TokenId).unwrap();
-            assert_eq!(item.const_data.to_vec(), data.const_data);
-            assert_eq!(item.variable_data.to_vec(), data.variable_data);
-            assert_eq!(
-                item.owner[0],
-                Ownership {
-                    owner: 1,
-                    fraction: 1023
-                }
-            );
-        }
-    });
+		assert_ok!(TemplateModule::create_multiple_items(
+			origin1,
+			1,
+			account(1),
+			items_data
+				.clone()
+				.into_iter()
+				.map(|d| { d.into() })
+				.collect()
+		));
+		for (index, data) in items_data.iter().enumerate() {
+			let item = TemplateModule::refungible_item_id(1, (index + 1) as TokenId).unwrap();
+			assert_eq!(item.const_data.to_vec(), data.const_data);
+			assert_eq!(item.variable_data.to_vec(), data.variable_data);
+			assert_eq!(
+				item.owner[0],
+				Ownership {
+					owner: account(1),
+					fraction: 1023
+				}
+			);
+		}
+	});
 }
 
 #[test]
 fn create_fungible_item() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::Fungible(3), 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let data = default_fungible_data();
-        create_test_item(collection_id, &data.into());
+		let collection_id = create_test_collection(&CollectionMode::Fungible(3), 1);
 
-        assert_eq!(TemplateModule::fungible_item_id(collection_id, 1).value, 5);
-    });
+		let data = default_fungible_data();
+		create_test_item(collection_id, &data.into());
+
+		assert_eq!(TemplateModule::fungible_item_id(collection_id, 1).value, 5);
+	});
 }
 
 //#[test]
@@ -245,7 +290,7 @@
 //             1,
 //             items_data.clone().into_iter().map(|d| { d.into() }).collect()
 //         ));
-        
+
 //         for (index, _) in items_data.iter().enumerate() {
 //             assert_eq!(TemplateModule::fungible_item_id(1, (index + 1) as TokenId).value, 5);
 //         }
@@ -256,636 +301,746 @@
 
 #[test]
 fn transfer_fungible_item() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::Fungible(3), 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
+		let collection_id = create_test_collection(&CollectionMode::Fungible(3), 1);
 
-        let data = default_fungible_data();
-        create_test_item(collection_id, &data.into());
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
 
-        assert_eq!(TemplateModule::fungible_item_id(1, 1).value, 5);
-        assert_eq!(TemplateModule::balance_count(1, 1), 5);
+		let data = default_fungible_data();
+		create_test_item(collection_id, &data.into());
 
-        // change owner scenario
-        assert_ok!(TemplateModule::transfer(origin1.clone(), 2, 1, 1, 5));
-        assert_eq!(TemplateModule::fungible_item_id(1, 1).value, 0);
-        assert_eq!(TemplateModule::balance_count(1, 1), 0);
-        assert_eq!(TemplateModule::balance_count(1, 2), 5);
+		assert_eq!(TemplateModule::fungible_item_id(1, 1).value, 5);
+		assert_eq!(TemplateModule::balance_count(1, 1), 5);
 
-        // split item scenario
-        assert_ok!(TemplateModule::transfer(origin2.clone(), 3, 1, 1, 3));
-        assert_eq!(TemplateModule::balance_count(1, 2), 2);
-        assert_eq!(TemplateModule::balance_count(1, 3), 3);
+		// change owner scenario
+		assert_ok!(TemplateModule::transfer(origin1, account(2), 1, 1, 5));
+		assert_eq!(TemplateModule::fungible_item_id(1, 1).value, 0);
+		assert_eq!(TemplateModule::balance_count(1, 1), 0);
+		assert_eq!(TemplateModule::balance_count(1, 2), 5);
 
-        // split item and new owner has account scenario
-        assert_ok!(TemplateModule::transfer(origin2.clone(), 3, 1, 1, 1));
-        assert_eq!(TemplateModule::fungible_item_id(1, 2).value, 1);
-        assert_eq!(TemplateModule::fungible_item_id(1, 3).value, 4);
-        assert_eq!(TemplateModule::balance_count(1, 2), 1);
-        assert_eq!(TemplateModule::balance_count(1, 3), 4);
-    });
+		// split item scenario
+		assert_ok!(TemplateModule::transfer(
+			origin2.clone(),
+			account(3),
+			1,
+			1,
+			3
+		));
+		assert_eq!(TemplateModule::balance_count(1, 2), 2);
+		assert_eq!(TemplateModule::balance_count(1, 3), 3);
+
+		// split item and new owner has account scenario
+		assert_ok!(TemplateModule::transfer(origin2, account(3), 1, 1, 1));
+		assert_eq!(TemplateModule::fungible_item_id(1, 2).value, 1);
+		assert_eq!(TemplateModule::fungible_item_id(1, 3).value, 4);
+		assert_eq!(TemplateModule::balance_count(1, 2), 1);
+		assert_eq!(TemplateModule::balance_count(1, 3), 4);
+	});
 }
 
 #[test]
 fn transfer_refungible_item() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::ReFungible, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let data = default_re_fungible_data();
-        create_test_item(collection_id, &data.clone().into());
+		let collection_id = create_test_collection(&CollectionMode::ReFungible, 1);
 
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
-        {
-            let item = TemplateModule::refungible_item_id(collection_id, 1).unwrap();
-            assert_eq!(
-                item.const_data,
-                data.const_data
-            );
-            assert_eq!(
-                item.variable_data,
-                data.variable_data
-            );
-            assert_eq!(
-                item.owner[0],
-                Ownership {
-                    owner: 1,
-                    fraction: 1023
-                }
-            );
-        }
-        assert_eq!(TemplateModule::balance_count(1, 1), 1023);
-        assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
+		let data = default_re_fungible_data();
+		create_test_item(collection_id, &data.clone().into());
 
-        // change owner scenario
-        assert_ok!(TemplateModule::transfer(origin1.clone(), 2, 1, 1, 1023));
-        assert_eq!(
-            TemplateModule::refungible_item_id(1, 1).unwrap().owner[0],
-            Ownership {
-                owner: 2,
-                fraction: 1023
-            }
-        );
-        assert_eq!(TemplateModule::balance_count(1, 1), 0);
-        assert_eq!(TemplateModule::balance_count(1, 2), 1023);
-        // assert_eq!(TemplateModule::address_tokens(1, 1), []);
-        assert_eq!(TemplateModule::address_tokens(1, 2), [1]);
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
+		{
+			let item = TemplateModule::refungible_item_id(collection_id, 1).unwrap();
+			assert_eq!(item.const_data, data.const_data);
+			assert_eq!(item.variable_data, data.variable_data);
+			assert_eq!(
+				item.owner[0],
+				Ownership {
+					owner: account(1),
+					fraction: 1023
+				}
+			);
+		}
+		assert_eq!(TemplateModule::balance_count(1, 1), 1023);
+		assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
+
+		// change owner scenario
+		assert_ok!(TemplateModule::transfer(origin1, account(2), 1, 1, 1023));
+		assert_eq!(
+			TemplateModule::refungible_item_id(1, 1).unwrap().owner[0],
+			Ownership {
+				owner: account(2),
+				fraction: 1023
+			}
+		);
+		assert_eq!(TemplateModule::balance_count(1, 1), 0);
+		assert_eq!(TemplateModule::balance_count(1, 2), 1023);
+		// assert_eq!(TemplateModule::address_tokens(1, 1), []);
+		assert_eq!(TemplateModule::address_tokens(1, 2), [1]);
 
-        // split item scenario
-        assert_ok!(TemplateModule::transfer(origin2.clone(), 3, 1, 1, 500));
-        {
-            let item = TemplateModule::refungible_item_id(1, 1).unwrap();
-            assert_eq!(
-                item.owner[0],
-                Ownership {
-                    owner: 2,
-                    fraction: 523
-                }
-            );
-            assert_eq!(
-                item.owner[1],
-                Ownership {
-                    owner: 3,
-                    fraction: 500
-                }
-            );
-        }
-        assert_eq!(TemplateModule::balance_count(1, 2), 523);
-        assert_eq!(TemplateModule::balance_count(1, 3), 500);
-        assert_eq!(TemplateModule::address_tokens(1, 2), [1]);
-        assert_eq!(TemplateModule::address_tokens(1, 3), [1]);
+		// split item scenario
+		assert_ok!(TemplateModule::transfer(
+			origin2.clone(),
+			account(3),
+			1,
+			1,
+			500
+		));
+		{
+			let item = TemplateModule::refungible_item_id(1, 1).unwrap();
+			assert_eq!(
+				item.owner[0],
+				Ownership {
+					owner: account(2),
+					fraction: 523
+				}
+			);
+			assert_eq!(
+				item.owner[1],
+				Ownership {
+					owner: account(3),
+					fraction: 500
+				}
+			);
+		}
+		assert_eq!(TemplateModule::balance_count(1, 2), 523);
+		assert_eq!(TemplateModule::balance_count(1, 3), 500);
+		assert_eq!(TemplateModule::address_tokens(1, 2), [1]);
+		assert_eq!(TemplateModule::address_tokens(1, 3), [1]);
 
-        // split item and new owner has account scenario
-        assert_ok!(TemplateModule::transfer(origin2.clone(), 3, 1, 1, 200));
-        {
-            let item = TemplateModule::refungible_item_id(1, 1).unwrap();
-            assert_eq!(
-                item.owner[0],
-                Ownership {
-                    owner: 2,
-                    fraction: 323
-                }
-            );
-            assert_eq!(
-                item.owner[1],
-                Ownership {
-                    owner: 3,
-                    fraction: 700
-                }
-            );
-        }
-        assert_eq!(TemplateModule::balance_count(1, 2), 323);
-        assert_eq!(TemplateModule::balance_count(1, 3), 700);
-        assert_eq!(TemplateModule::address_tokens(1, 2), [1]);
-        assert_eq!(TemplateModule::address_tokens(1, 3), [1]);
-    });
+		// split item and new owner has account scenario
+		assert_ok!(TemplateModule::transfer(origin2, account(3), 1, 1, 200));
+		{
+			let item = TemplateModule::refungible_item_id(1, 1).unwrap();
+			assert_eq!(
+				item.owner[0],
+				Ownership {
+					owner: account(2),
+					fraction: 323
+				}
+			);
+			assert_eq!(
+				item.owner[1],
+				Ownership {
+					owner: account(3),
+					fraction: 700
+				}
+			);
+		}
+		assert_eq!(TemplateModule::balance_count(1, 2), 323);
+		assert_eq!(TemplateModule::balance_count(1, 3), 700);
+		assert_eq!(TemplateModule::address_tokens(1, 2), [1]);
+		assert_eq!(TemplateModule::address_tokens(1, 3), [1]);
+	});
 }
 
 #[test]
 fn transfer_nft_item() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.into());
-        assert_eq!(TemplateModule::balance_count(1, 1), 1);
-        assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let origin1 = Origin::signed(1);
-        // default scenario
-        assert_ok!(TemplateModule::transfer(origin1.clone(), 2, 1, 1, 1000));
-        assert_eq!(TemplateModule::nft_item_id(1, 1).unwrap().owner, 2);
-        assert_eq!(TemplateModule::balance_count(1, 1), 0);
-        assert_eq!(TemplateModule::balance_count(1, 2), 1);
-        // assert_eq!(TemplateModule::address_tokens(1, 1), []);
-        assert_eq!(TemplateModule::address_tokens(1, 2), [1]);
-    });
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
+		assert_eq!(TemplateModule::balance_count(1, 1), 1);
+		assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
+
+		let origin1 = Origin::signed(1);
+		// default scenario
+		assert_ok!(TemplateModule::transfer(origin1, account(2), 1, 1, 1000));
+		assert_eq!(TemplateModule::nft_item_id(1, 1).unwrap().owner, account(2));
+		assert_eq!(TemplateModule::balance_count(1, 1), 0);
+		assert_eq!(TemplateModule::balance_count(1, 2), 1);
+		// assert_eq!(TemplateModule::address_tokens(1, 1), []);
+		assert_eq!(TemplateModule::address_tokens(1, 2), [1]);
+	});
 }
 
 #[test]
 fn nft_approve_and_transfer_from() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.into());
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
 
-        assert_eq!(TemplateModule::balance_count(1, 1), 1);
-        assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
 
-        // neg transfer
-        assert_noop!(TemplateModule::transfer_from(
-            origin2.clone(),
-            1,
-            2,
-            1,
-            1,
-            1), Error::<Test>::NoPermission);
+		assert_eq!(TemplateModule::balance_count(1, 1), 1);
+		assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
 
-        // do approve
-        assert_ok!(TemplateModule::approve(origin1.clone(), 2, 1, 1, 5));
-        assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 5);
-        assert_eq!(
-            TemplateModule::approved(1, (1, 1, 2)),
-            5
-        );
+		// neg transfer
+		assert_noop!(
+			TemplateModule::transfer_from(origin2.clone(), account(1), account(2), 1, 1, 1),
+			Error::<Test>::NoPermission
+		);
 
-        assert_ok!(TemplateModule::transfer_from(
-            origin2.clone(),
-            1,
-            3,
-            1,
-            1,
-            1
-        ));
-        assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 4);
-    });
+		// do approve
+		assert_ok!(TemplateModule::approve(origin1, account(2), 1, 1, 5));
+		assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 5);
+		assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 5);
+
+		assert_ok!(TemplateModule::transfer_from(
+			origin2,
+			account(1),
+			account(3),
+			1,
+			1,
+			1
+		));
+		assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 4);
+	});
 }
 
 #[test]
 fn nft_approve_and_transfer_from_white_list() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.clone().into());
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
 
-        assert_eq!(TemplateModule::nft_item_id(1, 1).unwrap().const_data, data.const_data);
-        assert_eq!(TemplateModule::balance_count(1, 1), 1);
-        assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.clone().into());
 
-        assert_ok!(TemplateModule::set_mint_permission(
-            origin1.clone(),
-            1,
-            true
-        ));
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            1,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 1));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 3));
+		assert_eq!(
+			TemplateModule::nft_item_id(1, 1).unwrap().const_data,
+			data.const_data
+		);
+		assert_eq!(TemplateModule::balance_count(1, 1), 1);
+		assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
+
+		assert_ok!(TemplateModule::set_mint_permission(
+			origin1.clone(),
+			1,
+			true
+		));
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			1,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			1,
+			account(1)
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			1,
+			account(2)
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			1,
+			account(3)
+		));
 
-        // do approve
-        assert_ok!(TemplateModule::approve(origin1.clone(), 2, 1, 1, 5));
-        assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 5);
-        assert_ok!(TemplateModule::approve(origin1.clone(), 3, 1, 1, 5));
-        assert_eq!(TemplateModule::approved(1, (1, 1, 3)), 5);
+		// do approve
+		assert_ok!(TemplateModule::approve(
+			origin1.clone(),
+			account(2),
+			1,
+			1,
+			5
+		));
+		assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 5);
+		assert_ok!(TemplateModule::approve(origin1, account(3), 1, 1, 5));
+		assert_eq!(TemplateModule::approved(1, (1, 1, 3)), 5);
 
-        assert_ok!(TemplateModule::transfer_from(
-            origin2.clone(),
-            1,
-            3,
-            1,
-            1,
-            1
-        ));
-        assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 4);
-    });
+		assert_ok!(TemplateModule::transfer_from(
+			origin2,
+			account(1),
+			account(3),
+			1,
+			1,
+			1
+		));
+		assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 4);
+	});
 }
 
 #[test]
 fn refungible_approve_and_transfer_from() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::ReFungible, 1);
-        
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
+	new_test_ext().execute_with(|| {
+		default_limits();
+
+		let collection_id = create_test_collection(&CollectionMode::ReFungible, 1);
+
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
 
-        let data = default_re_fungible_data();
-        create_test_item(collection_id, &data.into());
+		let data = default_re_fungible_data();
+		create_test_item(collection_id, &data.into());
 
-        assert_eq!(TemplateModule::balance_count(1, 1), 1023);
-        assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
+		assert_eq!(TemplateModule::balance_count(1, 1), 1023);
+		assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
 
-        assert_ok!(TemplateModule::set_mint_permission(
-            origin1.clone(),
-            1,
-            true
-        ));
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            1,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 1));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 3));
+		assert_ok!(TemplateModule::set_mint_permission(
+			origin1.clone(),
+			1,
+			true
+		));
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			1,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			1,
+			account(1)
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			1,
+			account(2)
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			1,
+			account(3)
+		));
 
-        // do approve
-        assert_ok!(TemplateModule::approve(origin1.clone(), 2, 1, 1, 1023));
-        assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 1023);
+		// do approve
+		assert_ok!(TemplateModule::approve(origin1, account(2), 1, 1, 1023));
+		assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 1023);
 
-        assert_ok!(TemplateModule::transfer_from(
-            origin2.clone(),
-            1,
-            3,
-            1,
-            1,
-            100
-        ));
-        assert_eq!(TemplateModule::balance_count(1, 1), 923);
-        assert_eq!(TemplateModule::balance_count(1, 3), 100);
-        assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
-        assert_eq!(TemplateModule::address_tokens(1, 3), [1]);
+		assert_ok!(TemplateModule::transfer_from(
+			origin2,
+			account(1),
+			account(3),
+			1,
+			1,
+			100
+		));
+		assert_eq!(TemplateModule::balance_count(1, 1), 923);
+		assert_eq!(TemplateModule::balance_count(1, 3), 100);
+		assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
+		assert_eq!(TemplateModule::address_tokens(1, 3), [1]);
 
-        assert_eq!(
-            TemplateModule::approved(1, (1, 1, 2)),
-            923
-        );
-    });
+		assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 923);
+	});
 }
 
 #[test]
 fn fungible_approve_and_transfer_from() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::Fungible(3), 1);
-        
-        let data = default_fungible_data();
-        create_test_item(collection_id, &data.into());
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
+		let collection_id = create_test_collection(&CollectionMode::Fungible(3), 1);
+
+		let data = default_fungible_data();
+		create_test_item(collection_id, &data.into());
+
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
 
-        assert_eq!(TemplateModule::balance_count(1, 1), 5);
+		assert_eq!(TemplateModule::balance_count(1, 1), 5);
 
-        assert_ok!(TemplateModule::set_mint_permission(
-            origin1.clone(),
-            1,
-            true
-        ));
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            1,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 1));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 3));
+		assert_ok!(TemplateModule::set_mint_permission(
+			origin1.clone(),
+			1,
+			true
+		));
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			1,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			1,
+			account(1)
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			1,
+			account(2)
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			1,
+			account(3)
+		));
 
-        // do approve
-        assert_ok!(TemplateModule::approve(origin1.clone(), 2, 1, 1, 5));
-        assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 5);
-        assert_ok!(TemplateModule::approve(origin1.clone(), 3, 1, 1, 5));
-        assert_eq!(TemplateModule::approved(1, (1, 1, 3)), 5);
-        assert_eq!(
-            TemplateModule::approved(1, (1, 1, 2)),
-            5
-        );
+		// do approve
+		assert_ok!(TemplateModule::approve(
+			origin1.clone(),
+			account(2),
+			1,
+			1,
+			5
+		));
+		assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 5);
+		assert_ok!(TemplateModule::approve(origin1, account(3), 1, 1, 5));
+		assert_eq!(TemplateModule::approved(1, (1, 1, 3)), 5);
+		assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 5);
 
-        assert_ok!(TemplateModule::transfer_from(
-            origin2.clone(),
-            1,
-            3,
-            1,
-            1,
-            4
-        ));
-        assert_eq!(TemplateModule::balance_count(1, 1), 1);
-        assert_eq!(TemplateModule::balance_count(1, 3), 4);
+		assert_ok!(TemplateModule::transfer_from(
+			origin2.clone(),
+			account(1),
+			account(3),
+			1,
+			1,
+			4
+		));
+		assert_eq!(TemplateModule::balance_count(1, 1), 1);
+		assert_eq!(TemplateModule::balance_count(1, 3), 4);
 
-        assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 1);
+		assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 1);
 
-        assert_noop!(TemplateModule::transfer_from(
-            origin2.clone(),
-            1,
-            3,
-            1,
-            1,
-            4
-        ), Error::<Test>::NoPermission);
-    });
+		assert_noop!(
+			TemplateModule::transfer_from(origin2, account(1), account(3), 1, 1, 4),
+			Error::<Test>::NoPermission
+		);
+	});
 }
 
 #[test]
 fn change_collection_owner() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
-        
-        let origin1 = Origin::signed(1);
-        assert_ok!(TemplateModule::change_collection_owner(
-            origin1.clone(),
-            collection_id,
-            2
-        ));
-        assert_eq!(TemplateModule::collection_id(collection_id).unwrap().owner, 2);
-    });
+	new_test_ext().execute_with(|| {
+		default_limits();
+
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+
+		let origin1 = Origin::signed(1);
+		assert_ok!(TemplateModule::change_collection_owner(
+			origin1,
+			collection_id,
+			2
+		));
+		assert_eq!(
+			TemplateModule::collection_id(collection_id).unwrap().owner,
+			2
+		);
+	});
 }
 
 #[test]
 fn destroy_collection() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
-        
-        let origin1 = Origin::signed(1);
-        assert_ok!(TemplateModule::destroy_collection(origin1.clone(), collection_id));
-    });
+	new_test_ext().execute_with(|| {
+		default_limits();
+
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+
+		let origin1 = Origin::signed(1);
+		assert_ok!(TemplateModule::destroy_collection(origin1, collection_id));
+	});
 }
 
 #[test]
 fn burn_nft_item() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
-        assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 2));
-        
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.into());
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        // check balance (collection with id = 1, user id = 1)
-        assert_eq!(TemplateModule::balance_count(1, 1), 1);
+		let origin1 = Origin::signed(1);
+		assert_ok!(TemplateModule::add_collection_admin(
+			origin1.clone(),
+			collection_id,
+			account(2)
+		));
 
-        // burn item
-        assert_ok!(TemplateModule::burn_item(origin1.clone(), 1, 1, 5));
-        assert_noop!(
-            TemplateModule::burn_item(origin1.clone(), 1, 1, 5),
-            Error::<Test>::TokenNotFound
-        );
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
+
+		// check balance (collection with id = 1, user id = 1)
+		assert_eq!(TemplateModule::balance_count(1, 1), 1);
+
+		// burn item
+		assert_ok!(TemplateModule::burn_item(origin1.clone(), 1, 1, 5));
+		assert_noop!(
+			TemplateModule::burn_item(origin1, 1, 1, 5),
+			Error::<Test>::TokenNotFound
+		);
 
-        assert_eq!(TemplateModule::balance_count(1, 1), 0);
-    });
+		assert_eq!(TemplateModule::balance_count(1, 1), 0);
+	});
 }
 
 #[test]
 fn burn_fungible_item() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::Fungible(3), 1);
-        
-        let origin1 = Origin::signed(1);
-        assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 2));
-        
-        let data = default_fungible_data();
-        create_test_item(collection_id, &data.into());
+	new_test_ext().execute_with(|| {
+		default_limits();
+
+		let collection_id = create_test_collection(&CollectionMode::Fungible(3), 1);
+
+		let origin1 = Origin::signed(1);
+		assert_ok!(TemplateModule::add_collection_admin(
+			origin1.clone(),
+			collection_id,
+			account(2)
+		));
+
+		let data = default_fungible_data();
+		create_test_item(collection_id, &data.into());
 
-        // check balance (collection with id = 1, user id = 1)
-        assert_eq!(TemplateModule::balance_count(1, 1), 5);
+		// check balance (collection with id = 1, user id = 1)
+		assert_eq!(TemplateModule::balance_count(1, 1), 5);
 
-        // burn item
-        assert_ok!(TemplateModule::burn_item(origin1.clone(), 1, 1, 5));
-        assert_noop!(
-            TemplateModule::burn_item(origin1.clone(), 1, 1, 5),
-            Error::<Test>::TokenValueNotEnough
-        );
+		// burn item
+		assert_ok!(TemplateModule::burn_item(origin1.clone(), 1, 1, 5));
+		assert_noop!(
+			TemplateModule::burn_item(origin1, 1, 1, 5),
+			Error::<Test>::TokenValueNotEnough
+		);
 
-        assert_eq!(TemplateModule::balance_count(1, 1), 0);
-    });
+		assert_eq!(TemplateModule::balance_count(1, 1), 0);
+	});
 }
 
 #[test]
 fn burn_refungible_item() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::ReFungible, 1);
-        let origin1 = Origin::signed(1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        assert_ok!(TemplateModule::set_mint_permission(
-            origin1.clone(),
-            collection_id,
-            true
-        ));
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            collection_id,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 1));
+		let collection_id = create_test_collection(&CollectionMode::ReFungible, 1);
+		let origin1 = Origin::signed(1);
 
-        assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), 1, 2));
-        
-        let data = default_re_fungible_data();
-        create_test_item(collection_id, &data.into());
+		assert_ok!(TemplateModule::set_mint_permission(
+			origin1.clone(),
+			collection_id,
+			true
+		));
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			1,
+			account(1)
+		));
+
+		assert_ok!(TemplateModule::add_collection_admin(
+			origin1.clone(),
+			1,
+			account(2)
+		));
+
+		let data = default_re_fungible_data();
+		create_test_item(collection_id, &data.into());
 
-        // check balance (collection with id = 1, user id = 2)
-        assert_eq!(TemplateModule::balance_count(1, 1), 1023);
+		// check balance (collection with id = 1, user id = 2)
+		assert_eq!(TemplateModule::balance_count(1, 1), 1023);
 
-        // burn item
-        assert_ok!(TemplateModule::burn_item(origin1.clone(), 1, 1, 1023));
-        assert_noop!(
-            TemplateModule::burn_item(origin1.clone(), 1, 1, 1023),
-            Error::<Test>::TokenNotFound
-        );
+		// burn item
+		assert_ok!(TemplateModule::burn_item(origin1.clone(), 1, 1, 1023));
+		assert_noop!(
+			TemplateModule::burn_item(origin1, 1, 1, 1023),
+			Error::<Test>::TokenNotFound
+		);
 
-        assert_eq!(TemplateModule::balance_count(1, 1), 0);
-    });
+		assert_eq!(TemplateModule::balance_count(1, 1), 0);
+	});
 }
 
 #[test]
 fn add_collection_admin() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection1_id = create_test_collection_for_owner(&CollectionMode::NFT, 1, 1);
-        create_test_collection_for_owner(&CollectionMode::NFT, 2, 2);
-        create_test_collection_for_owner(&CollectionMode::NFT, 3, 3);
-        
-        let origin1 = Origin::signed(1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        // collection admin
-        assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection1_id, 2));
-        assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection1_id, 3));
+		let collection1_id = create_test_collection_for_owner(&CollectionMode::NFT, 1, 1);
+		create_test_collection_for_owner(&CollectionMode::NFT, 2, 2);
+		create_test_collection_for_owner(&CollectionMode::NFT, 3, 3);
+
+		let origin1 = Origin::signed(1);
+
+		// collection admin
+		assert_ok!(TemplateModule::add_collection_admin(
+			origin1.clone(),
+			collection1_id,
+			account(2)
+		));
+		assert_ok!(TemplateModule::add_collection_admin(
+			origin1,
+			collection1_id,
+			account(3)
+		));
 
-        assert_eq!(TemplateModule::admin_list_collection(collection1_id).contains(&2), true);
-        assert_eq!(TemplateModule::admin_list_collection(collection1_id).contains(&3), true);
-    });
+		assert!(TemplateModule::admin_list_collection(collection1_id).contains(&account(2)),);
+		assert!(TemplateModule::admin_list_collection(collection1_id).contains(&account(3)),);
+	});
 }
 
 #[test]
 fn remove_collection_admin() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection1_id = create_test_collection_for_owner(&CollectionMode::NFT, 1, 1);
-        create_test_collection_for_owner(&CollectionMode::NFT, 2, 2);
-        create_test_collection_for_owner(&CollectionMode::NFT, 3, 3);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
+		let collection1_id = create_test_collection_for_owner(&CollectionMode::NFT, 1, 1);
+		create_test_collection_for_owner(&CollectionMode::NFT, 2, 2);
+		create_test_collection_for_owner(&CollectionMode::NFT, 3, 3);
 
-        // collection admin
-        assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection1_id, 2));
-        assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection1_id, 3));
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
 
-        assert_eq!(TemplateModule::admin_list_collection(1).contains(&2), true);
-        assert_eq!(TemplateModule::admin_list_collection(1).contains(&3), true);
+		// collection admin
+		assert_ok!(TemplateModule::add_collection_admin(
+			origin1.clone(),
+			collection1_id,
+			account(2)
+		));
+		assert_ok!(TemplateModule::add_collection_admin(
+			origin1,
+			collection1_id,
+			account(3)
+		));
 
-        // remove admin
-        assert_ok!(TemplateModule::remove_collection_admin(
-            origin2.clone(),
-            1,
-            3
-        ));
-        assert_eq!(TemplateModule::admin_list_collection(1).contains(&3), false);
-    });
+		assert!(TemplateModule::admin_list_collection(1).contains(&account(2)),);
+		assert!(TemplateModule::admin_list_collection(1).contains(&account(3)),);
+
+		// remove admin
+		assert_ok!(TemplateModule::remove_collection_admin(
+			origin2,
+			1,
+			account(3)
+		));
+		assert!(!TemplateModule::admin_list_collection(1).contains(&account(3)),);
+	});
 }
 
 #[test]
 fn balance_of() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let nft_collection_id = create_test_collection(&CollectionMode::NFT, 1);
-        let fungible_collection_id = create_test_collection(&CollectionMode::Fungible(3), 2);
-        let re_fungible_collection_id = create_test_collection(&CollectionMode::ReFungible, 3);
-        
-        // check balance before
-        assert_eq!(TemplateModule::balance_count(nft_collection_id, 1), 0);
-        assert_eq!(TemplateModule::balance_count(fungible_collection_id, 1), 0);
-        assert_eq!(TemplateModule::balance_count(re_fungible_collection_id, 1), 0);
+	new_test_ext().execute_with(|| {
+		default_limits();
+
+		let nft_collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		let fungible_collection_id = create_test_collection(&CollectionMode::Fungible(3), 2);
+		let re_fungible_collection_id = create_test_collection(&CollectionMode::ReFungible, 3);
+
+		// check balance before
+		assert_eq!(TemplateModule::balance_count(nft_collection_id, 1), 0);
+		assert_eq!(TemplateModule::balance_count(fungible_collection_id, 1), 0);
+		assert_eq!(
+			TemplateModule::balance_count(re_fungible_collection_id, 1),
+			0
+		);
+
+		let nft_data = default_nft_data();
+		create_test_item(nft_collection_id, &nft_data.into());
+
+		let fungible_data = default_fungible_data();
+		create_test_item(fungible_collection_id, &fungible_data.into());
 
-        let nft_data = default_nft_data();
-        create_test_item(nft_collection_id, &nft_data.into());
-        
-        let fungible_data = default_fungible_data();
-        create_test_item(fungible_collection_id, &fungible_data.into());
-        
-        let re_fungible_data = default_re_fungible_data();
-        create_test_item(re_fungible_collection_id, &re_fungible_data.into());
+		let re_fungible_data = default_re_fungible_data();
+		create_test_item(re_fungible_collection_id, &re_fungible_data.into());
 
-        // check balance (collection with id = 1, user id = 1)
-        assert_eq!(TemplateModule::balance_count(nft_collection_id, 1), 1);
-        assert_eq!(TemplateModule::balance_count(fungible_collection_id, 1), 5);
-        assert_eq!(TemplateModule::balance_count(re_fungible_collection_id, 1), 1023);
-        assert_eq!(TemplateModule::nft_item_id(nft_collection_id, 1).unwrap().owner, 1);
-        assert_eq!(TemplateModule::fungible_item_id(fungible_collection_id, 1).value, 5);
-        assert_eq!(TemplateModule::refungible_item_id(re_fungible_collection_id, 1).unwrap().owner[0].owner, 1);
-    });
+		// check balance (collection with id = 1, user id = 1)
+		assert_eq!(TemplateModule::balance_count(nft_collection_id, 1), 1);
+		assert_eq!(TemplateModule::balance_count(fungible_collection_id, 1), 5);
+		assert_eq!(
+			TemplateModule::balance_count(re_fungible_collection_id, 1),
+			1023
+		);
+		assert_eq!(
+			TemplateModule::nft_item_id(nft_collection_id, 1)
+				.unwrap()
+				.owner,
+			account(1)
+		);
+		assert_eq!(
+			TemplateModule::fungible_item_id(fungible_collection_id, 1).value,
+			5
+		);
+		assert_eq!(
+			TemplateModule::refungible_item_id(re_fungible_collection_id, 1)
+				.unwrap()
+				.owner[0]
+				.owner,
+			account(1)
+		);
+	});
 }
 
 #[test]
 fn approve() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
-        
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.into());
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
-        
-        // approve
-        assert_ok!(TemplateModule::approve(origin1.clone(), 2, 1, 1, 1));
-        assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 1);
-    });
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
+
+		let origin1 = Origin::signed(1);
+
+		// approve
+		assert_ok!(TemplateModule::approve(origin1, account(2), 1, 1, 1));
+		assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 1);
+	});
 }
 
 #[test]
 fn transfer_from() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.into());
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
 
-        // approve
-        assert_ok!(TemplateModule::approve(origin1.clone(), 2, 1, 1, 1));
-        assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 1);
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
 
-        assert_ok!(TemplateModule::set_mint_permission(
-            origin1.clone(),
-            1,
-            true
-        ));
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            1,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 1));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 3));
+		// approve
+		assert_ok!(TemplateModule::approve(
+			origin1.clone(),
+			account(2),
+			1,
+			1,
+			1
+		));
+		assert_eq!(TemplateModule::approved(1, (1, 1, 2)), 1);
 
-        assert_ok!(TemplateModule::transfer_from(
-            origin2.clone(),
-            1,
-            2,
-            1,
-            1,
-            1
-        ));
+		assert_ok!(TemplateModule::set_mint_permission(
+			origin1.clone(),
+			1,
+			true
+		));
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			1,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			1,
+			account(1)
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			1,
+			account(2)
+		));
+		assert_ok!(TemplateModule::add_to_white_list(origin1, 1, account(3)));
 
-        // after transfer
-        assert_eq!(TemplateModule::balance_count(1, 1), 0);
-        assert_eq!(TemplateModule::balance_count(1, 2), 1);
-    });
+		assert_ok!(TemplateModule::transfer_from(
+			origin2,
+			account(1),
+			account(2),
+			1,
+			1,
+			1
+		));
+
+		// after transfer
+		assert_eq!(TemplateModule::balance_count(1, 1), 0);
+		assert_eq!(TemplateModule::balance_count(1, 2), 1);
+	});
 }
 
 // #endregion
@@ -895,1093 +1050,1304 @@
 
 #[test]
 fn owner_can_add_address_to_white_list() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
+
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let origin1 = Origin::signed(1);
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2));
-        assert_eq!(TemplateModule::white_list(collection_id, 2), true);
-    });
+		let origin1 = Origin::signed(1);
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1,
+			collection_id,
+			account(2)
+		));
+		assert!(TemplateModule::white_list(collection_id, 2));
+	});
 }
 
 #[test]
 fn admin_can_add_address_to_white_list() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 2));
-        assert_ok!(TemplateModule::add_to_white_list(origin2.clone(), collection_id, 3));
-        assert_eq!(TemplateModule::white_list(collection_id, 3), true);
-    });
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
+
+		assert_ok!(TemplateModule::add_collection_admin(
+			origin1,
+			collection_id,
+			account(2)
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin2,
+			collection_id,
+			account(3)
+		));
+		assert!(TemplateModule::white_list(collection_id, 3));
+	});
 }
 
 #[test]
 fn nonprivileged_user_cannot_add_address_to_white_list() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin2 = Origin::signed(2);
-        assert_noop!(
-            TemplateModule::add_to_white_list(origin2.clone(), collection_id, 3),
-            Error::<Test>::NoPermission
-        );
-    });
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+
+		let origin2 = Origin::signed(2);
+		assert_noop!(
+			TemplateModule::add_to_white_list(origin2, collection_id, account(3)),
+			Error::<Test>::NoPermission
+		);
+	});
 }
 
 #[test]
 fn nobody_can_add_address_to_white_list_of_nonexisting_collection() {
-    new_test_ext().execute_with(|| {
-        default_limits();
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
+		let origin1 = Origin::signed(1);
 
-        assert_noop!(
-            TemplateModule::add_to_white_list(origin1.clone(), 1, 2),
-            Error::<Test>::CollectionNotFound
-        );
-    });
+		assert_noop!(
+			TemplateModule::add_to_white_list(origin1, 1, account(2)),
+			Error::<Test>::CollectionNotFound
+		);
+	});
 }
 
 #[test]
 fn nobody_can_add_address_to_white_list_of_deleted_collection() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
+
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let origin1 = Origin::signed(1);
-        assert_ok!(TemplateModule::destroy_collection(origin1.clone(), collection_id));
-        assert_noop!(
-            TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2),
-            Error::<Test>::CollectionNotFound
-        );
-    });
+		let origin1 = Origin::signed(1);
+		assert_ok!(TemplateModule::destroy_collection(
+			origin1.clone(),
+			collection_id
+		));
+		assert_noop!(
+			TemplateModule::add_to_white_list(origin1, collection_id, account(2)),
+			Error::<Test>::CollectionNotFound
+		);
+	});
 }
 
 // If address is already added to white list, nothing happens
 #[test]
 fn address_is_already_added_to_white_list() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
-        let origin1 = Origin::signed(1);
-        
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2));
-        assert_eq!(TemplateModule::white_list(collection_id, 2), true);
-    });
+	new_test_ext().execute_with(|| {
+		default_limits();
+
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		let origin1 = Origin::signed(1);
+
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			collection_id,
+			account(2)
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1,
+			collection_id,
+			account(2)
+		));
+		assert!(TemplateModule::white_list(collection_id, 2));
+	});
 }
 
 #[test]
 fn owner_can_remove_address_from_white_list() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
+
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let origin1 = Origin::signed(1);
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2));
-        assert_ok!(TemplateModule::remove_from_white_list(
-            origin1.clone(),
-            collection_id,
-            2
-        ));
-        assert_eq!(TemplateModule::white_list(collection_id, 2), false);
-    });
+		let origin1 = Origin::signed(1);
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			collection_id,
+			account(2)
+		));
+		assert_ok!(TemplateModule::remove_from_white_list(
+			origin1,
+			collection_id,
+			account(2)
+		));
+		assert!(!TemplateModule::white_list(collection_id, 2));
+	});
 }
 
 #[test]
 fn admin_can_remove_address_from_white_list() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 2));
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
 
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 3));
-        assert_ok!(TemplateModule::remove_from_white_list(
-            origin2.clone(),
-            collection_id,
-            3
-        ));
-        assert_eq!(TemplateModule::white_list(collection_id, 3), false);
-    });
+		assert_ok!(TemplateModule::add_collection_admin(
+			origin1.clone(),
+			collection_id,
+			account(2)
+		));
+
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1,
+			collection_id,
+			account(3)
+		));
+		assert_ok!(TemplateModule::remove_from_white_list(
+			origin2,
+			collection_id,
+			account(3)
+		));
+		assert!(!TemplateModule::white_list(collection_id, 3));
+	});
 }
 
 #[test]
 fn nonprivileged_user_cannot_remove_address_from_white_list() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
+	new_test_ext().execute_with(|| {
+		default_limits();
+
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
 
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2));
-        assert_noop!(
-            TemplateModule::remove_from_white_list(origin2.clone(), collection_id, 2),
-            Error::<Test>::NoPermission
-        );
-        assert_eq!(TemplateModule::white_list(collection_id, 2), true);
-    });
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1,
+			collection_id,
+			account(2)
+		));
+		assert_noop!(
+			TemplateModule::remove_from_white_list(origin2, collection_id, account(2)),
+			Error::<Test>::NoPermission
+		);
+		assert!(TemplateModule::white_list(collection_id, 2));
+	});
 }
 
 #[test]
 fn nobody_can_remove_address_from_white_list_of_nonexisting_collection() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        let origin1 = Origin::signed(1);
+	new_test_ext().execute_with(|| {
+		default_limits();
+		let origin1 = Origin::signed(1);
 
-        assert_noop!(
-            TemplateModule::remove_from_white_list(origin1.clone(), 1, 2),
-            Error::<Test>::CollectionNotFound
-        );
-    });
+		assert_noop!(
+			TemplateModule::remove_from_white_list(origin1, 1, account(2)),
+			Error::<Test>::CollectionNotFound
+		);
+	});
 }
 
 #[test]
 fn nobody_can_remove_address_from_white_list_of_deleted_collection() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2));
-        assert_ok!(TemplateModule::destroy_collection(origin1.clone(), collection_id));
-        assert_noop!(
-            TemplateModule::remove_from_white_list(origin2.clone(), collection_id, 2),
-            Error::<Test>::CollectionNotFound
-        );
-        assert_eq!(TemplateModule::white_list(collection_id, 2), false);
-    });
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
+
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			collection_id,
+			account(2)
+		));
+		assert_ok!(TemplateModule::destroy_collection(origin1, collection_id));
+		assert_noop!(
+			TemplateModule::remove_from_white_list(origin2, collection_id, account(2)),
+			Error::<Test>::CollectionNotFound
+		);
+		assert!(!TemplateModule::white_list(collection_id, 2));
+	});
 }
 
 // If address is already removed from white list, nothing happens
 #[test]
 fn address_is_already_removed_from_white_list() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
-        let origin1 = Origin::signed(1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2));
-        assert_ok!(TemplateModule::remove_from_white_list(
-            origin1.clone(),
-            collection_id,
-            2
-        ));
-        assert_ok!(TemplateModule::remove_from_white_list(
-            origin1.clone(),
-            collection_id,
-            2
-        ));
-        assert_eq!(TemplateModule::white_list(collection_id, 2), false);
-    });
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		let origin1 = Origin::signed(1);
+
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			collection_id,
+			account(2)
+		));
+		assert_ok!(TemplateModule::remove_from_white_list(
+			origin1.clone(),
+			collection_id,
+			account(2)
+		));
+		assert_ok!(TemplateModule::remove_from_white_list(
+			origin1,
+			collection_id,
+			account(2)
+		));
+		assert!(!TemplateModule::white_list(collection_id, 2));
+	});
 }
 
 // If Public Access mode is set to WhiteList, tokens can’t be transferred from a non-whitelisted address with transfer or transferFrom (2 tests)
 #[test]
 fn white_list_test_1() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
-        
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.into());
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+
+		let origin1 = Origin::signed(1);
+
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
 
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            collection_id,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2));
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			collection_id,
+			account(2)
+		));
 
-        assert_noop!(
-            TemplateModule::transfer(origin1.clone(), 3, 1, 1, 1),
-            Error::<Test>::AddresNotInWhiteList
-        );
-    });
+		assert_noop!(
+			TemplateModule::transfer(origin1, account(3), 1, 1, 1),
+			Error::<Test>::AddresNotInWhiteList
+		);
+	});
 }
 
 #[test]
 fn white_list_test_2() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
-        let origin1 = Origin::signed(1);
-        
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.into());
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            collection_id,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 1));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2));
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		let origin1 = Origin::signed(1);
 
-        // do approve
-        assert_ok!(TemplateModule::approve(origin1.clone(), 1, 1, 1, 1));
-        assert_eq!(TemplateModule::approved(1, (1, 1, 1)), 1);
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
 
-        assert_ok!(TemplateModule::remove_from_white_list(
-            origin1.clone(),
-            1,
-            1
-        ));
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			1,
+			account(1)
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			1,
+			account(2)
+		));
+
+		// do approve
+		assert_ok!(TemplateModule::approve(
+			origin1.clone(),
+			account(1),
+			1,
+			1,
+			1
+		));
+		assert_eq!(TemplateModule::approved(1, (1, 1, 1)), 1);
 
-        assert_noop!(
-            TemplateModule::transfer_from(origin1.clone(), 1, 3, 1, 1, 1),
-            Error::<Test>::AddresNotInWhiteList
-        );
-    });
+		assert_ok!(TemplateModule::remove_from_white_list(
+			origin1.clone(),
+			1,
+			account(1)
+		));
+
+		assert_noop!(
+			TemplateModule::transfer_from(origin1, account(1), account(3), 1, 1, 1),
+			Error::<Test>::AddresNotInWhiteList
+		);
+	});
 }
 
 // If Public Access mode is set to WhiteList, tokens can’t be transferred to a non-whitelisted address with transfer or transferFrom (2 tests)
 #[test]
 fn white_list_test_3() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
+
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+
+		let origin1 = Origin::signed(1);
 
-        let origin1 = Origin::signed(1);
-        
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.into());
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
 
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            collection_id,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 1));
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			1,
+			account(1)
+		));
 
-        assert_noop!(
-            TemplateModule::transfer(origin1.clone(), 3, 1, 1, 1),
-            Error::<Test>::AddresNotInWhiteList
-        );
-    });
+		assert_noop!(
+			TemplateModule::transfer(origin1, account(3), 1, 1, 1),
+			Error::<Test>::AddresNotInWhiteList
+		);
+	});
 }
 
 #[test]
 fn white_list_test_4() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.into());
+		let origin1 = Origin::signed(1);
 
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            collection_id,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 1));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2));
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
 
-        // do approve
-        assert_ok!(TemplateModule::approve(origin1.clone(), 1, 1, 1, 1));
-        assert_eq!(TemplateModule::approved(1, (1, 1, 1)), 1);
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			collection_id,
+			account(1)
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			collection_id,
+			account(2)
+		));
+
+		// do approve
+		assert_ok!(TemplateModule::approve(
+			origin1.clone(),
+			account(1),
+			1,
+			1,
+			1
+		));
+		assert_eq!(TemplateModule::approved(1, (1, 1, 1)), 1);
 
-        assert_ok!(TemplateModule::remove_from_white_list(
-            origin1.clone(),
-            collection_id,
-            2
-        ));
+		assert_ok!(TemplateModule::remove_from_white_list(
+			origin1.clone(),
+			collection_id,
+			account(2)
+		));
 
-        assert_noop!(
-            TemplateModule::transfer_from(origin1.clone(), 1, 3, 1, 1, 1),
-            Error::<Test>::AddresNotInWhiteList
-        );
-    });
+		assert_noop!(
+			TemplateModule::transfer_from(origin1, account(1), account(3), 1, 1, 1),
+			Error::<Test>::AddresNotInWhiteList
+		);
+	});
 }
 
 // If Public Access mode is set to WhiteList, tokens can’t be destroyed by a non-whitelisted address (even if it owned them before enabling WhiteList mode)
 #[test]
 fn white_list_test_5() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+
+		let origin1 = Origin::signed(1);
 
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.into());
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
 
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            collection_id,
-            AccessMode::WhiteList
-        ));
-        assert_noop!(
-            TemplateModule::burn_item(origin1.clone(), 1, 1, 5),
-            Error::<Test>::AddresNotInWhiteList
-        );
-    });
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::WhiteList
+		));
+		assert_noop!(
+			TemplateModule::burn_item(origin1, 1, 1, 5),
+			Error::<Test>::AddresNotInWhiteList
+		);
+	});
 }
 
 // If Public Access mode is set to WhiteList, token transfers can’t be Approved by a non-whitelisted address (see Approve method).
 #[test]
 fn white_list_test_6() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.into());
+		let origin1 = Origin::signed(1);
 
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            collection_id,
-            AccessMode::WhiteList
-        ));
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
+
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::WhiteList
+		));
 
-        // do approve
-        assert_noop!(
-            TemplateModule::approve(origin1.clone(), 1, 1, 1, 5),
-            Error::<Test>::AddresNotInWhiteList
-        );
-    });
+		// do approve
+		assert_noop!(
+			TemplateModule::approve(origin1, account(1), 1, 1, 5),
+			Error::<Test>::AddresNotInWhiteList
+		);
+	});
 }
 
 // If Public Access mode is set to WhiteList, tokens can be transferred from a whitelisted address with transfer or transferFrom (2 tests) and
 //          tokens can be transferred from a whitelisted address with transfer or transferFrom (2 tests)
 #[test]
 fn white_list_test_7() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
+
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
 
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.into());
-        
-        let origin1 = Origin::signed(1);
+		let origin1 = Origin::signed(1);
 
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            collection_id,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 1));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2));
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			collection_id,
+			account(1)
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			collection_id,
+			account(2)
+		));
 
-        assert_ok!(TemplateModule::transfer(origin1.clone(), 2, 1, 1, 1));
-    });
+		assert_ok!(TemplateModule::transfer(origin1, account(2), 1, 1, 1));
+	});
 }
 
 #[test]
 fn white_list_test_8() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.into());
-        
-        let origin1 = Origin::signed(1);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            collection_id,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 1));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2));
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
 
-        // do approve
-        assert_ok!(TemplateModule::approve(origin1.clone(), 1, 1, 1, 5));
-        assert_eq!(TemplateModule::approved(1, (1, 1, 1)), 5);
+		let origin1 = Origin::signed(1);
 
-        assert_ok!(TemplateModule::transfer_from(
-            origin1.clone(),
-            1,
-            2,
-            1,
-            1,
-            1
-        ));
-    });
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			collection_id,
+			account(1)
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1.clone(),
+			collection_id,
+			account(2)
+		));
+
+		// do approve
+		assert_ok!(TemplateModule::approve(
+			origin1.clone(),
+			account(1),
+			1,
+			1,
+			5
+		));
+		assert_eq!(TemplateModule::approved(1, (1, 1, 1)), 5);
+
+		assert_ok!(TemplateModule::transfer_from(
+			origin1,
+			account(1),
+			account(2),
+			1,
+			1,
+			1
+		));
+	});
 }
 
 // If Public Access mode is set to WhiteList, and Mint Permission is set to false, tokens can be created by owner.
 #[test]
 fn white_list_test_9() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
-        let origin1 = Origin::signed(1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            collection_id,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::set_mint_permission(
-            origin1.clone(),
-            collection_id,
-            false
-        ));
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		let origin1 = Origin::signed(1);
 
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.into());
-    });
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::set_mint_permission(
+			origin1,
+			collection_id,
+			false
+		));
+
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
+	});
 }
 
 // If Public Access mode is set to WhiteList, and Mint Permission is set to false, tokens can be created by admin.
 #[test]
 fn white_list_test_10() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            collection_id,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::set_mint_permission(
-            origin1.clone(),
-            collection_id,
-            false
-        ));
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
 
-        assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 2));
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::set_mint_permission(
+			origin1.clone(),
+			collection_id,
+			false
+		));
 
-        assert_ok!(TemplateModule::create_item(
-            origin2.clone(),
-            collection_id,
-            2,
-            default_nft_data().into()
-        ));
-    });
+		assert_ok!(TemplateModule::add_collection_admin(
+			origin1,
+			collection_id,
+			account(2)
+		));
+
+		assert_ok!(TemplateModule::create_item(
+			origin2,
+			collection_id,
+			account(2),
+			default_nft_data().into()
+		));
+	});
 }
 
 // If Public Access mode is set to WhiteList, and Mint Permission is set to false, tokens cannot be created by non-privileged and white listed address.
 #[test]
 fn white_list_test_11() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            collection_id,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::set_mint_permission(
-            origin1.clone(),
-            collection_id,
-            false
-        ));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2));
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
 
-        assert_noop!(
-            TemplateModule::create_item(origin2.clone(), 1, 2, default_nft_data().into()),
-            Error::<Test>::PublicMintingNotAllowed
-        );
-    });
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::set_mint_permission(
+			origin1.clone(),
+			collection_id,
+			false
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1,
+			collection_id,
+			account(2)
+		));
+
+		assert_noop!(
+			TemplateModule::create_item(origin2, 1, account(2), default_nft_data().into()),
+			Error::<Test>::PublicMintingNotAllowed
+		);
+	});
 }
 
 // If Public Access mode is set to WhiteList, and Mint Permission is set to false, tokens cannot be created by non-privileged and non-white listed address.
 #[test]
 fn white_list_test_12() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
+
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
 
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            collection_id,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::set_mint_permission(
-            origin1.clone(),
-            collection_id,
-            false
-        ));
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::set_mint_permission(
+			origin1,
+			collection_id,
+			false
+		));
 
-        assert_noop!(
-            TemplateModule::create_item(origin2.clone(), 1, 2, default_nft_data().into()),
-            Error::<Test>::PublicMintingNotAllowed
-        );
-    });
+		assert_noop!(
+			TemplateModule::create_item(origin2, 1, account(2), default_nft_data().into()),
+			Error::<Test>::PublicMintingNotAllowed
+		);
+	});
 }
 
 // If Public Access mode is set to WhiteList, and Mint Permission is set to true, tokens can be created by owner.
 #[test]
 fn white_list_test_13() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            collection_id,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::set_mint_permission(
-            origin1.clone(),
-            collection_id,
-            true
-        ));
+		let origin1 = Origin::signed(1);
+
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::set_mint_permission(
+			origin1,
+			collection_id,
+			true
+		));
 
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.into());
-    });
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
+	});
 }
 
 // If Public Access mode is set to WhiteList, and Mint Permission is set to true, tokens can be created by admin.
 #[test]
 fn white_list_test_14() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
+
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
 
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            collection_id,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::set_mint_permission(
-            origin1.clone(),
-            collection_id,
-            true
-        ));
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::set_mint_permission(
+			origin1.clone(),
+			collection_id,
+			true
+		));
 
-        assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 2));
+		assert_ok!(TemplateModule::add_collection_admin(
+			origin1,
+			collection_id,
+			account(2)
+		));
 
-        assert_ok!(TemplateModule::create_item(
-            origin2.clone(),
-            1,
-            2,
-            default_nft_data().into()
-        ));
-    });
+		assert_ok!(TemplateModule::create_item(
+			origin2,
+			1,
+			account(2),
+			default_nft_data().into()
+		));
+	});
 }
 
 // If Public Access mode is set to WhiteList, and Mint Permission is set to true, tokens cannot be created by non-privileged and non-white listed address.
 #[test]
 fn white_list_test_15() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            collection_id,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::set_mint_permission(
-            origin1.clone(),
-            collection_id,
-            true
-        ));
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
 
-        assert_noop!(
-            TemplateModule::create_item(origin2.clone(), 1, 2, default_nft_data().into()),
-            Error::<Test>::AddresNotInWhiteList
-        );
-    });
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::set_mint_permission(
+			origin1,
+			collection_id,
+			true
+		));
+
+		assert_noop!(
+			TemplateModule::create_item(origin2, 1, account(2), default_nft_data().into()),
+			Error::<Test>::AddresNotInWhiteList
+		);
+	});
 }
 
 // If Public Access mode is set to WhiteList, and Mint Permission is set to true, tokens can be created by non-privileged and white listed address.
 #[test]
 fn white_list_test_16() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
+
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let origin1 = Origin::signed(1);
-        let origin2 = Origin::signed(2);
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
 
-        assert_ok!(TemplateModule::set_public_access_mode(
-            origin1.clone(),
-            collection_id,
-            AccessMode::WhiteList
-        ));
-        assert_ok!(TemplateModule::set_mint_permission(
-            origin1.clone(),
-            collection_id,
-            true
-        ));
-        assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2));
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::WhiteList
+		));
+		assert_ok!(TemplateModule::set_mint_permission(
+			origin1.clone(),
+			collection_id,
+			true
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin1,
+			collection_id,
+			account(2)
+		));
 
-        assert_ok!(TemplateModule::create_item(
-            origin2.clone(),
-            1,
-            2,
-            default_nft_data().into()
-        ));
-    });
+		assert_ok!(TemplateModule::create_item(
+			origin2,
+			1,
+			account(2),
+			default_nft_data().into()
+		));
+	});
 }
 
 // Total number of collections. Positive test
 #[test]
 fn total_number_collections_bound() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        create_test_collection(&CollectionMode::NFT, 1);
-    });
+	new_test_ext().execute_with(|| {
+		default_limits();
+
+		create_test_collection(&CollectionMode::NFT, 1);
+	});
 }
 
 // Total number of collections. Negotive test
 #[test]
 fn total_number_collections_bound_neg() {
-    new_test_ext().execute_with(|| {
-        default_limits();
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
+		let origin1 = Origin::signed(1);
 
-        for i in 0..default_collection_numbers_limit() {
-            create_test_collection(&CollectionMode::NFT, i + 1);
-        }
+		for i in 0..default_collection_numbers_limit() {
+			create_test_collection(&CollectionMode::NFT, i + 1);
+		}
 
-        let col_name1: Vec<u16> = "Test1\0".encode_utf16().collect::<Vec<u16>>();
-        let col_desc1: Vec<u16> = "TestDescription1\0".encode_utf16().collect::<Vec<u16>>();
-        let token_prefix1: Vec<u8> = b"token_prefix1\0".to_vec();
+		let col_name1: Vec<u16> = "Test1\0".encode_utf16().collect::<Vec<u16>>();
+		let col_desc1: Vec<u16> = "TestDescription1\0".encode_utf16().collect::<Vec<u16>>();
+		let token_prefix1: Vec<u8> = b"token_prefix1\0".to_vec();
 
-        // 11-th collection in chain. Expects error
-        assert_noop!(TemplateModule::create_collection(
-            origin1.clone(),
-            col_name1.clone(),
-            col_desc1.clone(),
-            token_prefix1.clone(),
-            CollectionMode::NFT
-        ), Error::<Test>::TotalCollectionsLimitExceeded);
-    });
+		// 11-th collection in chain. Expects error
+		assert_noop!(
+			TemplateModule::create_collection(
+				origin1,
+				col_name1,
+				col_desc1,
+				token_prefix1,
+				CollectionMode::NFT
+			),
+			Error::<Test>::TotalCollectionsLimitExceeded
+		);
+	});
 }
 
 // Owned tokens by a single address. Positive test
 #[test]
 fn owned_tokens_bound() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
+
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.clone().into());
-        create_test_item(collection_id, &data.into());
-    });
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.clone().into());
+		create_test_item(collection_id, &data.into());
+	});
 }
 
 // Owned tokens by a single address. Negotive test
 #[test]
 fn owned_tokens_bound_neg() {
-    new_test_ext().execute_with(|| {
-        assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { 
-            collection_numbers_limit: 10,
-            account_token_ownership_limit: 1,
-            collections_admins_limit: 5,
-            custom_data_limit: 2048,
-            nft_sponsor_transfer_timeout: 15,
-            fungible_sponsor_transfer_timeout: 15,
-            refungible_sponsor_transfer_timeout: 15,
-            const_on_chain_schema_limit: 1024,
-            offchain_schema_limit: 1024,
-            variable_on_chain_schema_limit: 1024,
-        }));
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		assert_ok!(TemplateModule::set_chain_limits(
+			RawOrigin::Root.into(),
+			ChainLimits {
+				collection_numbers_limit: 10,
+				account_token_ownership_limit: 1,
+				collections_admins_limit: 5,
+				custom_data_limit: 2048,
+				nft_sponsor_transfer_timeout: 15,
+				fungible_sponsor_transfer_timeout: 15,
+				refungible_sponsor_transfer_timeout: 15,
+				const_on_chain_schema_limit: 1024,
+				offchain_schema_limit: 1024,
+				variable_on_chain_schema_limit: 1024,
+			}
+		));
 
-        let origin1 = Origin::signed(1);
-        let data = default_nft_data();
-        create_test_item(collection_id, &data.clone().into());
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        assert_noop!(TemplateModule::create_item(
-            origin1.clone(),
-            1,
-            1,
-            data.into()
-        ),  Error::<Test>::AddressOwnershipLimitExceeded);
-    });
+		let origin1 = Origin::signed(1);
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.clone().into());
+
+		assert_noop!(
+			TemplateModule::create_item(origin1, 1, account(1), data.into()),
+			Error::<Test>::AddressOwnershipLimitExceeded
+		);
+	});
 }
 
 // Number of collection admins. Positive test
 #[test]
 fn collection_admins_bound() {
-    new_test_ext().execute_with(|| {
-        assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { 
-            collection_numbers_limit: 10,
-            account_token_ownership_limit: 10,
-            collections_admins_limit: 2,
-            custom_data_limit: 2048,
-            nft_sponsor_transfer_timeout: 15,
-            fungible_sponsor_transfer_timeout: 15,
-            refungible_sponsor_transfer_timeout: 15,
-            const_on_chain_schema_limit: 1024,
-            offchain_schema_limit: 1024,
-            variable_on_chain_schema_limit: 1024,
-        }));
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		assert_ok!(TemplateModule::set_chain_limits(
+			RawOrigin::Root.into(),
+			ChainLimits {
+				collection_numbers_limit: 10,
+				account_token_ownership_limit: 10,
+				collections_admins_limit: 2,
+				custom_data_limit: 2048,
+				nft_sponsor_transfer_timeout: 15,
+				fungible_sponsor_transfer_timeout: 15,
+				refungible_sponsor_transfer_timeout: 15,
+				const_on_chain_schema_limit: 1024,
+				offchain_schema_limit: 1024,
+				variable_on_chain_schema_limit: 1024,
+			}
+		));
+
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+
+		let origin1 = Origin::signed(1);
 
-        let origin1 = Origin::signed(1);
-        
-        assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 2));
-        assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 3));
-    });
+		assert_ok!(TemplateModule::add_collection_admin(
+			origin1.clone(),
+			collection_id,
+			account(2)
+		));
+		assert_ok!(TemplateModule::add_collection_admin(
+			origin1,
+			collection_id,
+			account(3)
+		));
+	});
 }
 
 // Number of collection admins. Negotive test
 #[test]
 fn collection_admins_bound_neg() {
-    new_test_ext().execute_with(|| {
-        assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { 
-            collection_numbers_limit: 10,
-            account_token_ownership_limit: 1,
-            collections_admins_limit: 1,
-            custom_data_limit: 2048,
-            nft_sponsor_transfer_timeout: 15,
-            fungible_sponsor_transfer_timeout: 15,
-            refungible_sponsor_transfer_timeout: 15,
-            const_on_chain_schema_limit: 1024,
-            offchain_schema_limit: 1024,
-            variable_on_chain_schema_limit: 1024,
-        }));
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		assert_ok!(TemplateModule::set_chain_limits(
+			RawOrigin::Root.into(),
+			ChainLimits {
+				collection_numbers_limit: 10,
+				account_token_ownership_limit: 1,
+				collections_admins_limit: 1,
+				custom_data_limit: 2048,
+				nft_sponsor_transfer_timeout: 15,
+				fungible_sponsor_transfer_timeout: 15,
+				refungible_sponsor_transfer_timeout: 15,
+				const_on_chain_schema_limit: 1024,
+				offchain_schema_limit: 1024,
+				variable_on_chain_schema_limit: 1024,
+			}
+		));
 
-        let origin1 = Origin::signed(1);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+
+		let origin1 = Origin::signed(1);
 
-        assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 2));
-        assert_noop!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 3), Error::<Test>::CollectionAdminsLimitExceeded);
-    });
+		assert_ok!(TemplateModule::add_collection_admin(
+			origin1.clone(),
+			collection_id,
+			account(2)
+		));
+		assert_noop!(
+			TemplateModule::add_collection_admin(origin1, collection_id, account(3)),
+			Error::<Test>::CollectionAdminsLimitExceeded
+		);
+	});
 }
 
 // NFT custom data size. Negative test const_data.
 #[test]
 fn custom_data_size_nft_const_data_bound_neg() {
-    new_test_ext().execute_with(|| {
-        assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { 
-            collection_numbers_limit: 10,
-            account_token_ownership_limit: 10,
-            collections_admins_limit: 5,
-            custom_data_limit: 2,
-            nft_sponsor_transfer_timeout: 15,
-            fungible_sponsor_transfer_timeout: 15,
-            refungible_sponsor_transfer_timeout: 15,
-            const_on_chain_schema_limit: 1024,
-            offchain_schema_limit: 1024,
-            variable_on_chain_schema_limit: 1024,
-        }));
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		assert_ok!(TemplateModule::set_chain_limits(
+			RawOrigin::Root.into(),
+			ChainLimits {
+				collection_numbers_limit: 10,
+				account_token_ownership_limit: 10,
+				collections_admins_limit: 5,
+				custom_data_limit: 2,
+				nft_sponsor_transfer_timeout: 15,
+				fungible_sponsor_transfer_timeout: 15,
+				refungible_sponsor_transfer_timeout: 15,
+				const_on_chain_schema_limit: 1024,
+				offchain_schema_limit: 1024,
+				variable_on_chain_schema_limit: 1024,
+			}
+		));
+
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let origin1 = Origin::signed(1);
-        let too_big_const_data = CreateItemData::NFT(CreateNftData{
-            const_data: vec![1, 2, 3, 4],
-            variable_data: vec![]
-        });
+		let origin1 = Origin::signed(1);
+		let too_big_const_data = CreateItemData::NFT(CreateNftData {
+			const_data: vec![1, 2, 3, 4],
+			variable_data: vec![],
+		});
 
-        assert_noop!(TemplateModule::create_item(
-            origin1.clone(),
-            collection_id,
-            1,
-            too_big_const_data
-        ), Error::<Test>::TokenConstDataLimitExceeded);
-    });
+		assert_noop!(
+			TemplateModule::create_item(origin1, collection_id, account(1), too_big_const_data),
+			Error::<Test>::TokenConstDataLimitExceeded
+		);
+	});
 }
 
 // NFT custom data size. Negative test variable_data.
 #[test]
 fn custom_data_size_nft_variable_data_bound_neg() {
-    new_test_ext().execute_with(|| {
-        assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { 
-            collection_numbers_limit: 10,
-            account_token_ownership_limit: 10,
-            collections_admins_limit: 5,
-            custom_data_limit: 2,
-            nft_sponsor_transfer_timeout: 15,
-            fungible_sponsor_transfer_timeout: 15,
-            refungible_sponsor_transfer_timeout: 15,
-            const_on_chain_schema_limit: 1024,
-            offchain_schema_limit: 1024,
-            variable_on_chain_schema_limit: 1024,
-        }));
+	new_test_ext().execute_with(|| {
+		assert_ok!(TemplateModule::set_chain_limits(
+			RawOrigin::Root.into(),
+			ChainLimits {
+				collection_numbers_limit: 10,
+				account_token_ownership_limit: 10,
+				collections_admins_limit: 5,
+				custom_data_limit: 2,
+				nft_sponsor_transfer_timeout: 15,
+				fungible_sponsor_transfer_timeout: 15,
+				refungible_sponsor_transfer_timeout: 15,
+				const_on_chain_schema_limit: 1024,
+				offchain_schema_limit: 1024,
+				variable_on_chain_schema_limit: 1024,
+			}
+		));
 
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let origin1 = Origin::signed(1);
-        let too_big_const_data = CreateItemData::NFT(CreateNftData{
-            const_data: vec![],
-            variable_data: vec![1, 2, 3, 4]
-        });
+		let origin1 = Origin::signed(1);
+		let too_big_const_data = CreateItemData::NFT(CreateNftData {
+			const_data: vec![],
+			variable_data: vec![1, 2, 3, 4],
+		});
 
-        assert_noop!(TemplateModule::create_item(
-            origin1.clone(),
-            collection_id,
-            1,
-            too_big_const_data
-        ), Error::<Test>::TokenVariableDataLimitExceeded);
-    });
+		assert_noop!(
+			TemplateModule::create_item(origin1, collection_id, account(1), too_big_const_data),
+			Error::<Test>::TokenVariableDataLimitExceeded
+		);
+	});
 }
 
 // Re fungible custom data size. Negative test const_data.
 #[test]
 fn custom_data_size_re_fungible_const_data_bound_neg() {
-    new_test_ext().execute_with(|| {
-        assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { 
-            collection_numbers_limit: 10,
-            account_token_ownership_limit: 10,
-            collections_admins_limit: 5,
-            custom_data_limit: 2,
-            nft_sponsor_transfer_timeout: 15,
-            fungible_sponsor_transfer_timeout: 15,
-            refungible_sponsor_transfer_timeout: 15,
-            const_on_chain_schema_limit: 1024,
-            offchain_schema_limit: 1024,
-            variable_on_chain_schema_limit: 1024,
-        }));
+	new_test_ext().execute_with(|| {
+		assert_ok!(TemplateModule::set_chain_limits(
+			RawOrigin::Root.into(),
+			ChainLimits {
+				collection_numbers_limit: 10,
+				account_token_ownership_limit: 10,
+				collections_admins_limit: 5,
+				custom_data_limit: 2,
+				nft_sponsor_transfer_timeout: 15,
+				fungible_sponsor_transfer_timeout: 15,
+				refungible_sponsor_transfer_timeout: 15,
+				const_on_chain_schema_limit: 1024,
+				offchain_schema_limit: 1024,
+				variable_on_chain_schema_limit: 1024,
+			}
+		));
 
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let origin1 = Origin::signed(1);
-        let too_big_const_data = CreateItemData::NFT(CreateNftData{
-            const_data: vec![1, 2, 3, 4],
-            variable_data: vec![]
-        });
+		let origin1 = Origin::signed(1);
+		let too_big_const_data = CreateItemData::NFT(CreateNftData {
+			const_data: vec![1, 2, 3, 4],
+			variable_data: vec![],
+		});
 
-        assert_noop!(TemplateModule::create_item(
-            origin1.clone(),
-            collection_id,
-            1,
-            too_big_const_data
-        ), Error::<Test>::TokenConstDataLimitExceeded);
-    });
+		assert_noop!(
+			TemplateModule::create_item(origin1, collection_id, account(1), too_big_const_data),
+			Error::<Test>::TokenConstDataLimitExceeded
+		);
+	});
 }
 
 // Re fungible custom data size. Negative test variable_data.
 #[test]
 fn custom_data_size_re_fungible_variable_data_bound_neg() {
-    new_test_ext().execute_with(|| {
-        assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { 
-            collection_numbers_limit: 10,
-            account_token_ownership_limit: 10,
-            collections_admins_limit: 5,
-            custom_data_limit: 2,
-            nft_sponsor_transfer_timeout: 15,
-            fungible_sponsor_transfer_timeout: 15,
-            refungible_sponsor_transfer_timeout: 15,
-            const_on_chain_schema_limit: 1024,
-            offchain_schema_limit: 1024,
-            variable_on_chain_schema_limit: 1024,
-        }));
+	new_test_ext().execute_with(|| {
+		assert_ok!(TemplateModule::set_chain_limits(
+			RawOrigin::Root.into(),
+			ChainLimits {
+				collection_numbers_limit: 10,
+				account_token_ownership_limit: 10,
+				collections_admins_limit: 5,
+				custom_data_limit: 2,
+				nft_sponsor_transfer_timeout: 15,
+				fungible_sponsor_transfer_timeout: 15,
+				refungible_sponsor_transfer_timeout: 15,
+				const_on_chain_schema_limit: 1024,
+				offchain_schema_limit: 1024,
+				variable_on_chain_schema_limit: 1024,
+			}
+		));
 
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let origin1 = Origin::signed(1);
-        let too_big_const_data = CreateItemData::NFT(CreateNftData{
-            const_data: vec![],
-            variable_data: vec![1, 2, 3, 4]
-        });
+		let origin1 = Origin::signed(1);
+		let too_big_const_data = CreateItemData::NFT(CreateNftData {
+			const_data: vec![],
+			variable_data: vec![1, 2, 3, 4],
+		});
 
-        assert_noop!(TemplateModule::create_item(
-            origin1.clone(),
-            collection_id,
-            1,
-            too_big_const_data
-        ), Error::<Test>::TokenVariableDataLimitExceeded);
-    });
+		assert_noop!(
+			TemplateModule::create_item(origin1, collection_id, account(1), too_big_const_data),
+			Error::<Test>::TokenVariableDataLimitExceeded
+		);
+	});
 }
 // #endregion
 
 #[test]
 fn set_const_on_chain_schema() {
-    new_test_ext().execute_with(|| {
-        default_limits();
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let origin1 = Origin::signed(1);
-        assert_ok!(TemplateModule::set_const_on_chain_schema(origin1, collection_id, b"test const on chain schema".to_vec()));
+		let origin1 = Origin::signed(1);
+		assert_ok!(TemplateModule::set_const_on_chain_schema(
+			origin1,
+			collection_id,
+			b"test const on chain schema".to_vec()
+		));
 
-        assert_eq!(TemplateModule::collection_id(collection_id).unwrap().const_on_chain_schema, b"test const on chain schema".to_vec());
-        assert_eq!(TemplateModule::collection_id(collection_id).unwrap().variable_on_chain_schema, b"".to_vec());
-    });
+		assert_eq!(
+			TemplateModule::collection_id(collection_id)
+				.unwrap()
+				.const_on_chain_schema,
+			b"test const on chain schema".to_vec()
+		);
+		assert_eq!(
+			TemplateModule::collection_id(collection_id)
+				.unwrap()
+				.variable_on_chain_schema,
+			b"".to_vec()
+		);
+	});
 }
 
 #[test]
 fn set_variable_on_chain_schema() {
-    new_test_ext().execute_with(|| {
-        default_limits();
-        
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let origin1 = Origin::signed(1);
-        assert_ok!(TemplateModule::set_variable_on_chain_schema(origin1, collection_id, b"test variable on chain schema".to_vec()));
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        assert_eq!(TemplateModule::collection_id(collection_id).unwrap().const_on_chain_schema, b"".to_vec());
-        assert_eq!(TemplateModule::collection_id(collection_id).unwrap().variable_on_chain_schema, b"test variable on chain schema".to_vec());
-    });
+		let origin1 = Origin::signed(1);
+		assert_ok!(TemplateModule::set_variable_on_chain_schema(
+			origin1,
+			collection_id,
+			b"test variable on chain schema".to_vec()
+		));
+
+		assert_eq!(
+			TemplateModule::collection_id(collection_id)
+				.unwrap()
+				.const_on_chain_schema,
+			b"".to_vec()
+		);
+		assert_eq!(
+			TemplateModule::collection_id(collection_id)
+				.unwrap()
+				.variable_on_chain_schema,
+			b"test variable on chain schema".to_vec()
+		);
+	});
 }
 
 #[test]
 fn set_variable_meta_data_on_nft_token_stores_variable_meta_data() {
-    new_test_ext().execute_with(|| {
-        default_limits();
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let origin1 = Origin::signed(1);
-        
-        let data = default_nft_data();
-        create_test_item(1, &data.into());
-        
-        let variable_data = b"test set_variable_meta_data method.".to_vec();
-        assert_ok!(TemplateModule::set_variable_meta_data(origin1, collection_id, 1, variable_data.clone()));
+		let origin1 = Origin::signed(1);
 
-        assert_eq!(TemplateModule::nft_item_id(collection_id, 1).unwrap().variable_data, variable_data);
-    });
+		let data = default_nft_data();
+		create_test_item(1, &data.into());
+
+		let variable_data = b"test set_variable_meta_data method.".to_vec();
+		assert_ok!(TemplateModule::set_variable_meta_data(
+			origin1,
+			collection_id,
+			1,
+			variable_data.clone()
+		));
+
+		assert_eq!(
+			TemplateModule::nft_item_id(collection_id, 1)
+				.unwrap()
+				.variable_data,
+			variable_data
+		);
+	});
 }
 
 #[test]
 fn set_variable_meta_data_on_re_fungible_token_stores_variable_meta_data() {
-    new_test_ext().execute_with(|| {
-        default_limits();
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let collection_id = create_test_collection(&CollectionMode::ReFungible, 1);
+		let collection_id = create_test_collection(&CollectionMode::ReFungible, 1);
 
-        let origin1 = Origin::signed(1);
+		let origin1 = Origin::signed(1);
 
-        let data = default_re_fungible_data();
-        create_test_item(1, &data.into());
+		let data = default_re_fungible_data();
+		create_test_item(1, &data.into());
 
-        let variable_data = b"test set_variable_meta_data method.".to_vec();
-        assert_ok!(TemplateModule::set_variable_meta_data(origin1, collection_id, 1, variable_data.clone()));
+		let variable_data = b"test set_variable_meta_data method.".to_vec();
+		assert_ok!(TemplateModule::set_variable_meta_data(
+			origin1,
+			collection_id,
+			1,
+			variable_data.clone()
+		));
 
-        assert_eq!(TemplateModule::refungible_item_id(collection_id, 1).unwrap().variable_data, variable_data);
-    });
+		assert_eq!(
+			TemplateModule::refungible_item_id(collection_id, 1)
+				.unwrap()
+				.variable_data,
+			variable_data
+		);
+	});
 }
 
-
 #[test]
 fn set_variable_meta_data_on_fungible_token_fails() {
-    new_test_ext().execute_with(|| {
-        default_limits();
+	new_test_ext().execute_with(|| {
+		default_limits();
 
-        let collection_id = create_test_collection(&CollectionMode::Fungible(3), 1);
+		let collection_id = create_test_collection(&CollectionMode::Fungible(3), 1);
 
-        let origin1 = Origin::signed(1);
+		let origin1 = Origin::signed(1);
 
-        let data = default_fungible_data();
-        create_test_item(1, &data.into());
+		let data = default_fungible_data();
+		create_test_item(1, &data.into());
 
-        let variable_data = b"test set_variable_meta_data method.".to_vec();
-        assert_noop!(TemplateModule::set_variable_meta_data(origin1, collection_id, 1, variable_data.clone()), Error::<Test>::CantStoreMetadataInFungibleTokens);
-    });
+		let variable_data = b"test set_variable_meta_data method.".to_vec();
+		assert_noop!(
+			TemplateModule::set_variable_meta_data(origin1, collection_id, 1, variable_data),
+			Error::<Test>::CantStoreMetadataInFungibleTokens
+		);
+	});
 }
 
 #[test]
 fn set_variable_meta_data_on_nft_token_fails_for_big_data() {
-    new_test_ext().execute_with(|| {
-        assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { 
-            collection_numbers_limit: default_collection_numbers_limit(),
-            account_token_ownership_limit: 10,
-            collections_admins_limit: 5,
-            custom_data_limit: 10,
-            nft_sponsor_transfer_timeout: 15,
-            fungible_sponsor_transfer_timeout: 15,
-            refungible_sponsor_transfer_timeout: 15,
-            const_on_chain_schema_limit: 1024,
-            offchain_schema_limit: 1024,
-            variable_on_chain_schema_limit: 1024,
-        }));
+	new_test_ext().execute_with(|| {
+		assert_ok!(TemplateModule::set_chain_limits(
+			RawOrigin::Root.into(),
+			ChainLimits {
+				collection_numbers_limit: default_collection_numbers_limit(),
+				account_token_ownership_limit: 10,
+				collections_admins_limit: 5,
+				custom_data_limit: 10,
+				nft_sponsor_transfer_timeout: 15,
+				fungible_sponsor_transfer_timeout: 15,
+				refungible_sponsor_transfer_timeout: 15,
+				const_on_chain_schema_limit: 1024,
+				offchain_schema_limit: 1024,
+				variable_on_chain_schema_limit: 1024,
+			}
+		));
 
-        let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
 
-        let origin1 = Origin::signed(1);
+		let origin1 = Origin::signed(1);
 
-        let data = default_nft_data();
-        create_test_item(1, &data.into());
+		let data = default_nft_data();
+		create_test_item(1, &data.into());
 
-        let variable_data = b"test set_variable_meta_data method, bigger than limits.".to_vec();
-        assert_noop!(TemplateModule::set_variable_meta_data(origin1, collection_id, 1, variable_data), Error::<Test>::TokenVariableDataLimitExceeded);
-    });
+		let variable_data = b"test set_variable_meta_data method, bigger than limits.".to_vec();
+		assert_noop!(
+			TemplateModule::set_variable_meta_data(origin1, collection_id, 1, variable_data),
+			Error::<Test>::TokenVariableDataLimitExceeded
+		);
+	});
 }
 
 #[test]
 fn set_variable_meta_data_on_re_fungible_token_fails_for_big_data() {
-    new_test_ext().execute_with(|| {
-        assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { 
-            collection_numbers_limit: default_collection_numbers_limit(),
-            account_token_ownership_limit: 10,
-            collections_admins_limit: 5,
-            custom_data_limit: 10,
-            nft_sponsor_transfer_timeout: 15,
-            fungible_sponsor_transfer_timeout: 15,
-            refungible_sponsor_transfer_timeout: 15,
-            const_on_chain_schema_limit: 1024,
-            offchain_schema_limit: 1024,
-            variable_on_chain_schema_limit: 1024,
-        }));
+	new_test_ext().execute_with(|| {
+		assert_ok!(TemplateModule::set_chain_limits(
+			RawOrigin::Root.into(),
+			ChainLimits {
+				collection_numbers_limit: default_collection_numbers_limit(),
+				account_token_ownership_limit: 10,
+				collections_admins_limit: 5,
+				custom_data_limit: 10,
+				nft_sponsor_transfer_timeout: 15,
+				fungible_sponsor_transfer_timeout: 15,
+				refungible_sponsor_transfer_timeout: 15,
+				const_on_chain_schema_limit: 1024,
+				offchain_schema_limit: 1024,
+				variable_on_chain_schema_limit: 1024,
+			}
+		));
 
+		let collection_id = create_test_collection(&CollectionMode::ReFungible, 1);
 
-        let collection_id = create_test_collection(&CollectionMode::ReFungible, 1);
+		let origin1 = Origin::signed(1);
 
-        let origin1 = Origin::signed(1);
-
-        let data = default_re_fungible_data();
-        create_test_item(1, &data.into());
+		let data = default_re_fungible_data();
+		create_test_item(1, &data.into());
 
-        let variable_data = b"test set_variable_meta_data method, bigger than limits.".to_vec();
-        assert_noop!(TemplateModule::set_variable_meta_data(origin1, collection_id, 1, variable_data), Error::<Test>::TokenVariableDataLimitExceeded);
-    });
+		let variable_data = b"test set_variable_meta_data method, bigger than limits.".to_vec();
+		assert_noop!(
+			TemplateModule::set_variable_meta_data(origin1, collection_id, 1, variable_data),
+			Error::<Test>::TokenVariableDataLimitExceeded
+		);
+	});
 }
modifiedpallets/scheduler/Cargo.tomldiffbeforeafterboth
--- a/pallets/scheduler/Cargo.toml
+++ b/pallets/scheduler/Cargo.toml
@@ -12,19 +12,19 @@
 [dependencies]
 serde = { version = "1.0.119", default-features = false }
 codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
-frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-io = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-frame-benchmarking = { default-features = false, version = '3.0.0', optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
+frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-io = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+frame-benchmarking = { default-features = false, version = '3.0.0', optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
 
 up-sponsorship = { default-features = false, path = "../../primitives/sponsorship", version = "0.1.0" }
 log = { version = "0.4.14", default-features = false }
 
 [dev-dependencies]
-sp-core = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-substrate-test-utils = { version = "3.0.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
+sp-core = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+substrate-test-utils = { version = "3.0.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
 
 [features]
 default = ["std"]
modifiedpallets/scheduler/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/scheduler/src/benchmarking.rs
+++ b/pallets/scheduler/src/benchmarking.rs
@@ -31,7 +31,7 @@
 const BLOCK_NUMBER: u32 = 2;
 
 // Add `n` named items to the schedule
-fn fill_schedule<T: Config> (when: T::BlockNumber, n: u32) -> Result<(), &'static str> {
+fn fill_schedule<T: Config>(when: T::BlockNumber, n: u32) -> Result<(), &'static str> {
 	// Essentially a no-op call.
 	let call = frame_system::Call::set_storage(vec![]);
 	for i in 0..n {
@@ -47,7 +47,10 @@
 			call.clone().into(),
 		)?;
 	}
-	ensure!(Agenda::<T>::get(when).len() == n as usize, "didn't fill schedule");
+	ensure!(
+		Agenda::<T>::get(when).len() == n as usize,
+		"didn't fill schedule"
+	);
 	Ok(())
 }
 
@@ -141,8 +144,4 @@
 	}
 }
 
-impl_benchmark_test_suite!(
-	Scheduler,
-	crate::tests::new_test_ext(),
-	crate::tests::Test,
-);
+impl_benchmark_test_suite!(Scheduler, crate::tests::new_test_ext(), crate::tests::Test,);
modifiedpallets/scheduler/src/lib.rsdiffbeforeafterboth
before · pallets/scheduler/src/lib.rs
1// This file is part of Substrate.23// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.4// SPDX-License-Identifier: Apache-2.056// Licensed under the Apache License, Version 2.0 (the "License");7// you may not use this file except in compliance with the License.8// You may obtain a copy of the License at9//10// 	http://www.apache.org/licenses/LICENSE-2.011//12// Unless required by applicable law or agreed to in writing, software13// distributed under the License is distributed on an "AS IS" BASIS,14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15// See the License for the specific language governing permissions and16// limitations under the License.1718//! # Scheduler19//! A module for scheduling dispatches.20//!21//! - [`Config`]22//! - [`Call`]23//! - [`Module`]24//!25//! ## Overview26//!27//! This module exposes capabilities for scheduling dispatches to occur at a28//! specified block number or at a specified period. These scheduled dispatches29//! may be named or anonymous and may be canceled.30//!31//! **NOTE:** The scheduled calls will be dispatched with the default filter32//! for the origin: namely `frame_system::Config::BaseCallFilter` for all origin33//! except root which will get no filter. And not the filter contained in origin34//! use to call `fn schedule`.35//!36//! If a call is scheduled using proxy or whatever mecanism which adds filter,37//! then those filter will not be used when dispatching the schedule call.38//!39//! ## Interface40//!41//! ### Dispatchable Functions42//!43//! * `schedule` - schedule a dispatch, which may be periodic, to occur at a44//!   specified block and with a specified priority.45//! * `cancel` - cancel a scheduled dispatch, specified by block number and46//!   index.47//! * `schedule_named` - augments the `schedule` interface with an additional48//!   `Vec<u8>` parameter that can be used for identification.49//! * `cancel_named` - the named complement to the cancel function.5051// Ensure we're `no_std` when compiling for Wasm.52#![cfg_attr(not(feature = "std"), no_std)]5354mod benchmarking;55pub mod weights;5657use sp_std::{prelude::*, marker::PhantomData, borrow::Borrow};58use codec::{Encode, Decode, Codec};59use sp_runtime::{RuntimeDebug, traits::{Zero, One, BadOrigin, Saturating}};60use frame_support::{61	decl_module, decl_storage, decl_event, decl_error, IterableStorageMap,62	dispatch::{Dispatchable, DispatchError, DispatchResult, Parameter},63	traits::{Get, schedule::{self, DispatchTime}, OriginTrait, EnsureOrigin, IsType},64	weights::{GetDispatchInfo, Weight},65};66use frame_system::{self as system, ensure_signed};67pub use weights::WeightInfo;68use up_sponsorship::SponsorshipHandler;6970/// Our pallet's configuration trait. All our types and constants go in here. If the71/// pallet is dependent on specific other pallets, then their configuration traits72/// should be added to our implied traits list.73///74/// `system::Config` should always be included in our implied traits.75/// // 76pub trait Config: system::Config77{ 7879	/// The overarching event type.80	type Event: From<Event<Self>> + Into<<Self as system::Config>::Event>;8182	/// The aggregated origin which the dispatch will take.83	type Origin: OriginTrait<PalletsOrigin = Self::PalletsOrigin>84		+ From<Self::PalletsOrigin> + IsType<<Self as system::Config>::Origin>;8586	/// The caller origin, overarching type of all pallets origins.87	type PalletsOrigin: From<system::RawOrigin<Self::AccountId>> + Codec + Clone + Eq;8889	/// The aggregated call type.90	type Call: Parameter + Dispatchable<Origin=<Self as Config>::Origin> + GetDispatchInfo + From<system::Call<Self>>;9192	/// The maximum weight that may be scheduled per block for any dispatchables of less priority93	/// than `schedule::HARD_DEADLINE`.94	type MaximumWeight: Get<Weight>;9596	/// Required origin to schedule or cancel calls.97	type ScheduleOrigin: EnsureOrigin<<Self as system::Config>::Origin>;9899	/// The maximum number of scheduled calls in the queue for a single block.100	/// Not strictly enforced, but used for weight estimation.101	type MaxScheduledPerBlock: Get<u32>;102103	/// Sponsoring function104	type SponsorshipHandler: SponsorshipHandler<Self::AccountId, <Self as Config>::Call>;105106	/// Weight information for extrinsics in this pallet.107	type WeightInfo: WeightInfo;108}109110// pub type SelfWeightInfo<T> = <T as system::Config>::WeightInfo;111112/// Just a simple index for naming period tasks.113pub type PeriodicIndex = u32;114/// The location of a scheduled task that can be used to remove it.115pub type TaskAddress<BlockNumber> = (BlockNumber, u32);116117#[cfg_attr(any(feature = "std", test), derive(PartialEq, Eq))]118#[derive(Clone, RuntimeDebug, Encode, Decode)]119struct ScheduledV1<Call, BlockNumber> {120	maybe_id: Option<Vec<u8>>,121	priority: schedule::Priority,122	call: Call,123	maybe_periodic: Option<schedule::Period<BlockNumber>>,124}125126/// Information regarding an item to be executed in the future.127#[cfg_attr(any(feature = "std", test), derive(PartialEq, Eq))]128#[derive(Clone, RuntimeDebug, Encode, Decode)]129pub struct ScheduledV2<Call, BlockNumber, PalletsOrigin, AccountId> {130	/// The unique identity for this task, if there is one.131	maybe_id: Option<Vec<u8>>,132	/// This task's priority.133	priority: schedule::Priority,134	/// The call to be dispatched.135	call: Call,136	/// If the call is periodic, then this points to the information concerning that.137	maybe_periodic: Option<schedule::Period<BlockNumber>>,138	/// The origin to dispatch the call.139	origin: PalletsOrigin,140	_phantom: PhantomData<AccountId>,141}142143/// The current version of Scheduled struct.144pub type Scheduled<Call, BlockNumber, PalletsOrigin, AccountId> = ScheduledV2<Call, BlockNumber, PalletsOrigin, AccountId>;145146// A value placed in storage that represents the current version of the Scheduler storage.147// This value is used by the `on_runtime_upgrade` logic to determine whether we run148// storage migration logic.149#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug)]150enum Releases {151	V1,152	V2,153}154155impl Default for Releases {156	fn default() -> Self {157		Releases::V1158	}159}160161#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)]162pub struct CallSpec {163164	module: u32,165	method: u32,166}167168decl_storage! {169	trait Store for Module<T: Config> as Scheduler {170		/// Items to be executed, indexed by the block number that they should be executed on.171		pub Agenda: map hasher(twox_64_concat) T::BlockNumber172			=> Vec<Option<Scheduled<<T as Config>::Call, T::BlockNumber, T::PalletsOrigin, T::AccountId>>>;173174		pub SpecAgenda: map hasher(twox_64_concat) T::BlockNumber175			=> Vec<Option<CallSpec>>;			176177		/// Lookup from identity to the block number and index of the task.178		Lookup: map hasher(twox_64_concat) Vec<u8> => Option<TaskAddress<T::BlockNumber>>;179180		/// Storage version of the pallet.181		///182		/// New networks start with last version.183		StorageVersion build(|_| Releases::V2): Releases;184	}185}186187decl_event!(188	pub enum Event<T> where <T as system::Config>::BlockNumber {189		/// Scheduled some task. \[when, index\]190		Scheduled(BlockNumber, u32),191		/// Canceled some task. \[when, index\]192		Canceled(BlockNumber, u32),193		/// Dispatched some task. \[task, id, result\]194		Dispatched(TaskAddress<BlockNumber>, Option<Vec<u8>>, DispatchResult),195	}196);197198decl_error! {199	pub enum Error for Module<T: Config> {200		/// Failed to schedule a call201		FailedToSchedule,202		/// Cannot find the scheduled call.203		NotFound,204		/// Given target block number is in the past.205		TargetBlockNumberInPast,206		/// Reschedule failed because it does not change scheduled time.207		RescheduleNoChange,208	}209}210211decl_module! {212	/// Scheduler module declaration.213	pub struct Module<T: Config> for enum Call 214	where 215		origin: <T as system::Config>::Origin216	{217		type Error = Error<T>;218		fn deposit_event() = default;219220221		/// Anonymously schedule a task.222		///223		/// # <weight>224		/// - S = Number of already scheduled calls225		/// - Base Weight: 22.29 + .126 * S µs226		/// - DB Weight:227		///     - Read: Agenda228		///     - Write: Agenda229		/// - Will use base weight of 25 which should be good for up to 30 scheduled calls230		/// # </weight>231		#[weight = <T as Config>::WeightInfo::schedule(T::MaxScheduledPerBlock::get())]232		fn schedule(origin,233			when: T::BlockNumber,234			maybe_periodic: Option<schedule::Period<T::BlockNumber>>,235			priority: schedule::Priority,236			call: Box<<T as Config>::Call>,237		) 238		{239			let origin = <T as Config>::Origin::from(origin);240			Self::do_schedule(DispatchTime::At(when), maybe_periodic, priority, origin.caller().clone(), *call)?;241		}242243		/// Cancel an anonymously scheduled task.244		///245		/// # <weight>246		/// - S = Number of already scheduled calls247		/// - Base Weight: 22.15 + 2.869 * S µs248		/// - DB Weight:249		///     - Read: Agenda250		///     - Write: Agenda, Lookup251		/// - Will use base weight of 100 which should be good for up to 30 scheduled calls252		/// # </weight>253		#[weight = <T as Config>::WeightInfo::cancel(T::MaxScheduledPerBlock::get())]254		fn cancel(origin, when: T::BlockNumber, index: u32) {255			T::ScheduleOrigin::ensure_origin(origin.clone())?;256			let origin = <T as Config>::Origin::from(origin);257			Self::do_cancel(Some(origin.caller().clone()), (when, index))?;258		}259260		/// Schedule a named task.261		///262		/// # <weight>263		/// - S = Number of already scheduled calls264		/// - Base Weight: 29.6 + .159 * S µs265		/// - DB Weight:266		///     - Read: Agenda, Lookup267		///     - Write: Agenda, Lookup268		/// - Will use base weight of 35 which should be good for more than 30 scheduled calls269		/// # </weight>270		#[weight = <T as Config>::WeightInfo::schedule_named(T::MaxScheduledPerBlock::get())]271		fn schedule_named(origin,272			id: Vec<u8>,273			when: T::BlockNumber,274			maybe_periodic: Option<schedule::Period<T::BlockNumber>>,275			priority: schedule::Priority,276			call: Box<<T as Config>::Call>,277		) {278			T::ScheduleOrigin::ensure_origin(origin.clone())?;279			let origin = <T as Config>::Origin::from(origin);280			Self::do_schedule_named(281				id, DispatchTime::At(when), maybe_periodic, priority, origin.caller().clone(), *call282			)?;283		}284285		/// Cancel a named scheduled task.286		///287		/// # <weight>288		/// - S = Number of already scheduled calls289		/// - Base Weight: 24.91 + 2.907 * S µs290		/// - DB Weight:291		///     - Read: Agenda, Lookup292		///     - Write: Agenda, Lookup293		/// - Will use base weight of 100 which should be good for up to 30 scheduled calls294		/// # </weight>295		#[weight = <T as Config>::WeightInfo::cancel_named(T::MaxScheduledPerBlock::get())]296		fn cancel_named(origin, id: Vec<u8>) {297			T::ScheduleOrigin::ensure_origin(origin.clone())?;298			let origin = <T as Config>::Origin::from(origin);299			Self::do_cancel_named(Some(origin.caller().clone()), id)?;300		}301302		/// Anonymously schedule a task after a delay.303		///304		/// # <weight>305		/// Same as [`schedule`].306		/// # </weight>307		#[weight = <T as Config>::WeightInfo::schedule(T::MaxScheduledPerBlock::get())]308		fn schedule_after(origin,309			after: T::BlockNumber,310			maybe_periodic: Option<schedule::Period<T::BlockNumber>>,311			priority: schedule::Priority,312			call: Box<<T as Config>::Call>,313		) {314			T::ScheduleOrigin::ensure_origin(origin.clone())?;315			let origin = <T as Config>::Origin::from(origin);316			Self::do_schedule(317				DispatchTime::After(after), maybe_periodic, priority, origin.caller().clone(), *call318			)?;319		}320321		/// Schedule a named task after a delay.322		///323		/// # <weight>324		/// Same as [`schedule_named`].325		/// # </weight>326		#[weight = <T as Config>::WeightInfo::schedule_named(T::MaxScheduledPerBlock::get())]327		fn schedule_named_after(origin,328			id: Vec<u8>,329			after: T::BlockNumber,330			maybe_periodic: Option<schedule::Period<T::BlockNumber>>,331			priority: schedule::Priority,332			call: Box<<T as Config>::Call>,333		) {334			T::ScheduleOrigin::ensure_origin(origin.clone())?;335			let origin = <T as Config>::Origin::from(origin);336			Self::do_schedule_named(337				id, DispatchTime::After(after), maybe_periodic, priority, origin.caller().clone(), *call338			)?;339		}340341		/// Execute the scheduled calls342		///343		/// # <weight>344		/// - S = Number of already scheduled calls345		/// - N = Named scheduled calls346		/// - P = Periodic Calls347		/// - Base Weight: 9.243 + 23.45 * S µs348		/// - DB Weight:349		///     - Read: Agenda + Lookup * N + Agenda(Future) * P350		///     - Write: Agenda + Lookup * N  + Agenda(future) * P351		/// # </weight>352		fn on_initialize(now: T::BlockNumber) -> Weight {353			let limit = T::MaximumWeight::get();354			let mut queued = Agenda::<T>::take(now).into_iter()355				.enumerate()356				.filter_map(|(index, s)| s.map(|inner| (index as u32, inner)))357				.collect::<Vec<_>>();358			if queued.len() as u32 > T::MaxScheduledPerBlock::get() {359				log::warn!(360					target: "runtime::scheduler",361					"Warning: This block has more items queued in Scheduler than \362					expected from the runtime configuration. An update might be needed."363				);364			}365			queued.sort_by_key(|(_, s)| s.priority);366			let base_weight: Weight = T::DbWeight::get().reads_writes(1, 2); // Agenda + Agenda(next)367			let mut total_weight: Weight = 0;368			queued.into_iter()369				.enumerate()370				.scan(base_weight, |cumulative_weight, (order, (index, s))| {371					*cumulative_weight = cumulative_weight372						.saturating_add(s.call.get_dispatch_info().weight);373374					let origin = <<T as Config>::Origin as From<T::PalletsOrigin>>::from(375						s.origin.clone()376					).into();377378					if ensure_signed(origin).is_ok() {379						 // AccountData for inner call origin accountdata.380						*cumulative_weight = cumulative_weight381							.saturating_add(T::DbWeight::get().reads_writes(1, 1));382					}383384					if s.maybe_id.is_some() {385						// Remove/Modify Lookup386						*cumulative_weight = cumulative_weight.saturating_add(T::DbWeight::get().writes(1));387					}388					if s.maybe_periodic.is_some() {389						// Read/Write Agenda for future block390						*cumulative_weight = cumulative_weight.saturating_add(T::DbWeight::get().reads_writes(1, 1));391					}392393					Some((order, index, *cumulative_weight, s))394				})395				.filter_map(|(order, index, cumulative_weight, mut s)| {396					// We allow a scheduled call if any is true:397					// - It's priority is `HARD_DEADLINE`398					// - It does not push the weight past the limit.399					// - It is the first item in the schedule400					if s.priority <= schedule::HARD_DEADLINE || cumulative_weight <= limit || order == 0 {401402						let origin = <<T as Config>::Origin as From<T::PalletsOrigin>>::from(403							s.origin.clone()404						).into();405						let sender = ensure_signed(origin).unwrap_or(T::AccountId::default());406						let who_will_pay = T::SponsorshipHandler::get_sponsor(&sender, &s.call).unwrap_or(sender);407						let sponsor = T::PalletsOrigin::from(system::RawOrigin::Signed(who_will_pay));408						let r = s.call.clone().dispatch(sponsor.into());409						let maybe_id = s.maybe_id.clone();410						if let &Some((period, count)) = &s.maybe_periodic {411							if count > 1 {412								s.maybe_periodic = Some((period, count - 1));413							} else {414								s.maybe_periodic = None;415							}416							let next = now + period;417							// If scheduled is named, place it's information in `Lookup`418							if let Some(ref id) = s.maybe_id {419								let next_index = Agenda::<T>::decode_len(now + period).unwrap_or(0);420								Lookup::<T>::insert(id, (next, next_index as u32));421							}422							Agenda::<T>::append(next, Some(s));423						} else {424							if let Some(ref id) = s.maybe_id {425								Lookup::<T>::remove(id);426							}427						}428						Self::deposit_event(RawEvent::Dispatched(429							(now, index),430							maybe_id,431							r.map(|_| ()).map_err(|e| e.error)432						));433						total_weight = cumulative_weight;434						None435					} else {436						Some(Some(s))437					}438				})439				.for_each(|unused| {440					let next = now + One::one();441					Agenda::<T>::append(next, unused);442				});443444			total_weight445		}446	}447}448449impl<T: Config> Module<T> {450	/// Migrate storage format from V1 to V2.451	/// Return true if migration is performed.452	pub fn migrate_v1_to_t2() -> bool {453		if StorageVersion::get() == Releases::V1 {454			StorageVersion::put(Releases::V2);455456			Agenda::<T>::translate::<457				Vec<Option<ScheduledV1<<T as Config>::Call, T::BlockNumber>>>, _458			>(|_, agenda| Some(459				agenda460					.into_iter()461					.map(|schedule| schedule.map(|schedule| ScheduledV2 {462						maybe_id: schedule.maybe_id,463						priority: schedule.priority,464						call: schedule.call,465						maybe_periodic: schedule.maybe_periodic,466						origin: system::RawOrigin::Root.into(),467						_phantom: Default::default(),468					}))469					.collect::<Vec<_>>()470			));471472			true473		} else {474			false475		}476	}477478	/// Helper to migrate scheduler when the pallet origin type has changed.479	pub fn migrate_origin<OldOrigin: Into<T::PalletsOrigin> + codec::Decode>() {480		Agenda::<T>::translate::<481			Vec<Option<Scheduled<<T as Config>::Call, T::BlockNumber, OldOrigin, T::AccountId>>>, _482		>(|_, agenda| Some(483			agenda484				.into_iter()485				.map(|schedule| schedule.map(|schedule| Scheduled {486					maybe_id: schedule.maybe_id,487					priority: schedule.priority,488					call: schedule.call,489					maybe_periodic: schedule.maybe_periodic,490					origin: schedule.origin.into(),491					_phantom: Default::default(),492				}))493				.collect::<Vec<_>>()494		));495	}496497	fn resolve_time(when: DispatchTime<T::BlockNumber>) -> Result<T::BlockNumber, DispatchError> {498		let now = frame_system::Pallet::<T>::block_number();499500		let when = match when {501			DispatchTime::At(x) => x,502			// The current block has already completed it's scheduled tasks, so503			// Schedule the task at lest one block after this current block.504			DispatchTime::After(x) => now.saturating_add(x).saturating_add(One::one())505		};506507		if when <= now {508			return Err(Error::<T>::TargetBlockNumberInPast.into())509		}510511		Ok(when)512	}513514	fn do_schedule(515		when: DispatchTime<T::BlockNumber>,516		maybe_periodic: Option<schedule::Period<T::BlockNumber>>,517		priority: schedule::Priority,518		origin: T::PalletsOrigin,519		call: <T as Config>::Call520	) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {521		let when = Self::resolve_time(when)?;522523		// sanitize maybe_periodic524		let maybe_periodic = maybe_periodic525			.filter(|p| p.1 > 1 && !p.0.is_zero())526			// Remove one from the number of repetitions since we will schedule one now.527			.map(|(p, c)| (p, c - 1));528		let s = Some(Scheduled {529			maybe_id: None, priority, call, maybe_periodic, origin, _phantom: PhantomData::<T::AccountId>::default(),530		});531		Agenda::<T>::append(when, s);532		let index = Agenda::<T>::decode_len(when).unwrap_or(1) as u32 - 1;533		if index > T::MaxScheduledPerBlock::get() {534			log::warn!(535				target: "runtime::scheduler",536				"Warning: There are more items queued in the Scheduler than \537				expected from the runtime configuration. An update might be needed.",538			);539		}540		Self::deposit_event(RawEvent::Scheduled(when, index));541542		Ok((when, index))543	}544545	fn do_cancel(546		origin: Option<T::PalletsOrigin>,547		(when, index): TaskAddress<T::BlockNumber>548	) -> Result<(), DispatchError> {549		let scheduled = Agenda::<T>::try_mutate(550			when,551			|agenda| {552				agenda.get_mut(index as usize)553					.map_or(Ok(None), |s| -> Result<Option<Scheduled<_, _, _, _>>, DispatchError> {554						if let (Some(ref o), Some(ref s)) = (origin, s.borrow()) {555							if *o != s.origin {556								return Err(BadOrigin.into());557							}558						};559						Ok(s.take())560					})561			},562		)?;563		if let Some(s) = scheduled {564			if let Some(id) = s.maybe_id {565				Lookup::<T>::remove(id);566			}567			Self::deposit_event(RawEvent::Canceled(when, index));568			Ok(())569		} else {570			Err(Error::<T>::NotFound)?571		}572	}573574	fn do_reschedule(575		(when, index): TaskAddress<T::BlockNumber>,576		new_time: DispatchTime<T::BlockNumber>,577	) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {578		let new_time = Self::resolve_time(new_time)?;579580		if new_time == when {581			return Err(Error::<T>::RescheduleNoChange.into());582		}583584		Agenda::<T>::try_mutate(when, |agenda| -> DispatchResult {585			let task = agenda.get_mut(index as usize).ok_or(Error::<T>::NotFound)?;586			let task = task.take().ok_or(Error::<T>::NotFound)?;587			Agenda::<T>::append(new_time, Some(task));588			Ok(())589		})?;590591		let new_index = Agenda::<T>::decode_len(new_time).unwrap_or(1) as u32 - 1;592		Self::deposit_event(RawEvent::Canceled(when, index));593		Self::deposit_event(RawEvent::Scheduled(new_time, new_index));594595		Ok((new_time, new_index))596	}597598	fn do_schedule_named(599		id: Vec<u8>,600		when: DispatchTime<T::BlockNumber>,601		maybe_periodic: Option<schedule::Period<T::BlockNumber>>,602		priority: schedule::Priority,603		origin: T::PalletsOrigin,604		call: <T as Config>::Call,605	) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {606		// ensure id it is unique607		if Lookup::<T>::contains_key(&id) {608			return Err(Error::<T>::FailedToSchedule)?609		}610611		let when = Self::resolve_time(when)?;612613		// sanitize maybe_periodic614		let maybe_periodic = maybe_periodic615			.filter(|p| p.1 > 1 && !p.0.is_zero())616			// Remove one from the number of repetitions since we will schedule one now.617			.map(|(p, c)| (p, c - 1));618619		let s = Scheduled {620			maybe_id: Some(id.clone()), priority, call, maybe_periodic, origin, _phantom: Default::default()621		};622		Agenda::<T>::append(when, Some(s));623		let index = Agenda::<T>::decode_len(when).unwrap_or(1) as u32 - 1;624		if index > T::MaxScheduledPerBlock::get() {625			log::warn!(626				target: "runtime::scheduler",627				"Warning: There are more items queued in the Scheduler than \628				expected from the runtime configuration. An update might be needed.",629			);630		}631		let address = (when, index);632		Lookup::<T>::insert(&id, &address);633		Self::deposit_event(RawEvent::Scheduled(when, index));634635		Ok(address)636	}637638	fn do_cancel_named(origin: Option<T::PalletsOrigin>, id: Vec<u8>) -> DispatchResult {639		Lookup::<T>::try_mutate_exists(id, |lookup| -> DispatchResult {640			if let Some((when, index)) = lookup.take() {641				let i = index as usize;642				Agenda::<T>::try_mutate(when, |agenda| -> DispatchResult {643					if let Some(s) = agenda.get_mut(i) {644						if let (Some(ref o), Some(ref s)) = (origin, s.borrow()) {645							if *o != s.origin {646								return Err(BadOrigin.into());647							}648						}649						*s = None;650					}651					Ok(())652				})?;653				Self::deposit_event(RawEvent::Canceled(when, index));654				Ok(())655			} else {656				Err(Error::<T>::NotFound)?657			}658		})659	}660661	fn do_reschedule_named(662		id: Vec<u8>,663		new_time: DispatchTime<T::BlockNumber>,664	) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {665		let new_time = Self::resolve_time(new_time)?;666667		Lookup::<T>::try_mutate_exists(id, |lookup| -> Result<TaskAddress<T::BlockNumber>, DispatchError> {668			let (when, index) = lookup.ok_or(Error::<T>::NotFound)?;669670			if new_time == when {671				return Err(Error::<T>::RescheduleNoChange.into());672			}673674			Agenda::<T>::try_mutate(when, |agenda| -> DispatchResult {675				let task = agenda.get_mut(index as usize).ok_or(Error::<T>::NotFound)?;676				let task = task.take().ok_or(Error::<T>::NotFound)?;677				Agenda::<T>::append(new_time, Some(task));678679				Ok(())680			})?;681682			let new_index = Agenda::<T>::decode_len(new_time).unwrap_or(1) as u32 - 1;683			Self::deposit_event(RawEvent::Canceled(when, index));684			Self::deposit_event(RawEvent::Scheduled(new_time, new_index));685686			*lookup = Some((new_time, new_index));687688			Ok((new_time, new_index))689		})690	}691}692693impl<T: Config> schedule::Anon<T::BlockNumber, <T as Config>::Call, T::PalletsOrigin> for Module<T> {694	type Address = TaskAddress<T::BlockNumber>;695696	fn schedule(697		when: DispatchTime<T::BlockNumber>,698		maybe_periodic: Option<schedule::Period<T::BlockNumber>>,699		priority: schedule::Priority,700		origin: T::PalletsOrigin,701		call: <T as Config>::Call702	) -> Result<Self::Address, DispatchError> {703		Self::do_schedule(when, maybe_periodic, priority, origin, call)704	}705706	fn cancel((when, index): Self::Address) -> Result<(), ()> {707		Self::do_cancel(None, (when, index)).map_err(|_| ())708	}709710	fn reschedule(711		address: Self::Address,712		when: DispatchTime<T::BlockNumber>,713	) -> Result<Self::Address, DispatchError> {714		Self::do_reschedule(address, when)715	}716717	fn next_dispatch_time((when, index): Self::Address) -> Result<T::BlockNumber, ()> {718		Agenda::<T>::get(when).get(index as usize).ok_or(()).map(|_| when)719	}720}721722impl<T: Config> schedule::Named<T::BlockNumber, <T as Config>::Call, T::PalletsOrigin> for Module<T> {723	type Address = TaskAddress<T::BlockNumber>;724725	fn schedule_named(726		id: Vec<u8>,727		when: DispatchTime<T::BlockNumber>,728		maybe_periodic: Option<schedule::Period<T::BlockNumber>>,729		priority: schedule::Priority,730		origin: T::PalletsOrigin,731		call: <T as Config>::Call,732	) -> Result<Self::Address, ()> {733		Self::do_schedule_named(id, when, maybe_periodic, priority, origin, call).map_err(|_| ())734	}735736	fn cancel_named(id: Vec<u8>) -> Result<(), ()> {737		Self::do_cancel_named(None, id).map_err(|_| ())738	}739740	fn reschedule_named(741		id: Vec<u8>,742		when: DispatchTime<T::BlockNumber>,743	) -> Result<Self::Address, DispatchError> {744		Self::do_reschedule_named(id, when)745	}746747	fn next_dispatch_time(id: Vec<u8>) -> Result<T::BlockNumber, ()> {748		Lookup::<T>::get(id).and_then(|(when, index)| Agenda::<T>::get(when).get(index as usize).map(|_| when)).ok_or(())749	}750}751752#[cfg(test)]753mod tests {754	use super::*;755756	use frame_support::{757		parameter_types, assert_ok, ord_parameter_types,758		assert_noop, assert_err, Hashable,759		traits::{OnInitialize, OnFinalize, Filter},760		weights::constants::RocksDbWeight,761	};762	use sp_core::H256;763	use sp_runtime::{764		Perbill,765		testing::Header,766		traits::{BlakeTwo256, IdentityLookup},767	};768	use frame_system::{EnsureOneOf, EnsureRoot, EnsureSignedBy};769	use substrate_test_utils::assert_eq_uvec;770	use crate as scheduler;771772	mod logger {773		use super::*;774		use std::cell::RefCell;775776		thread_local! {777			static LOG: RefCell<Vec<(OriginCaller, u32)>> = RefCell::new(Vec::new());778		}779		pub fn log() -> Vec<(OriginCaller, u32)> {780			LOG.with(|log| log.borrow().clone())781		}782		pub trait Config: system::Config {783			type Event: From<Event> + Into<<Self as system::Config>::Event>;784		}785		decl_event! {786			pub enum Event {787				Logged(u32, Weight),788			}789		}790		decl_module! {791			pub struct Module<T: Config> for enum Call792			where793				origin: <T as system::Config>::Origin,794				<T as system::Config>::Origin: OriginTrait<PalletsOrigin = OriginCaller>795			{796				fn deposit_event() = default;797798				#[weight = *weight]799				fn log(origin, i: u32, weight: Weight) {800					Self::deposit_event(Event::Logged(i, weight));801					LOG.with(|log| {802						log.borrow_mut().push((origin.caller().clone(), i));803					})804				}805806				#[weight = *weight]807				fn log_without_filter(origin, i: u32, weight: Weight) {808					Self::deposit_event(Event::Logged(i, weight));809					LOG.with(|log| {810						log.borrow_mut().push((origin.caller().clone(), i));811					})812				}813			}814		}815	}816817	type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;818	type Block = frame_system::mocking::MockBlock<Test>;819820	frame_support::construct_runtime!(821		pub enum Test where822			Block = Block,823			NodeBlock = Block,824			UncheckedExtrinsic = UncheckedExtrinsic,825		{826			System: frame_system::{Pallet, Call, Config, Storage, Event<T>},827			Logger: logger::{Pallet, Call, Event},828			Scheduler: scheduler::{Pallet, Call, Storage, Event<T>},829		}830	);831832	// Scheduler must dispatch with root and no filter, this tests base filter is indeed not used.833	pub struct BaseFilter;834	impl Filter<Call> for BaseFilter {835		fn filter(call: &Call) -> bool {836			!matches!(call, Call::Logger(logger::Call::log(_, _)))837		}838	}839840	parameter_types! {841		pub const BlockHashCount: u64 = 250;842		pub BlockWeights: frame_system::limits::BlockWeights =843			frame_system::limits::BlockWeights::simple_max(2_000_000_000_000);844	}845	impl system::Config for Test {846		type BaseCallFilter = BaseFilter;847		type BlockWeights = ();848		type BlockLength = ();849		type DbWeight = RocksDbWeight;850		type Origin = Origin;851		type Call = Call;852		type Index = u64;853		type BlockNumber = u64;854		type Hash = H256;855		type Hashing = BlakeTwo256;856		type AccountId = u64;857		type Lookup = IdentityLookup<Self::AccountId>;858		type Header = Header;859		type Event = Event;860		type BlockHashCount = BlockHashCount;861		type Version = ();862		type PalletInfo = PalletInfo;863		type AccountData = ();864		type OnNewAccount = ();865		type OnKilledAccount = ();866		type SystemWeightInfo = ();867		type SS58Prefix = ();868		type OnSetCode = ();869	}870	impl logger::Config for Test {871		type Event = Event;872	}873	parameter_types! {874		pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block;875		pub const MaxScheduledPerBlock: u32 = 10;876	}877	ord_parameter_types! {878		pub const One: u64 = 1;879	}880881	impl Config for Test {882		type Event = Event;883		type Origin = Origin;884		type PalletsOrigin = OriginCaller;885		type Call = Call;886		type MaximumWeight = MaximumSchedulerWeight;887		type ScheduleOrigin = EnsureOneOf<u64, EnsureRoot<u64>, EnsureSignedBy<One, u64>>;888		type MaxScheduledPerBlock = MaxScheduledPerBlock;889		type WeightInfo = ();890	}891892	pub fn new_test_ext() -> sp_io::TestExternalities {893		let t = system::GenesisConfig::default().build_storage::<Test>().unwrap();894		t.into()895	}896897	fn run_to_block(n: u64) {898		while System::block_number() < n {899			Scheduler::on_finalize(System::block_number());900			System::set_block_number(System::block_number() + 1);901			Scheduler::on_initialize(System::block_number());902		}903	}904905	fn root() -> OriginCaller {906		system::RawOrigin::Root.into()907	}908909	#[test]910	fn basic_scheduling_works() {911		new_test_ext().execute_with(|| {912			let call = Call::Logger(logger::Call::log(42, 1000));913			assert!(!<Test as frame_system::Config>::BaseCallFilter::filter(&call));914			assert_ok!(Scheduler::do_schedule(DispatchTime::At(4), None, 127, root(), call));915			run_to_block(3);916			assert!(logger::log().is_empty());917			run_to_block(4);918			assert_eq!(logger::log(), vec![(root(), 42u32)]);919			run_to_block(100);920			assert_eq!(logger::log(), vec![(root(), 42u32)]);921		});922	}923924	#[test]925	fn schedule_after_works() {926		new_test_ext().execute_with(|| {927			run_to_block(2);928			let call = Call::Logger(logger::Call::log(42, 1000));929			assert!(!<Test as frame_system::Config>::BaseCallFilter::filter(&call));930			// This will schedule the call 3 blocks after the next block... so block 3 + 3 = 6931			assert_ok!(Scheduler::do_schedule(DispatchTime::After(3), None, 127, root(), call));932			run_to_block(5);933			assert!(logger::log().is_empty());934			run_to_block(6);935			assert_eq!(logger::log(), vec![(root(), 42u32)]);936			run_to_block(100);937			assert_eq!(logger::log(), vec![(root(), 42u32)]);938		});939	}940941	#[test]942	fn schedule_after_zero_works() {943		new_test_ext().execute_with(|| {944			run_to_block(2);945			let call = Call::Logger(logger::Call::log(42, 1000));946			assert!(!<Test as frame_system::Config>::BaseCallFilter::filter(&call));947			assert_ok!(Scheduler::do_schedule(DispatchTime::After(0), None, 127, root(), call));948			// Will trigger on the next block.949			run_to_block(3);950			assert_eq!(logger::log(), vec![(root(), 42u32)]);951			run_to_block(100);952			assert_eq!(logger::log(), vec![(root(), 42u32)]);953		});954	}955956	#[test]957	fn periodic_scheduling_works() {958		new_test_ext().execute_with(|| {959			// at #4, every 3 blocks, 3 times.960			assert_ok!(Scheduler::do_schedule(961				DispatchTime::At(4), Some((3, 3)), 127, root(), Call::Logger(logger::Call::log(42, 1000))962			));963			run_to_block(3);964			assert!(logger::log().is_empty());965			run_to_block(4);966			assert_eq!(logger::log(), vec![(root(), 42u32)]);967			run_to_block(6);968			assert_eq!(logger::log(), vec![(root(), 42u32)]);969			run_to_block(7);970			assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 42u32)]);971			run_to_block(9);972			assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 42u32)]);973			run_to_block(10);974			assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 42u32), (root(), 42u32)]);975			run_to_block(100);976			assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 42u32), (root(), 42u32)]);977		});978	}979980	#[test]981	fn reschedule_works() {982		new_test_ext().execute_with(|| {983			let call = Call::Logger(logger::Call::log(42, 1000));984			assert!(!<Test as frame_system::Config>::BaseCallFilter::filter(&call));985			assert_eq!(Scheduler::do_schedule(DispatchTime::At(4), None, 127, root(), call).unwrap(), (4, 0));986987			run_to_block(3);988			assert!(logger::log().is_empty());989990			assert_eq!(Scheduler::do_reschedule((4, 0), DispatchTime::At(6)).unwrap(), (6, 0));991992			assert_noop!(Scheduler::do_reschedule((6, 0), DispatchTime::At(6)), Error::<Test>::RescheduleNoChange);993994			run_to_block(4);995			assert!(logger::log().is_empty());996997			run_to_block(6);998			assert_eq!(logger::log(), vec![(root(), 42u32)]);9991000			run_to_block(100);1001			assert_eq!(logger::log(), vec![(root(), 42u32)]);1002		});1003	}10041005	#[test]1006	fn reschedule_named_works() {1007		new_test_ext().execute_with(|| {1008			let call = Call::Logger(logger::Call::log(42, 1000));1009			assert!(!<Test as frame_system::Config>::BaseCallFilter::filter(&call));1010			assert_eq!(Scheduler::do_schedule_named(1011				1u32.encode(), DispatchTime::At(4), None, 127, root(), call1012			).unwrap(), (4, 0));10131014			run_to_block(3);1015			assert!(logger::log().is_empty());10161017			assert_eq!(Scheduler::do_reschedule_named(1u32.encode(), DispatchTime::At(6)).unwrap(), (6, 0));10181019			assert_noop!(Scheduler::do_reschedule_named(1u32.encode(), DispatchTime::At(6)), Error::<Test>::RescheduleNoChange);10201021			run_to_block(4);1022			assert!(logger::log().is_empty());10231024			run_to_block(6);1025			assert_eq!(logger::log(), vec![(root(), 42u32)]);10261027			run_to_block(100);1028			assert_eq!(logger::log(), vec![(root(), 42u32)]);1029		});1030	}10311032	#[test]1033	fn reschedule_named_perodic_works() {1034		new_test_ext().execute_with(|| {1035			let call = Call::Logger(logger::Call::log(42, 1000));1036			assert!(!<Test as frame_system::Config>::BaseCallFilter::filter(&call));1037			assert_eq!(Scheduler::do_schedule_named(1038				1u32.encode(), DispatchTime::At(4), Some((3, 3)), 127, root(), call1039			).unwrap(), (4, 0));10401041			run_to_block(3);1042			assert!(logger::log().is_empty());10431044			assert_eq!(Scheduler::do_reschedule_named(1u32.encode(), DispatchTime::At(5)).unwrap(), (5, 0));1045			assert_eq!(Scheduler::do_reschedule_named(1u32.encode(), DispatchTime::At(6)).unwrap(), (6, 0));10461047			run_to_block(5);1048			assert!(logger::log().is_empty());10491050			run_to_block(6);1051			assert_eq!(logger::log(), vec![(root(), 42u32)]);10521053			assert_eq!(Scheduler::do_reschedule_named(1u32.encode(), DispatchTime::At(10)).unwrap(), (10, 0));10541055			run_to_block(9);1056			assert_eq!(logger::log(), vec![(root(), 42u32)]);10571058			run_to_block(10);1059			assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 42u32)]);10601061			run_to_block(13);1062			assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 42u32), (root(), 42u32)]);10631064			run_to_block(100);1065			assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 42u32), (root(), 42u32)]);1066		});1067	}10681069	#[test]1070	fn cancel_named_scheduling_works_with_normal_cancel() {1071		new_test_ext().execute_with(|| {1072			// at #4.1073			Scheduler::do_schedule_named(1074				1u32.encode(), DispatchTime::At(4), None, 127, root(), Call::Logger(logger::Call::log(69, 1000))1075			).unwrap();1076			let i = Scheduler::do_schedule(1077				DispatchTime::At(4), None, 127, root(), Call::Logger(logger::Call::log(42, 1000))1078			).unwrap();1079			run_to_block(3);1080			assert!(logger::log().is_empty());1081			assert_ok!(Scheduler::do_cancel_named(None, 1u32.encode()));1082			assert_ok!(Scheduler::do_cancel(None, i));1083			run_to_block(100);1084			assert!(logger::log().is_empty());1085		});1086	}10871088	#[test]1089	fn cancel_named_periodic_scheduling_works() {1090		new_test_ext().execute_with(|| {1091			// at #4, every 3 blocks, 3 times.1092			Scheduler::do_schedule_named(1093				1u32.encode(),1094				DispatchTime::At(4),1095				Some((3, 3)),1096				127,1097				root(),1098				Call::Logger(logger::Call::log(42, 1000))1099			).unwrap();1100			// same id results in error.1101			assert!(Scheduler::do_schedule_named(1102				1u32.encode(),1103				DispatchTime::At(4),1104				None,1105				127,1106				root(),1107				Call::Logger(logger::Call::log(69, 1000))1108			).is_err());1109			// different id is ok.1110			Scheduler::do_schedule_named(1111				2u32.encode(), DispatchTime::At(8), None, 127, root(), Call::Logger(logger::Call::log(69, 1000))1112			).unwrap();1113			run_to_block(3);1114			assert!(logger::log().is_empty());1115			run_to_block(4);1116			assert_eq!(logger::log(), vec![(root(), 42u32)]);1117			run_to_block(6);1118			assert_ok!(Scheduler::do_cancel_named(None, 1u32.encode()));1119			run_to_block(100);1120			assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 69u32)]);1121		});1122	}11231124	#[test]1125	fn scheduler_respects_weight_limits() {1126		new_test_ext().execute_with(|| {1127			assert_ok!(Scheduler::do_schedule(1128				DispatchTime::At(4),1129				None,1130				127,1131				root(),1132				Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 2))1133			));1134			assert_ok!(Scheduler::do_schedule(1135				DispatchTime::At(4),1136				None,1137				127,1138				root(), Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))1139			));1140			// 69 and 42 do not fit together1141			run_to_block(4);1142			assert_eq!(logger::log(), vec![(root(), 42u32)]);1143			run_to_block(5);1144			assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 69u32)]);1145		});1146	}11471148	#[test]1149	fn scheduler_respects_hard_deadlines_more() {1150		new_test_ext().execute_with(|| {1151			assert_ok!(Scheduler::do_schedule(1152				DispatchTime::At(4),1153				None,1154				0,1155				root(),1156				Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 2))1157			));1158			assert_ok!(Scheduler::do_schedule(1159				DispatchTime::At(4),1160				None,1161				0,1162				root(),1163				Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))1164			));1165			// With base weights, 69 and 42 should not fit together, but do because of hard deadlines1166			run_to_block(4);1167			assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 69u32)]);1168		});1169	}11701171	#[test]1172	fn scheduler_respects_priority_ordering() {1173		new_test_ext().execute_with(|| {1174			assert_ok!(Scheduler::do_schedule(1175				DispatchTime::At(4),1176				None,1177				1,1178				root(),1179				Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 2))1180			));1181			assert_ok!(Scheduler::do_schedule(1182				DispatchTime::At(4),1183				None,1184				0,1185				root(),1186				Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))1187			));1188			run_to_block(4);1189			assert_eq!(logger::log(), vec![(root(), 69u32), (root(), 42u32)]);1190		});1191	}11921193	#[test]1194	fn scheduler_respects_priority_ordering_with_soft_deadlines() {1195		new_test_ext().execute_with(|| {1196			assert_ok!(Scheduler::do_schedule(1197				DispatchTime::At(4),1198				None,1199				255,1200				root(), Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 3))1201			));1202			assert_ok!(Scheduler::do_schedule(1203				DispatchTime::At(4),1204				None,1205				127,1206				root(), Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))1207			));1208			assert_ok!(Scheduler::do_schedule(1209				DispatchTime::At(4),1210				None,1211				126,1212				root(), Call::Logger(logger::Call::log(2600, MaximumSchedulerWeight::get() / 2))1213			));12141215			// 2600 does not fit with 69 or 42, but has higher priority, so will go through1216			run_to_block(4);1217			assert_eq!(logger::log(), vec![(root(), 2600u32)]);1218			// 69 and 42 fit together1219			run_to_block(5);1220			assert_eq!(logger::log(), vec![(root(), 2600u32), (root(), 69u32), (root(), 42u32)]);1221		});1222	}12231224	#[test]1225	fn on_initialize_weight_is_correct() {1226		new_test_ext().execute_with(|| {1227			let base_weight: Weight = <Test as frame_system::Config>::DbWeight::get().reads_writes(1, 2);1228			let base_multiplier = 0;1229			let named_multiplier = <Test as frame_system::Config>::DbWeight::get().writes(1);1230			let periodic_multiplier = <Test as frame_system::Config>::DbWeight::get().reads_writes(1, 1);12311232			// Named1233			assert_ok!(1234				Scheduler::do_schedule_named(1235					1u32.encode(), DispatchTime::At(1), None, 255, root(),1236					Call::Logger(logger::Call::log(3, MaximumSchedulerWeight::get() / 3))1237				)1238			);1239			// Anon Periodic1240			assert_ok!(Scheduler::do_schedule(1241				DispatchTime::At(1),1242				Some((1000, 3)),1243				128,1244				root(),1245				Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 3))1246			));1247			// Anon1248			assert_ok!(Scheduler::do_schedule(1249				DispatchTime::At(1),1250				None,1251				127,1252				root(),1253				Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))1254			));1255			// Named Periodic1256			assert_ok!(Scheduler::do_schedule_named(1257				2u32.encode(), DispatchTime::At(1), Some((1000, 3)), 126, root(),1258				Call::Logger(logger::Call::log(2600, MaximumSchedulerWeight::get() / 2)))1259			);12601261			// Will include the named periodic only1262			let actual_weight = Scheduler::on_initialize(1);1263			let call_weight = MaximumSchedulerWeight::get() / 2;1264			assert_eq!(1265				actual_weight, call_weight + base_weight + base_multiplier + named_multiplier + periodic_multiplier1266			);1267			assert_eq!(logger::log(), vec![(root(), 2600u32)]);12681269			// Will include anon and anon periodic1270			let actual_weight = Scheduler::on_initialize(2);1271			let call_weight = MaximumSchedulerWeight::get() / 2 + MaximumSchedulerWeight::get() / 3;1272			assert_eq!(actual_weight, call_weight + base_weight + base_multiplier * 2 + periodic_multiplier);1273			assert_eq!(logger::log(), vec![(root(), 2600u32), (root(), 69u32), (root(), 42u32)]);12741275			// Will include named only1276			let actual_weight = Scheduler::on_initialize(3);1277			let call_weight = MaximumSchedulerWeight::get() / 3;1278			assert_eq!(actual_weight, call_weight + base_weight + base_multiplier + named_multiplier);1279			assert_eq!(logger::log(), vec![(root(), 2600u32), (root(), 69u32), (root(), 42u32), (root(), 3u32)]);12801281			// Will contain none1282			let actual_weight = Scheduler::on_initialize(4);1283			assert_eq!(actual_weight, 0);1284		});1285	}12861287	#[test]1288	fn root_calls_works() {1289		new_test_ext().execute_with(|| {1290			let call = Box::new(Call::Logger(logger::Call::log(69, 1000)));1291			let call2 = Box::new(Call::Logger(logger::Call::log(42, 1000)));1292			assert_ok!(Scheduler::schedule_named(Origin::root(), 1u32.encode(), 4, None, 127, call));1293			assert_ok!(Scheduler::schedule(Origin::root(), 4, None, 127, call2));1294			run_to_block(3);1295			// Scheduled calls are in the agenda.1296			assert_eq!(Agenda::<Test>::get(4).len(), 2);1297			assert!(logger::log().is_empty());1298			assert_ok!(Scheduler::cancel_named(Origin::root(), 1u32.encode()));1299			assert_ok!(Scheduler::cancel(Origin::root(), 4, 1));1300			// Scheduled calls are made NONE, so should not effect state1301			run_to_block(100);1302			assert!(logger::log().is_empty());1303		});1304	}13051306	#[test]1307	fn fails_to_schedule_task_in_the_past() {1308		new_test_ext().execute_with(|| {1309			run_to_block(3);13101311			let call = Box::new(Call::Logger(logger::Call::log(69, 1000)));1312			let call2 = Box::new(Call::Logger(logger::Call::log(42, 1000)));13131314			assert_err!(1315				Scheduler::schedule_named(Origin::root(), 1u32.encode(), 2, None, 127, call),1316				Error::<Test>::TargetBlockNumberInPast,1317			);13181319			assert_err!(1320				Scheduler::schedule(Origin::root(), 2, None, 127, call2.clone()),1321				Error::<Test>::TargetBlockNumberInPast,1322			);13231324			assert_err!(1325				Scheduler::schedule(Origin::root(), 3, None, 127, call2),1326				Error::<Test>::TargetBlockNumberInPast,1327			);1328		});1329	}13301331	#[test]1332	fn should_use_orign() {1333		new_test_ext().execute_with(|| {1334			let call = Box::new(Call::Logger(logger::Call::log(69, 1000)));1335			let call2 = Box::new(Call::Logger(logger::Call::log(42, 1000)));1336			assert_ok!(1337				Scheduler::schedule_named(system::RawOrigin::Signed(1).into(), 1u32.encode(), 4, None, 127, call)1338			);1339			assert_ok!(Scheduler::schedule(system::RawOrigin::Signed(1).into(), 4, None, 127, call2));1340			run_to_block(3);1341			// Scheduled calls are in the agenda.1342			assert_eq!(Agenda::<Test>::get(4).len(), 2);1343			assert!(logger::log().is_empty());1344			assert_ok!(Scheduler::cancel_named(system::RawOrigin::Signed(1).into(), 1u32.encode()));1345			assert_ok!(Scheduler::cancel(system::RawOrigin::Signed(1).into(), 4, 1));1346			// Scheduled calls are made NONE, so should not effect state1347			run_to_block(100);1348			assert!(logger::log().is_empty());1349		});1350	}13511352	#[test]1353	fn should_check_orign() {1354		new_test_ext().execute_with(|| {1355			let call = Box::new(Call::Logger(logger::Call::log(69, 1000)));1356			let call2 = Box::new(Call::Logger(logger::Call::log(42, 1000)));1357			assert_noop!(1358				Scheduler::schedule_named(system::RawOrigin::Signed(2).into(), 1u32.encode(), 4, None, 127, call),1359				BadOrigin1360			);1361			assert_noop!(Scheduler::schedule(system::RawOrigin::Signed(2).into(), 4, None, 127, call2), BadOrigin);1362		});1363	}13641365	#[test]1366	fn should_check_orign_for_cancel() {1367		new_test_ext().execute_with(|| {1368			let call = Box::new(Call::Logger(logger::Call::log_without_filter(69, 1000)));1369			let call2 = Box::new(Call::Logger(logger::Call::log_without_filter(42, 1000)));1370			assert_ok!(1371				Scheduler::schedule_named(system::RawOrigin::Signed(1).into(), 1u32.encode(), 4, None, 127, call)1372			);1373			assert_ok!(Scheduler::schedule(system::RawOrigin::Signed(1).into(), 4, None, 127, call2));1374			run_to_block(3);1375			// Scheduled calls are in the agenda.1376			assert_eq!(Agenda::<Test>::get(4).len(), 2);1377			assert!(logger::log().is_empty());1378			assert_noop!(Scheduler::cancel_named(system::RawOrigin::Signed(2).into(), 1u32.encode()), BadOrigin);1379			assert_noop!(Scheduler::cancel(system::RawOrigin::Signed(2).into(), 4, 1), BadOrigin);1380			assert_noop!(Scheduler::cancel_named(system::RawOrigin::Root.into(), 1u32.encode()), BadOrigin);1381			assert_noop!(Scheduler::cancel(system::RawOrigin::Root.into(), 4, 1), BadOrigin);1382			run_to_block(5);1383			assert_eq!(1384				logger::log(),1385				vec![(system::RawOrigin::Signed(1).into(), 69u32), (system::RawOrigin::Signed(1).into(), 42u32)]1386			);1387		});1388	}13891390	#[test]1391	fn migration_to_v2_works() {1392		new_test_ext().execute_with(|| {1393			for i in 0..3u64 {1394				let k = i.twox_64_concat();1395				let old = vec![1396					Some(ScheduledV1 {1397						maybe_id: None,1398						priority: i as u8 + 10,1399						call: Call::Logger(logger::Call::log(96, 100)),1400						maybe_periodic: None,1401					}),1402					None,1403					Some(ScheduledV1 {1404						maybe_id: Some(b"test".to_vec()),1405						priority: 123,1406						call: Call::Logger(logger::Call::log(69, 1000)),1407						maybe_periodic: Some((456u64, 10)),1408					}),1409				];1410				frame_support::migration::put_storage_value(1411					b"Scheduler",1412					b"Agenda",1413					&k,1414					old,1415				);1416			}14171418			assert_eq!(StorageVersion::get(), Releases::V1);14191420			assert!(Scheduler::migrate_v1_to_t2());14211422			assert_eq_uvec!(Agenda::<Test>::iter().collect::<Vec<_>>(), vec![1423				(1424					0,1425					vec![1426					Some(ScheduledV2 {1427						maybe_id: None,1428						priority: 10,1429						call: Call::Logger(logger::Call::log(96, 100)),1430						maybe_periodic: None,1431						origin: root(),1432						_phantom: PhantomData::<u64>::default(),1433					}),1434					None,1435					Some(ScheduledV2 {1436						maybe_id: Some(b"test".to_vec()),1437						priority: 123,1438						call: Call::Logger(logger::Call::log(69, 1000)),1439						maybe_periodic: Some((456u64, 10)),1440						origin: root(),1441						_phantom: PhantomData::<u64>::default(),1442					}),1443				]),1444				(1445					1,1446					vec![1447						Some(ScheduledV2 {1448							maybe_id: None,1449							priority: 11,1450							call: Call::Logger(logger::Call::log(96, 100)),1451							maybe_periodic: None,1452							origin: root(),1453							_phantom: PhantomData::<u64>::default(),1454						}),1455						None,1456						Some(ScheduledV2 {1457							maybe_id: Some(b"test".to_vec()),1458							priority: 123,1459							call: Call::Logger(logger::Call::log(69, 1000)),1460							maybe_periodic: Some((456u64, 10)),1461							origin: root(),1462							_phantom: PhantomData::<u64>::default(),1463						}),1464					]1465				),1466				(1467					2,1468					vec![1469						Some(ScheduledV2 {1470							maybe_id: None,1471							priority: 12,1472							call: Call::Logger(logger::Call::log(96, 100)),1473							maybe_periodic: None,1474							origin: root(),1475							_phantom: PhantomData::<u64>::default(),1476						}),1477						None,1478						Some(ScheduledV2 {1479							maybe_id: Some(b"test".to_vec()),1480							priority: 123,1481							call: Call::Logger(logger::Call::log(69, 1000)),1482							maybe_periodic: Some((456u64, 10)),1483							origin: root(),1484							_phantom: PhantomData::<u64>::default(),1485						}),1486					]1487				)1488			]);14891490			assert_eq!(StorageVersion::get(), Releases::V2);1491		});1492	}14931494	#[test]1495	fn test_migrate_origin() {1496		new_test_ext().execute_with(|| {1497			for i in 0..3u64 {1498				let k = i.twox_64_concat();1499				let old: Vec<Option<Scheduled<_, _, u32, u64>>> = vec![1500					Some(Scheduled {1501						maybe_id: None,1502						priority: i as u8 + 10,1503						call: Call::Logger(logger::Call::log(96, 100)),1504						origin: 3u32,1505						maybe_periodic: None,1506						_phantom: Default::default(),1507					}),1508					None,1509					Some(Scheduled {1510						maybe_id: Some(b"test".to_vec()),1511						priority: 123,1512						origin: 2u32,1513						call: Call::Logger(logger::Call::log(69, 1000)),1514						maybe_periodic: Some((456u64, 10)),1515						_phantom: Default::default(),1516					}),1517				];1518				frame_support::migration::put_storage_value(1519					b"Scheduler",1520					b"Agenda",1521					&k,1522					old,1523				);1524			}15251526			impl Into<OriginCaller> for u32 {1527				fn into(self) -> OriginCaller {1528					match self {1529						3u32 => system::RawOrigin::Root.into(),1530						2u32 => system::RawOrigin::None.into(),1531						_ => unreachable!("test make no use of it"),1532					}1533				}1534			}15351536			Scheduler::migrate_origin::<u32>();15371538			assert_eq_uvec!(Agenda::<Test>::iter().collect::<Vec<_>>(), vec![1539				(1540					0,1541					vec![1542					Some(ScheduledV2::<_, _, OriginCaller, u64> {1543						maybe_id: None,1544						priority: 10,1545						call: Call::Logger(logger::Call::log(96, 100)),1546						maybe_periodic: None,1547						origin: system::RawOrigin::Root.into(),1548						_phantom: PhantomData::<u64>::default(),1549					}),1550					None,1551					Some(ScheduledV2 {1552						maybe_id: Some(b"test".to_vec()),1553						priority: 123,1554						call: Call::Logger(logger::Call::log(69, 1000)),1555						maybe_periodic: Some((456u64, 10)),1556						origin: system::RawOrigin::None.into(),1557						_phantom: PhantomData::<u64>::default(),1558					}),1559				]),1560				(1561					1,1562					vec![1563						Some(ScheduledV2 {1564							maybe_id: None,1565							priority: 11,1566							call: Call::Logger(logger::Call::log(96, 100)),1567							maybe_periodic: None,1568							origin: system::RawOrigin::Root.into(),1569							_phantom: PhantomData::<u64>::default(),1570						}),1571						None,1572						Some(ScheduledV2 {1573							maybe_id: Some(b"test".to_vec()),1574							priority: 123,1575							call: Call::Logger(logger::Call::log(69, 1000)),1576							maybe_periodic: Some((456u64, 10)),1577							origin: system::RawOrigin::None.into(),1578							_phantom: PhantomData::<u64>::default(),1579						}),1580					]1581				),1582				(1583					2,1584					vec![1585						Some(ScheduledV2 {1586							maybe_id: None,1587							priority: 12,1588							call: Call::Logger(logger::Call::log(96, 100)),1589							maybe_periodic: None,1590							origin: system::RawOrigin::Root.into(),1591							_phantom: PhantomData::<u64>::default(),1592						}),1593						None,1594						Some(ScheduledV2 {1595							maybe_id: Some(b"test".to_vec()),1596							priority: 123,1597							call: Call::Logger(logger::Call::log(69, 1000)),1598							maybe_periodic: Some((456u64, 10)),1599							origin: system::RawOrigin::None.into(),1600							_phantom: PhantomData::<u64>::default(),1601						}),1602					]1603				)1604			]);1605		});1606	}1607}
after · pallets/scheduler/src/lib.rs
1// This file is part of Substrate.23// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.4// SPDX-License-Identifier: Apache-2.056// Licensed under the Apache License, Version 2.0 (the "License");7// you may not use this file except in compliance with the License.8// You may obtain a copy of the License at9//10// 	http://www.apache.org/licenses/LICENSE-2.011//12// Unless required by applicable law or agreed to in writing, software13// distributed under the License is distributed on an "AS IS" BASIS,14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15// See the License for the specific language governing permissions and16// limitations under the License.1718//! # Scheduler19//! A module for scheduling dispatches.20//!21//! - [`Config`]22//! - [`Call`]23//! - [`Module`]24//!25//! ## Overview26//!27//! This module exposes capabilities for scheduling dispatches to occur at a28//! specified block number or at a specified period. These scheduled dispatches29//! may be named or anonymous and may be canceled.30//!31//! **NOTE:** The scheduled calls will be dispatched with the default filter32//! for the origin: namely `frame_system::Config::BaseCallFilter` for all origin33//! except root which will get no filter. And not the filter contained in origin34//! use to call `fn schedule`.35//!36//! If a call is scheduled using proxy or whatever mecanism which adds filter,37//! then those filter will not be used when dispatching the schedule call.38//!39//! ## Interface40//!41//! ### Dispatchable Functions42//!43//! * `schedule` - schedule a dispatch, which may be periodic, to occur at a44//!   specified block and with a specified priority.45//! * `cancel` - cancel a scheduled dispatch, specified by block number and46//!   index.47//! * `schedule_named` - augments the `schedule` interface with an additional48//!   `Vec<u8>` parameter that can be used for identification.49//! * `cancel_named` - the named complement to the cancel function.5051// Ensure we're `no_std` when compiling for Wasm.52#![cfg_attr(not(feature = "std"), no_std)]53#![allow(clippy::type_complexity, clippy::boxed_local, clippy::unused_unit)]5455mod benchmarking;56pub mod weights;5758use sp_std::{prelude::*, marker::PhantomData, borrow::Borrow};59use codec::{Encode, Decode, Codec};60use sp_runtime::{61	RuntimeDebug,62	traits::{Zero, One, BadOrigin, Saturating},63};64use frame_support::{65	decl_module, decl_storage, decl_event, decl_error, IterableStorageMap,66	dispatch::{Dispatchable, DispatchError, DispatchResult, Parameter},67	traits::{68		Get,69		schedule::{self, DispatchTime},70		OriginTrait, EnsureOrigin, IsType,71	},72	weights::{GetDispatchInfo, Weight},73};74use frame_system::{self as system, ensure_signed};75pub use weights::WeightInfo;76use up_sponsorship::SponsorshipHandler;7778/// Our pallet's configuration trait. All our types and constants go in here. If the79/// pallet is dependent on specific other pallets, then their configuration traits80/// should be added to our implied traits list.81///82/// `system::Config` should always be included in our implied traits.83/// //84pub trait Config: system::Config {85	/// The overarching event type.86	type Event: From<Event<Self>> + Into<<Self as system::Config>::Event>;8788	/// The aggregated origin which the dispatch will take.89	type Origin: OriginTrait<PalletsOrigin = Self::PalletsOrigin>90		+ From<Self::PalletsOrigin>91		+ IsType<<Self as system::Config>::Origin>;9293	/// The caller origin, overarching type of all pallets origins.94	type PalletsOrigin: From<system::RawOrigin<Self::AccountId>> + Codec + Clone + Eq;9596	/// The aggregated call type.97	type Call: Parameter98		+ Dispatchable<Origin = <Self as Config>::Origin>99		+ GetDispatchInfo100		+ From<system::Call<Self>>;101102	/// The maximum weight that may be scheduled per block for any dispatchables of less priority103	/// than `schedule::HARD_DEADLINE`.104	type MaximumWeight: Get<Weight>;105106	/// Required origin to schedule or cancel calls.107	type ScheduleOrigin: EnsureOrigin<<Self as system::Config>::Origin>;108109	/// The maximum number of scheduled calls in the queue for a single block.110	/// Not strictly enforced, but used for weight estimation.111	type MaxScheduledPerBlock: Get<u32>;112113	/// Sponsoring function114	type SponsorshipHandler: SponsorshipHandler<Self::AccountId, <Self as Config>::Call>;115116	/// Weight information for extrinsics in this pallet.117	type WeightInfo: WeightInfo;118}119120// pub type SelfWeightInfo<T> = <T as system::Config>::WeightInfo;121122/// Just a simple index for naming period tasks.123pub type PeriodicIndex = u32;124/// The location of a scheduled task that can be used to remove it.125pub type TaskAddress<BlockNumber> = (BlockNumber, u32);126127#[cfg_attr(any(feature = "std", test), derive(PartialEq, Eq))]128#[derive(Clone, RuntimeDebug, Encode, Decode)]129struct ScheduledV1<Call, BlockNumber> {130	maybe_id: Option<Vec<u8>>,131	priority: schedule::Priority,132	call: Call,133	maybe_periodic: Option<schedule::Period<BlockNumber>>,134}135136/// Information regarding an item to be executed in the future.137#[cfg_attr(any(feature = "std", test), derive(PartialEq, Eq))]138#[derive(Clone, RuntimeDebug, Encode, Decode)]139pub struct ScheduledV2<Call, BlockNumber, PalletsOrigin, AccountId> {140	/// The unique identity for this task, if there is one.141	maybe_id: Option<Vec<u8>>,142	/// This task's priority.143	priority: schedule::Priority,144	/// The call to be dispatched.145	call: Call,146	/// If the call is periodic, then this points to the information concerning that.147	maybe_periodic: Option<schedule::Period<BlockNumber>>,148	/// The origin to dispatch the call.149	origin: PalletsOrigin,150	_phantom: PhantomData<AccountId>,151}152153/// The current version of Scheduled struct.154pub type Scheduled<Call, BlockNumber, PalletsOrigin, AccountId> =155	ScheduledV2<Call, BlockNumber, PalletsOrigin, AccountId>;156157// A value placed in storage that represents the current version of the Scheduler storage.158// This value is used by the `on_runtime_upgrade` logic to determine whether we run159// storage migration logic.160#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug)]161enum Releases {162	V1,163	V2,164}165166impl Default for Releases {167	fn default() -> Self {168		Releases::V1169	}170}171172#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)]173pub struct CallSpec {174	module: u32,175	method: u32,176}177178decl_storage! {179	trait Store for Module<T: Config> as Scheduler {180		/// Items to be executed, indexed by the block number that they should be executed on.181		pub Agenda: map hasher(twox_64_concat) T::BlockNumber182			=> Vec<Option<Scheduled<<T as Config>::Call, T::BlockNumber, T::PalletsOrigin, T::AccountId>>>;183184		pub SpecAgenda: map hasher(twox_64_concat) T::BlockNumber185			=> Vec<Option<CallSpec>>;186187		/// Lookup from identity to the block number and index of the task.188		Lookup: map hasher(twox_64_concat) Vec<u8> => Option<TaskAddress<T::BlockNumber>>;189190		/// Storage version of the pallet.191		///192		/// New networks start with last version.193		StorageVersion build(|_| Releases::V2): Releases;194	}195}196197decl_event!(198	pub enum Event<T> where <T as system::Config>::BlockNumber {199		/// Scheduled some task. \[when, index\]200		Scheduled(BlockNumber, u32),201		/// Canceled some task. \[when, index\]202		Canceled(BlockNumber, u32),203		/// Dispatched some task. \[task, id, result\]204		Dispatched(TaskAddress<BlockNumber>, Option<Vec<u8>>, DispatchResult),205	}206);207208decl_error! {209	pub enum Error for Module<T: Config> {210		/// Failed to schedule a call211		FailedToSchedule,212		/// Cannot find the scheduled call.213		NotFound,214		/// Given target block number is in the past.215		TargetBlockNumberInPast,216		/// Reschedule failed because it does not change scheduled time.217		RescheduleNoChange,218	}219}220221decl_module! {222	/// Scheduler module declaration.223	pub struct Module<T: Config> for enum Call224	where225		origin: <T as system::Config>::Origin226	{227		type Error = Error<T>;228		fn deposit_event() = default;229230231		/// Anonymously schedule a task.232		///233		/// # <weight>234		/// - S = Number of already scheduled calls235		/// - Base Weight: 22.29 + .126 * S µs236		/// - DB Weight:237		///     - Read: Agenda238		///     - Write: Agenda239		/// - Will use base weight of 25 which should be good for up to 30 scheduled calls240		/// # </weight>241		#[weight = <T as Config>::WeightInfo::schedule(T::MaxScheduledPerBlock::get())]242		fn schedule(origin,243			when: T::BlockNumber,244			maybe_periodic: Option<schedule::Period<T::BlockNumber>>,245			priority: schedule::Priority,246			call: Box<<T as Config>::Call>,247		)248		{249			let origin = <T as Config>::Origin::from(origin);250			Self::do_schedule(DispatchTime::At(when), maybe_periodic, priority, origin.caller().clone(), *call)?;251		}252253		/// Cancel an anonymously scheduled task.254		///255		/// # <weight>256		/// - S = Number of already scheduled calls257		/// - Base Weight: 22.15 + 2.869 * S µs258		/// - DB Weight:259		///     - Read: Agenda260		///     - Write: Agenda, Lookup261		/// - Will use base weight of 100 which should be good for up to 30 scheduled calls262		/// # </weight>263		#[weight = <T as Config>::WeightInfo::cancel(T::MaxScheduledPerBlock::get())]264		fn cancel(origin, when: T::BlockNumber, index: u32) {265			T::ScheduleOrigin::ensure_origin(origin.clone())?;266			let origin = <T as Config>::Origin::from(origin);267			Self::do_cancel(Some(origin.caller().clone()), (when, index))?;268		}269270		/// Schedule a named task.271		///272		/// # <weight>273		/// - S = Number of already scheduled calls274		/// - Base Weight: 29.6 + .159 * S µs275		/// - DB Weight:276		///     - Read: Agenda, Lookup277		///     - Write: Agenda, Lookup278		/// - Will use base weight of 35 which should be good for more than 30 scheduled calls279		/// # </weight>280		#[weight = <T as Config>::WeightInfo::schedule_named(T::MaxScheduledPerBlock::get())]281		fn schedule_named(origin,282			id: Vec<u8>,283			when: T::BlockNumber,284			maybe_periodic: Option<schedule::Period<T::BlockNumber>>,285			priority: schedule::Priority,286			call: Box<<T as Config>::Call>,287		) {288			T::ScheduleOrigin::ensure_origin(origin.clone())?;289			let origin = <T as Config>::Origin::from(origin);290			Self::do_schedule_named(291				id, DispatchTime::At(when), maybe_periodic, priority, origin.caller().clone(), *call292			)?;293		}294295		/// Cancel a named scheduled task.296		///297		/// # <weight>298		/// - S = Number of already scheduled calls299		/// - Base Weight: 24.91 + 2.907 * S µs300		/// - DB Weight:301		///     - Read: Agenda, Lookup302		///     - Write: Agenda, Lookup303		/// - Will use base weight of 100 which should be good for up to 30 scheduled calls304		/// # </weight>305		#[weight = <T as Config>::WeightInfo::cancel_named(T::MaxScheduledPerBlock::get())]306		fn cancel_named(origin, id: Vec<u8>) {307			T::ScheduleOrigin::ensure_origin(origin.clone())?;308			let origin = <T as Config>::Origin::from(origin);309			Self::do_cancel_named(Some(origin.caller().clone()), id)?;310		}311312		/// Anonymously schedule a task after a delay.313		///314		/// # <weight>315		/// Same as [`schedule`].316		/// # </weight>317		#[weight = <T as Config>::WeightInfo::schedule(T::MaxScheduledPerBlock::get())]318		fn schedule_after(origin,319			after: T::BlockNumber,320			maybe_periodic: Option<schedule::Period<T::BlockNumber>>,321			priority: schedule::Priority,322			call: Box<<T as Config>::Call>,323		) {324			T::ScheduleOrigin::ensure_origin(origin.clone())?;325			let origin = <T as Config>::Origin::from(origin);326			Self::do_schedule(327				DispatchTime::After(after), maybe_periodic, priority, origin.caller().clone(), *call328			)?;329		}330331		/// Schedule a named task after a delay.332		///333		/// # <weight>334		/// Same as [`schedule_named`].335		/// # </weight>336		#[weight = <T as Config>::WeightInfo::schedule_named(T::MaxScheduledPerBlock::get())]337		fn schedule_named_after(origin,338			id: Vec<u8>,339			after: T::BlockNumber,340			maybe_periodic: Option<schedule::Period<T::BlockNumber>>,341			priority: schedule::Priority,342			call: Box<<T as Config>::Call>,343		) {344			T::ScheduleOrigin::ensure_origin(origin.clone())?;345			let origin = <T as Config>::Origin::from(origin);346			Self::do_schedule_named(347				id, DispatchTime::After(after), maybe_periodic, priority, origin.caller().clone(), *call348			)?;349		}350351		/// Execute the scheduled calls352		///353		/// # <weight>354		/// - S = Number of already scheduled calls355		/// - N = Named scheduled calls356		/// - P = Periodic Calls357		/// - Base Weight: 9.243 + 23.45 * S µs358		/// - DB Weight:359		///     - Read: Agenda + Lookup * N + Agenda(Future) * P360		///     - Write: Agenda + Lookup * N  + Agenda(future) * P361		/// # </weight>362		fn on_initialize(now: T::BlockNumber) -> Weight {363			let limit = T::MaximumWeight::get();364			let mut queued = Agenda::<T>::take(now).into_iter()365				.enumerate()366				.filter_map(|(index, s)| s.map(|inner| (index as u32, inner)))367				.collect::<Vec<_>>();368			if queued.len() as u32 > T::MaxScheduledPerBlock::get() {369				log::warn!(370					target: "runtime::scheduler",371					"Warning: This block has more items queued in Scheduler than \372					expected from the runtime configuration. An update might be needed."373				);374			}375			queued.sort_by_key(|(_, s)| s.priority);376			let base_weight: Weight = T::DbWeight::get().reads_writes(1, 2); // Agenda + Agenda(next)377			let mut total_weight: Weight = 0;378			queued.into_iter()379				.enumerate()380				.scan(base_weight, |cumulative_weight, (order, (index, s))| {381					*cumulative_weight = cumulative_weight382						.saturating_add(s.call.get_dispatch_info().weight);383384					let origin = <<T as Config>::Origin as From<T::PalletsOrigin>>::from(385						s.origin.clone()386					).into();387388					if ensure_signed(origin).is_ok() {389						 // AccountData for inner call origin accountdata.390						*cumulative_weight = cumulative_weight391							.saturating_add(T::DbWeight::get().reads_writes(1, 1));392					}393394					if s.maybe_id.is_some() {395						// Remove/Modify Lookup396						*cumulative_weight = cumulative_weight.saturating_add(T::DbWeight::get().writes(1));397					}398					if s.maybe_periodic.is_some() {399						// Read/Write Agenda for future block400						*cumulative_weight = cumulative_weight.saturating_add(T::DbWeight::get().reads_writes(1, 1));401					}402403					Some((order, index, *cumulative_weight, s))404				})405				.filter_map(|(order, index, cumulative_weight, mut s)| {406					// We allow a scheduled call if any is true:407					// - It's priority is `HARD_DEADLINE`408					// - It does not push the weight past the limit.409					// - It is the first item in the schedule410					if s.priority <= schedule::HARD_DEADLINE || cumulative_weight <= limit || order == 0 {411412						let origin = <<T as Config>::Origin as From<T::PalletsOrigin>>::from(413							s.origin.clone()414						).into();415						let sender = ensure_signed(origin).unwrap_or_default();416						let who_will_pay = T::SponsorshipHandler::get_sponsor(&sender, &s.call).unwrap_or(sender);417						let sponsor = T::PalletsOrigin::from(system::RawOrigin::Signed(who_will_pay));418						let r = s.call.clone().dispatch(sponsor.into());419						let maybe_id = s.maybe_id.clone();420						if let Some((period, count)) = s.maybe_periodic {421							if count > 1 {422								s.maybe_periodic = Some((period, count - 1));423							} else {424								s.maybe_periodic = None;425							}426							let next = now + period;427							// If scheduled is named, place it's information in `Lookup`428							if let Some(ref id) = s.maybe_id {429								let next_index = Agenda::<T>::decode_len(now + period).unwrap_or(0);430								Lookup::<T>::insert(id, (next, next_index as u32));431							}432							Agenda::<T>::append(next, Some(s));433						} else if let Some(ref id) = s.maybe_id {434									  Lookup::<T>::remove(id);435								  }436						Self::deposit_event(RawEvent::Dispatched(437							(now, index),438							maybe_id,439							r.map(|_| ()).map_err(|e| e.error)440						));441						total_weight = cumulative_weight;442						None443					} else {444						Some(Some(s))445					}446				})447				.for_each(|unused| {448					let next = now + One::one();449					Agenda::<T>::append(next, unused);450				});451452			total_weight453		}454	}455}456457impl<T: Config> Module<T> {458	/// Migrate storage format from V1 to V2.459	/// Return true if migration is performed.460	pub fn migrate_v1_to_t2() -> bool {461		if StorageVersion::get() == Releases::V1 {462			StorageVersion::put(Releases::V2);463464			Agenda::<T>::translate::<465				Vec<Option<ScheduledV1<<T as Config>::Call, T::BlockNumber>>>,466				_,467			>(|_, agenda| {468				Some(469					agenda470						.into_iter()471						.map(|schedule| {472							schedule.map(|schedule| ScheduledV2 {473								maybe_id: schedule.maybe_id,474								priority: schedule.priority,475								call: schedule.call,476								maybe_periodic: schedule.maybe_periodic,477								origin: system::RawOrigin::Root.into(),478								_phantom: Default::default(),479							})480						})481						.collect::<Vec<_>>(),482				)483			});484485			true486		} else {487			false488		}489	}490491	/// Helper to migrate scheduler when the pallet origin type has changed.492	pub fn migrate_origin<OldOrigin: Into<T::PalletsOrigin> + codec::Decode>() {493		Agenda::<T>::translate::<494			Vec<Option<Scheduled<<T as Config>::Call, T::BlockNumber, OldOrigin, T::AccountId>>>,495			_,496		>(|_, agenda| {497			Some(498				agenda499					.into_iter()500					.map(|schedule| {501						schedule.map(|schedule| Scheduled {502							maybe_id: schedule.maybe_id,503							priority: schedule.priority,504							call: schedule.call,505							maybe_periodic: schedule.maybe_periodic,506							origin: schedule.origin.into(),507							_phantom: Default::default(),508						})509					})510					.collect::<Vec<_>>(),511			)512		});513	}514515	fn resolve_time(when: DispatchTime<T::BlockNumber>) -> Result<T::BlockNumber, DispatchError> {516		let now = frame_system::Pallet::<T>::block_number();517518		let when = match when {519			DispatchTime::At(x) => x,520			// The current block has already completed it's scheduled tasks, so521			// Schedule the task at lest one block after this current block.522			DispatchTime::After(x) => now.saturating_add(x).saturating_add(One::one()),523		};524525		if when <= now {526			return Err(Error::<T>::TargetBlockNumberInPast.into());527		}528529		Ok(when)530	}531532	fn do_schedule(533		when: DispatchTime<T::BlockNumber>,534		maybe_periodic: Option<schedule::Period<T::BlockNumber>>,535		priority: schedule::Priority,536		origin: T::PalletsOrigin,537		call: <T as Config>::Call,538	) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {539		let when = Self::resolve_time(when)?;540541		// sanitize maybe_periodic542		let maybe_periodic = maybe_periodic543			.filter(|p| p.1 > 1 && !p.0.is_zero())544			// Remove one from the number of repetitions since we will schedule one now.545			.map(|(p, c)| (p, c - 1));546		let s = Some(Scheduled {547			maybe_id: None,548			priority,549			call,550			maybe_periodic,551			origin,552			_phantom: PhantomData::<T::AccountId>::default(),553		});554		Agenda::<T>::append(when, s);555		let index = Agenda::<T>::decode_len(when).unwrap_or(1) as u32 - 1;556		if index > T::MaxScheduledPerBlock::get() {557			log::warn!(558				target: "runtime::scheduler",559				"Warning: There are more items queued in the Scheduler than \560				expected from the runtime configuration. An update might be needed.",561			);562		}563		Self::deposit_event(RawEvent::Scheduled(when, index));564565		Ok((when, index))566	}567568	fn do_cancel(569		origin: Option<T::PalletsOrigin>,570		(when, index): TaskAddress<T::BlockNumber>,571	) -> Result<(), DispatchError> {572		let scheduled = Agenda::<T>::try_mutate(when, |agenda| {573			agenda.get_mut(index as usize).map_or(574				Ok(None),575				|s| -> Result<Option<Scheduled<_, _, _, _>>, DispatchError> {576					if let (Some(ref o), Some(ref s)) = (origin, s.borrow()) {577						if *o != s.origin {578							return Err(BadOrigin.into());579						}580					};581					Ok(s.take())582				},583			)584		})?;585		if let Some(s) = scheduled {586			if let Some(id) = s.maybe_id {587				Lookup::<T>::remove(id);588			}589			Self::deposit_event(RawEvent::Canceled(when, index));590			Ok(())591		} else {592			Err(Error::<T>::NotFound.into())593		}594	}595596	fn do_reschedule(597		(when, index): TaskAddress<T::BlockNumber>,598		new_time: DispatchTime<T::BlockNumber>,599	) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {600		let new_time = Self::resolve_time(new_time)?;601602		if new_time == when {603			return Err(Error::<T>::RescheduleNoChange.into());604		}605606		Agenda::<T>::try_mutate(when, |agenda| -> DispatchResult {607			let task = agenda.get_mut(index as usize).ok_or(Error::<T>::NotFound)?;608			let task = task.take().ok_or(Error::<T>::NotFound)?;609			Agenda::<T>::append(new_time, Some(task));610			Ok(())611		})?;612613		let new_index = Agenda::<T>::decode_len(new_time).unwrap_or(1) as u32 - 1;614		Self::deposit_event(RawEvent::Canceled(when, index));615		Self::deposit_event(RawEvent::Scheduled(new_time, new_index));616617		Ok((new_time, new_index))618	}619620	fn do_schedule_named(621		id: Vec<u8>,622		when: DispatchTime<T::BlockNumber>,623		maybe_periodic: Option<schedule::Period<T::BlockNumber>>,624		priority: schedule::Priority,625		origin: T::PalletsOrigin,626		call: <T as Config>::Call,627	) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {628		// ensure id it is unique629		if Lookup::<T>::contains_key(&id) {630			return Err(Error::<T>::FailedToSchedule.into());631		}632633		let when = Self::resolve_time(when)?;634635		// sanitize maybe_periodic636		let maybe_periodic = maybe_periodic637			.filter(|p| p.1 > 1 && !p.0.is_zero())638			// Remove one from the number of repetitions since we will schedule one now.639			.map(|(p, c)| (p, c - 1));640641		let s = Scheduled {642			maybe_id: Some(id.clone()),643			priority,644			call,645			maybe_periodic,646			origin,647			_phantom: Default::default(),648		};649		Agenda::<T>::append(when, Some(s));650		let index = Agenda::<T>::decode_len(when).unwrap_or(1) as u32 - 1;651		if index > T::MaxScheduledPerBlock::get() {652			log::warn!(653				target: "runtime::scheduler",654				"Warning: There are more items queued in the Scheduler than \655				expected from the runtime configuration. An update might be needed.",656			);657		}658		let address = (when, index);659		Lookup::<T>::insert(&id, &address);660		Self::deposit_event(RawEvent::Scheduled(when, index));661662		Ok(address)663	}664665	fn do_cancel_named(origin: Option<T::PalletsOrigin>, id: Vec<u8>) -> DispatchResult {666		Lookup::<T>::try_mutate_exists(id, |lookup| -> DispatchResult {667			if let Some((when, index)) = lookup.take() {668				let i = index as usize;669				Agenda::<T>::try_mutate(when, |agenda| -> DispatchResult {670					if let Some(s) = agenda.get_mut(i) {671						if let (Some(ref o), Some(ref s)) = (origin, s.borrow()) {672							if *o != s.origin {673								return Err(BadOrigin.into());674							}675						}676						*s = None;677					}678					Ok(())679				})?;680				Self::deposit_event(RawEvent::Canceled(when, index));681				Ok(())682			} else {683				Err(Error::<T>::NotFound.into())684			}685		})686	}687688	fn do_reschedule_named(689		id: Vec<u8>,690		new_time: DispatchTime<T::BlockNumber>,691	) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {692		let new_time = Self::resolve_time(new_time)?;693694		Lookup::<T>::try_mutate_exists(695			id,696			|lookup| -> Result<TaskAddress<T::BlockNumber>, DispatchError> {697				let (when, index) = lookup.ok_or(Error::<T>::NotFound)?;698699				if new_time == when {700					return Err(Error::<T>::RescheduleNoChange.into());701				}702703				Agenda::<T>::try_mutate(when, |agenda| -> DispatchResult {704					let task = agenda.get_mut(index as usize).ok_or(Error::<T>::NotFound)?;705					let task = task.take().ok_or(Error::<T>::NotFound)?;706					Agenda::<T>::append(new_time, Some(task));707708					Ok(())709				})?;710711				let new_index = Agenda::<T>::decode_len(new_time).unwrap_or(1) as u32 - 1;712				Self::deposit_event(RawEvent::Canceled(when, index));713				Self::deposit_event(RawEvent::Scheduled(new_time, new_index));714715				*lookup = Some((new_time, new_index));716717				Ok((new_time, new_index))718			},719		)720	}721}722723impl<T: Config> schedule::Anon<T::BlockNumber, <T as Config>::Call, T::PalletsOrigin>724	for Module<T>725{726	type Address = TaskAddress<T::BlockNumber>;727728	fn schedule(729		when: DispatchTime<T::BlockNumber>,730		maybe_periodic: Option<schedule::Period<T::BlockNumber>>,731		priority: schedule::Priority,732		origin: T::PalletsOrigin,733		call: <T as Config>::Call,734	) -> Result<Self::Address, DispatchError> {735		Self::do_schedule(when, maybe_periodic, priority, origin, call)736	}737738	fn cancel((when, index): Self::Address) -> Result<(), ()> {739		Self::do_cancel(None, (when, index)).map_err(|_| ())740	}741742	fn reschedule(743		address: Self::Address,744		when: DispatchTime<T::BlockNumber>,745	) -> Result<Self::Address, DispatchError> {746		Self::do_reschedule(address, when)747	}748749	fn next_dispatch_time((when, index): Self::Address) -> Result<T::BlockNumber, ()> {750		Agenda::<T>::get(when)751			.get(index as usize)752			.ok_or(())753			.map(|_| when)754	}755}756757impl<T: Config> schedule::Named<T::BlockNumber, <T as Config>::Call, T::PalletsOrigin>758	for Module<T>759{760	type Address = TaskAddress<T::BlockNumber>;761762	fn schedule_named(763		id: Vec<u8>,764		when: DispatchTime<T::BlockNumber>,765		maybe_periodic: Option<schedule::Period<T::BlockNumber>>,766		priority: schedule::Priority,767		origin: T::PalletsOrigin,768		call: <T as Config>::Call,769	) -> Result<Self::Address, ()> {770		Self::do_schedule_named(id, when, maybe_periodic, priority, origin, call).map_err(|_| ())771	}772773	fn cancel_named(id: Vec<u8>) -> Result<(), ()> {774		Self::do_cancel_named(None, id).map_err(|_| ())775	}776777	fn reschedule_named(778		id: Vec<u8>,779		when: DispatchTime<T::BlockNumber>,780	) -> Result<Self::Address, DispatchError> {781		Self::do_reschedule_named(id, when)782	}783784	fn next_dispatch_time(id: Vec<u8>) -> Result<T::BlockNumber, ()> {785		Lookup::<T>::get(id)786			.and_then(|(when, index)| Agenda::<T>::get(when).get(index as usize).map(|_| when))787			.ok_or(())788	}789}790791#[cfg(test)]792#[allow(clippy::from_over_into)]793mod tests {794	use super::*;795796	use frame_support::{797		parameter_types, assert_ok, ord_parameter_types, assert_noop, assert_err, Hashable,798		traits::{OnInitialize, OnFinalize, Filter},799		weights::constants::RocksDbWeight,800	};801	use sp_core::H256;802	use sp_runtime::{803		Perbill,804		testing::Header,805		traits::{BlakeTwo256, IdentityLookup},806	};807	use frame_system::{EnsureOneOf, EnsureRoot, EnsureSignedBy};808	use substrate_test_utils::assert_eq_uvec;809	use crate as scheduler;810811	mod logger {812		use super::*;813		use std::cell::RefCell;814815		thread_local! {816			static LOG: RefCell<Vec<(OriginCaller, u32)>> = RefCell::new(Vec::new());817		}818		pub fn log() -> Vec<(OriginCaller, u32)> {819			LOG.with(|log| log.borrow().clone())820		}821		pub trait Config: system::Config {822			type Event: From<Event> + Into<<Self as system::Config>::Event>;823		}824		decl_event! {825			pub enum Event {826				Logged(u32, Weight),827			}828		}829		decl_module! {830			pub struct Module<T: Config> for enum Call831			where832				origin: <T as system::Config>::Origin,833				<T as system::Config>::Origin: OriginTrait<PalletsOrigin = OriginCaller>834			{835				fn deposit_event() = default;836837				#[weight = *weight]838				fn log(origin, i: u32, weight: Weight) {839					Self::deposit_event(Event::Logged(i, weight));840					LOG.with(|log| {841						log.borrow_mut().push((origin.caller().clone(), i));842					})843				}844845				#[weight = *weight]846				fn log_without_filter(origin, i: u32, weight: Weight) {847					Self::deposit_event(Event::Logged(i, weight));848					LOG.with(|log| {849						log.borrow_mut().push((origin.caller().clone(), i));850					})851				}852			}853		}854	}855856	type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;857	type Block = frame_system::mocking::MockBlock<Test>;858859	frame_support::construct_runtime!(860		pub enum Test where861			Block = Block,862			NodeBlock = Block,863			UncheckedExtrinsic = UncheckedExtrinsic,864		{865			System: frame_system::{Pallet, Call, Config, Storage, Event<T>},866			Logger: logger::{Pallet, Call, Event},867			Scheduler: scheduler::{Pallet, Call, Storage, Event<T>},868		}869	);870871	// Scheduler must dispatch with root and no filter, this tests base filter is indeed not used.872	pub struct BaseFilter;873	impl Filter<Call> for BaseFilter {874		fn filter(call: &Call) -> bool {875			!matches!(call, Call::Logger(logger::Call::log(_, _)))876		}877	}878879	parameter_types! {880		pub const BlockHashCount: u64 = 250;881		pub BlockWeights: frame_system::limits::BlockWeights =882			frame_system::limits::BlockWeights::simple_max(2_000_000_000_000);883	}884	impl system::Config for Test {885		type BaseCallFilter = BaseFilter;886		type BlockWeights = ();887		type BlockLength = ();888		type DbWeight = RocksDbWeight;889		type Origin = Origin;890		type Call = Call;891		type Index = u64;892		type BlockNumber = u64;893		type Hash = H256;894		type Hashing = BlakeTwo256;895		type AccountId = u64;896		type Lookup = IdentityLookup<Self::AccountId>;897		type Header = Header;898		type Event = Event;899		type BlockHashCount = BlockHashCount;900		type Version = ();901		type PalletInfo = PalletInfo;902		type AccountData = ();903		type OnNewAccount = ();904		type OnKilledAccount = ();905		type SystemWeightInfo = ();906		type SS58Prefix = ();907		type OnSetCode = ();908	}909	impl logger::Config for Test {910		type Event = Event;911	}912	parameter_types! {913		pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block;914		pub const MaxScheduledPerBlock: u32 = 10;915	}916	ord_parameter_types! {917		pub const One: u64 = 1;918	}919920	impl Config for Test {921		type Event = Event;922		type Origin = Origin;923		type PalletsOrigin = OriginCaller;924		type Call = Call;925		type MaximumWeight = MaximumSchedulerWeight;926		type ScheduleOrigin = EnsureOneOf<u64, EnsureRoot<u64>, EnsureSignedBy<One, u64>>;927		type MaxScheduledPerBlock = MaxScheduledPerBlock;928		type WeightInfo = ();929		type SponsorshipHandler = ();930	}931932	pub fn new_test_ext() -> sp_io::TestExternalities {933		let t = system::GenesisConfig::default()934			.build_storage::<Test>()935			.unwrap();936		t.into()937	}938939	fn run_to_block(n: u64) {940		while System::block_number() < n {941			Scheduler::on_finalize(System::block_number());942			System::set_block_number(System::block_number() + 1);943			Scheduler::on_initialize(System::block_number());944		}945	}946947	fn root() -> OriginCaller {948		system::RawOrigin::Root.into()949	}950951	#[test]952	fn basic_scheduling_works() {953		new_test_ext().execute_with(|| {954			let call = Call::Logger(logger::Call::log(42, 1000));955			assert!(!<Test as frame_system::Config>::BaseCallFilter::filter(956				&call957			));958			assert_ok!(Scheduler::do_schedule(959				DispatchTime::At(4),960				None,961				127,962				root(),963				call964			));965			run_to_block(3);966			assert!(logger::log().is_empty());967			run_to_block(4);968			assert_eq!(logger::log(), vec![(root(), 42u32)]);969			run_to_block(100);970			assert_eq!(logger::log(), vec![(root(), 42u32)]);971		});972	}973974	#[test]975	fn schedule_after_works() {976		new_test_ext().execute_with(|| {977			run_to_block(2);978			let call = Call::Logger(logger::Call::log(42, 1000));979			assert!(!<Test as frame_system::Config>::BaseCallFilter::filter(980				&call981			));982			// This will schedule the call 3 blocks after the next block... so block 3 + 3 = 6983			assert_ok!(Scheduler::do_schedule(984				DispatchTime::After(3),985				None,986				127,987				root(),988				call989			));990			run_to_block(5);991			assert!(logger::log().is_empty());992			run_to_block(6);993			assert_eq!(logger::log(), vec![(root(), 42u32)]);994			run_to_block(100);995			assert_eq!(logger::log(), vec![(root(), 42u32)]);996		});997	}998999	#[test]1000	fn schedule_after_zero_works() {1001		new_test_ext().execute_with(|| {1002			run_to_block(2);1003			let call = Call::Logger(logger::Call::log(42, 1000));1004			assert!(!<Test as frame_system::Config>::BaseCallFilter::filter(1005				&call1006			));1007			assert_ok!(Scheduler::do_schedule(1008				DispatchTime::After(0),1009				None,1010				127,1011				root(),1012				call1013			));1014			// Will trigger on the next block.1015			run_to_block(3);1016			assert_eq!(logger::log(), vec![(root(), 42u32)]);1017			run_to_block(100);1018			assert_eq!(logger::log(), vec![(root(), 42u32)]);1019		});1020	}10211022	#[test]1023	fn periodic_scheduling_works() {1024		new_test_ext().execute_with(|| {1025			// at #4, every 3 blocks, 3 times.1026			assert_ok!(Scheduler::do_schedule(1027				DispatchTime::At(4),1028				Some((3, 3)),1029				127,1030				root(),1031				Call::Logger(logger::Call::log(42, 1000))1032			));1033			run_to_block(3);1034			assert!(logger::log().is_empty());1035			run_to_block(4);1036			assert_eq!(logger::log(), vec![(root(), 42u32)]);1037			run_to_block(6);1038			assert_eq!(logger::log(), vec![(root(), 42u32)]);1039			run_to_block(7);1040			assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 42u32)]);1041			run_to_block(9);1042			assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 42u32)]);1043			run_to_block(10);1044			assert_eq!(1045				logger::log(),1046				vec![(root(), 42u32), (root(), 42u32), (root(), 42u32)]1047			);1048			run_to_block(100);1049			assert_eq!(1050				logger::log(),1051				vec![(root(), 42u32), (root(), 42u32), (root(), 42u32)]1052			);1053		});1054	}10551056	#[test]1057	fn reschedule_works() {1058		new_test_ext().execute_with(|| {1059			let call = Call::Logger(logger::Call::log(42, 1000));1060			assert!(!<Test as frame_system::Config>::BaseCallFilter::filter(1061				&call1062			));1063			assert_eq!(1064				Scheduler::do_schedule(DispatchTime::At(4), None, 127, root(), call).unwrap(),1065				(4, 0)1066			);10671068			run_to_block(3);1069			assert!(logger::log().is_empty());10701071			assert_eq!(1072				Scheduler::do_reschedule((4, 0), DispatchTime::At(6)).unwrap(),1073				(6, 0)1074			);10751076			assert_noop!(1077				Scheduler::do_reschedule((6, 0), DispatchTime::At(6)),1078				Error::<Test>::RescheduleNoChange1079			);10801081			run_to_block(4);1082			assert!(logger::log().is_empty());10831084			run_to_block(6);1085			assert_eq!(logger::log(), vec![(root(), 42u32)]);10861087			run_to_block(100);1088			assert_eq!(logger::log(), vec![(root(), 42u32)]);1089		});1090	}10911092	#[test]1093	fn reschedule_named_works() {1094		new_test_ext().execute_with(|| {1095			let call = Call::Logger(logger::Call::log(42, 1000));1096			assert!(!<Test as frame_system::Config>::BaseCallFilter::filter(1097				&call1098			));1099			assert_eq!(1100				Scheduler::do_schedule_named(1101					1u32.encode(),1102					DispatchTime::At(4),1103					None,1104					127,1105					root(),1106					call1107				)1108				.unwrap(),1109				(4, 0)1110			);11111112			run_to_block(3);1113			assert!(logger::log().is_empty());11141115			assert_eq!(1116				Scheduler::do_reschedule_named(1u32.encode(), DispatchTime::At(6)).unwrap(),1117				(6, 0)1118			);11191120			assert_noop!(1121				Scheduler::do_reschedule_named(1u32.encode(), DispatchTime::At(6)),1122				Error::<Test>::RescheduleNoChange1123			);11241125			run_to_block(4);1126			assert!(logger::log().is_empty());11271128			run_to_block(6);1129			assert_eq!(logger::log(), vec![(root(), 42u32)]);11301131			run_to_block(100);1132			assert_eq!(logger::log(), vec![(root(), 42u32)]);1133		});1134	}11351136	#[test]1137	fn reschedule_named_perodic_works() {1138		new_test_ext().execute_with(|| {1139			let call = Call::Logger(logger::Call::log(42, 1000));1140			assert!(!<Test as frame_system::Config>::BaseCallFilter::filter(1141				&call1142			));1143			assert_eq!(1144				Scheduler::do_schedule_named(1145					1u32.encode(),1146					DispatchTime::At(4),1147					Some((3, 3)),1148					127,1149					root(),1150					call1151				)1152				.unwrap(),1153				(4, 0)1154			);11551156			run_to_block(3);1157			assert!(logger::log().is_empty());11581159			assert_eq!(1160				Scheduler::do_reschedule_named(1u32.encode(), DispatchTime::At(5)).unwrap(),1161				(5, 0)1162			);1163			assert_eq!(1164				Scheduler::do_reschedule_named(1u32.encode(), DispatchTime::At(6)).unwrap(),1165				(6, 0)1166			);11671168			run_to_block(5);1169			assert!(logger::log().is_empty());11701171			run_to_block(6);1172			assert_eq!(logger::log(), vec![(root(), 42u32)]);11731174			assert_eq!(1175				Scheduler::do_reschedule_named(1u32.encode(), DispatchTime::At(10)).unwrap(),1176				(10, 0)1177			);11781179			run_to_block(9);1180			assert_eq!(logger::log(), vec![(root(), 42u32)]);11811182			run_to_block(10);1183			assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 42u32)]);11841185			run_to_block(13);1186			assert_eq!(1187				logger::log(),1188				vec![(root(), 42u32), (root(), 42u32), (root(), 42u32)]1189			);11901191			run_to_block(100);1192			assert_eq!(1193				logger::log(),1194				vec![(root(), 42u32), (root(), 42u32), (root(), 42u32)]1195			);1196		});1197	}11981199	#[test]1200	fn cancel_named_scheduling_works_with_normal_cancel() {1201		new_test_ext().execute_with(|| {1202			// at #4.1203			Scheduler::do_schedule_named(1204				1u32.encode(),1205				DispatchTime::At(4),1206				None,1207				127,1208				root(),1209				Call::Logger(logger::Call::log(69, 1000)),1210			)1211			.unwrap();1212			let i = Scheduler::do_schedule(1213				DispatchTime::At(4),1214				None,1215				127,1216				root(),1217				Call::Logger(logger::Call::log(42, 1000)),1218			)1219			.unwrap();1220			run_to_block(3);1221			assert!(logger::log().is_empty());1222			assert_ok!(Scheduler::do_cancel_named(None, 1u32.encode()));1223			assert_ok!(Scheduler::do_cancel(None, i));1224			run_to_block(100);1225			assert!(logger::log().is_empty());1226		});1227	}12281229	#[test]1230	fn cancel_named_periodic_scheduling_works() {1231		new_test_ext().execute_with(|| {1232			// at #4, every 3 blocks, 3 times.1233			Scheduler::do_schedule_named(1234				1u32.encode(),1235				DispatchTime::At(4),1236				Some((3, 3)),1237				127,1238				root(),1239				Call::Logger(logger::Call::log(42, 1000)),1240			)1241			.unwrap();1242			// same id results in error.1243			assert!(Scheduler::do_schedule_named(1244				1u32.encode(),1245				DispatchTime::At(4),1246				None,1247				127,1248				root(),1249				Call::Logger(logger::Call::log(69, 1000))1250			)1251			.is_err());1252			// different id is ok.1253			Scheduler::do_schedule_named(1254				2u32.encode(),1255				DispatchTime::At(8),1256				None,1257				127,1258				root(),1259				Call::Logger(logger::Call::log(69, 1000)),1260			)1261			.unwrap();1262			run_to_block(3);1263			assert!(logger::log().is_empty());1264			run_to_block(4);1265			assert_eq!(logger::log(), vec![(root(), 42u32)]);1266			run_to_block(6);1267			assert_ok!(Scheduler::do_cancel_named(None, 1u32.encode()));1268			run_to_block(100);1269			assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 69u32)]);1270		});1271	}12721273	#[test]1274	fn scheduler_respects_weight_limits() {1275		new_test_ext().execute_with(|| {1276			assert_ok!(Scheduler::do_schedule(1277				DispatchTime::At(4),1278				None,1279				127,1280				root(),1281				Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 2))1282			));1283			assert_ok!(Scheduler::do_schedule(1284				DispatchTime::At(4),1285				None,1286				127,1287				root(),1288				Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))1289			));1290			// 69 and 42 do not fit together1291			run_to_block(4);1292			assert_eq!(logger::log(), vec![(root(), 42u32)]);1293			run_to_block(5);1294			assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 69u32)]);1295		});1296	}12971298	#[test]1299	fn scheduler_respects_hard_deadlines_more() {1300		new_test_ext().execute_with(|| {1301			assert_ok!(Scheduler::do_schedule(1302				DispatchTime::At(4),1303				None,1304				0,1305				root(),1306				Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 2))1307			));1308			assert_ok!(Scheduler::do_schedule(1309				DispatchTime::At(4),1310				None,1311				0,1312				root(),1313				Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))1314			));1315			// With base weights, 69 and 42 should not fit together, but do because of hard deadlines1316			run_to_block(4);1317			assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 69u32)]);1318		});1319	}13201321	#[test]1322	fn scheduler_respects_priority_ordering() {1323		new_test_ext().execute_with(|| {1324			assert_ok!(Scheduler::do_schedule(1325				DispatchTime::At(4),1326				None,1327				1,1328				root(),1329				Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 2))1330			));1331			assert_ok!(Scheduler::do_schedule(1332				DispatchTime::At(4),1333				None,1334				0,1335				root(),1336				Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))1337			));1338			run_to_block(4);1339			assert_eq!(logger::log(), vec![(root(), 69u32), (root(), 42u32)]);1340		});1341	}13421343	#[test]1344	fn scheduler_respects_priority_ordering_with_soft_deadlines() {1345		new_test_ext().execute_with(|| {1346			assert_ok!(Scheduler::do_schedule(1347				DispatchTime::At(4),1348				None,1349				255,1350				root(),1351				Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 3))1352			));1353			assert_ok!(Scheduler::do_schedule(1354				DispatchTime::At(4),1355				None,1356				127,1357				root(),1358				Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))1359			));1360			assert_ok!(Scheduler::do_schedule(1361				DispatchTime::At(4),1362				None,1363				126,1364				root(),1365				Call::Logger(logger::Call::log(2600, MaximumSchedulerWeight::get() / 2))1366			));13671368			// 2600 does not fit with 69 or 42, but has higher priority, so will go through1369			run_to_block(4);1370			assert_eq!(logger::log(), vec![(root(), 2600u32)]);1371			// 69 and 42 fit together1372			run_to_block(5);1373			assert_eq!(1374				logger::log(),1375				vec![(root(), 2600u32), (root(), 69u32), (root(), 42u32)]1376			);1377		});1378	}13791380	#[test]1381	fn on_initialize_weight_is_correct() {1382		new_test_ext().execute_with(|| {1383			let base_weight: Weight =1384				<Test as frame_system::Config>::DbWeight::get().reads_writes(1, 2);1385			let base_multiplier = 0;1386			let named_multiplier = <Test as frame_system::Config>::DbWeight::get().writes(1);1387			let periodic_multiplier =1388				<Test as frame_system::Config>::DbWeight::get().reads_writes(1, 1);13891390			// Named1391			assert_ok!(Scheduler::do_schedule_named(1392				1u32.encode(),1393				DispatchTime::At(1),1394				None,1395				255,1396				root(),1397				Call::Logger(logger::Call::log(3, MaximumSchedulerWeight::get() / 3))1398			));1399			// Anon Periodic1400			assert_ok!(Scheduler::do_schedule(1401				DispatchTime::At(1),1402				Some((1000, 3)),1403				128,1404				root(),1405				Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 3))1406			));1407			// Anon1408			assert_ok!(Scheduler::do_schedule(1409				DispatchTime::At(1),1410				None,1411				127,1412				root(),1413				Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))1414			));1415			// Named Periodic1416			assert_ok!(Scheduler::do_schedule_named(1417				2u32.encode(),1418				DispatchTime::At(1),1419				Some((1000, 3)),1420				126,1421				root(),1422				Call::Logger(logger::Call::log(2600, MaximumSchedulerWeight::get() / 2))1423			));14241425			// Will include the named periodic only1426			let actual_weight = Scheduler::on_initialize(1);1427			let call_weight = MaximumSchedulerWeight::get() / 2;1428			assert_eq!(1429				actual_weight,1430				call_weight1431					+ base_weight + base_multiplier1432					+ named_multiplier + periodic_multiplier1433			);1434			assert_eq!(logger::log(), vec![(root(), 2600u32)]);14351436			// Will include anon and anon periodic1437			let actual_weight = Scheduler::on_initialize(2);1438			let call_weight = MaximumSchedulerWeight::get() / 2 + MaximumSchedulerWeight::get() / 3;1439			assert_eq!(1440				actual_weight,1441				call_weight + base_weight + base_multiplier * 2 + periodic_multiplier1442			);1443			assert_eq!(1444				logger::log(),1445				vec![(root(), 2600u32), (root(), 69u32), (root(), 42u32)]1446			);14471448			// Will include named only1449			let actual_weight = Scheduler::on_initialize(3);1450			let call_weight = MaximumSchedulerWeight::get() / 3;1451			assert_eq!(1452				actual_weight,1453				call_weight + base_weight + base_multiplier + named_multiplier1454			);1455			assert_eq!(1456				logger::log(),1457				vec![1458					(root(), 2600u32),1459					(root(), 69u32),1460					(root(), 42u32),1461					(root(), 3u32)1462				]1463			);14641465			// Will contain none1466			let actual_weight = Scheduler::on_initialize(4);1467			assert_eq!(actual_weight, 0);1468		});1469	}14701471	#[test]1472	fn root_calls_works() {1473		new_test_ext().execute_with(|| {1474			let call = Box::new(Call::Logger(logger::Call::log(69, 1000)));1475			let call2 = Box::new(Call::Logger(logger::Call::log(42, 1000)));1476			assert_ok!(Scheduler::schedule_named(1477				Origin::root(),1478				1u32.encode(),1479				4,1480				None,1481				127,1482				call1483			));1484			assert_ok!(Scheduler::schedule(Origin::root(), 4, None, 127, call2));1485			run_to_block(3);1486			// Scheduled calls are in the agenda.1487			assert_eq!(Agenda::<Test>::get(4).len(), 2);1488			assert!(logger::log().is_empty());1489			assert_ok!(Scheduler::cancel_named(Origin::root(), 1u32.encode()));1490			assert_ok!(Scheduler::cancel(Origin::root(), 4, 1));1491			// Scheduled calls are made NONE, so should not effect state1492			run_to_block(100);1493			assert!(logger::log().is_empty());1494		});1495	}14961497	#[test]1498	fn fails_to_schedule_task_in_the_past() {1499		new_test_ext().execute_with(|| {1500			run_to_block(3);15011502			let call = Box::new(Call::Logger(logger::Call::log(69, 1000)));1503			let call2 = Box::new(Call::Logger(logger::Call::log(42, 1000)));15041505			assert_err!(1506				Scheduler::schedule_named(Origin::root(), 1u32.encode(), 2, None, 127, call),1507				Error::<Test>::TargetBlockNumberInPast,1508			);15091510			assert_err!(1511				Scheduler::schedule(Origin::root(), 2, None, 127, call2.clone()),1512				Error::<Test>::TargetBlockNumberInPast,1513			);15141515			assert_err!(1516				Scheduler::schedule(Origin::root(), 3, None, 127, call2),1517				Error::<Test>::TargetBlockNumberInPast,1518			);1519		});1520	}15211522	#[test]1523	fn should_use_orign() {1524		new_test_ext().execute_with(|| {1525			let call = Box::new(Call::Logger(logger::Call::log(69, 1000)));1526			let call2 = Box::new(Call::Logger(logger::Call::log(42, 1000)));1527			assert_ok!(Scheduler::schedule_named(1528				system::RawOrigin::Signed(1).into(),1529				1u32.encode(),1530				4,1531				None,1532				127,1533				call1534			));1535			assert_ok!(Scheduler::schedule(1536				system::RawOrigin::Signed(1).into(),1537				4,1538				None,1539				127,1540				call21541			));1542			run_to_block(3);1543			// Scheduled calls are in the agenda.1544			assert_eq!(Agenda::<Test>::get(4).len(), 2);1545			assert!(logger::log().is_empty());1546			assert_ok!(Scheduler::cancel_named(1547				system::RawOrigin::Signed(1).into(),1548				1u32.encode()1549			));1550			assert_ok!(Scheduler::cancel(system::RawOrigin::Signed(1).into(), 4, 1));1551			// Scheduled calls are made NONE, so should not effect state1552			run_to_block(100);1553			assert!(logger::log().is_empty());1554		});1555	}15561557	#[test]1558	fn should_check_orign() {1559		new_test_ext().execute_with(|| {1560			let call = Box::new(Call::Logger(logger::Call::log(69, 1000)));1561			let call2 = Box::new(Call::Logger(logger::Call::log(42, 1000)));1562			assert_noop!(1563				Scheduler::schedule_named(1564					system::RawOrigin::Signed(2).into(),1565					1u32.encode(),1566					4,1567					None,1568					127,1569					call1570				),1571				BadOrigin1572			);1573			assert_noop!(1574				Scheduler::schedule(system::RawOrigin::Signed(2).into(), 4, None, 127, call2),1575				BadOrigin1576			);1577		});1578	}15791580	#[test]1581	fn should_check_orign_for_cancel() {1582		new_test_ext().execute_with(|| {1583			let call = Box::new(Call::Logger(logger::Call::log_without_filter(69, 1000)));1584			let call2 = Box::new(Call::Logger(logger::Call::log_without_filter(42, 1000)));1585			assert_ok!(Scheduler::schedule_named(1586				system::RawOrigin::Signed(1).into(),1587				1u32.encode(),1588				4,1589				None,1590				127,1591				call1592			));1593			assert_ok!(Scheduler::schedule(1594				system::RawOrigin::Signed(1).into(),1595				4,1596				None,1597				127,1598				call21599			));1600			run_to_block(3);1601			// Scheduled calls are in the agenda.1602			assert_eq!(Agenda::<Test>::get(4).len(), 2);1603			assert!(logger::log().is_empty());1604			assert_noop!(1605				Scheduler::cancel_named(system::RawOrigin::Signed(2).into(), 1u32.encode()),1606				BadOrigin1607			);1608			assert_noop!(1609				Scheduler::cancel(system::RawOrigin::Signed(2).into(), 4, 1),1610				BadOrigin1611			);1612			assert_noop!(1613				Scheduler::cancel_named(system::RawOrigin::Root.into(), 1u32.encode()),1614				BadOrigin1615			);1616			assert_noop!(1617				Scheduler::cancel(system::RawOrigin::Root.into(), 4, 1),1618				BadOrigin1619			);1620			run_to_block(5);1621			assert_eq!(1622				logger::log(),1623				vec![1624					(system::RawOrigin::Signed(1).into(), 69u32),1625					(system::RawOrigin::Signed(1).into(), 42u32)1626				]1627			);1628		});1629	}16301631	#[test]1632	fn migration_to_v2_works() {1633		new_test_ext().execute_with(|| {1634			for i in 0..3u64 {1635				let k = i.twox_64_concat();1636				let old = vec![1637					Some(ScheduledV1 {1638						maybe_id: None,1639						priority: i as u8 + 10,1640						call: Call::Logger(logger::Call::log(96, 100)),1641						maybe_periodic: None,1642					}),1643					None,1644					Some(ScheduledV1 {1645						maybe_id: Some(b"test".to_vec()),1646						priority: 123,1647						call: Call::Logger(logger::Call::log(69, 1000)),1648						maybe_periodic: Some((456u64, 10)),1649					}),1650				];1651				frame_support::migration::put_storage_value(b"Scheduler", b"Agenda", &k, old);1652			}16531654			assert_eq!(StorageVersion::get(), Releases::V1);16551656			assert!(Scheduler::migrate_v1_to_t2());16571658			assert_eq_uvec!(1659				Agenda::<Test>::iter().collect::<Vec<_>>(),1660				vec![1661					(1662						0,1663						vec![1664							Some(ScheduledV2 {1665								maybe_id: None,1666								priority: 10,1667								call: Call::Logger(logger::Call::log(96, 100)),1668								maybe_periodic: None,1669								origin: root(),1670								_phantom: PhantomData::<u64>::default(),1671							}),1672							None,1673							Some(ScheduledV2 {1674								maybe_id: Some(b"test".to_vec()),1675								priority: 123,1676								call: Call::Logger(logger::Call::log(69, 1000)),1677								maybe_periodic: Some((456u64, 10)),1678								origin: root(),1679								_phantom: PhantomData::<u64>::default(),1680							}),1681						]1682					),1683					(1684						1,1685						vec![1686							Some(ScheduledV2 {1687								maybe_id: None,1688								priority: 11,1689								call: Call::Logger(logger::Call::log(96, 100)),1690								maybe_periodic: None,1691								origin: root(),1692								_phantom: PhantomData::<u64>::default(),1693							}),1694							None,1695							Some(ScheduledV2 {1696								maybe_id: Some(b"test".to_vec()),1697								priority: 123,1698								call: Call::Logger(logger::Call::log(69, 1000)),1699								maybe_periodic: Some((456u64, 10)),1700								origin: root(),1701								_phantom: PhantomData::<u64>::default(),1702							}),1703						]1704					),1705					(1706						2,1707						vec![1708							Some(ScheduledV2 {1709								maybe_id: None,1710								priority: 12,1711								call: Call::Logger(logger::Call::log(96, 100)),1712								maybe_periodic: None,1713								origin: root(),1714								_phantom: PhantomData::<u64>::default(),1715							}),1716							None,1717							Some(ScheduledV2 {1718								maybe_id: Some(b"test".to_vec()),1719								priority: 123,1720								call: Call::Logger(logger::Call::log(69, 1000)),1721								maybe_periodic: Some((456u64, 10)),1722								origin: root(),1723								_phantom: PhantomData::<u64>::default(),1724							}),1725						]1726					)1727				]1728			);17291730			assert_eq!(StorageVersion::get(), Releases::V2);1731		});1732	}17331734	#[test]1735	fn test_migrate_origin() {1736		new_test_ext().execute_with(|| {1737			for i in 0..3u64 {1738				let k = i.twox_64_concat();1739				let old: Vec<Option<Scheduled<_, _, u32, u64>>> = vec![1740					Some(Scheduled {1741						maybe_id: None,1742						priority: i as u8 + 10,1743						call: Call::Logger(logger::Call::log(96, 100)),1744						origin: 3u32,1745						maybe_periodic: None,1746						_phantom: Default::default(),1747					}),1748					None,1749					Some(Scheduled {1750						maybe_id: Some(b"test".to_vec()),1751						priority: 123,1752						origin: 2u32,1753						call: Call::Logger(logger::Call::log(69, 1000)),1754						maybe_periodic: Some((456u64, 10)),1755						_phantom: Default::default(),1756					}),1757				];1758				frame_support::migration::put_storage_value(b"Scheduler", b"Agenda", &k, old);1759			}17601761			impl From<u32> for OriginCaller {1762				fn from(value: u32) -> Self {1763					match value {1764						3 => system::RawOrigin::Root.into(),1765						2 => system::RawOrigin::None.into(),1766						_ => unimplemented!(),1767					}1768				}1769			}17701771			Scheduler::migrate_origin::<u32>();17721773			assert_eq_uvec!(1774				Agenda::<Test>::iter().collect::<Vec<_>>(),1775				vec![1776					(1777						0,1778						vec![1779							Some(ScheduledV2::<_, _, OriginCaller, u64> {1780								maybe_id: None,1781								priority: 10,1782								call: Call::Logger(logger::Call::log(96, 100)),1783								maybe_periodic: None,1784								origin: system::RawOrigin::Root.into(),1785								_phantom: PhantomData::<u64>::default(),1786							}),1787							None,1788							Some(ScheduledV2 {1789								maybe_id: Some(b"test".to_vec()),1790								priority: 123,1791								call: Call::Logger(logger::Call::log(69, 1000)),1792								maybe_periodic: Some((456u64, 10)),1793								origin: system::RawOrigin::None.into(),1794								_phantom: PhantomData::<u64>::default(),1795							}),1796						]1797					),1798					(1799						1,1800						vec![1801							Some(ScheduledV2 {1802								maybe_id: None,1803								priority: 11,1804								call: Call::Logger(logger::Call::log(96, 100)),1805								maybe_periodic: None,1806								origin: system::RawOrigin::Root.into(),1807								_phantom: PhantomData::<u64>::default(),1808							}),1809							None,1810							Some(ScheduledV2 {1811								maybe_id: Some(b"test".to_vec()),1812								priority: 123,1813								call: Call::Logger(logger::Call::log(69, 1000)),1814								maybe_periodic: Some((456u64, 10)),1815								origin: system::RawOrigin::None.into(),1816								_phantom: PhantomData::<u64>::default(),1817							}),1818						]1819					),1820					(1821						2,1822						vec![1823							Some(ScheduledV2 {1824								maybe_id: None,1825								priority: 12,1826								call: Call::Logger(logger::Call::log(96, 100)),1827								maybe_periodic: None,1828								origin: system::RawOrigin::Root.into(),1829								_phantom: PhantomData::<u64>::default(),1830							}),1831							None,1832							Some(ScheduledV2 {1833								maybe_id: Some(b"test".to_vec()),1834								priority: 123,1835								call: Call::Logger(logger::Call::log(69, 1000)),1836								maybe_periodic: Some((456u64, 10)),1837								origin: system::RawOrigin::None.into(),1838								_phantom: PhantomData::<u64>::default(),1839							}),1840						]1841					)1842				]1843			);1844		});1845	}1846}
modifiedpallets/scheduler/src/weights.rsdiffbeforeafterboth
--- a/pallets/scheduler/src/weights.rs
+++ b/pallets/scheduler/src/weights.rs
@@ -34,85 +34,76 @@
 // --output=./frame/scheduler/src/weights.rs
 // --template=./.maintain/frame-weight-template.hbs
 
-
 #![allow(unused_parens)]
 #![allow(unused_imports)]
 
-use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
+use frame_support::{
+	traits::Get,
+	weights::{Weight, constants::RocksDbWeight},
+};
 use sp_std::marker::PhantomData;
 
 /// Weight functions needed for pallet_scheduler.
 pub trait WeightInfo {
-	fn schedule(s: u32, ) -> Weight;
-	fn cancel(s: u32, ) -> Weight;
-	fn schedule_named(s: u32, ) -> Weight;
-	fn cancel_named(s: u32, ) -> Weight;
-	
+	fn schedule(s: u32) -> Weight;
+	fn cancel(s: u32) -> Weight;
+	fn schedule_named(s: u32) -> Weight;
+	fn cancel_named(s: u32) -> Weight;
 }
 
 /// Weights for pallet_scheduler using the Substrate node and recommended hardware.
 pub struct SubstrateWeight<T>(PhantomData<T>);
 impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
-	fn schedule(s: u32, ) -> Weight {
-		(35_029_000 as Weight)
-			.saturating_add((77_000 as Weight).saturating_mul(s as Weight))
-			.saturating_add(T::DbWeight::get().reads(1 as Weight))
-			.saturating_add(T::DbWeight::get().writes(1 as Weight))
-			
+	fn schedule(s: u32) -> Weight {
+		35_029_000_u64
+			.saturating_add(77_000_u64.saturating_mul(s as Weight))
+			.saturating_add(T::DbWeight::get().reads(1_u64))
+			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	fn cancel(s: u32, ) -> Weight {
-		(31_419_000 as Weight)
-			.saturating_add((4_015_000 as Weight).saturating_mul(s as Weight))
-			.saturating_add(T::DbWeight::get().reads(1 as Weight))
-			.saturating_add(T::DbWeight::get().writes(2 as Weight))
-			
+	fn cancel(s: u32) -> Weight {
+		31_419_000_u64
+			.saturating_add(4_015_000_u64.saturating_mul(s as Weight))
+			.saturating_add(T::DbWeight::get().reads(1_u64))
+			.saturating_add(T::DbWeight::get().writes(2_u64))
 	}
-	fn schedule_named(s: u32, ) -> Weight {
-		(44_752_000 as Weight)
-			.saturating_add((123_000 as Weight).saturating_mul(s as Weight))
-			.saturating_add(T::DbWeight::get().reads(2 as Weight))
-			.saturating_add(T::DbWeight::get().writes(2 as Weight))
-			
+	fn schedule_named(s: u32) -> Weight {
+		44_752_000_u64
+			.saturating_add(123_000_u64.saturating_mul(s as Weight))
+			.saturating_add(T::DbWeight::get().reads(2_u64))
+			.saturating_add(T::DbWeight::get().writes(2_u64))
 	}
-	fn cancel_named(s: u32, ) -> Weight {
-		(35_712_000 as Weight)
-			.saturating_add((4_008_000 as Weight).saturating_mul(s as Weight))
-			.saturating_add(T::DbWeight::get().reads(2 as Weight))
-			.saturating_add(T::DbWeight::get().writes(2 as Weight))
-			
+	fn cancel_named(s: u32) -> Weight {
+		35_712_000_u64
+			.saturating_add(4_008_000_u64.saturating_mul(s as Weight))
+			.saturating_add(T::DbWeight::get().reads(2_u64))
+			.saturating_add(T::DbWeight::get().writes(2_u64))
 	}
-	
 }
 
 // For backwards compatibility and tests
 impl WeightInfo for () {
-	fn schedule(s: u32, ) -> Weight {
-		(35_029_000 as Weight)
-			.saturating_add((77_000 as Weight).saturating_mul(s as Weight))
-			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
-			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
-			
+	fn schedule(s: u32) -> Weight {
+		35_029_000_u64
+			.saturating_add(77_000_u64.saturating_mul(s as Weight))
+			.saturating_add(RocksDbWeight::get().reads(1_u64))
+			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	fn cancel(s: u32, ) -> Weight {
-		(31_419_000 as Weight)
-			.saturating_add((4_015_000 as Weight).saturating_mul(s as Weight))
-			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
-			.saturating_add(RocksDbWeight::get().writes(2 as Weight))
-			
+	fn cancel(s: u32) -> Weight {
+		31_419_000_u64
+			.saturating_add(4_015_000_u64.saturating_mul(s as Weight))
+			.saturating_add(RocksDbWeight::get().reads(1_u64))
+			.saturating_add(RocksDbWeight::get().writes(2_u64))
 	}
-	fn schedule_named(s: u32, ) -> Weight {
-		(44_752_000 as Weight)
-			.saturating_add((123_000 as Weight).saturating_mul(s as Weight))
-			.saturating_add(RocksDbWeight::get().reads(2 as Weight))
-			.saturating_add(RocksDbWeight::get().writes(2 as Weight))
-			
+	fn schedule_named(s: u32) -> Weight {
+		44_752_000_u64
+			.saturating_add(123_000_u64.saturating_mul(s as Weight))
+			.saturating_add(RocksDbWeight::get().reads(2_u64))
+			.saturating_add(RocksDbWeight::get().writes(2_u64))
 	}
-	fn cancel_named(s: u32, ) -> Weight {
-		(35_712_000 as Weight)
-			.saturating_add((4_008_000 as Weight).saturating_mul(s as Weight))
-			.saturating_add(RocksDbWeight::get().reads(2 as Weight))
-			.saturating_add(RocksDbWeight::get().writes(2 as Weight))
-			
+	fn cancel_named(s: u32) -> Weight {
+		35_712_000_u64
+			.saturating_add(4_008_000_u64.saturating_mul(s as Weight))
+			.saturating_add(RocksDbWeight::get().reads(2_u64))
+			.saturating_add(RocksDbWeight::get().writes(2_u64))
 	}
-	
 }
modifiedprimitives/nft/Cargo.tomldiffbeforeafterboth
--- a/primitives/nft/Cargo.toml
+++ b/primitives/nft/Cargo.toml
@@ -11,11 +11,11 @@
 [dependencies]
 codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ['derive'] }
 serde = { version = "1.0.119", features = ['derive'], default-features = false }
-frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-pallet-contracts = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-core = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-runtime = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
+frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+pallet-contracts = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-core = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+sp-runtime = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
 
 [features]
 default = ["std"]
modifiedprimitives/nft/src/lib.rsdiffbeforeafterboth
--- a/primitives/nft/src/lib.rs
+++ b/primitives/nft/src/lib.rs
@@ -1,26 +1,23 @@
-
 #![cfg_attr(not(feature = "std"), no_std)]
 
 pub use serde::{Serialize, Deserialize};
 
-use frame_system;
 use sp_runtime::sp_std::prelude::Vec;
 use codec::{Decode, Encode};
 pub use frame_support::{
-    construct_runtime, decl_event, decl_module, decl_storage, decl_error,
-    dispatch::DispatchResult,
-    ensure, fail, parameter_types,
-    traits::{
-        Currency, ExistenceRequirement, Get, Imbalance, KeyOwnerProofSystem, OnUnbalanced,
-        Randomness, IsSubType, WithdrawReasons,
-    },
-    weights::{
-        constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
-        DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,
-        WeightToFeePolynomial, DispatchClass,
-    },
-    StorageValue,
-    transactional,
+	construct_runtime, decl_event, decl_module, decl_storage, decl_error,
+	dispatch::DispatchResult,
+	ensure, fail, parameter_types,
+	traits::{
+		Currency, ExistenceRequirement, Get, Imbalance, KeyOwnerProofSystem, OnUnbalanced,
+		Randomness, IsSubType, WithdrawReasons,
+	},
+	weights::{
+		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
+		DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,
+		WeightToFeePolynomial, DispatchClass,
+	},
+	StorageValue, transactional,
 };
 
 pub const MAX_DECIMAL_POINTS: DecimalPoints = 30;
@@ -35,251 +32,245 @@
 #[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 pub enum CollectionMode {
-    Invalid,
-    NFT,
-    // decimal points
-    Fungible(DecimalPoints),
-    ReFungible,
+	Invalid,
+	NFT,
+	// decimal points
+	Fungible(DecimalPoints),
+	ReFungible,
 }
 
 impl Default for CollectionMode {
-    fn default() -> Self {
-        Self::Invalid
-    }
+	fn default() -> Self {
+		Self::Invalid
+	}
 }
 
-impl Into<u8> for CollectionMode {
-    fn into(self) -> u8 {
-        match self {
-            CollectionMode::Invalid => 0,
-            CollectionMode::NFT => 1,
-            CollectionMode::Fungible(_) => 2,
-            CollectionMode::ReFungible => 3,
-        }
-    }
+impl CollectionMode {
+	pub fn id(&self) -> u8 {
+		match self {
+			CollectionMode::Invalid => 0,
+			CollectionMode::NFT => 1,
+			CollectionMode::Fungible(_) => 2,
+			CollectionMode::ReFungible => 3,
+		}
+	}
 }
 
 pub trait SponsoringResolve<AccountId, Call> {
-    fn resolve(
-        who: &AccountId,
-		call: &Call) -> Option<AccountId>;
+	fn resolve(who: &AccountId, call: &Call) -> Option<AccountId>;
 }
 
 #[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 pub enum AccessMode {
-    Normal,
-    WhiteList,
+	Normal,
+	WhiteList,
 }
 impl Default for AccessMode {
-    fn default() -> Self {
-        Self::Normal
-    }
+	fn default() -> Self {
+		Self::Normal
+	}
 }
 
 #[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 pub enum SchemaVersion {
-    ImageURL,
-    Unique,
+	ImageURL,
+	Unique,
 }
 impl Default for SchemaVersion {
-    fn default() -> Self {
-        Self::ImageURL
-    }
+	fn default() -> Self {
+		Self::ImageURL
+	}
 }
 
 #[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 pub struct Ownership<AccountId> {
-    pub owner: AccountId,
-    pub fraction: u128,
+	pub owner: AccountId,
+	pub fraction: u128,
 }
 
 #[derive(Encode, Decode, Debug, Clone, PartialEq)]
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 pub enum SponsorshipState<AccountId> {
-    /// The fees are applied to the transaction sender
-    Disabled,
-    Unconfirmed(AccountId),
-    /// Transactions are sponsored by specified account
-    Confirmed(AccountId),
+	/// The fees are applied to the transaction sender
+	Disabled,
+	Unconfirmed(AccountId),
+	/// Transactions are sponsored by specified account
+	Confirmed(AccountId),
 }
 
 impl<AccountId> SponsorshipState<AccountId> {
-    pub fn sponsor(&self) -> Option<&AccountId> {
-        match self {
-            Self::Confirmed(sponsor) => Some(sponsor),
-            _ => None,
-        }
-    }
+	pub fn sponsor(&self) -> Option<&AccountId> {
+		match self {
+			Self::Confirmed(sponsor) => Some(sponsor),
+			_ => None,
+		}
+	}
 
-    pub fn pending_sponsor(&self) -> Option<&AccountId> {
-        match self {
-            Self::Unconfirmed(sponsor) | Self::Confirmed(sponsor) => Some(sponsor),
-            _ => None,
-        }
-    }
+	pub fn pending_sponsor(&self) -> Option<&AccountId> {
+		match self {
+			Self::Unconfirmed(sponsor) | Self::Confirmed(sponsor) => Some(sponsor),
+			_ => None,
+		}
+	}
 
-    pub fn confirmed(&self) -> bool {
-        matches!(self, Self::Confirmed(_))
-    }
+	pub fn confirmed(&self) -> bool {
+		matches!(self, Self::Confirmed(_))
+	}
 }
 
 impl<T> Default for SponsorshipState<T> {
-    fn default() -> Self {
-        Self::Disabled
-    }
+	fn default() -> Self {
+		Self::Disabled
+	}
 }
 
 #[derive(Encode, Decode, Clone, PartialEq)]
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 pub struct Collection<T: frame_system::Config> {
-    pub owner: T::AccountId,
-    pub mode: CollectionMode,
-    pub access: AccessMode,
-    pub decimal_points: DecimalPoints,
-    pub name: Vec<u16>,        // 64 include null escape char
-    pub description: Vec<u16>, // 256 include null escape char
-    pub token_prefix: Vec<u8>, // 16 include null escape char
-    pub mint_mode: bool,
-    pub offchain_schema: Vec<u8>,
-    pub schema_version: SchemaVersion,
-    pub sponsorship: SponsorshipState<T::AccountId>,
-    pub limits: CollectionLimits<T::BlockNumber>, // Collection private restrictions 
-    pub variable_on_chain_schema: Vec<u8>, //
-    pub const_on_chain_schema: Vec<u8>, //
+	pub owner: T::AccountId,
+	pub mode: CollectionMode,
+	pub access: AccessMode,
+	pub decimal_points: DecimalPoints,
+	pub name: Vec<u16>,        // 64 include null escape char
+	pub description: Vec<u16>, // 256 include null escape char
+	pub token_prefix: Vec<u8>, // 16 include null escape char
+	pub mint_mode: bool,
+	pub offchain_schema: Vec<u8>,
+	pub schema_version: SchemaVersion,
+	pub sponsorship: SponsorshipState<T::AccountId>,
+	pub limits: CollectionLimits<T::BlockNumber>, // Collection private restrictions
+	pub variable_on_chain_schema: Vec<u8>,        //
+	pub const_on_chain_schema: Vec<u8>,           //
 }
 
 #[derive(Encode, Decode, Debug, Clone, PartialEq)]
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 pub struct NftItemType<AccountId> {
-    pub owner: AccountId,
-    pub const_data: Vec<u8>,
-    pub variable_data: Vec<u8>,
+	pub owner: AccountId,
+	pub const_data: Vec<u8>,
+	pub variable_data: Vec<u8>,
 }
 
 #[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 pub struct FungibleItemType {
-    pub value: u128,
+	pub value: u128,
 }
 
 #[derive(Encode, Decode, Debug, Clone, PartialEq)]
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 pub struct ReFungibleItemType<AccountId> {
-    pub owner: Vec<Ownership<AccountId>>,
-    pub const_data: Vec<u8>,
-    pub variable_data: Vec<u8>,
+	pub owner: Vec<Ownership<AccountId>>,
+	pub const_data: Vec<u8>,
+	pub variable_data: Vec<u8>,
 }
-
 
 #[derive(Encode, Decode, Debug, Clone, PartialEq)]
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 pub struct CollectionLimits<BlockNumber: Encode + Decode> {
-    pub account_token_ownership_limit: u32,
-    pub sponsored_data_size: u32,
-    /// None - setVariableMetadata is not sponsored
-    /// Some(v) - setVariableMetadata is sponsored 
-    ///           if there is v block between txs
-    pub sponsored_data_rate_limit: Option<BlockNumber>,
-    pub token_limit: u32,
+	pub account_token_ownership_limit: u32,
+	pub sponsored_data_size: u32,
+	/// None - setVariableMetadata is not sponsored
+	/// Some(v) - setVariableMetadata is sponsored
+	///           if there is v block between txs
+	pub sponsored_data_rate_limit: Option<BlockNumber>,
+	pub token_limit: u32,
 
-    // Timeouts for item types in passed blocks
-    pub sponsor_transfer_timeout: u32,
-    pub owner_can_transfer: bool,
-    pub owner_can_destroy: bool,
+	// Timeouts for item types in passed blocks
+	pub sponsor_transfer_timeout: u32,
+	pub owner_can_transfer: bool,
+	pub owner_can_destroy: bool,
 }
 
 impl<BlockNumber: Encode + Decode> Default for CollectionLimits<BlockNumber> {
-    fn default() -> Self {
-        Self { 
-            account_token_ownership_limit: 10_000_000, 
-            token_limit: u32::max_value(),
-            sponsored_data_size: u32::MAX, 
-            sponsored_data_rate_limit: None,
-            sponsor_transfer_timeout: 14400,
-            owner_can_transfer: true,
-            owner_can_destroy: true
-        }
-    }
+	fn default() -> Self {
+		Self {
+			account_token_ownership_limit: 10_000_000,
+			token_limit: u32::max_value(),
+			sponsored_data_size: u32::MAX,
+			sponsored_data_rate_limit: None,
+			sponsor_transfer_timeout: 14400,
+			owner_can_transfer: true,
+			owner_can_destroy: true,
+		}
+	}
 }
 
 #[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 pub struct ChainLimits {
-    pub collection_numbers_limit: u32,
-    pub account_token_ownership_limit: u32,
-    pub collections_admins_limit: u64,
-    pub custom_data_limit: u32,
+	pub collection_numbers_limit: u32,
+	pub account_token_ownership_limit: u32,
+	pub collections_admins_limit: u64,
+	pub custom_data_limit: u32,
 
-    // Timeouts for item types in passed blocks
-    pub nft_sponsor_transfer_timeout: u32,
-    pub fungible_sponsor_transfer_timeout: u32,
-    pub refungible_sponsor_transfer_timeout: u32,
+	// Timeouts for item types in passed blocks
+	pub nft_sponsor_transfer_timeout: u32,
+	pub fungible_sponsor_transfer_timeout: u32,
+	pub refungible_sponsor_transfer_timeout: u32,
 
-    // Schema limits
-    pub offchain_schema_limit: u32,
-    pub variable_on_chain_schema_limit: u32,
-    pub const_on_chain_schema_limit: u32,
+	// Schema limits
+	pub offchain_schema_limit: u32,
+	pub variable_on_chain_schema_limit: u32,
+	pub const_on_chain_schema_limit: u32,
 }
 
-
 #[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 pub struct CreateNftData {
-    pub const_data: Vec<u8>,
-    pub variable_data: Vec<u8>,
+	pub const_data: Vec<u8>,
+	pub variable_data: Vec<u8>,
 }
 
 #[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 pub struct CreateFungibleData {
-    pub value: u128,
+	pub value: u128,
 }
 
 #[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 pub struct CreateReFungibleData {
-    pub const_data: Vec<u8>,
-    pub variable_data: Vec<u8>,
-    pub pieces: u128,
+	pub const_data: Vec<u8>,
+	pub variable_data: Vec<u8>,
+	pub pieces: u128,
 }
 
 #[derive(Encode, Decode, Debug, Clone, PartialEq)]
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 pub enum CreateItemData {
-    NFT(CreateNftData),
-    Fungible(CreateFungibleData),
-    ReFungible(CreateReFungibleData),
+	NFT(CreateNftData),
+	Fungible(CreateFungibleData),
+	ReFungible(CreateReFungibleData),
 }
 
 impl CreateItemData {
-    pub fn len(&self) -> usize {
-        let len = match self {
-            CreateItemData::NFT(data) => data.variable_data.len() + data.const_data.len(),
-            CreateItemData::ReFungible(data) => data.variable_data.len() + data.const_data.len(),
-            _ => 0
-        };
-        
-        return len;
-    }
+	pub fn data_size(&self) -> usize {
+		match self {
+			CreateItemData::NFT(data) => data.variable_data.len() + data.const_data.len(),
+			CreateItemData::ReFungible(data) => data.variable_data.len() + data.const_data.len(),
+			_ => 0,
+		}
+	}
 }
 
 impl From<CreateNftData> for CreateItemData {
-    fn from(item: CreateNftData) -> Self {
-        CreateItemData::NFT(item)
-    }
+	fn from(item: CreateNftData) -> Self {
+		CreateItemData::NFT(item)
+	}
 }
 
 impl From<CreateReFungibleData> for CreateItemData {
-    fn from(item: CreateReFungibleData) -> Self {
-        CreateItemData::ReFungible(item)
-    }
+	fn from(item: CreateReFungibleData) -> Self {
+		CreateItemData::ReFungible(item)
+	}
 }
 
 impl From<CreateFungibleData> for CreateItemData {
-    fn from(item: CreateFungibleData) -> Self {
-        CreateItemData::Fungible(item)
-    }
+	fn from(item: CreateFungibleData) -> Self {
+		CreateItemData::Fungible(item)
+	}
 }
modifiedruntime/Cargo.tomldiffbeforeafterboth
--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -95,38 +95,38 @@
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
 optional = true
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.frame-executive]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.frame-support]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.frame-system]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.frame-system-benchmarking]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
 optional = true
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.frame-system-rpc-runtime-api]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.hex-literal]
@@ -142,152 +142,152 @@
 [dependencies.pallet-aura]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-balances]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 # Contracts specific packages
 [dependencies.pallet-contracts]
 git = 'https://github.com/paritytech/substrate.git'
 default-features = false
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-contracts-primitives]
 git = 'https://github.com/paritytech/substrate.git'
 default-features = false
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-contracts-rpc-runtime-api]
 git = 'https://github.com/paritytech/substrate.git'
 default-features = false
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-randomness-collective-flip]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-sudo]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-timestamp]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-transaction-payment]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-transaction-payment-rpc-runtime-api]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-treasury]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.pallet-vesting]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-arithmetic]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-api]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-block-builder]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-core]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-consensus-aura]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '0.9.0'
 
 [dependencies.sp-inherents]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-io]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-offchain]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-runtime]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-session]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-std]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-transaction-pool]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.sp-version]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
 [dependencies.smallvec]
@@ -299,42 +299,47 @@
 [dependencies.parachain-info]
 default-features = false
 git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 version = '0.1.0'
 
 [dependencies.cumulus-pallet-aura-ext]
 git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 default-features = false
 
 [dependencies.cumulus-pallet-parachain-system]
 git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 default-features = false
 
 [dependencies.cumulus-primitives-core]
 git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 default-features = false
 
 [dependencies.cumulus-pallet-xcm]
 git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 default-features = false
 
 [dependencies.cumulus-pallet-dmp-queue]
 git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 default-features = false
 
 [dependencies.cumulus-pallet-xcmp-queue]
 git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
 default-features = false
 
 [dependencies.cumulus-primitives-utility]
 git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.3'
+branch = 'polkadot-v0.9.7'
+default-features = false
+
+[dependencies.cumulus-primitives-timestamp]
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.7'
 default-features = false
 
 ################################################################################
@@ -342,27 +347,27 @@
 
 [dependencies.polkadot-parachain]
 git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.3'
+branch = 'release-v0.9.7'
 default-features = false
 
 [dependencies.xcm]
 git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.3'
+branch = 'release-v0.9.7'
 default-features = false
 
 [dependencies.xcm-builder]
 git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.3'
+branch = 'release-v0.9.7'
 default-features = false
 
 [dependencies.xcm-executor]
 git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.3'
+branch = 'release-v0.9.7'
 default-features = false
 
 [dependencies.pallet-xcm]
 git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.3'
+branch = 'release-v0.9.7'
 default-features = false
 
 
@@ -379,8 +384,8 @@
 pallet-nft-transaction-payment = { path = '../pallets/nft-transaction-payment', default-features = false, version = '3.0.0' }
 pallet-nft-charge-transaction = { path = '../pallets/nft-charge-transaction', default-features = false, version = '3.0.0' }
 
-pallet-evm = { default-features = false, version = "4.0.0-dev", git = "https://github.com/usetech-llc/frontier.git", branch = "injected-transactions-parachain" }
-pallet-ethereum = { default-features = false, version = "2.0.0-dev", git = "https://github.com/usetech-llc/frontier.git", branch = "injected-transactions-parachain" }
+pallet-evm = { default-features = false, version = "5.0.0-dev", git = "https://github.com/usetech-llc/frontier.git", branch = "injected-transactions-parachain" }
+pallet-ethereum = { default-features = false, version = "3.0.0-dev", git = "https://github.com/usetech-llc/frontier.git", branch = "injected-transactions-parachain" }
 fp-rpc = { default-features = false, version = "2.0.0", git = "https://github.com/usetech-llc/frontier.git", branch = "injected-transactions-parachain" }
 
 ################################################################################
modifiedruntime/build.rsdiffbeforeafterboth
--- a/runtime/build.rs
+++ b/runtime/build.rs
@@ -1,9 +1,9 @@
 use substrate_wasm_builder::WasmBuilder;
 
 fn main() {
-    WasmBuilder::new()
-        .with_current_project()
-        .import_memory()
-        .export_heap_base()
-        .build()
-}
\ No newline at end of file
+	WasmBuilder::new()
+		.with_current_project()
+		.import_memory()
+		.export_heap_base()
+		.build()
+}
modifiedruntime/src/chain_extension.rsdiffbeforeafterboth
--- a/runtime/src/chain_extension.rs
+++ b/runtime/src/chain_extension.rs
@@ -9,7 +9,7 @@
 
 pub use pallet_contracts::chain_extension::RetVal;
 use pallet_contracts::chain_extension::{
-    ChainExtension, Environment, Ext, InitState, SysConfig, UncheckedFrom,
+	ChainExtension, Environment, Ext, InitState, SysConfig, UncheckedFrom,
 };
 
 pub use frame_support::debug;
@@ -25,56 +25,56 @@
 /// Create item parameters
 #[derive(Debug, PartialEq, Encode, Decode)]
 pub struct NFTExtCreateItem<E: Ext> {
-    pub owner: <E::T as SysConfig>::AccountId,
-    pub collection_id: u32,
-    pub data: CreateItemData,
+	pub owner: <E::T as SysConfig>::AccountId,
+	pub collection_id: u32,
+	pub data: CreateItemData,
 }
 
 /// Transfer parameters
 #[derive(Debug, PartialEq, Encode, Decode)]
 pub struct NFTExtTransfer<E: Ext> {
-    pub recipient: <E::T as SysConfig>::AccountId,
-    pub collection_id: u32,
-    pub token_id: u32,
-    pub amount: u128,
+	pub recipient: <E::T as SysConfig>::AccountId,
+	pub collection_id: u32,
+	pub token_id: u32,
+	pub amount: u128,
 }
 
 #[derive(Debug, PartialEq, Encode, Decode)]
 pub struct NFTExtCreateMultipleItems<E: Ext> {
-    pub owner: <E::T as SysConfig>::AccountId,
-    pub collection_id: u32,
-    pub data: Vec<CreateItemData>,
+	pub owner: <E::T as SysConfig>::AccountId,
+	pub collection_id: u32,
+	pub data: Vec<CreateItemData>,
 }
 
 #[derive(Debug, PartialEq, Encode, Decode)]
 pub struct NFTExtApprove<E: Ext> {
-    pub spender: <E::T as SysConfig>::AccountId,
-    pub collection_id: u32,
-    pub item_id: u32,
-    pub amount: u128,
+	pub spender: <E::T as SysConfig>::AccountId,
+	pub collection_id: u32,
+	pub item_id: u32,
+	pub amount: u128,
 }
 
 #[derive(Debug, PartialEq, Encode, Decode)]
 pub struct NFTExtTransferFrom<E: Ext> {
-    pub owner: <E::T as SysConfig>::AccountId,
-    pub recipient: <E::T as SysConfig>::AccountId,
-    pub collection_id: u32,
-    pub item_id: u32,
-    pub amount: u128,
+	pub owner: <E::T as SysConfig>::AccountId,
+	pub recipient: <E::T as SysConfig>::AccountId,
+	pub collection_id: u32,
+	pub item_id: u32,
+	pub amount: u128,
 }
 
 #[derive(Debug, PartialEq, Encode, Decode)]
 pub struct NFTExtSetVariableMetaData {
-    pub collection_id: u32,
-    pub item_id: u32,
-    pub data: Vec<u8>,   
+	pub collection_id: u32,
+	pub item_id: u32,
+	pub data: Vec<u8>,
 }
 
 #[derive(Debug, PartialEq, Encode, Decode)]
 pub struct NFTExtToggleWhiteList<E: Ext> {
-    pub collection_id: u32,
-    pub address: <E::T as SysConfig>::AccountId,
-    pub whitelisted: bool,
+	pub collection_id: u32,
+	pub address: <E::T as SysConfig>::AccountId,
+	pub whitelisted: bool,
 }
 
 /// The chain Extension of NFT pallet
@@ -83,150 +83,146 @@
 pub type NftWeightInfoOf<C> = <C as pallet_nft::Config>::WeightInfo;
 
 impl<C: Config + pallet_contracts::Config> ChainExtension<C> for NFTExtension {
-    fn call<E: Ext>(func_id: u32, env: Environment<E, InitState>) -> Result<RetVal, DispatchError>
-    where
-        E: Ext<T = C>,
-        C: pallet_nft::Config,
-        <E::T as SysConfig>::AccountId: UncheckedFrom<<E::T as SysConfig>::Hash> + AsRef<[u8]>,
-    {
-        // The memory of the vm stores buf in scale-codec
-        match func_id {
-            0 => {
-                let mut env = env.buf_in_buf_out();
-                let input: NFTExtTransfer<E> = env.read_as()?;
-                env.charge_weight(NftWeightInfoOf::<C>::transfer())?;
+	fn call<E: Ext>(func_id: u32, env: Environment<E, InitState>) -> Result<RetVal, DispatchError>
+	where
+		E: Ext<T = C>,
+		C: pallet_nft::Config,
+		<E::T as SysConfig>::AccountId: UncheckedFrom<<E::T as SysConfig>::Hash> + AsRef<[u8]>,
+	{
+		// The memory of the vm stores buf in scale-codec
+		match func_id {
+			0 => {
+				let mut env = env.buf_in_buf_out();
+				let input: NFTExtTransfer<E> = env.read_as()?;
+				env.charge_weight(NftWeightInfoOf::<C>::transfer())?;
 
-                let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
+				let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
 
-                pallet_nft::Module::<C>::transfer_internal(
-                    &C::CrossAccountId::from_sub(env.ext().address().clone()),
-                    &C::CrossAccountId::from_sub(input.recipient),
-                    &collection,
-                    input.token_id,
-                    input.amount,
-                )?;
+				pallet_nft::Module::<C>::transfer_internal(
+					&C::CrossAccountId::from_sub(env.ext().address().clone()),
+					&C::CrossAccountId::from_sub(input.recipient),
+					&collection,
+					input.token_id,
+					input.amount,
+				)?;
 
-                pallet_nft::Module::<C>::submit_logs(collection)?;
-                Ok(RetVal::Converging(0))
-            },
-            1 => {
-                // Create Item
-                let mut env = env.buf_in_buf_out();
-                let input: NFTExtCreateItem<E> = env.read_as()?;
-                env.charge_weight(NftWeightInfoOf::<C>::create_item(input.data.len()))?;
+				pallet_nft::Module::<C>::submit_logs(collection)?;
+				Ok(RetVal::Converging(0))
+			}
+			1 => {
+				// Create Item
+				let mut env = env.buf_in_buf_out();
+				let input: NFTExtCreateItem<E> = env.read_as()?;
+				env.charge_weight(NftWeightInfoOf::<C>::create_item(input.data.data_size()))?;
 
-                let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
+				let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
 
-                pallet_nft::Module::<C>::create_item_internal(
-                    &C::CrossAccountId::from_sub(env.ext().address().clone()),
-                    &collection,
-                    &C::CrossAccountId::from_sub(input.owner),
-                    input.data,
-                )?;
+				pallet_nft::Module::<C>::create_item_internal(
+					&C::CrossAccountId::from_sub(env.ext().address().clone()),
+					&collection,
+					&C::CrossAccountId::from_sub(input.owner),
+					input.data,
+				)?;
 
-                pallet_nft::Module::<C>::submit_logs(collection)?;
-                Ok(RetVal::Converging(0))
-            },
-            2 => {
-                // Create multiple items
-                let mut env = env.buf_in_buf_out();
-                let input: NFTExtCreateMultipleItems<E> = env.read_as()?;
-                env.charge_weight(NftWeightInfoOf::<C>::create_item(
-                    input.data.iter()
-                        .map(|i| i.len())
-                        .sum()
-                ))?;
+				pallet_nft::Module::<C>::submit_logs(collection)?;
+				Ok(RetVal::Converging(0))
+			}
+			2 => {
+				// Create multiple items
+				let mut env = env.buf_in_buf_out();
+				let input: NFTExtCreateMultipleItems<E> = env.read_as()?;
+				env.charge_weight(NftWeightInfoOf::<C>::create_item(
+					input.data.iter().map(|i| i.data_size()).sum(),
+				))?;
 
-                let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
+				let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
 
-                pallet_nft::Module::<C>::create_multiple_items_internal(
-                    &C::CrossAccountId::from_sub(env.ext().address().clone()),
-                    &collection,
-                    &C::CrossAccountId::from_sub(input.owner),
-                    input.data,
-                )?;
+				pallet_nft::Module::<C>::create_multiple_items_internal(
+					&C::CrossAccountId::from_sub(env.ext().address().clone()),
+					&collection,
+					&C::CrossAccountId::from_sub(input.owner),
+					input.data,
+				)?;
 
-                pallet_nft::Module::<C>::submit_logs(collection)?;
-                Ok(RetVal::Converging(0))
-            },
-            3 => {
-                // Approve
-                let mut env = env.buf_in_buf_out();
-                let input: NFTExtApprove<E> = env.read_as()?;
-                env.charge_weight(NftWeightInfoOf::<C>::approve())?;
+				pallet_nft::Module::<C>::submit_logs(collection)?;
+				Ok(RetVal::Converging(0))
+			}
+			3 => {
+				// Approve
+				let mut env = env.buf_in_buf_out();
+				let input: NFTExtApprove<E> = env.read_as()?;
+				env.charge_weight(NftWeightInfoOf::<C>::approve())?;
 
-                let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
+				let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
 
-                pallet_nft::Module::<C>::approve_internal(
-                    &C::CrossAccountId::from_sub(env.ext().address().clone()),
-                    &C::CrossAccountId::from_sub(input.spender),
-                    &collection,
-                    input.item_id,
-                    input.amount,
-                )?;
+				pallet_nft::Module::<C>::approve_internal(
+					&C::CrossAccountId::from_sub(env.ext().address().clone()),
+					&C::CrossAccountId::from_sub(input.spender),
+					&collection,
+					input.item_id,
+					input.amount,
+				)?;
 
-                pallet_nft::Module::<C>::submit_logs(collection)?;
-                Ok(RetVal::Converging(0))
-            },
-            4 => {
-                // Transfer from
-                let mut env = env.buf_in_buf_out();
-                let input: NFTExtTransferFrom<E> = env.read_as()?;
-                env.charge_weight(NftWeightInfoOf::<C>::transfer_from())?;
+				pallet_nft::Module::<C>::submit_logs(collection)?;
+				Ok(RetVal::Converging(0))
+			}
+			4 => {
+				// Transfer from
+				let mut env = env.buf_in_buf_out();
+				let input: NFTExtTransferFrom<E> = env.read_as()?;
+				env.charge_weight(NftWeightInfoOf::<C>::transfer_from())?;
 
-                let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
+				let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
 
-                pallet_nft::Module::<C>::transfer_from_internal(
-                    &C::CrossAccountId::from_sub(env.ext().address().clone()),
-                    &C::CrossAccountId::from_sub(input.owner),
-                    &C::CrossAccountId::from_sub(input.recipient),
-                    &collection,
-                    input.item_id,
-                    input.amount
-                )?;
+				pallet_nft::Module::<C>::transfer_from_internal(
+					&C::CrossAccountId::from_sub(env.ext().address().clone()),
+					&C::CrossAccountId::from_sub(input.owner),
+					&C::CrossAccountId::from_sub(input.recipient),
+					&collection,
+					input.item_id,
+					input.amount,
+				)?;
 
-                pallet_nft::Module::<C>::submit_logs(collection)?;
-                Ok(RetVal::Converging(0))
-            },
-            5 => {
-                // Set variable metadata
-                let mut env = env.buf_in_buf_out();
-                let input: NFTExtSetVariableMetaData = env.read_as()?;
-                env.charge_weight(NftWeightInfoOf::<C>::set_variable_meta_data())?;
+				pallet_nft::Module::<C>::submit_logs(collection)?;
+				Ok(RetVal::Converging(0))
+			}
+			5 => {
+				// Set variable metadata
+				let mut env = env.buf_in_buf_out();
+				let input: NFTExtSetVariableMetaData = env.read_as()?;
+				env.charge_weight(NftWeightInfoOf::<C>::set_variable_meta_data())?;
 
-                let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
+				let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
 
-                pallet_nft::Module::<C>::set_variable_meta_data_internal(
-                    &C::CrossAccountId::from_sub(env.ext().address().clone()),
-                    &collection,
-                    input.item_id,
-                    input.data,
-                )?;
+				pallet_nft::Module::<C>::set_variable_meta_data_internal(
+					&C::CrossAccountId::from_sub(env.ext().address().clone()),
+					&collection,
+					input.item_id,
+					input.data,
+				)?;
 
-                pallet_nft::Module::<C>::submit_logs(collection)?;
-                Ok(RetVal::Converging(0))
-            },
-            6 => {
-                // Toggle whitelist
-                let mut env = env.buf_in_buf_out();
-                let input: NFTExtToggleWhiteList<E> = env.read_as()?;
-                env.charge_weight(NftWeightInfoOf::<C>::add_to_white_list())?;
+				pallet_nft::Module::<C>::submit_logs(collection)?;
+				Ok(RetVal::Converging(0))
+			}
+			6 => {
+				// Toggle whitelist
+				let mut env = env.buf_in_buf_out();
+				let input: NFTExtToggleWhiteList<E> = env.read_as()?;
+				env.charge_weight(NftWeightInfoOf::<C>::add_to_white_list())?;
 
-                let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
+				let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
 
-                pallet_nft::Module::<C>::toggle_white_list_internal(
-                    &C::CrossAccountId::from_sub(env.ext().address().clone()),
-                    &collection,
-                    &C::CrossAccountId::from_sub(input.address),
-                    input.whitelisted,
-                )?;
+				pallet_nft::Module::<C>::toggle_white_list_internal(
+					&C::CrossAccountId::from_sub(env.ext().address().clone()),
+					&collection,
+					&C::CrossAccountId::from_sub(input.address),
+					input.whitelisted,
+				)?;
 
-                pallet_nft::Module::<C>::submit_logs(collection)?;
-                Ok(RetVal::Converging(0))
-            }
-            _ => {
-                Err(DispatchError::Other("unknown chain_extension func_id"))
-            }
-        }
-    }
+				pallet_nft::Module::<C>::submit_logs(collection)?;
+				Ok(RetVal::Converging(0))
+			}
+			_ => Err(DispatchError::Other("unknown chain_extension func_id")),
+		}
+	}
 }
modifiedruntime/src/lib.rsdiffbeforeafterboth
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -8,25 +8,25 @@
 #![cfg_attr(not(feature = "std"), no_std)]
 // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
 #![recursion_limit = "1024"]
-
+#![allow(clippy::from_over_into, clippy::identity_op)]
+#![allow(clippy::fn_to_numeric_cast_with_truncation)]
 // Make the WASM binary available.
 #[cfg(feature = "std")]
 include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
 
 use sp_api::impl_runtime_apis;
-use sp_core::{ crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160 };
+use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};
 // #[cfg(any(feature = "std", test))]
 // pub use sp_runtime::BuildStorage;
 
 use sp_runtime::{
-    Permill, Perbill, Percent,
-    create_runtime_str, generic, impl_opaque_keys,
-    traits::{
-        AccountIdLookup, ConvertInto, BlakeTwo256, Block as BlockT, IdentifyAccount, 
-		Verify, AccountIdConversion,
-    },
-    transaction_validity::{TransactionSource, TransactionValidity},
-    ApplyExtrinsicResult, MultiSignature,
+	Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,
+	traits::{
+		AccountIdLookup, ConvertInto, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify,
+		AccountIdConversion,
+	},
+	transaction_validity::{TransactionSource, TransactionValidity},
+	ApplyExtrinsicResult, MultiSignature,
 };
 
 use sp_std::prelude::*;
@@ -34,48 +34,45 @@
 #[cfg(feature = "std")]
 use sp_version::NativeVersion;
 use sp_version::RuntimeVersion;
-pub use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo};
+pub use pallet_transaction_payment::{
+	Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,
+};
 // A few exports that help ease life for downstream crates.
 pub use pallet_balances::Call as BalancesCall;
 pub use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping, Runner};
 pub use frame_support::{
-    construct_runtime,
-	match_type,
-    dispatch::DispatchResult,
-	PalletId,
-    parameter_types,
-    StorageValue,
-	ConsensusEngineId,
-    traits::{
-        All, Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier, OnUnbalanced, Randomness, FindAuthor
-    },
-    weights::{
-        constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
-        DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,
-        WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients
-    },
+	construct_runtime, match_type,
+	dispatch::DispatchResult,
+	PalletId, parameter_types, StorageValue, ConsensusEngineId,
+	traits::{
+		All, Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier,
+		OnUnbalanced, Randomness, FindAuthor,
+	},
+	weights::{
+		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
+		DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,
+		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,
+	},
 };
 use nft_data_structs::*;
 use pallet_contracts::weights::WeightInfo;
 // #[cfg(any(feature = "std", test))]
 use frame_system::{
-    self as system,
-    EnsureRoot, EnsureSigned,
+	self as system, EnsureRoot, EnsureSigned,
 	limits::{BlockWeights, BlockLength},
 };
-use sp_arithmetic::{traits::{BaseArithmetic, Unsigned}};
+use sp_arithmetic::{
+	traits::{BaseArithmetic, Unsigned},
+};
 use smallvec::smallvec;
 use codec::{Encode, Decode};
 use pallet_evm::{Account as EVMAccount, FeeCalculator, OnMethodCall};
 use fp_rpc::TransactionStatus;
 use sp_core::crypto::Public;
 use sp_runtime::{
-	traits::{ 
-		Dispatchable,
-	},
+	traits::{Dispatchable},
 };
 use pallet_contracts::chain_extension::UncheckedFrom;
-
 
 pub use pallet_timestamp::Call as TimestampCall;
 pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
@@ -94,9 +91,8 @@
 };
 use xcm_executor::{Config, XcmExecutor};
 
-
 mod chain_extension;
-use crate::chain_extension::{ NFTExtension, Imbalance };
+use crate::chain_extension::{NFTExtension, Imbalance};
 
 /// Re-export a nft pallet
 /// TODO: Check this re-export. Is this safe and good style?
@@ -144,16 +140,16 @@
 
 	pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
 
-    /// Opaque block type.
-    pub type Block = generic::Block<Header, UncheckedExtrinsic>;
+	/// Opaque block type.
+	pub type Block = generic::Block<Header, UncheckedExtrinsic>;
 
-    pub type SessionHandlers = ();
+	pub type SessionHandlers = ();
 
 	impl_opaque_keys! {
-        pub struct SessionKeys {
+		pub struct SessionKeys {
 			pub aura: Aura,
 		}
-    }
+	}
 }
 
 /// This runtime version.
@@ -178,8 +174,8 @@
 
 #[derive(codec::Encode, codec::Decode)]
 pub enum XCMPMessage<XAccountId, XBalance> {
-    /// Transfer tokens to the given account from the Parachain account.
-    TransferToken(XAccountId, XBalance),
+	/// Transfer tokens to the given account from the Parachain account.
+	TransferToken(XAccountId, XBalance),
 }
 
 /// The version information used to identify this runtime when compiled natively.
@@ -195,7 +191,7 @@
 
 pub struct DealWithFees;
 impl OnUnbalanced<NegativeImbalance> for DealWithFees {
-	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item=NegativeImbalance>) {
+	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {
 		if let Some(fees) = fees_then_tips.next() {
 			// for fees, 100% to treasury
 			let mut split = fees.ration(100, 0);
@@ -245,7 +241,6 @@
 	pub const Version: RuntimeVersion = VERSION;
 	pub const SS58Prefix: u8 = 42;
 }
-
 
 parameter_types! {
 	pub const ChainId: u64 = 8888;
@@ -255,6 +250,7 @@
 	type BlockGasLimit = BlockGasLimit;
 	type FeeCalculator = ();
 	type GasWeightMapping = ();
+	type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping;
 	type CallOrigin = EnsureAddressTruncated;
 	type WithdrawOrigin = EnsureAddressTruncated;
 	type AddressMapping = HashedAddressMapping<Self::Hashing>;
@@ -268,10 +264,10 @@
 }
 
 pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);
-impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F>
-{
-	fn find_author<'a, I>(digests: I) -> Option<H160> where
-		I: 'a + IntoIterator<Item=(ConsensusEngineId, &'a [u8])>
+impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {
+	fn find_author<'a, I>(digests: I) -> Option<H160>
+	where
+		I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,
 	{
 		if let Some(author_index) = F::find_author(digests) {
 			let authority_id = Aura::authorities()[author_index as usize].clone();
@@ -292,52 +288,54 @@
 	type EvmSubmitLog = pallet_evm::Pallet<Runtime>;
 }
 
+impl pallet_randomness_collective_flip::Config for Runtime {}
+
 impl system::Config for Runtime {
-    /// The data to be stored in an account.
-    type AccountData = pallet_balances::AccountData<Balance>;
-    /// The identifier used to distinguish between accounts.
-    type AccountId = AccountId;
-    /// The basic call filter to use in dispatchable.
-    type BaseCallFilter = ();
-    /// Maximum number of block number to block hash mappings to keep (oldest pruned first).
-    type BlockHashCount = BlockHashCount;
-    /// The maximum length of a block (in bytes).
+	/// The data to be stored in an account.
+	type AccountData = pallet_balances::AccountData<Balance>;
+	/// The identifier used to distinguish between accounts.
+	type AccountId = AccountId;
+	/// The basic call filter to use in dispatchable.
+	type BaseCallFilter = ();
+	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
+	type BlockHashCount = BlockHashCount;
+	/// The maximum length of a block (in bytes).
 	type BlockLength = RuntimeBlockLength;
-    /// The index type for blocks.
-    type BlockNumber = BlockNumber;
-    /// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.
+	/// The index type for blocks.
+	type BlockNumber = BlockNumber;
+	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.
 	type BlockWeights = RuntimeBlockWeights;
-    /// The aggregated dispatch type that is available for extrinsics.
-    type Call = Call;
-    /// The weight of database operations that the runtime can invoke.
-    type DbWeight = RocksDbWeight;
-    /// The ubiquitous event type.
-    type Event = Event;
-    /// The type for hashing blocks and tries.
-    type Hash = Hash;
+	/// The aggregated dispatch type that is available for extrinsics.
+	type Call = Call;
+	/// The weight of database operations that the runtime can invoke.
+	type DbWeight = RocksDbWeight;
+	/// The ubiquitous event type.
+	type Event = Event;
+	/// The type for hashing blocks and tries.
+	type Hash = Hash;
 	/// The hashing algorithm used.
-    type Hashing = BlakeTwo256;
-    /// The header type.
-    type Header = generic::Header<BlockNumber, BlakeTwo256>;
-    /// The index type for storing how many extrinsics an account has signed.
-    type Index = Index;
-    /// The lookup mechanism to get account ID from whatever is passed in dispatchers.
-    type Lookup = AccountIdLookup<AccountId, ()>;
-    /// What to do if an account is fully reaped from the system.
-    type OnKilledAccount = ();
-    /// What to do if a new account is created.
-    type OnNewAccount = ();
-    type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
-    /// The ubiquitous origin type.
-    type Origin = Origin;
- 	/// This type is being generated by `construct_runtime!`.
-    type PalletInfo = PalletInfo;
-    /// This is used as an identifier of the chain. 42 is the generic substrate prefix.
+	type Hashing = BlakeTwo256;
+	/// The header type.
+	type Header = generic::Header<BlockNumber, BlakeTwo256>;
+	/// The index type for storing how many extrinsics an account has signed.
+	type Index = Index;
+	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
+	type Lookup = AccountIdLookup<AccountId, ()>;
+	/// What to do if an account is fully reaped from the system.
+	type OnKilledAccount = ();
+	/// What to do if a new account is created.
+	type OnNewAccount = ();
+	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
+	/// The ubiquitous origin type.
+	type Origin = Origin;
+	/// This type is being generated by `construct_runtime!`.
+	type PalletInfo = PalletInfo;
+	/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
 	type SS58Prefix = SS58Prefix;
 	/// Weight information for the extrinsics of this pallet.
-    type SystemWeightInfo = system::weights::SubstrateWeight<Runtime>;
-    /// Version of the runtime.
-    type Version = Version;
+	type SystemWeightInfo = system::weights::SubstrateWeight<Runtime>;
+	/// Version of the runtime.
+	type Version = Version;
 }
 
 parameter_types! {
@@ -360,6 +358,8 @@
 
 impl pallet_balances::Config for Runtime {
 	type MaxLocks = MaxLocks;
+	type MaxReserves = ();
+	type ReserveIdentifier = [u8; 8];
 	/// The type for recording an account's balance.
 	type Balance = Balance;
 	/// The ubiquitous event type.
@@ -373,7 +373,7 @@
 pub const MICROUNIQUE: Balance = 1_000_000_000;
 pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;
 pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;
-pub const UNIQUE: Balance      = 100 * CENTIUNIQUE;
+pub const UNIQUE: Balance = 100 * CENTIUNIQUE;
 
 pub const fn deposit(items: u32, bytes: u32) -> Balance {
 	items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE
@@ -437,8 +437,9 @@
 /// Linear implementor of `WeightToFeePolynomial`
 pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);
 
-impl<T> WeightToFeePolynomial for LinearFee<T> where
-	T: BaseArithmetic + From<u32> + Copy + Unsigned
+impl<T> WeightToFeePolynomial for LinearFee<T>
+where
+	T: BaseArithmetic + From<u32> + Copy + Unsigned,
 {
 	type Balance = T;
 
@@ -622,12 +623,12 @@
 	type AssetTransactor = LocalAssetTransactor;
 	type OriginConverter = XcmOriginToTransactDispatchOrigin;
 	type IsReserve = NativeAsset;
-	type IsTeleporter = NativeAsset;	// <- should be enough to allow teleportation of ROC
+	type IsTeleporter = NativeAsset; // <- should be enough to allow teleportation of ROC
 	type LocationInverter = LocationInverter<Ancestry>;
 	type Barrier = Barrier;
 	type Weigher = FixedWeightBounds<UnitWeightCost, Call>;
 	type Trader = UsingComponents<IdentityFee<Balance>, RelayLocation, AccountId, Balances, ()>;
-	type ResponseHandler = ();	// Don't handle responses for now.
+	type ResponseHandler = (); // Don't handle responses for now.
 }
 
 // parameter_types! {
@@ -689,7 +690,6 @@
 	type Event = Event;
 	type WeightInfo = nft_weights::WeightInfo;
 
-	type EvmWithdrawOrigin = EnsureAddressTruncated;
 	type EvmBackwardsAddressMapping = pallet_nft::MapBackwardsAddressTruncated;
 	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;
 	type CrossAccountId = pallet_nft::BasicCrossAccountId<Self>;
@@ -721,14 +721,13 @@
 
 pub struct Sponsoring;
 impl SponsoringResolve<AccountId, Call> for Sponsoring {
-
-	fn resolve(who: &AccountId, call: &Call) -> Option<AccountId> 
-	where 
-		Call: Dispatchable<Info=DispatchInfo>,
-		Call: IsSubType<pallet_nft::Call<Runtime>>, 
+	fn resolve(who: &AccountId, call: &Call) -> Option<AccountId>
+	where
+		Call: Dispatchable<Info = DispatchInfo>,
+		Call: IsSubType<pallet_nft::Call<Runtime>>,
 		Call: IsSubType<pallet_contracts::Call<Runtime>>,
 		AccountId: AsRef<[u8]>,
-		AccountId: UncheckedFrom<Hash>
+		AccountId: UncheckedFrom<Hash>,
 	{
 		pallet_nft_transaction_payment::Module::<Runtime>::withdraw_type(who, call)
 	}
@@ -736,7 +735,7 @@
 
 type SponsorshipHandler = (
 	pallet_nft::NftSponsorshipHandler<Runtime>,
-    pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,
+	pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,
 );
 
 impl pallet_scheduler::Config for Runtime {
@@ -760,20 +759,20 @@
 impl pallet_contract_helpers::Config for Runtime {}
 
 construct_runtime!(
-    pub enum Runtime where
-        Block = Block,
-        NodeBlock = opaque::Block,
-        UncheckedExtrinsic = UncheckedExtrinsic
-    {
+	pub enum Runtime where
+		Block = Block,
+		NodeBlock = opaque::Block,
+		UncheckedExtrinsic = UncheckedExtrinsic
+	{
 		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,
 		Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>},
 		RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage},
 		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
 		TransactionPayment: pallet_transaction_payment::{Pallet, Storage},
-        Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>},
+		Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>},
 		Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>},
 		System: system::{Pallet, Call, Storage, Config, Event<T>},
-        Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>},
+		Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>},
 
 		ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,
 		ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,
@@ -793,28 +792,36 @@
 
 
 		// Unique Pallets
-        Inflation: pallet_inflation::{Pallet, Call, Storage},
+		Inflation: pallet_inflation::{Pallet, Call, Storage},
 		Nft: pallet_nft::{Pallet, Call, Config<T>, Storage, Event<T>},
 		Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>},
 		NftPayment: pallet_nft_transaction_payment::{Pallet, Call, Storage},
 		Charging: pallet_nft_charge_transaction::{Pallet, Call, Storage },
 		ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage},
-    }
+	}
 );
 
 pub struct TransactionConverter;
 
 impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {
 	fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {
-		UncheckedExtrinsic::new_unsigned(pallet_ethereum::Call::<Runtime>::transact(transaction).into())
+		UncheckedExtrinsic::new_unsigned(
+			pallet_ethereum::Call::<Runtime>::transact(transaction).into(),
+		)
 	}
 }
 
 impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {
-	fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> opaque::UncheckedExtrinsic {
-		let extrinsic = UncheckedExtrinsic::new_unsigned(pallet_ethereum::Call::<Runtime>::transact(transaction).into());
+	fn convert_transaction(
+		&self,
+		transaction: pallet_ethereum::Transaction,
+	) -> opaque::UncheckedExtrinsic {
+		let extrinsic = UncheckedExtrinsic::new_unsigned(
+			pallet_ethereum::Call::<Runtime>::transact(transaction).into(),
+		);
 		let encoded = extrinsic.encode();
-		opaque::UncheckedExtrinsic::decode(&mut &encoded[..]).expect("Encoded extrinsic is always valid")
+		opaque::UncheckedExtrinsic::decode(&mut &encoded[..])
+			.expect("Encoded extrinsic is always valid")
 	}
 }
 
@@ -830,13 +837,13 @@
 pub type BlockId = generic::BlockId<Block>;
 /// The SignedExtension to the basic transaction logic.
 pub type SignedExtra = (
-    system::CheckSpecVersion<Runtime>,
-    // system::CheckTxVersion<Runtime>,
-    system::CheckGenesis<Runtime>,
-    system::CheckEra<Runtime>,
-    system::CheckNonce<Runtime>,
-    system::CheckWeight<Runtime>,
-    pallet_nft_charge_transaction::ChargeTransactionPayment<Runtime>,
+	system::CheckSpecVersion<Runtime>,
+	// system::CheckTxVersion<Runtime>,
+	system::CheckGenesis<Runtime>,
+	system::CheckEra<Runtime>,
+	system::CheckNonce<Runtime>,
+	system::CheckWeight<Runtime>,
+	pallet_nft_charge_transaction::ChargeTransactionPayment<Runtime>,
 	pallet_contract_helpers::ContractHelpersExtension<Runtime>,
 );
 /// Unchecked extrinsic type as expected by this runtime.
@@ -845,11 +852,11 @@
 pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
 /// Executive: handles dispatch to the various modules.
 pub type Executive = frame_executive::Executive<
-    Runtime,
-    Block,
-    frame_system::ChainContext<Runtime>,
-    Runtime,
-    AllPallets,
+	Runtime,
+	Block,
+	frame_system::ChainContext<Runtime>,
+	Runtime,
+	AllPallets,
 >;
 
 impl_opaque_keys! {
@@ -867,59 +874,59 @@
 		}
 	}
 
-    impl sp_api::Core<Block> for Runtime {
-        fn version() -> RuntimeVersion {
-            VERSION
-        }
+	impl sp_api::Core<Block> for Runtime {
+		fn version() -> RuntimeVersion {
+			VERSION
+		}
 
-        fn execute_block(block: Block) {
-            Executive::execute_block(block)
-        }
+		fn execute_block(block: Block) {
+			Executive::execute_block(block)
+		}
 
-        fn initialize_block(header: &<Block as BlockT>::Header) {
-            Executive::initialize_block(header)
-        }
-    }
+		fn initialize_block(header: &<Block as BlockT>::Header) {
+			Executive::initialize_block(header)
+		}
+	}
 
-    impl sp_api::Metadata<Block> for Runtime {
-        fn metadata() -> OpaqueMetadata {
-            Runtime::metadata().into()
-        }
-    }
+	impl sp_api::Metadata<Block> for Runtime {
+		fn metadata() -> OpaqueMetadata {
+			Runtime::metadata().into()
+		}
+	}
 
-    impl sp_block_builder::BlockBuilder<Block> for Runtime {
-        fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
-            Executive::apply_extrinsic(extrinsic)
-        }
+	impl sp_block_builder::BlockBuilder<Block> for Runtime {
+		fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
+			Executive::apply_extrinsic(extrinsic)
+		}
 
-        fn finalize_block() -> <Block as BlockT>::Header {
-            Executive::finalize_block()
-        }
+		fn finalize_block() -> <Block as BlockT>::Header {
+			Executive::finalize_block()
+		}
 
-        fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
-            data.create_extrinsics()
-        }
+		fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
+			data.create_extrinsics()
+		}
 
-        fn check_inherents(
-            block: Block,
-            data: sp_inherents::InherentData,
-        ) -> sp_inherents::CheckInherentsResult {
-            data.check_extrinsics(&block)
-        }
+		fn check_inherents(
+			block: Block,
+			data: sp_inherents::InherentData,
+		) -> sp_inherents::CheckInherentsResult {
+			data.check_extrinsics(&block)
+		}
 
-        // fn random_seed() -> <Block as BlockT>::Hash {
-        //     RandomnessCollectiveFlip::random_seed().0
-        // }
-    }
+		// fn random_seed() -> <Block as BlockT>::Hash {
+		//     RandomnessCollectiveFlip::random_seed().0
+		// }
+	}
 
-    impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
-        fn validate_transaction(
-            source: TransactionSource,
-            tx: <Block as BlockT>::Extrinsic,
-        ) -> TransactionValidity {
-            Executive::validate_transaction(source, tx)
-        }
-    }
+	impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
+		fn validate_transaction(
+			source: TransactionSource,
+			tx: <Block as BlockT>::Extrinsic,
+		) -> TransactionValidity {
+			Executive::validate_transaction(source, tx)
+		}
+	}
 
 	impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
 		fn offchain_worker(header: &<Block as BlockT>::Header) {
@@ -980,7 +987,7 @@
 				gas_limit.low_u64(),
 				gas_price,
 				nonce,
-				config.as_ref().unwrap_or(<Runtime as pallet_evm::Config>::config()),
+				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),
 			).map_err(|err| err.into())
 		}
 
@@ -1008,7 +1015,7 @@
 				gas_limit.low_u64(),
 				gas_price,
 				nonce,
-				config.as_ref().unwrap_or(<Runtime as pallet_evm::Config>::config()),
+				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),
 			).map_err(|err| err.into())
 		}
 
@@ -1119,7 +1126,7 @@
 		}
 	}
 
-    #[cfg(feature = "runtime-benchmarks")]
+	#[cfg(feature = "runtime-benchmarks")]
 	impl frame_benchmarking::Benchmark<Block> for Runtime {
 		fn dispatch_benchmark(
 			config: frame_benchmarking::BenchmarkConfig
@@ -1151,7 +1158,31 @@
 	}
 }
 
+struct CheckInherents;
+
+impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
+	fn check_inherents(
+		block: &Block,
+		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,
+	) -> sp_inherents::CheckInherentsResult {
+		let relay_chain_slot = relay_state_proof
+			.read_slot()
+			.expect("Could not read the relay chain slot from the proof");
+
+		let inherent_data =
+			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(
+				relay_chain_slot,
+				sp_std::time::Duration::from_secs(6),
+			)
+			.create_inherent_data()
+			.expect("Could not create the timestamp inherent data");
+
+		inherent_data.check_extrinsics(&block)
+	}
+}
+
 cumulus_pallet_parachain_system::register_validate_block!(
-	Runtime,
-	cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
+	Runtime = Runtime,
+	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
+	CheckInherents = CheckInherents,
 );
modifiedruntime/src/nft_weights.rsdiffbeforeafterboth
--- a/runtime/src/nft_weights.rs
+++ b/runtime/src/nft_weights.rs
@@ -8,154 +8,154 @@
 pub struct WeightInfo;
 impl pallet_nft::WeightInfo for WeightInfo {
 	fn create_collection() -> Weight {
-		(70_000_000 as Weight)
-			.saturating_add(DbWeight::get().reads(7 as Weight))
-			.saturating_add(DbWeight::get().writes(5 as Weight))
+		70_000_000_u64
+			.saturating_add(DbWeight::get().reads(7_u64))
+			.saturating_add(DbWeight::get().writes(5_u64))
 	}
 	fn destroy_collection() -> Weight {
-		(90_000_000 as Weight)
-			.saturating_add(DbWeight::get().reads(2 as Weight))
-			.saturating_add(DbWeight::get().writes(5 as Weight))
+		90_000_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(5_u64))
 	}
 	fn add_to_white_list() -> Weight {
-		(30_000_000 as Weight)
-			.saturating_add(DbWeight::get().reads(3 as Weight))
-			.saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn remove_from_white_list() -> Weight {
-		(35_000_000 as Weight)
-			.saturating_add(DbWeight::get().reads(3 as Weight))
-			.saturating_add(DbWeight::get().writes(1 as Weight))
+		30_000_000_u64
+			.saturating_add(DbWeight::get().reads(3_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn remove_from_white_list() -> Weight {
+		35_000_000_u64
+			.saturating_add(DbWeight::get().reads(3_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
 	}
 	fn set_public_access_mode() -> Weight {
-		(27_000_000 as Weight)
-			.saturating_add(DbWeight::get().reads(1 as Weight))
-			.saturating_add(DbWeight::get().writes(1 as Weight))
+		27_000_000_u64
+			.saturating_add(DbWeight::get().reads(1_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
 	}
 	fn set_mint_permission() -> Weight {
-		(27_000_000 as Weight)
-			.saturating_add(DbWeight::get().reads(1 as Weight))
-			.saturating_add(DbWeight::get().writes(1 as Weight))
+		27_000_000_u64
+			.saturating_add(DbWeight::get().reads(1_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
 	}
 	fn change_collection_owner() -> Weight {
-		(27_000_000 as Weight)
-			.saturating_add(DbWeight::get().reads(1 as Weight))
-			.saturating_add(DbWeight::get().writes(1 as Weight))
+		27_000_000_u64
+			.saturating_add(DbWeight::get().reads(1_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
 	}
 	fn add_collection_admin() -> Weight {
-        (32_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(3 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
+		32_000_000_u64
+			.saturating_add(DbWeight::get().reads(3_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
 	}
 	fn remove_collection_admin() -> Weight {
-		(50_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(2 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn set_collection_sponsor() -> Weight {
-		(32_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(2 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }  
-    fn confirm_sponsorship() -> Weight {
-		(22_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(1 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }  
-    fn remove_collection_sponsor() -> Weight {
-		(24_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(1 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }  
-    fn create_item(s: usize, ) -> Weight {
-        (130_000_000 as Weight)
-            .saturating_add((2135 as Weight).saturating_mul(s as Weight).saturating_mul(500 as Weight)) // 500 is temparary multiplier, fee for storage
-            .saturating_add(DbWeight::get().reads(10 as Weight))
-            .saturating_add(DbWeight::get().writes(8 as Weight))
-    }  
-    fn burn_item() -> Weight {
-		(170_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(9 as Weight))
-            .saturating_add(DbWeight::get().writes(7 as Weight))
-    }  
-    fn transfer() -> Weight {
-        (125_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(7 as Weight))
-            .saturating_add(DbWeight::get().writes(7 as Weight))
-    }  
-    fn approve() -> Weight {
-        (45_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(3 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn transfer_from() -> Weight {
-        (150_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(9 as Weight))
-            .saturating_add(DbWeight::get().writes(8 as Weight))
-    }
-    fn set_offchain_schema() -> Weight {
-        (33_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(2 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn set_const_on_chain_schema() -> Weight {
-        (11_100_000 as Weight)
-            .saturating_add(DbWeight::get().reads(2 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn set_variable_on_chain_schema() -> Weight {
-        (11_100_000 as Weight)
-            .saturating_add(DbWeight::get().reads(2 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn set_variable_meta_data() -> Weight {
-        (17_500_000 as Weight)
-            .saturating_add(DbWeight::get().reads(2 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn enable_contract_sponsoring() -> Weight {
-        (13_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(1 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn set_schema_version() -> Weight {
-        (8_500_000 as Weight)
-            .saturating_add(DbWeight::get().reads(2 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn set_chain_limits() -> Weight {
-        (1_300_000 as Weight)
-            .saturating_add(DbWeight::get().reads(0 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
-    fn set_contract_sponsoring_rate_limit() -> Weight {
-        (3_500_000 as Weight)
-            .saturating_add(DbWeight::get().reads(0 as Weight))
-            .saturating_add(DbWeight::get().writes(2 as Weight))
-    }    
-    fn set_variable_meta_data_sponsoring_rate_limit() -> Weight {
-        (3_500_000 as Weight)
-            .saturating_add(DbWeight::get().reads(1 as Weight))
-            .saturating_add(DbWeight::get().writes(2 as Weight))
-    }
-    fn toggle_contract_white_list() -> Weight {
-        (3_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(0 as Weight))
-            .saturating_add(DbWeight::get().writes(2 as Weight))
-    }    
-    fn add_to_contract_white_list() -> Weight {
-        (3_000_000 as Weight)
-            .saturating_add(DbWeight::get().reads(0 as Weight))
-            .saturating_add(DbWeight::get().writes(2 as Weight))
-    }    
-    fn remove_from_contract_white_list() -> Weight {
-        (3_200_000 as Weight)
-            .saturating_add(DbWeight::get().reads(0 as Weight))
-            .saturating_add(DbWeight::get().writes(2 as Weight))
-    }
-    fn set_collection_limits() -> Weight {
-        (8_900_000 as Weight)
-            .saturating_add(DbWeight::get().reads(2 as Weight))
-            .saturating_add(DbWeight::get().writes(1 as Weight))
-    }
+		50_000_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn set_collection_sponsor() -> Weight {
+		32_000_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn confirm_sponsorship() -> Weight {
+		22_000_000_u64
+			.saturating_add(DbWeight::get().reads(1_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn remove_collection_sponsor() -> Weight {
+		24_000_000_u64
+			.saturating_add(DbWeight::get().reads(1_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn create_item(s: usize) -> Weight {
+		130_000_000_u64
+			.saturating_add(2135_u64.saturating_mul(s as Weight).saturating_mul(500_u64)) // 500 is temparary multiplier, fee for storage
+			.saturating_add(DbWeight::get().reads(10_u64))
+			.saturating_add(DbWeight::get().writes(8_u64))
+	}
+	fn burn_item() -> Weight {
+		170_000_000_u64
+			.saturating_add(DbWeight::get().reads(9_u64))
+			.saturating_add(DbWeight::get().writes(7_u64))
+	}
+	fn transfer() -> Weight {
+		125_000_000_u64
+			.saturating_add(DbWeight::get().reads(7_u64))
+			.saturating_add(DbWeight::get().writes(7_u64))
+	}
+	fn approve() -> Weight {
+		45_000_000_u64
+			.saturating_add(DbWeight::get().reads(3_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn transfer_from() -> Weight {
+		150_000_000_u64
+			.saturating_add(DbWeight::get().reads(9_u64))
+			.saturating_add(DbWeight::get().writes(8_u64))
+	}
+	fn set_offchain_schema() -> Weight {
+		33_000_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn set_const_on_chain_schema() -> Weight {
+		11_100_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn set_variable_on_chain_schema() -> Weight {
+		11_100_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn set_variable_meta_data() -> Weight {
+		17_500_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn enable_contract_sponsoring() -> Weight {
+		13_000_000_u64
+			.saturating_add(DbWeight::get().reads(1_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn set_schema_version() -> Weight {
+		8_500_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn set_chain_limits() -> Weight {
+		1_300_000_u64
+			.saturating_add(DbWeight::get().reads(0_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
+	fn set_contract_sponsoring_rate_limit() -> Weight {
+		3_500_000_u64
+			.saturating_add(DbWeight::get().reads(0_u64))
+			.saturating_add(DbWeight::get().writes(2_u64))
+	}
+	fn set_variable_meta_data_sponsoring_rate_limit() -> Weight {
+		3_500_000_u64
+			.saturating_add(DbWeight::get().reads(1_u64))
+			.saturating_add(DbWeight::get().writes(2_u64))
+	}
+	fn toggle_contract_white_list() -> Weight {
+		3_000_000_u64
+			.saturating_add(DbWeight::get().reads(0_u64))
+			.saturating_add(DbWeight::get().writes(2_u64))
+	}
+	fn add_to_contract_white_list() -> Weight {
+		3_000_000_u64
+			.saturating_add(DbWeight::get().reads(0_u64))
+			.saturating_add(DbWeight::get().writes(2_u64))
+	}
+	fn remove_from_contract_white_list() -> Weight {
+		3_200_000_u64
+			.saturating_add(DbWeight::get().reads(0_u64))
+			.saturating_add(DbWeight::get().writes(2_u64))
+	}
+	fn set_collection_limits() -> Weight {
+		8_900_000_u64
+			.saturating_add(DbWeight::get().reads(2_u64))
+			.saturating_add(DbWeight::get().writes(1_u64))
+	}
 }
modifiedruntime_types.jsondiffbeforeafterboth
--- a/runtime_types.json
+++ b/runtime_types.json
@@ -11,6 +11,10 @@
         "WhiteList"
       ]
     },
+    "CallSpec": {
+      "Module": "u32",
+      "Method": "u32"
+    },
     "DecimalPoints": "u8",
     "CollectionMode": {
       "_enum": {
addedtests/.eslintrc.jsondiffbeforeafterboth
--- /dev/null
+++ b/tests/.eslintrc.json
@@ -0,0 +1,68 @@
+{
+    "env": {
+        "browser": true,
+        "es2020": true
+    },
+    "extends": [
+        "eslint:recommended",
+        "plugin:@typescript-eslint/recommended"
+    ],
+    "parser": "@typescript-eslint/parser",
+    "parserOptions": {
+        "ecmaVersion": 11,
+        "sourceType": "module"
+    },
+    "plugins": [
+        "@typescript-eslint"
+    ],
+    "rules": {
+        "indent": [
+            "error",
+            2,
+            {
+                "SwitchCase": 1
+            }
+        ],
+        "function-call-argument-newline": [
+            "error",
+            "consistent"
+        ],
+        "function-paren-newline": [
+            "error",
+            "multiline"
+        ],
+        "linebreak-style": [
+            "error",
+            "unix"
+        ],
+        "quotes": [
+            "error",
+            "single",
+            {
+                "avoidEscape": true
+            }
+        ],
+        "semi": [
+            "error",
+            "always"
+        ],
+        "@typescript-eslint/explicit-module-boundary-types": "off",
+        "comma-dangle": [
+            "error",
+            "always-multiline"
+        ],
+        "no-unused-vars": "off",
+        "@typescript-eslint/no-empty-function": "off",
+        "@typescript-eslint/no-non-null-assertion": "off",
+        "@typescript-eslint/no-explicit-any": "off",
+        "@typescript-eslint/no-unused-vars": "warn",
+        "no-async-promise-executor": "warn",
+        "@typescript-eslint/no-empty-interface": "off",
+        "prefer-const": [
+            "error",
+            {
+                "destructuring": "all"
+            }
+        ]
+    }
+}
\ No newline at end of file
modifiedtests/package.jsondiffbeforeafterboth
--- a/tests/package.json
+++ b/tests/package.json
@@ -14,14 +14,20 @@
     "mocha": "^8.3.2",
     "ts-node": "^9.1.1",
     "tslint": "^6.1.3",
-    "typescript": "^4.2.4"
+    "typescript": "^4.2.4",
+    "eslint": "^7.28.0",
+    "@types/node": "^14.14.12",
+    "@typescript-eslint/eslint-plugin": "^3.4.0",
+    "@typescript-eslint/parser": "^3.4.0"
   },
   "scripts": {
+    "lint": "eslint --ext .ts,.js src/",
+    "fix": "eslint --ext .ts,.js src/ --fix",
     "test": "mocha --timeout 9999999 -r ts-node/register ./**/*.test.ts",
     "testEth": "mocha --timeout 9999999 -r ts-node/register ./**/eth/**/*.test.ts",
     "load": "mocha --timeout 9999999 -r ts-node/register ./**/*.load.ts",
     "loadTransfer": "ts-node src/transfer.nload.ts",
-    "testCollision": "mocha --timeout 9999999 -r ts-node/register ./src/collision-tests/*.test.ts", 
+    "testCollision": "mocha --timeout 9999999 -r ts-node/register ./src/collision-tests/*.test.ts",
     "testAddCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/addCollectionAdmin.test.ts",
     "testSetSchemaVersion": "mocha --timeout 9999999 -r ts-node/register ./**/setSchemaVersion.test.ts",
     "testSetVariableMetaData": "mocha --timeout 9999999 -r ts-node/register ./**/setVariableMetaData.test.ts",
modifiedtests/src/addToContractWhiteList.test.tsdiffbeforeafterboth
--- a/tests/src/addToContractWhiteList.test.ts
+++ b/tests/src/addToContractWhiteList.test.ts
@@ -3,25 +3,25 @@
 // file 'LICENSE', which is part of this source code package.
 //
 
-import chai from "chai";
+import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
-import usingApi, { submitTransactionAsync, submitTransactionExpectFailAsync } from "./substrate/substrate-api";
-import privateKey from "./substrate/privateKey";
+import usingApi, { submitTransactionAsync, submitTransactionExpectFailAsync } from './substrate/substrate-api';
+import privateKey from './substrate/privateKey';
 import {
-  deployFlipper
-} from "./util/contracthelpers";
+  deployFlipper,
+} from './util/contracthelpers';
 import {
-  getGenericResult, normalizeAccountId
-} from "./util/helpers"
+  getGenericResult,
+} from './util/helpers';
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
 
 describe('Integration Test addToContractWhiteList', () => {
 
-  it(`Add an address to a contract white list`, async () => {
+  it('Add an address to a contract white list', async () => {
     await usingApi(async api => {
-      const bob = privateKey("//Bob");
+      const bob = privateKey('//Bob');
       const [contract, deployer] = await deployFlipper(api);
 
       const whiteListedBefore = (await api.query.nft.contractWhiteList(contract.address, bob.address)).toJSON();
@@ -35,9 +35,9 @@
     });
   });
 
-  it(`Adding same address to white list repeatedly should not produce errors`, async () => {
+  it('Adding same address to white list repeatedly should not produce errors', async () => {
     await usingApi(async api => {
-      const bob = privateKey("//Bob");
+      const bob = privateKey('//Bob');
       const [contract, deployer] = await deployFlipper(api);
 
       const whiteListedBefore = (await api.query.nft.contractWhiteList(contract.address, bob.address)).toJSON();
@@ -58,11 +58,11 @@
 
 describe('Negative Integration Test addToContractWhiteList', () => {
 
-  it(`Add an address to a white list of a non-contract`, async () => {
+  it('Add an address to a white list of a non-contract', async () => {
     await usingApi(async api => {
-      const alice = privateKey("//Bob");
-      const bob = privateKey("//Bob");
-      const charlieGuineaPig = privateKey("//Charlie");
+      const alice = privateKey('//Bob');
+      const bob = privateKey('//Bob');
+      const charlieGuineaPig = privateKey('//Charlie');
 
       const whiteListedBefore = (await api.query.nft.contractWhiteList(charlieGuineaPig.address, bob.address)).toJSON();
       const addTx = api.tx.nft.addToContractWhiteList(charlieGuineaPig.address, bob.address);
@@ -74,10 +74,10 @@
     });
   });
 
-  it(`Add to a contract white list using a non-owner address`, async () => {
+  it('Add to a contract white list using a non-owner address', async () => {
     await usingApi(async api => {
-      const bob = privateKey("//Bob");
-      const [contract, deployer] = await deployFlipper(api);
+      const bob = privateKey('//Bob');
+      const [contract] = await deployFlipper(api);
 
       const whiteListedBefore = (await api.query.nft.contractWhiteList(contract.address, bob.address)).toJSON();
       const addTx = api.tx.nft.addToContractWhiteList(contract.address, bob.address);
modifiedtests/src/addToWhiteList.test.tsdiffbeforeafterboth
--- a/tests/src/addToWhiteList.test.ts
+++ b/tests/src/addToWhiteList.test.ts
@@ -1,87 +1,87 @@
-//
-// This file is subject to the terms and conditions defined in
-// file 'LICENSE', which is part of this source code package.
-//
-
-import { IKeyringPair } from '@polkadot/types/types';
-import chai from 'chai';
-import chaiAsPromised from 'chai-as-promised';
-import privateKey from './substrate/privateKey';
-import usingApi, { submitTransactionExpectFailAsync } from './substrate/substrate-api';
-import {
-  addToWhiteListExpectSuccess,
-  createCollectionExpectSuccess,
-  createItemExpectSuccess,
-  destroyCollectionExpectSuccess,
-  enablePublicMintingExpectSuccess,
-  enableWhiteListExpectSuccess,
-  normalizeAccountId,
-} from './util/helpers';
-
-chai.use(chaiAsPromised);
-const expect = chai.expect;
-
-let Alice: IKeyringPair;
-let Bob: IKeyringPair;
-
-describe('Integration Test ext. addToWhiteList()', () => {
-
-  before(async () => {
-    await usingApi(async (api) => {
-      Alice = privateKey('//Alice');
-      Bob = privateKey('//Bob');
-    });
-  });
-
-  it('Execute the extrinsic with parameters: Collection ID and address to add to the white list', async () => {
-    const collectionId = await createCollectionExpectSuccess();
-    await addToWhiteListExpectSuccess(Alice, collectionId, Bob.address);
-  });
-
-  it('Whitelisted minting: list restrictions', async () => {
-    const collectionId = await createCollectionExpectSuccess();
-    await addToWhiteListExpectSuccess(Alice, collectionId, Bob.address);
-    await enableWhiteListExpectSuccess(Alice, collectionId);
-    await enablePublicMintingExpectSuccess(Alice, collectionId);
-    await createItemExpectSuccess(Bob, collectionId, 'NFT', Bob.address);
-  });
-});
-
-describe('Negative Integration Test ext. addToWhiteList()', () => {
-
-  it('White list an address in the collection that does not exist', async () => {
-    await usingApi(async (api) => {
-      // tslint:disable-next-line: no-bitwise
-      const collectionId = parseInt((await api.query.nft.createdCollectionCount()).toString()) + 1;
-      const Bob = privateKey('//Bob');
-
-      const tx = api.tx.nft.addToWhiteList(collectionId, normalizeAccountId(Bob.address));
-      await expect(submitTransactionExpectFailAsync(Alice, tx)).to.be.rejected;
-    });
-  });
-
-  it('White list an address in the collection that was destroyed', async () => {
-    await usingApi(async (api) => {
-      const Alice = privateKey('//Alice');
-      const Bob = privateKey('//Bob');
-      // tslint:disable-next-line: no-bitwise
-      const collectionId = await createCollectionExpectSuccess();
-      await destroyCollectionExpectSuccess(collectionId);
-      const tx = api.tx.nft.addToWhiteList(collectionId, normalizeAccountId(Bob.address));
-      await expect(submitTransactionExpectFailAsync(Alice, tx)).to.be.rejected;
-    });
-  });
-
-  it('White list an address in the collection that does not have white list access enabled', async () => {
-    await usingApi(async (api) => {
-      const Alice = privateKey('//Alice');
-      const Ferdie = privateKey('//Ferdie');
-      const collectionId = await createCollectionExpectSuccess();
-      await enableWhiteListExpectSuccess(Alice, collectionId);
-      await enablePublicMintingExpectSuccess(Alice, collectionId);
-      const tx = api.tx.nft.createItem(collectionId, normalizeAccountId(Ferdie.address), 'NFT');
-      await expect(submitTransactionExpectFailAsync(Ferdie, tx)).to.be.rejected;
-    });
-  });
-
-});
+//
+// This file is subject to the terms and conditions defined in
+// file 'LICENSE', which is part of this source code package.
+//
+
+import { IKeyringPair } from '@polkadot/types/types';
+import chai from 'chai';
+import chaiAsPromised from 'chai-as-promised';
+import privateKey from './substrate/privateKey';
+import usingApi, { submitTransactionExpectFailAsync } from './substrate/substrate-api';
+import {
+  addToWhiteListExpectSuccess,
+  createCollectionExpectSuccess,
+  createItemExpectSuccess,
+  destroyCollectionExpectSuccess,
+  enablePublicMintingExpectSuccess,
+  enableWhiteListExpectSuccess,
+  normalizeAccountId,
+} from './util/helpers';
+
+chai.use(chaiAsPromised);
+const expect = chai.expect;
+
+let Alice: IKeyringPair;
+let Bob: IKeyringPair;
+
+describe('Integration Test ext. addToWhiteList()', () => {
+
+  before(async () => {
+    await usingApi(async () => {
+      Alice = privateKey('//Alice');
+      Bob = privateKey('//Bob');
+    });
+  });
+
+  it('Execute the extrinsic with parameters: Collection ID and address to add to the white list', async () => {
+    const collectionId = await createCollectionExpectSuccess();
+    await addToWhiteListExpectSuccess(Alice, collectionId, Bob.address);
+  });
+
+  it('Whitelisted minting: list restrictions', async () => {
+    const collectionId = await createCollectionExpectSuccess();
+    await addToWhiteListExpectSuccess(Alice, collectionId, Bob.address);
+    await enableWhiteListExpectSuccess(Alice, collectionId);
+    await enablePublicMintingExpectSuccess(Alice, collectionId);
+    await createItemExpectSuccess(Bob, collectionId, 'NFT', Bob.address);
+  });
+});
+
+describe('Negative Integration Test ext. addToWhiteList()', () => {
+
+  it('White list an address in the collection that does not exist', async () => {
+    await usingApi(async (api) => {
+      // tslint:disable-next-line: no-bitwise
+      const collectionId = parseInt((await api.query.nft.createdCollectionCount()).toString()) + 1;
+      const Bob = privateKey('//Bob');
+
+      const tx = api.tx.nft.addToWhiteList(collectionId, normalizeAccountId(Bob.address));
+      await expect(submitTransactionExpectFailAsync(Alice, tx)).to.be.rejected;
+    });
+  });
+
+  it('White list an address in the collection that was destroyed', async () => {
+    await usingApi(async (api) => {
+      const Alice = privateKey('//Alice');
+      const Bob = privateKey('//Bob');
+      // tslint:disable-next-line: no-bitwise
+      const collectionId = await createCollectionExpectSuccess();
+      await destroyCollectionExpectSuccess(collectionId);
+      const tx = api.tx.nft.addToWhiteList(collectionId, normalizeAccountId(Bob.address));
+      await expect(submitTransactionExpectFailAsync(Alice, tx)).to.be.rejected;
+    });
+  });
+
+  it('White list an address in the collection that does not have white list access enabled', async () => {
+    await usingApi(async (api) => {
+      const Alice = privateKey('//Alice');
+      const Ferdie = privateKey('//Ferdie');
+      const collectionId = await createCollectionExpectSuccess();
+      await enableWhiteListExpectSuccess(Alice, collectionId);
+      await enablePublicMintingExpectSuccess(Alice, collectionId);
+      const tx = api.tx.nft.createItem(collectionId, normalizeAccountId(Ferdie.address), 'NFT');
+      await expect(submitTransactionExpectFailAsync(Ferdie, tx)).to.be.rejected;
+    });
+  });
+
+});
modifiedtests/src/approve.test.tsdiffbeforeafterboth
--- a/tests/src/approve.test.ts
+++ b/tests/src/approve.test.ts
@@ -82,7 +82,7 @@
   let Charlie: IKeyringPair;
 
   before(async () => {
-    await usingApi(async (api) => {
+    await usingApi(async () => {
       Alice = privateKey('//Alice');
       Bob = privateKey('//Bob');
       Charlie = privateKey('//Charlie');
modifiedtests/src/block-production.test.tsdiffbeforeafterboth
--- a/tests/src/block-production.test.ts
+++ b/tests/src/block-production.test.ts
@@ -3,14 +3,15 @@
 // file 'LICENSE', which is part of this source code package.
 //
 
-import usingApi from "./substrate/substrate-api";
-import { expect } from "chai";
-import { ApiPromise } from "@polkadot/api";
+import usingApi from './substrate/substrate-api';
+import { expect } from 'chai';
+import { ApiPromise } from '@polkadot/api';
 
 const BlockTimeMs = 12000;
 const ToleranceMs = 1000;
 
-async function getBlocks(api: ApiPromise): Promise<number[]> {
+/* eslint no-async-promise-executor: "off" */
+function getBlocks(api: ApiPromise): Promise<number[]> {
   return new Promise<number[]>(async (resolve, reject) => {
     const blockNumbers: number[] = [];
     setTimeout(() => reject('Block production test failed due to timeout.'), BlockTimeMs + ToleranceMs);
@@ -27,7 +28,7 @@
 describe('Block Production smoke test', () => {
   it('Node produces new blocks', async () => {
     await usingApi(async (api) => {
-      let blocks: number[] | undefined = await getBlocks(api);
+      const blocks: number[] | undefined = await getBlocks(api);
       expect(blocks[0]).to.be.lessThan(blocks[1]);
     });
   });
modifiedtests/src/burnItem.test.tsdiffbeforeafterboth
--- a/tests/src/burnItem.test.ts
+++ b/tests/src/burnItem.test.ts
@@ -4,16 +4,15 @@
 //
 
 import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from './substrate/substrate-api';
-import { Keyring } from "@polkadot/api";
-import { IKeyringPair } from "@polkadot/types/types";
+import { Keyring } from '@polkadot/api';
+import { IKeyringPair } from '@polkadot/types/types';
 import { 
   createCollectionExpectSuccess, 
   createItemExpectSuccess,
   getGenericResult,
   destroyCollectionExpectSuccess,
-  normalizeAccountId
+  normalizeAccountId,
 } from './util/helpers';
-import { nullPublicKey } from "./accounts";
 
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
@@ -25,10 +24,10 @@
 
 describe('integration test: ext. burnItem():', () => {
   before(async () => {
-    await usingApi(async (api) => {
+    await usingApi(async () => {
       const keyring = new Keyring({ type: 'sr25519' });
-      alice = keyring.addFromUri(`//Alice`);
-      bob = keyring.addFromUri(`//Bob`);
+      alice = keyring.addFromUri('//Alice');
+      bob = keyring.addFromUri('//Bob');
     });
   });
 
@@ -139,10 +138,10 @@
 
 describe('Negative integration test: ext. burnItem():', () => {
   before(async () => {
-    await usingApi(async (api) => {
+    await usingApi(async () => {
       const keyring = new Keyring({ type: 'sr25519' });
-      alice = keyring.addFromUri(`//Alice`);
-      bob = keyring.addFromUri(`//Bob`);
+      alice = keyring.addFromUri('//Alice');
+      bob = keyring.addFromUri('//Bob');
     });
   });
 
modifiedtests/src/change-collection-owner.test.tsdiffbeforeafterboth
--- a/tests/src/change-collection-owner.test.ts
+++ b/tests/src/change-collection-owner.test.ts
@@ -6,8 +6,8 @@
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
 import privateKey from './substrate/privateKey';
-import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from "./substrate/substrate-api";
-import { createCollectionExpectSuccess, createCollectionExpectFailure, normalizeAccountId } from "./util/helpers";
+import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from './substrate/substrate-api';
+import { createCollectionExpectSuccess, normalizeAccountId } from './util/helpers';
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
@@ -32,7 +32,7 @@
 });
 
 describe('Negative Integration Test changeCollectionOwner(collection_id, new_owner):', () => {
-  it(`Not owner can't change owner.`, async () => {
+  it('Not owner can\'t change owner.', async () => {
     await usingApi(async api => {
       const collectionId = await createCollectionExpectSuccess();
       const alice = privateKey('//Alice');
@@ -48,7 +48,7 @@
       await createCollectionExpectSuccess();
     });
   });
-  it(`Can't change owner of not existing collection.`, async () => {
+  it('Can\'t change owner of not existing collection.', async () => {
     await usingApi(async api => {
       const collectionId = (1<<32) - 1;
       const alice = privateKey('//Alice');
modifiedtests/src/check-event/createItemEvent.test.tsdiffbeforeafterboth
--- a/tests/src/check-event/createItemEvent.test.ts
+++ b/tests/src/check-event/createItemEvent.test.ts
@@ -10,7 +10,7 @@
 import chaiAsPromised from 'chai-as-promised';
 import privateKey from '../substrate/privateKey';
 import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';
-import { createCollectionExpectSuccess, createItemExpectSuccess, nftEventMessage } from '../util/helpers';
+import { createCollectionExpectSuccess, nftEventMessage } from '../util/helpers';
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
modifiedtests/src/check-event/createMultipleItemsEvent.test.tsdiffbeforeafterboth
--- a/tests/src/check-event/createMultipleItemsEvent.test.ts
+++ b/tests/src/check-event/createMultipleItemsEvent.test.ts
@@ -10,7 +10,7 @@
 import chaiAsPromised from 'chai-as-promised';
 import privateKey from '../substrate/privateKey';
 import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';
-import { createCollectionExpectSuccess, createItemExpectSuccess, nftEventMessage } from '../util/helpers';
+import { createCollectionExpectSuccess, nftEventMessage } from '../util/helpers';
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
modifiedtests/src/collision-tests/admVsOwnerChanges.test.tsdiffbeforeafterboth
--- a/tests/src/collision-tests/admVsOwnerChanges.test.ts
+++ b/tests/src/collision-tests/admVsOwnerChanges.test.ts
@@ -1,55 +1,50 @@
-import { IKeyringPair } from '@polkadot/types/types';
-import chai from 'chai';
-import chaiAsPromised from 'chai-as-promised';
-import { alicesPublicKey, bobsPublicKey } from '../accounts';
-import getBalance from '../substrate/get-balance';
-import privateKey from '../substrate/privateKey';
-import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
-import waitNewBlocks from '../substrate/wait-new-blocks';
-import {
-  createCollectionExpectSuccess,
-  createItemExpectSuccess,
-  setCollectionSponsorExpectSuccess,
-} from '../util/helpers';
-
-chai.use(chaiAsPromised);
-const expect = chai.expect;
-let Alice: IKeyringPair;
-let Bob: IKeyringPair;
-let Ferdie: IKeyringPair;
-
-before(async () => {
-  await usingApi(async () => {
-    Alice = privateKey('//Alice');
-    Bob = privateKey('//Bob');
-    Ferdie = privateKey('//Ferdie');
-  });
-});
-
-describe('Admin vs Owner changes token: ', () => {
-  // tslint:disable-next-line: max-line-length
-  it('The collection admin changes the owner of the token and in the same block the current owner transfers the token to another address ', async () => {
-    await usingApi(async (api) => {
-      const collectionId = await createCollectionExpectSuccess();
-      const changeAdminTxBob = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);
-      await submitTransactionAsync(Alice, changeAdminTxBob);
-      const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));
-      const changeAdminTxFerdie = api.tx.nft.addCollectionAdmin(collectionId, Ferdie.address);
-      await submitTransactionAsync(Bob, changeAdminTxFerdie);
-      const itemId = await createItemExpectSuccess(Ferdie, collectionId, 'NFT');
-      //
-      const changeOwner = api.tx.nft.transferFrom(Ferdie.address, Bob.address, collectionId, itemId, 1);
-      const approve = api.tx.nft.approve(Bob.address, collectionId, itemId, 1);
-      const sendItem = api.tx.nft.transfer(Alice.address, collectionId, itemId, 1);
-      await Promise.all
-      ([
-        changeOwner.signAndSend(Alice),
-        approve.signAndSend(Bob),
-        sendItem.signAndSend(Ferdie),
-      ]);
-      const itemBefore: any = await api.query.nft.nftItemList(collectionId, itemId);
-      expect(itemBefore.Owner).not.to.be.eq(Bob.address);
-      await timeoutPromise(20000);
-    });
-  });
-});
+import { IKeyringPair } from '@polkadot/types/types';
+import chai from 'chai';
+import chaiAsPromised from 'chai-as-promised';
+import privateKey from '../substrate/privateKey';
+import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
+import {
+  createCollectionExpectSuccess,
+  createItemExpectSuccess,
+} from '../util/helpers';
+
+chai.use(chaiAsPromised);
+const expect = chai.expect;
+let Alice: IKeyringPair;
+let Bob: IKeyringPair;
+let Ferdie: IKeyringPair;
+
+before(async () => {
+  await usingApi(async () => {
+    Alice = privateKey('//Alice');
+    Bob = privateKey('//Bob');
+    Ferdie = privateKey('//Ferdie');
+  });
+});
+
+describe('Admin vs Owner changes token: ', () => {
+  // tslint:disable-next-line: max-line-length
+  it('The collection admin changes the owner of the token and in the same block the current owner transfers the token to another address ', async () => {
+    await usingApi(async (api) => {
+      const collectionId = await createCollectionExpectSuccess();
+      const changeAdminTxBob = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);
+      await submitTransactionAsync(Alice, changeAdminTxBob);
+      const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));
+      const changeAdminTxFerdie = api.tx.nft.addCollectionAdmin(collectionId, Ferdie.address);
+      await submitTransactionAsync(Bob, changeAdminTxFerdie);
+      const itemId = await createItemExpectSuccess(Ferdie, collectionId, 'NFT');
+      //
+      const changeOwner = api.tx.nft.transferFrom(Ferdie.address, Bob.address, collectionId, itemId, 1);
+      const approve = api.tx.nft.approve(Bob.address, collectionId, itemId, 1);
+      const sendItem = api.tx.nft.transfer(Alice.address, collectionId, itemId, 1);
+      await Promise.all([
+        changeOwner.signAndSend(Alice),
+        approve.signAndSend(Bob),
+        sendItem.signAndSend(Ferdie),
+      ]);
+      const itemBefore: any = await api.query.nft.nftItemList(collectionId, itemId);
+      expect(itemBefore.Owner).not.to.be.eq(Bob.address);
+      await timeoutPromise(20000);
+    });
+  });
+});
modifiedtests/src/collision-tests/admVsOwnerData.test.tsdiffbeforeafterboth
--- a/tests/src/collision-tests/admVsOwnerData.test.ts
+++ b/tests/src/collision-tests/admVsOwnerData.test.ts
@@ -1,54 +1,47 @@
-import { IKeyringPair } from '@polkadot/types/types';
-import chai from 'chai';
-import chaiAsPromised from 'chai-as-promised';
-import { alicesPublicKey, bobsPublicKey } from '../accounts';
-import getBalance from '../substrate/get-balance';
-import privateKey from '../substrate/privateKey';
-import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
-import waitNewBlocks from '../substrate/wait-new-blocks';
-import {
-  createCollectionExpectSuccess,
-  createItemExpectSuccess,
-  setCollectionSponsorExpectSuccess,
-} from '../util/helpers';
-
-chai.use(chaiAsPromised);
-const expect = chai.expect;
-let Alice: IKeyringPair;
-let Bob: IKeyringPair;
-let Ferdie: IKeyringPair;
-
-before(async () => {
-  await usingApi(async () => {
-    Alice = privateKey('//Alice');
-    Bob = privateKey('//Bob');
-    Ferdie = privateKey('//Ferdie');
-  });
-});
-
-describe('Admin vs Owner changes the data in the token: ', () => {
-  it('The collection admin changes the data in the token and in the same block the token owner also changes the data in it ', async () => {
-    await usingApi(async (api) => {
-      const AliceData = 1;
-      const BobData = 2;
-      const collectionId = await createCollectionExpectSuccess();
-      const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);
-      await submitTransactionAsync(Alice, changeAdminTx);
-      const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));
-      const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');
-      //
-      // tslint:disable-next-line: max-line-length
-      const AliceTx = api.tx.nft.setVariableMetaData(collectionId, itemId, AliceData.toString());
-      // tslint:disable-next-line: max-line-length
-      const BobTx = api.tx.nft.setVariableMetaData(collectionId, itemId, BobData.toString());
-      await Promise.all
-      ([
-        AliceTx.signAndSend(Alice),
-        BobTx.signAndSend(Bob),
-      ]);
-      const item: any = await api.query.nft.nftItemList(collectionId, itemId);
-      expect(item.VariableData).not.to.be.eq(null); // Pseudo-random selection of one of two values
-      await timeoutPromise(20000);
-    });
-  });
-});
+import { IKeyringPair } from '@polkadot/types/types';
+import chai from 'chai';
+import chaiAsPromised from 'chai-as-promised';
+import privateKey from '../substrate/privateKey';
+import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
+import {
+  createCollectionExpectSuccess,
+  createItemExpectSuccess,
+} from '../util/helpers';
+
+chai.use(chaiAsPromised);
+const expect = chai.expect;
+let Alice: IKeyringPair;
+let Bob: IKeyringPair;
+
+before(async () => {
+  await usingApi(async () => {
+    Alice = privateKey('//Alice');
+    Bob = privateKey('//Bob');
+  });
+});
+
+describe('Admin vs Owner changes the data in the token: ', () => {
+  it('The collection admin changes the data in the token and in the same block the token owner also changes the data in it ', async () => {
+    await usingApi(async (api) => {
+      const AliceData = 1;
+      const BobData = 2;
+      const collectionId = await createCollectionExpectSuccess();
+      const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);
+      await submitTransactionAsync(Alice, changeAdminTx);
+      const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));
+      const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');
+      //
+      // tslint:disable-next-line: max-line-length
+      const AliceTx = api.tx.nft.setVariableMetaData(collectionId, itemId, AliceData.toString());
+      // tslint:disable-next-line: max-line-length
+      const BobTx = api.tx.nft.setVariableMetaData(collectionId, itemId, BobData.toString());
+      await Promise.all([
+        AliceTx.signAndSend(Alice),
+        BobTx.signAndSend(Bob),
+      ]);
+      const item: any = await api.query.nft.nftItemList(collectionId, itemId);
+      expect(item.VariableData).not.to.be.eq(null); // Pseudo-random selection of one of two values
+      await timeoutPromise(20000);
+    });
+  });
+});
modifiedtests/src/collision-tests/admVsOwnerTake.test.tsdiffbeforeafterboth
--- a/tests/src/collision-tests/admVsOwnerTake.test.ts
+++ b/tests/src/collision-tests/admVsOwnerTake.test.ts
@@ -1,54 +1,49 @@
-import { IKeyringPair } from '@polkadot/types/types';
-import chai from 'chai';
-import chaiAsPromised from 'chai-as-promised';
-import { alicesPublicKey, bobsPublicKey } from '../accounts';
-import getBalance from '../substrate/get-balance';
-import privateKey from '../substrate/privateKey';
-import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
-import waitNewBlocks from '../substrate/wait-new-blocks';
-import {
-  createCollectionExpectSuccess,
-  createItemExpectSuccess,
-  setCollectionSponsorExpectSuccess,
-} from '../util/helpers';
-
-chai.use(chaiAsPromised);
-const expect = chai.expect;
-let Alice: IKeyringPair;
-let Bob: IKeyringPair;
-let Ferdie: IKeyringPair;
-
-before(async () => {
-  await usingApi(async () => {
-    Alice = privateKey('//Alice');
-    Bob = privateKey('//Bob');
-    Ferdie = privateKey('//Ferdie');
-  });
-});
-
-describe('Admin vs Owner take token: ', () => {
-  // tslint:disable-next-line: max-line-length
-  it('The collection admin burns the token and in the same block the token owner performs a transaction on it ', async () => {
-    await usingApi(async (api) => {
-      const collectionId = await createCollectionExpectSuccess();
-      const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);
-      await submitTransactionAsync(Alice, changeAdminTx);
-      const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));
-      const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');
-      //
-      const sendItem = api.tx.nft.transfer(Ferdie.address, collectionId, itemId, 1);
-      const burnItem = api.tx.nft.burnItem(collectionId, itemId, 1);
-      await Promise.all
-      ([
-        sendItem.signAndSend(Bob),
-        burnItem.signAndSend(Alice),
-      ]);
-      await timeoutPromise(10000);
-      let itemBurn: boolean = false;
-      itemBurn = (await (api.query.nft.nftItemList(collectionId, itemId))).toJSON() as boolean;
-      // tslint:disable-next-line: no-unused-expression
-      expect(itemBurn).to.be.null;
-      await timeoutPromise(20000);
-    });
-  });
-});
+import { IKeyringPair } from '@polkadot/types/types';
+import chai from 'chai';
+import chaiAsPromised from 'chai-as-promised';
+import privateKey from '../substrate/privateKey';
+import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
+import {
+  createCollectionExpectSuccess,
+  createItemExpectSuccess,
+} from '../util/helpers';
+
+chai.use(chaiAsPromised);
+const expect = chai.expect;
+let Alice: IKeyringPair;
+let Bob: IKeyringPair;
+let Ferdie: IKeyringPair;
+
+before(async () => {
+  await usingApi(async () => {
+    Alice = privateKey('//Alice');
+    Bob = privateKey('//Bob');
+    Ferdie = privateKey('//Ferdie');
+  });
+});
+
+describe('Admin vs Owner take token: ', () => {
+  // tslint:disable-next-line: max-line-length
+  it('The collection admin burns the token and in the same block the token owner performs a transaction on it ', async () => {
+    await usingApi(async (api) => {
+      const collectionId = await createCollectionExpectSuccess();
+      const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);
+      await submitTransactionAsync(Alice, changeAdminTx);
+      const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));
+      const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');
+      //
+      const sendItem = api.tx.nft.transfer(Ferdie.address, collectionId, itemId, 1);
+      const burnItem = api.tx.nft.burnItem(collectionId, itemId, 1);
+      await Promise.all([
+        sendItem.signAndSend(Bob),
+        burnItem.signAndSend(Alice),
+      ]);
+      await timeoutPromise(10000);
+      let itemBurn = false;
+      itemBurn = (await (api.query.nft.nftItemList(collectionId, itemId))).toJSON() as boolean;
+      // tslint:disable-next-line: no-unused-expression
+      expect(itemBurn).to.be.null;
+      await timeoutPromise(20000);
+    });
+  });
+});
modifiedtests/src/collision-tests/adminDestroyCollection.test.tsdiffbeforeafterboth
--- a/tests/src/collision-tests/adminDestroyCollection.test.ts
+++ b/tests/src/collision-tests/adminDestroyCollection.test.ts
@@ -1,35 +1,23 @@
 import { IKeyringPair } from '@polkadot/types/types';
-import BN from 'bn.js';
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
 import privateKey from '../substrate/privateKey';
-import usingApi, { submitTransactionAsync, submitTransactionExpectFailAsync } from '../substrate/substrate-api';
+import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
 import {
   createCollectionExpectSuccess,
 } from '../util/helpers';
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
-interface ITokenDataType {
-  Owner: number[];
-  ConstData: number[];
-  VariableData: number[];
-}
 let Alice: IKeyringPair;
 let Bob: IKeyringPair;
 let Ferdie: IKeyringPair;
-let Charlie: IKeyringPair;
-let Eve: IKeyringPair;
-let Dave: IKeyringPair;
 
 before(async () => {
   await usingApi(async () => {
     Alice = privateKey('//Alice');
     Bob = privateKey('//Bob');
     Ferdie = privateKey('//Ferdie');
-    Charlie = privateKey('//Charlie');
-    Eve = privateKey('//Eve');
-    Dave = privateKey('//Dave');
   });
 });
 
@@ -45,13 +33,12 @@
       //
       const addWhitelistAdm = api.tx.nft.addToWhiteList(collectionId, Ferdie.address);
       const destroyCollection = api.tx.nft.destroyCollection(collectionId);
-      await Promise.all
-      ([
+      await Promise.all([
         addWhitelistAdm.signAndSend(Bob),
         destroyCollection.signAndSend(Alice),
       ]);
       await timeoutPromise(10000);
-      let whiteList: boolean = false;
+      let whiteList = false;
       whiteList = (await api.query.nft.whiteList(collectionId, Ferdie.address)).toJSON() as boolean;
       // tslint:disable-next-line: no-unused-expression
       expect(whiteList).to.be.false;
modifiedtests/src/collision-tests/adminLimitsOff.test.tsdiffbeforeafterboth
--- a/tests/src/collision-tests/adminLimitsOff.test.ts
+++ b/tests/src/collision-tests/adminLimitsOff.test.ts
@@ -10,11 +10,6 @@
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
-interface ITokenDataType {
-  Owner: number[];
-  ConstData: number[];
-  VariableData: number[];
-}
 let Alice: IKeyringPair;
 let Bob: IKeyringPair;
 let Ferdie: IKeyringPair;
@@ -51,11 +46,9 @@
       await submitTransactionAsync(Alice, changeAdminTx3);
 
       const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));
-      //
       const addAdmOne = api.tx.nft.addCollectionAdmin(collectionId, Ferdie.address);
       const addAdmTwo = api.tx.nft.addCollectionAdmin(collectionId, Charlie.address);
-      await Promise.all
-      ([
+      await Promise.all([
         addAdmOne.signAndSend(Bob),
         addAdmTwo.signAndSend(Alice),
       ]);
modifiedtests/src/collision-tests/adminRightsOff.test.tsdiffbeforeafterboth
--- a/tests/src/collision-tests/adminRightsOff.test.ts
+++ b/tests/src/collision-tests/adminRightsOff.test.ts
@@ -3,33 +3,20 @@
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
 import privateKey from '../substrate/privateKey';
-import usingApi, { submitTransactionAsync, submitTransactionExpectFailAsync } from '../substrate/substrate-api';
+import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
 import {
   createCollectionExpectSuccess,
 } from '../util/helpers';
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
-interface ITokenDataType {
-  Owner: number[];
-  ConstData: number[];
-  VariableData: number[];
-}
 let Alice: IKeyringPair;
 let Bob: IKeyringPair;
-let Ferdie: IKeyringPair;
-let Charlie: IKeyringPair;
-let Eve: IKeyringPair;
-let Dave: IKeyringPair;
 
 before(async () => {
   await usingApi(async () => {
     Alice = privateKey('//Alice');
     Bob = privateKey('//Bob');
-    Ferdie = privateKey('//Ferdie');
-    Charlie = privateKey('//Charlie');
-    Eve = privateKey('//Eve');
-    Dave = privateKey('//Dave');
   });
 });
 
@@ -42,12 +29,10 @@
       await submitTransactionAsync(Alice, changeAdminTx);
       const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));
       await timeoutPromise(10000);
-      //
       const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];
       const addItemAdm = api.tx.nft.createMultipleItems(collectionId, Bob.address, args);
       const removeAdm = api.tx.nft.removeCollectionAdmin(collectionId, Bob.address);
-      await Promise.all
-      ([
+      await Promise.all([
         addItemAdm.signAndSend(Bob),
         removeAdm.signAndSend(Alice),
       ]);
modifiedtests/src/collision-tests/setSponsorNewOwner.test.tsdiffbeforeafterboth
--- a/tests/src/collision-tests/setSponsorNewOwner.test.ts
+++ b/tests/src/collision-tests/setSponsorNewOwner.test.ts
@@ -1,20 +1,14 @@
 import { IKeyringPair } from '@polkadot/types/types';
-import BN from 'bn.js';
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
 import privateKey from '../substrate/privateKey';
-import usingApi, { submitTransactionAsync, submitTransactionExpectFailAsync } from '../substrate/substrate-api';
+import usingApi from '../substrate/substrate-api';
 import {
-  createCollectionExpectSuccess, createItemExpectSuccess, setCollectionSponsorExpectSuccess,
+  createCollectionExpectSuccess, setCollectionSponsorExpectSuccess,
 } from '../util/helpers';
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
-interface ITokenDataType {
-  Owner: number[];
-  ConstData: number[];
-  VariableData: number[];
-}
 let Alice: IKeyringPair;
 let Bob: IKeyringPair;
 let Ferdie: IKeyringPair;
@@ -35,11 +29,9 @@
       await setCollectionSponsorExpectSuccess(collectionId, Bob.address);
       const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));
       await timeoutPromise(10000);
-      //
       const confirmSponsorship = api.tx.nft.confirmSponsorship(collectionId);
       const changeCollectionOwner = api.tx.nft.changeCollectionOwner(collectionId, Ferdie.address);
-      await Promise.all
-      ([
+      await Promise.all([
         confirmSponsorship.signAndSend(Bob),
         changeCollectionOwner.signAndSend(Alice),
       ]);
modifiedtests/src/collision-tests/sponsorPayments.test.tsdiffbeforeafterboth
--- a/tests/src/collision-tests/sponsorPayments.test.ts
+++ b/tests/src/collision-tests/sponsorPayments.test.ts
@@ -1,58 +1,54 @@
-import { IKeyringPair } from '@polkadot/types/types';
-import chai from 'chai';
-import chaiAsPromised from 'chai-as-promised';
-import { alicesPublicKey, bobsPublicKey } from '../accounts';
-import getBalance from '../substrate/get-balance';
-import privateKey from '../substrate/privateKey';
-import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
-import waitNewBlocks from '../substrate/wait-new-blocks';
-import {
-  confirmSponsorshipExpectSuccess,
-  createCollectionExpectSuccess,
-  createItemExpectSuccess,
-  setCollectionSponsorExpectSuccess,
-} from '../util/helpers';
-
-chai.use(chaiAsPromised);
-const expect = chai.expect;
-let Alice: IKeyringPair;
-let Bob: IKeyringPair;
-let Ferdie: IKeyringPair;
-
-before(async () => {
-  await usingApi(async () => {
-    Alice = privateKey('//Alice');
-    Bob = privateKey('//Bob');
-    Ferdie = privateKey('//Ferdie');
-  });
-});
-
-describe('Payment of commission if one block: ', () => {
-  // tslint:disable-next-line: max-line-length
-  it('Payment of commission if one block contains transactions for payment from the sponsor\'s balance and his (sponsor\'s) exclusion from the collection ', async () => {
-    await usingApi(async (api) => {
-      const collectionId = await createCollectionExpectSuccess();
-      const changeAdminTxBob = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);
-      await submitTransactionAsync(Alice, changeAdminTxBob);
-      const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));
-      const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');
-      await setCollectionSponsorExpectSuccess(collectionId, Bob.address);
-      await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
-      //
-      const [alicesBalanceBefore, bobsBalanceBefore] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);
-      const sendItem = api.tx.nft.transfer(Alice.address, collectionId, itemId, 1);
-      const revokeSponsor = api.tx.nft.removeCollectionSponsor(collectionId);
-      await Promise.all
-      ([
-        sendItem.signAndSend(Bob),
-        revokeSponsor.signAndSend(Alice),
-      ]);
-      const [alicesBalanceAfter, bobsBalanceAfter] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);
-      // tslint:disable-next-line:no-unused-expression
-      expect(alicesBalanceAfter === alicesBalanceBefore).to.be.true;
-      // tslint:disable-next-line:no-unused-expression
-      expect(bobsBalanceAfter === bobsBalanceBefore).to.be.true;
-      await timeoutPromise(20000);
-    });
-  });
-});
+import { IKeyringPair } from '@polkadot/types/types';
+import chai from 'chai';
+import chaiAsPromised from 'chai-as-promised';
+import { alicesPublicKey, bobsPublicKey } from '../accounts';
+import getBalance from '../substrate/get-balance';
+import privateKey from '../substrate/privateKey';
+import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
+import {
+  confirmSponsorshipExpectSuccess,
+  createCollectionExpectSuccess,
+  createItemExpectSuccess,
+  setCollectionSponsorExpectSuccess,
+} from '../util/helpers';
+
+chai.use(chaiAsPromised);
+const expect = chai.expect;
+let Alice: IKeyringPair;
+let Bob: IKeyringPair;
+
+before(async () => {
+  await usingApi(async () => {
+    Alice = privateKey('//Alice');
+    Bob = privateKey('//Bob');
+  });
+});
+
+describe('Payment of commission if one block: ', () => {
+  // tslint:disable-next-line: max-line-length
+  it('Payment of commission if one block contains transactions for payment from the sponsor\'s balance and his (sponsor\'s) exclusion from the collection ', async () => {
+    await usingApi(async (api) => {
+      const collectionId = await createCollectionExpectSuccess();
+      const changeAdminTxBob = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);
+      await submitTransactionAsync(Alice, changeAdminTxBob);
+      const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));
+      const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');
+      await setCollectionSponsorExpectSuccess(collectionId, Bob.address);
+      await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
+
+      const [alicesBalanceBefore, bobsBalanceBefore] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);
+      const sendItem = api.tx.nft.transfer(Alice.address, collectionId, itemId, 1);
+      const revokeSponsor = api.tx.nft.removeCollectionSponsor(collectionId);
+      await Promise.all([
+        sendItem.signAndSend(Bob),
+        revokeSponsor.signAndSend(Alice),
+      ]);
+      const [alicesBalanceAfter, bobsBalanceAfter] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);
+      // tslint:disable-next-line:no-unused-expression
+      expect(alicesBalanceAfter === alicesBalanceBefore).to.be.true;
+      // tslint:disable-next-line:no-unused-expression
+      expect(bobsBalanceAfter === bobsBalanceBefore).to.be.true;
+      await timeoutPromise(20000);
+    });
+  });
+});
modifiedtests/src/collision-tests/tokenLimitsOff.test.tsdiffbeforeafterboth
--- a/tests/src/collision-tests/tokenLimitsOff.test.ts
+++ b/tests/src/collision-tests/tokenLimitsOff.test.ts
@@ -13,11 +13,6 @@
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
-interface ITokenDataType {
-  Owner: number[];
-  ConstData: number[];
-  VariableData: number[];
-}
 let Alice: IKeyringPair;
 let Bob: IKeyringPair;
 let Ferdie: IKeyringPair;
@@ -63,14 +58,13 @@
       expect(subTxTesult.success).to.be.true;
       const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));
       await timeoutPromise(10000);
-      //
+
       const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];
       const mintItemOne = api.tx.nft
         .createMultipleItems(collectionId, Ferdie.address, args);
       const mintItemTwo = api.tx.nft
         .createMultipleItems(collectionId, Bob.address, args);
-      await Promise.all
-      ([
+      await Promise.all([
         mintItemOne.signAndSend(Ferdie),
         mintItemTwo.signAndSend(Bob),
       ]);
modifiedtests/src/collision-tests/turnsOffMinting.test.tsdiffbeforeafterboth
--- a/tests/src/collision-tests/turnsOffMinting.test.ts
+++ b/tests/src/collision-tests/turnsOffMinting.test.ts
@@ -1,50 +1,46 @@
-import { IKeyringPair } from '@polkadot/types/types';
-import chai from 'chai';
-import chaiAsPromised from 'chai-as-promised';
-import privateKey from '../substrate/privateKey';
-import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
-import waitNewBlocks from '../substrate/wait-new-blocks';
-import {
-  addToWhiteListExpectSuccess,
-  createCollectionExpectSuccess,
-  setMintPermissionExpectSuccess,
-} from '../util/helpers';
-
-chai.use(chaiAsPromised);
-const expect = chai.expect;
-let Alice: IKeyringPair;
-let Bob: IKeyringPair;
-let Ferdie: IKeyringPair;
-
-before(async () => {
-  await usingApi(async () => {
-    Alice = privateKey('//Alice');
-    Bob = privateKey('//Bob');
-    Ferdie = privateKey('//Ferdie');
-  });
-});
-
-describe('Turns off minting mode: ', () => {
-  // tslint:disable-next-line: max-line-length
-  it('The collection owner turns off minting mode and there are minting transactions in the same block ', async () => {
-    await usingApi(async (api) => {
-      const collectionId = await createCollectionExpectSuccess();
-      const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));
-      await setMintPermissionExpectSuccess(Alice, collectionId, true);
-      await addToWhiteListExpectSuccess(Alice, collectionId, Ferdie.address);
-      //
-      const mintItem = api.tx.nft.createItem(collectionId, Ferdie.address, 'NFT');
-      const offMinting = api.tx.nft.setMintPermission(collectionId, false);
-      await Promise.all
-      ([
-        mintItem.signAndSend(Ferdie),
-        offMinting.signAndSend(Alice),
-      ]);
-      let itemList: boolean = false;
-      itemList = (await (api.query.nft.nftItemList(collectionId, mintItem))).toJSON() as boolean;
-      // tslint:disable-next-line: no-unused-expression
-      expect(itemList).to.be.null;
-      await timeoutPromise(20000);
-    });
-  });
-});
+import { IKeyringPair } from '@polkadot/types/types';
+import chai from 'chai';
+import chaiAsPromised from 'chai-as-promised';
+import privateKey from '../substrate/privateKey';
+import usingApi from '../substrate/substrate-api';
+import {
+  addToWhiteListExpectSuccess,
+  createCollectionExpectSuccess,
+  setMintPermissionExpectSuccess,
+} from '../util/helpers';
+
+chai.use(chaiAsPromised);
+const expect = chai.expect;
+let Alice: IKeyringPair;
+let Ferdie: IKeyringPair;
+
+before(async () => {
+  await usingApi(async () => {
+    Alice = privateKey('//Alice');
+    Ferdie = privateKey('//Ferdie');
+  });
+});
+
+describe('Turns off minting mode: ', () => {
+  // tslint:disable-next-line: max-line-length
+  it('The collection owner turns off minting mode and there are minting transactions in the same block ', async () => {
+    await usingApi(async (api) => {
+      const collectionId = await createCollectionExpectSuccess();
+      const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));
+      await setMintPermissionExpectSuccess(Alice, collectionId, true);
+      await addToWhiteListExpectSuccess(Alice, collectionId, Ferdie.address);
+
+      const mintItem = api.tx.nft.createItem(collectionId, Ferdie.address, 'NFT');
+      const offMinting = api.tx.nft.setMintPermission(collectionId, false);
+      await Promise.all([
+        mintItem.signAndSend(Ferdie),
+        offMinting.signAndSend(Alice),
+      ]);
+      let itemList = false;
+      itemList = (await (api.query.nft.nftItemList(collectionId, mintItem))).toJSON() as boolean;
+      // tslint:disable-next-line: no-unused-expression
+      expect(itemList).to.be.null;
+      await timeoutPromise(20000);
+    });
+  });
+});
modifiedtests/src/config.tsdiffbeforeafterboth
--- a/tests/src/config.ts
+++ b/tests/src/config.ts
@@ -6,7 +6,7 @@
 import process from 'process';
 
 const config = {
-  substrateUrl: process.env.substrateUrl || 'ws://127.0.0.1:9944'
-}
+  substrateUrl: process.env.substrateUrl || 'ws://127.0.0.1:9844',
+};
 
 export default config;
\ No newline at end of file
modifiedtests/src/config_docker.tsdiffbeforeafterboth
--- a/tests/src/config_docker.ts
+++ b/tests/src/config_docker.ts
@@ -6,7 +6,7 @@
 import process from 'process';
 
 const config = {
-  substrateUrl: process.env.substrateUrl || 'ws://172.17.0.1:9944'
-}
+  substrateUrl: process.env.substrateUrl || 'ws://172.17.0.1:9944',
+};
 
 export default config;
\ No newline at end of file
modifiedtests/src/confirmSponsorship.test.tsdiffbeforeafterboth
--- a/tests/src/confirmSponsorship.test.ts
+++ b/tests/src/confirmSponsorship.test.ts
@@ -5,12 +5,11 @@
 
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
-import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from "./substrate/substrate-api";
+import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from './substrate/substrate-api';
 import { 
   createCollectionExpectSuccess, 
   setCollectionSponsorExpectSuccess, 
   destroyCollectionExpectSuccess, 
-  setCollectionSponsorExpectFailure,
   confirmSponsorshipExpectSuccess,
   confirmSponsorshipExpectFailure,
   createItemExpectSuccess,
@@ -20,10 +19,9 @@
   enablePublicMintingExpectSuccess,
   addToWhiteListExpectSuccess,
   normalizeAccountId,
-} from "./util/helpers";
-import { Keyring } from "@polkadot/api";
-import { IKeyringPair } from "@polkadot/types/types";
-import type { AccountId } from '@polkadot/types/interfaces';
+} from './util/helpers';
+import { Keyring } from '@polkadot/api';
+import { IKeyringPair } from '@polkadot/types/types';
 import { BigNumber } from 'bignumber.js';
 
 chai.use(chaiAsPromised);
@@ -36,11 +34,11 @@
 describe('integration test: ext. confirmSponsorship():', () => {
 
   before(async () => {
-    await usingApi(async (api) => {
+    await usingApi(async () => {
       const keyring = new Keyring({ type: 'sr25519' });
-      alice = keyring.addFromUri(`//Alice`);
-      bob = keyring.addFromUri(`//Bob`);
-      charlie = keyring.addFromUri(`//Charlie`);
+      alice = keyring.addFromUri('//Alice');
+      bob = keyring.addFromUri('//Bob');
+      charlie = keyring.addFromUri('//Charlie');
     });
   });
 
@@ -163,7 +161,7 @@
       await addToWhiteListExpectSuccess(alice, collectionId, zeroBalance.address);
 
       // Mint token using unused address as signer
-      const tokenId = await createItemExpectSuccess(zeroBalance, collectionId, 'NFT', zeroBalance.address);
+      await createItemExpectSuccess(zeroBalance, collectionId, 'NFT', zeroBalance.address);
 
       const BsponsorBalance = new BigNumber((await api.query.system.account(bob.address)).data.free.toString());
 
@@ -195,7 +193,7 @@
       const badTransaction = async function () { 
         await submitTransactionExpectFailAsync(zeroBalance, zeroToAlice);
       };
-      await expect(badTransaction()).to.be.rejectedWith("Inability to pay some fees");
+      await expect(badTransaction()).to.be.rejectedWith('Inability to pay some fees');
       const BsponsorBalance = new BigNumber((await api.query.system.account(bob.address)).data.free.toString());
 
       // Try again after Zero gets some balance - now it should succeed
@@ -228,11 +226,7 @@
       const result1 = getGenericResult(events1);
 
       const AsponsorBalance = new BigNumber((await api.query.system.account(bob.address)).data.free.toString());
-
-      const badTransaction = async function () { 
-        await submitTransactionExpectFailAsync(zeroBalance, zeroToAlice);
-      };
-
+      await submitTransactionExpectFailAsync(zeroBalance, zeroToAlice);
       const BsponsorBalance = new BigNumber((await api.query.system.account(bob.address)).data.free.toString());
 
       // Try again after Zero gets some balance - now it should succeed
@@ -271,7 +265,7 @@
       const badTransaction = async function () { 
         await submitTransactionExpectFailAsync(zeroBalance, zeroToAlice);
       };
-      await expect(badTransaction()).to.be.rejectedWith("Inability to pay some fees");
+      await expect(badTransaction()).to.be.rejectedWith('Inability to pay some fees');
       const BsponsorBalance = new BigNumber((await api.query.system.account(bob.address)).data.free.toString());
 
       // Try again after Zero gets some balance - now it should succeed
@@ -317,7 +311,7 @@
       const badTransaction = async function () { 
         await createItemExpectSuccess(zeroBalance, collectionId, 'NFT', zeroBalance.address);
       };
-      await expect(badTransaction()).to.be.rejectedWith("Inability to pay some fees");
+      await expect(badTransaction()).to.be.rejectedWith('Inability to pay some fees');
       console.error = consoleError;
       console.log = consoleLog;
       const BsponsorBalance = new BigNumber((await api.query.system.account(bob.address)).data.free.toString());
@@ -335,19 +329,19 @@
 
 describe('(!negative test!) integration test: ext. removeCollectionSponsor():', () => {
   before(async () => {
-    await usingApi(async (api) => {
+    await usingApi(async () => {
       const keyring = new Keyring({ type: 'sr25519' });
-      alice = keyring.addFromUri(`//Alice`);
-      bob = keyring.addFromUri(`//Bob`);
-      charlie = keyring.addFromUri(`//Charlie`);
+      alice = keyring.addFromUri('//Alice');
+      bob = keyring.addFromUri('//Bob');
+      charlie = keyring.addFromUri('//Charlie');
     });
   });
 
   it('(!negative test!) Confirm sponsorship for a collection that never existed', async () => {
     // Find the collection that never existed
-    const collectionId = 0;
+    let collectionId = 0;
     await usingApi(async (api) => {
-      const collectionId = parseInt((await api.query.nft.createdCollectionCount()).toString()) + 1;
+      collectionId = parseInt((await api.query.nft.createdCollectionCount()).toString()) + 1;
     });
 
     await confirmSponsorshipExpectFailure(collectionId, '//Bob');
modifiedtests/src/connection.test.tsdiffbeforeafterboth
--- a/tests/src/connection.test.ts
+++ b/tests/src/connection.test.ts
@@ -3,7 +3,7 @@
 // file 'LICENSE', which is part of this source code package.
 //
 
-import usingApi from "./substrate/substrate-api";
+import usingApi from './substrate/substrate-api';
 import { WsProvider } from '@polkadot/api';
 import * as chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
@@ -29,7 +29,7 @@
     const neverConnectProvider = new WsProvider('ws://255.255.255.255:9944');
     await expect((async () => {
       await usingApi(async api => {
-        const health = await api.rpc.system.health();
+        await api.rpc.system.health();
       }, { provider: neverConnectProvider });
     })()).to.be.eventually.rejected;
 
modifiedtests/src/contracts.test.tsdiffbeforeafterboth
--- a/tests/src/contracts.test.ts
+++ b/tests/src/contracts.test.ts
@@ -3,17 +3,17 @@
 // file 'LICENSE', which is part of this source code package.
 //
 
-import chai from "chai";
+import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
-import usingApi, { submitTransactionAsync, submitTransactionExpectFailAsync } from "./substrate/substrate-api";
-import fs from "fs";
-import { Abi, ContractPromise as Contract } from "@polkadot/api-contract";
-import privateKey from "./substrate/privateKey";
+import usingApi, { submitTransactionAsync } from './substrate/substrate-api';
+import fs from 'fs';
+import { Abi, ContractPromise as Contract } from '@polkadot/api-contract';
+import privateKey from './substrate/privateKey';
 import {
   deployFlipper,
   getFlipValue,
   deployTransferContract,
-} from "./util/contracthelpers";
+} from './util/contracthelpers';
 
 import {
   addToWhiteListExpectSuccess,
@@ -25,8 +25,8 @@
   getGenericResult,
   normalizeAccountId,
   isWhitelisted,
-  transferFromExpectSuccess
-} from "./util/helpers";
+  transferFromExpectSuccess,
+} from './util/helpers';
 
 
 chai.use(chaiAsPromised);
@@ -37,12 +37,12 @@
 const marketContractAddress = '5CYN9j3YvRkqxewoxeSvRbhAym4465C57uMmX5j4yz99L5H6';
 
 describe('Contracts', () => {
-  it(`Can deploy smart contract Flipper, instantiate it and call it's get and flip messages.`, async () => {
+  it('Can deploy smart contract Flipper, instantiate it and call it\'s get and flip messages.', async () => {
     await usingApi(async api => {
       const [contract, deployer] = await deployFlipper(api);
       const initialGetResponse = await getFlipValue(contract, deployer);
 
-      const bob = privateKey("//Bob");
+      const bob = privateKey('//Bob');
       const flip = contract.tx.flip(value, gasLimit);
       await submitTransactionAsync(bob, flip);
 
@@ -65,13 +65,13 @@
 describe.only('Chain extensions', () => {
   it('Transfer CE', async () => {
     await usingApi(async api => {
-      const alice = privateKey("//Alice");
-      const bob = privateKey("//Bob");
+      const alice = privateKey('//Alice');
+      const bob = privateKey('//Bob');
 
       // Prep work
       const collectionId = await createCollectionExpectSuccess();
       const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');
-      const [contract, deployer] = await deployTransferContract(api);
+      const [contract] = await deployTransferContract(api);
       const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, contract.address);
       await submitTransactionAsync(alice, changeAdminTx);
 
@@ -96,7 +96,7 @@
       const bob = privateKey('//Bob');
 
       const collectionId = await createCollectionExpectSuccess();
-      const [contract, deployer] = await deployTransferContract(api);
+      const [contract] = await deployTransferContract(api);
       await enablePublicMintingExpectSuccess(alice, collectionId);
       await enableWhiteListExpectSuccess(alice, collectionId);
       await addToWhiteListExpectSuccess(alice, collectionId, contract.address);
@@ -124,7 +124,7 @@
       const bob = privateKey('//Bob');
 
       const collectionId = await createCollectionExpectSuccess();
-      const [contract, deployer] = await deployTransferContract(api);
+      const [contract] = await deployTransferContract(api);
       await enablePublicMintingExpectSuccess(alice, collectionId);
       await enableWhiteListExpectSuccess(alice, collectionId);
       await addToWhiteListExpectSuccess(alice, collectionId, contract.address);
@@ -133,7 +133,7 @@
       const transferTx = contract.tx.createMultipleItems(value, gasLimit, bob.address, collectionId, [
         { Nft: { const_data: '0x010203', variable_data: '0x020304' } },
         { Nft: { const_data: '0x010204', variable_data: '0x020305' } },
-        { Nft: { const_data: '0x010205', variable_data: '0x020306' } }
+        { Nft: { const_data: '0x010205', variable_data: '0x020306' } },
       ]);
       const events = await submitTransactionAsync(alice, transferTx);
       const result = getGenericResult(events);
@@ -169,7 +169,7 @@
       const charlie = privateKey('//Charlie');
 
       const collectionId = await createCollectionExpectSuccess();
-      const [contract, deployer] = await deployTransferContract(api);
+      const [contract] = await deployTransferContract(api);
       const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', contract.address.toString());
 
       const transferTx = contract.tx.approve(value, gasLimit, bob.address, collectionId, tokenId, 1);
@@ -188,7 +188,7 @@
       const charlie = privateKey('//Charlie');
 
       const collectionId = await createCollectionExpectSuccess();
-      const [contract, deployer] = await deployTransferContract(api);
+      const [contract] = await deployTransferContract(api);
       const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', bob.address);
       await approveExpectSuccess(collectionId, tokenId, bob, contract.address.toString(), 1);
 
@@ -197,7 +197,7 @@
       const result = getGenericResult(events);
       expect(result.success).to.be.true;
 
-      const token: any = (await api.query.nft.nftItemList(collectionId, tokenId) as any).unwrap()
+      const token: any = (await api.query.nft.nftItemList(collectionId, tokenId) as any).unwrap();
       expect(token.Owner.toString()).to.be.equal(charlie.address);
     });
   });
@@ -207,7 +207,7 @@
       const alice = privateKey('//Alice');
 
       const collectionId = await createCollectionExpectSuccess();
-      const [contract, deployer] = await deployTransferContract(api);
+      const [contract] = await deployTransferContract(api);
       const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', contract.address.toString());
 
       const transferTx = contract.tx.setVariableMetaData(value, gasLimit, collectionId, tokenId, '0x121314');
@@ -215,7 +215,7 @@
       const result = getGenericResult(events);
       expect(result.success).to.be.true;
 
-      const token: any = (await api.query.nft.nftItemList(collectionId, tokenId) as any).unwrap()
+      const token: any = (await api.query.nft.nftItemList(collectionId, tokenId) as any).unwrap();
       expect(token.VariableData.toString()).to.be.equal('0x121314');
     });
   });
@@ -226,7 +226,7 @@
       const bob = privateKey('//Bob');
 
       const collectionId = await createCollectionExpectSuccess();
-      const [contract, deployer] = await deployTransferContract(api);
+      const [contract] = await deployTransferContract(api);
       const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, contract.address);
       await submitTransactionAsync(alice, changeAdminTx);      
 
modifiedtests/src/createItem.test.tsdiffbeforeafterboth
--- a/tests/src/createItem.test.ts
+++ b/tests/src/createItem.test.ts
@@ -1,39 +1,39 @@
-//
-// This file is subject to the terms and conditions defined in
-// file 'LICENSE', which is part of this source code package.
-//
-
-import { default as usingApi } from './substrate/substrate-api';
-import { Keyring } from "@polkadot/api";
-import { IKeyringPair } from "@polkadot/types/types";
-import { 
-  createCollectionExpectSuccess, 
-  createItemExpectSuccess
-} from './util/helpers';
-
-let alice: IKeyringPair;
-
-describe('integration test: ext. createItem():', () => {
-  before(async () => {
-    await usingApi(async (api) => {
-      const keyring = new Keyring({ type: 'sr25519' });
-      alice = keyring.addFromUri(`//Alice`);
-    });
-  });
-
-  it('Create new item in NFT collection', async () => {
-    const createMode = 'NFT';
-    const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});
-    await createItemExpectSuccess(alice, newCollectionID, createMode);
-  });
-  it('Create new item in Fungible collection', async () => {
-    const createMode = 'Fungible';
-    const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});
-    await createItemExpectSuccess(alice, newCollectionID, createMode);
-  });
-  it('Create new item in ReFungible collection', async () => {
-    const createMode = 'ReFungible';
-    const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});
-    await createItemExpectSuccess(alice, newCollectionID, createMode);
-  });
-});
+//
+// This file is subject to the terms and conditions defined in
+// file 'LICENSE', which is part of this source code package.
+//
+
+import { default as usingApi } from './substrate/substrate-api';
+import { Keyring } from '@polkadot/api';
+import { IKeyringPair } from '@polkadot/types/types';
+import { 
+  createCollectionExpectSuccess, 
+  createItemExpectSuccess,
+} from './util/helpers';
+
+let alice: IKeyringPair;
+
+describe('integration test: ext. createItem():', () => {
+  before(async () => {
+    await usingApi(async () => {
+      const keyring = new Keyring({ type: 'sr25519' });
+      alice = keyring.addFromUri('//Alice');
+    });
+  });
+
+  it('Create new item in NFT collection', async () => {
+    const createMode = 'NFT';
+    const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});
+    await createItemExpectSuccess(alice, newCollectionID, createMode);
+  });
+  it('Create new item in Fungible collection', async () => {
+    const createMode = 'Fungible';
+    const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});
+    await createItemExpectSuccess(alice, newCollectionID, createMode);
+  });
+  it('Create new item in ReFungible collection', async () => {
+    const createMode = 'ReFungible';
+    const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});
+    await createItemExpectSuccess(alice, newCollectionID, createMode);
+  });
+});
modifiedtests/src/creditFeesToTreasury.test.tsdiffbeforeafterboth
--- a/tests/src/creditFeesToTreasury.test.ts
+++ b/tests/src/creditFeesToTreasury.test.ts
@@ -5,16 +5,16 @@
 
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
-import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from "./substrate/substrate-api";
-import { alicesPublicKey, bobsPublicKey } from "./accounts";
-import privateKey from "./substrate/privateKey";
+import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from './substrate/substrate-api';
+import { alicesPublicKey, bobsPublicKey } from './accounts';
+import privateKey from './substrate/privateKey';
 import { BigNumber } from 'bignumber.js';
 import { IKeyringPair } from '@polkadot/types/types';
 import { 
   createCollectionExpectSuccess, 
   createItemExpectSuccess,
   getGenericResult,
-  transferExpectSuccess
+  transferExpectSuccess,
 } from './util/helpers';
 
 import { default as waitNewBlocks } from './substrate/wait-new-blocks';
@@ -23,7 +23,7 @@
 chai.use(chaiAsPromised);
 const expect = chai.expect;
 
-const Treasury = "5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z";
+const Treasury = '5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z';
 const saneMinimumFee = 0.05;
 const saneMaximumFee = 0.5;
 const createCollectionDeposit = 100;
@@ -33,8 +33,9 @@
 
 // Skip the inflation block pauses if the block is close to inflation block 
 // until the inflation happens
+/*eslint no-async-promise-executor: "off"*/
 function skipInflationBlock(api: ApiPromise): Promise<void> {
-  const promise = new Promise<void>(async (resolve, reject) => {
+  const promise = new Promise<void>(async (resolve) => {
     const blockInterval = parseInt((await api.consts.inflation.inflationBlockInterval).toString());
     const unsubscribe = await api.rpc.chain.subscribeNewHeads(head => {
       const currentBlock = parseInt(head.number.toString());
@@ -52,7 +53,7 @@
 
 describe('integration test: Fees must be credited to Treasury:', () => {
   before(async () => {
-    await usingApi(async (api) => {
+    await usingApi(async () => {
       alice = privateKey('//Alice');
       bob = privateKey('//Bob');
     });
modifiedtests/src/destroyCollection.test.tsdiffbeforeafterboth
--- a/tests/src/destroyCollection.test.ts
+++ b/tests/src/destroyCollection.test.ts
@@ -7,8 +7,8 @@
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
 import privateKey from './substrate/privateKey';
-import { default as usingApi } from "./substrate/substrate-api";
-import { createCollectionExpectSuccess, destroyCollectionExpectSuccess, destroyCollectionExpectFailure, setCollectionLimitsExpectSuccess } from "./util/helpers";
+import { default as usingApi } from './substrate/substrate-api';
+import { createCollectionExpectSuccess, destroyCollectionExpectSuccess, destroyCollectionExpectFailure, setCollectionLimitsExpectSuccess } from './util/helpers';
 
 chai.use(chaiAsPromised);
 
@@ -31,7 +31,7 @@
   let alice: IKeyringPair;
 
   before(async () => {
-    await usingApi(async (api) => {
+    await usingApi(async () => {
       alice = privateKey('//Alice');
     });
   });
modifiedtests/src/enableContractSponsoring.test.tsdiffbeforeafterboth
--- a/tests/src/enableContractSponsoring.test.ts
+++ b/tests/src/enableContractSponsoring.test.ts
@@ -81,7 +81,7 @@
 
   it('fails when called by non-owning user', async () => {
     await usingApi(async (api) => {
-      const [flipper, _] = await deployFlipper(api);
+      const [flipper] = await deployFlipper(api);
 
       await enableContractSponsoringExpectFailure(alice, flipper.address, true);
     });
modifiedtests/src/eth/fungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/fungible.test.ts
+++ b/tests/src/eth/fungible.test.ts
@@ -1,289 +1,294 @@
-import privateKey from "../substrate/privateKey";
-import { approveExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, transferExpectSuccess, transferFromExpectSuccess } from "../util/helpers";
-import { collectionIdToAddress, createEthAccount, itWeb3, normalizeEvents, recordEvents, subToEth, transferBalanceToEth } from "./util/helpers"
+//
+// This file is subject to the terms and conditions defined in
+// file 'LICENSE', which is part of this source code package.
+//
+
+import privateKey from '../substrate/privateKey';
+import { approveExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, transferExpectSuccess, transferFromExpectSuccess } from '../util/helpers';
+import { collectionIdToAddress, createEthAccount, itWeb3, normalizeEvents, recordEvents, subToEth, transferBalanceToEth } from './util/helpers';
 import fungibleAbi from './fungibleAbi.json';
-import { expect } from "chai";
+import { expect } from 'chai';
 
 describe('Information getting', () => {
-    itWeb3('totalSupply', async ({ web3 }) => {
-        const collection = await createCollectionExpectSuccess({
-            name: 'token name',
-            mode: { type: 'Fungible', decimalPoints: 0 }
-        });
-        const alice = privateKey('//Alice');
+  itWeb3('totalSupply', async ({ web3 }) => {
+    const collection = await createCollectionExpectSuccess({
+      name: 'token name',
+      mode: { type: 'Fungible', decimalPoints: 0 },
+    });
+    const alice = privateKey('//Alice');
 
-        await createFungibleItemExpectSuccess(alice, collection, { Value: 200n }, { substrate: alice.address });
+    await createFungibleItemExpectSuccess(alice, collection, { Value: 200n }, { substrate: alice.address });
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(fungibleAbi as any, address);
-        const totalSupply = await contract.methods.totalSupply().call();
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(fungibleAbi as any, address);
+    const totalSupply = await contract.methods.totalSupply().call();
+
+    // FIXME: always equals to 0, because this method is not implemented
+    expect(totalSupply).to.equal('0');
+  });
 
-        // FIXME: always equals to 0, because this method is not implemented
-        expect(totalSupply).to.equal('0');
+  itWeb3('balanceOf', async ({ web3 }) => {
+    const collection = await createCollectionExpectSuccess({
+      name: 'token name',
+      mode: { type: 'Fungible', decimalPoints: 0 },
     });
+    const alice = privateKey('//Alice');
 
-    itWeb3('balanceOf', async ({ web3 }) => {
-        const collection = await createCollectionExpectSuccess({
-            name: 'token name',
-            mode: { type: 'Fungible', decimalPoints: 0 }
-        });
-        const alice = privateKey('//Alice');
+    const caller = createEthAccount(web3);
+    await createFungibleItemExpectSuccess(alice, collection, { Value: 200n }, { ethereum: caller });
 
-        const caller = createEthAccount(web3);
-        await createFungibleItemExpectSuccess(alice, collection, { Value: 200n }, { ethereum: caller });
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(fungibleAbi as any, address);
+    const balance = await contract.methods.balanceOf(caller).call();
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(fungibleAbi as any, address);
-        const balance = await contract.methods.balanceOf(caller).call();
-
-        expect(balance).to.equal('200');
-    });
+    expect(balance).to.equal('200');
+  });
 });
 
 describe('Plain calls', () => {
-    itWeb3('Can perform approve()', async ({ web3, api }) => {
-        const collection = await createCollectionExpectSuccess({
-            name: 'token name',
-            mode: { type: 'Fungible', decimalPoints: 0 }
-        });
-        const alice = privateKey('//Alice');
+  itWeb3('Can perform approve()', async ({ web3, api }) => {
+    const collection = await createCollectionExpectSuccess({
+      name: 'token name',
+      mode: { type: 'Fungible', decimalPoints: 0 },
+    });
+    const alice = privateKey('//Alice');
 
-        const owner = createEthAccount(web3);
-        await transferBalanceToEth(api, alice, owner, 999999999999999);
+    const owner = createEthAccount(web3);
+    await transferBalanceToEth(api, alice, owner, 999999999999999);
 
-        await createFungibleItemExpectSuccess(alice, collection, { Value: 200n }, { ethereum: owner });
+    await createFungibleItemExpectSuccess(alice, collection, { Value: 200n }, { ethereum: owner });
 
-        const spender = createEthAccount(web3);
+    const spender = createEthAccount(web3);
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(fungibleAbi as any, address);
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(fungibleAbi as any, address);
+
+    {
+      const result = await contract.methods.approve(spender, 100).send({ from: owner, gas: '0x1000000', gasPrice: '0x01' });
+      const events = normalizeEvents(result.events);
 
+      expect(events).to.be.deep.equal([
         {
-            const result = await contract.methods.approve(spender, 100).send({ from: owner, gas: '0x1000000', gasPrice: '0x01' });
-            const events = normalizeEvents(result.events);
+          address,
+          event: 'Approval',
+          args: {
+            owner,
+            spender,
+            value: '100',
+          },
+        },
+      ]);
+    }
 
-            expect(events).to.be.deep.equal([
-                {
-                    address,
-                    event: 'Approval',
-                    args: {
-                        owner,
-                        spender,
-                        value: '100',
-                    }
-                }
-            ]);
-        }
+    {
+      const allowance = await contract.methods.allowance(owner, spender).call();
+      expect(+allowance).to.equal(100);
+    }
+  });
 
-        {
-            const allowance = await contract.methods.allowance(owner, spender).call();
-            expect(+allowance).to.equal(100);
-        }
+  itWeb3('Can perform transferFrom()', async ({ web3, api }) => {
+    const collection = await createCollectionExpectSuccess({
+      name: 'token name',
+      mode: { type: 'Fungible', decimalPoints: 0 },
     });
+    const alice = privateKey('//Alice');
 
-    itWeb3('Can perform transferFrom()', async ({ web3, api }) => {
-        const collection = await createCollectionExpectSuccess({
-            name: 'token name',
-            mode: { type: 'Fungible', decimalPoints: 0 }
-        });
-        const alice = privateKey('//Alice');
-
-        const owner = createEthAccount(web3);
-        await transferBalanceToEth(api, alice, owner, 999999999999999);
+    const owner = createEthAccount(web3);
+    await transferBalanceToEth(api, alice, owner, 999999999999999);
 
-        await createFungibleItemExpectSuccess(alice, collection, { Value: 200n }, { ethereum: owner });
+    await createFungibleItemExpectSuccess(alice, collection, { Value: 200n }, { ethereum: owner });
 
-        const spender = createEthAccount(web3);
-        await transferBalanceToEth(api, alice, spender, 999999999999999);
+    const spender = createEthAccount(web3);
+    await transferBalanceToEth(api, alice, spender, 999999999999999);
 
-        const receiver = createEthAccount(web3);
+    const receiver = createEthAccount(web3);
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(fungibleAbi as any, address);
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(fungibleAbi as any, address);
 
-        await contract.methods.approve(spender, 100).send({ from: owner, gas: '0x1000000', gasPrice: '0x01' });
+    await contract.methods.approve(spender, 100).send({ from: owner, gas: '0x1000000', gasPrice: '0x01' });
 
+    {
+      const result = await contract.methods.transferFrom(owner, receiver, 49).send({ from: spender, gas: '0x1000000', gasPrice: '0x01' });
+      const events = normalizeEvents(result.events);
+      expect(events).to.be.deep.equal([
         {
-            const result = await contract.methods.transferFrom(owner, receiver, 49).send({ from: spender, gas: '0x1000000', gasPrice: '0x01' });
-            const events = normalizeEvents(result.events);
-            expect(events).to.be.deep.equal([
-                {
-                    address,
-                    event: 'Transfer',
-                    args: {
-                        from: owner,
-                        to: receiver,
-                        value: '49',
-                    }
-                },
-                {
-                    address,
-                    event: 'Approval',
-                    args: {
-                        owner,
-                        spender,
-                        value: '51',
-                    }
-                }
-            ]);
-        }
-
+          address,
+          event: 'Transfer',
+          args: {
+            from: owner,
+            to: receiver,
+            value: '49',
+          },
+        },
         {
-            const balance = await contract.methods.balanceOf(receiver).call();
-            expect(+balance).to.equal(49);
-        }
+          address,
+          event: 'Approval',
+          args: {
+            owner,
+            spender,
+            value: '51',
+          },
+        },
+      ]);
+    }
 
-        {
-            const balance = await contract.methods.balanceOf(owner).call();
-            expect(+balance).to.equal(151);
-        }
-    });
+    {
+      const balance = await contract.methods.balanceOf(receiver).call();
+      expect(+balance).to.equal(49);
+    }
 
-    itWeb3('Can perform transfer()', async ({ web3, api }) => {
-        const collection = await createCollectionExpectSuccess({
-            name: 'token name',
-            mode: { type: 'Fungible', decimalPoints: 0 }
-        });
-        const alice = privateKey('//Alice');
+    {
+      const balance = await contract.methods.balanceOf(owner).call();
+      expect(+balance).to.equal(151);
+    }
+  });
 
-        const owner = createEthAccount(web3);
-        await transferBalanceToEth(api, alice, owner, 999999999999999);
+  itWeb3('Can perform transfer()', async ({ web3, api }) => {
+    const collection = await createCollectionExpectSuccess({
+      name: 'token name',
+      mode: { type: 'Fungible', decimalPoints: 0 },
+    });
+    const alice = privateKey('//Alice');
 
-        await createFungibleItemExpectSuccess(alice, collection, { Value: 200n }, { ethereum: owner });
+    const owner = createEthAccount(web3);
+    await transferBalanceToEth(api, alice, owner, 999999999999999);
 
-        const receiver = createEthAccount(web3);
-        await transferBalanceToEth(api, alice, receiver, 999999999999999);
+    await createFungibleItemExpectSuccess(alice, collection, { Value: 200n }, { ethereum: owner });
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(fungibleAbi as any, address);
+    const receiver = createEthAccount(web3);
+    await transferBalanceToEth(api, alice, receiver, 999999999999999);
 
-        {
-            const result = await contract.methods.transfer(receiver, 50).send({ from: owner, gas: '0x1000000', gasPrice: '0x01' });
-            const events = normalizeEvents(result.events);
-            expect(events).to.be.deep.equal([
-                {
-                    address,
-                    event: 'Transfer',
-                    args: {
-                        from: owner,
-                        to: receiver,
-                        value: '50',
-                    }
-                },
-            ])
-        }
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(fungibleAbi as any, address);
 
+    {
+      const result = await contract.methods.transfer(receiver, 50).send({ from: owner, gas: '0x1000000', gasPrice: '0x01' });
+      const events = normalizeEvents(result.events);
+      expect(events).to.be.deep.equal([
         {
-            const balance = await contract.methods.balanceOf(owner).call();
-            expect(+balance).to.equal(150);
-        }
+          address,
+          event: 'Transfer',
+          args: {
+            from: owner,
+            to: receiver,
+            value: '50',
+          },
+        },
+      ]);
+    }
+
+    {
+      const balance = await contract.methods.balanceOf(owner).call();
+      expect(+balance).to.equal(150);
+    }
 
-        {
-            const balance = await contract.methods.balanceOf(receiver).call();
-            expect(+balance).to.equal(50);
-        }
-    });
+    {
+      const balance = await contract.methods.balanceOf(receiver).call();
+      expect(+balance).to.equal(50);
+    }
+  });
 });
 
 describe('Substrate calls', () => {
-    itWeb3('Events emitted for approve()', async ({ web3 }) => {
-        const collection = await createCollectionExpectSuccess({
-            mode: { type: 'Fungible', decimalPoints: 0 }
-        });
-        const alice = privateKey('//Alice');
-
-        const receiver = createEthAccount(web3);
+  itWeb3('Events emitted for approve()', async ({ web3 }) => {
+    const collection = await createCollectionExpectSuccess({
+      mode: { type: 'Fungible', decimalPoints: 0 },
+    });
+    const alice = privateKey('//Alice');
 
-        await createFungibleItemExpectSuccess(alice, collection, { Value: 200n });
+    const receiver = createEthAccount(web3);
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(fungibleAbi as any, address);
+    await createFungibleItemExpectSuccess(alice, collection, { Value: 200n });
 
-        const events = await recordEvents(contract, async () => {
-            await approveExpectSuccess(collection, 1, alice, { ethereum: receiver }, 100);
-        });
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(fungibleAbi as any, address);
 
-        expect(events).to.be.deep.equal([
-            {
-                address,
-                event: 'Approval',
-                args: {
-                    owner: subToEth(alice.address),
-                    spender: receiver,
-                    value: '100',
-                }
-            }
-        ]);
+    const events = await recordEvents(contract, async () => {
+      await approveExpectSuccess(collection, 1, alice, { ethereum: receiver }, 100);
     });
 
-    itWeb3('Events emitted for transferFrom()', async ({ web3 }) => {
-        const collection = await createCollectionExpectSuccess({
-            mode: { type: 'Fungible', decimalPoints: 0 }
-        });
-        const alice = privateKey('//Alice');
-        const bob = privateKey('//Bob');
+    expect(events).to.be.deep.equal([
+      {
+        address,
+        event: 'Approval',
+        args: {
+          owner: subToEth(alice.address),
+          spender: receiver,
+          value: '100',
+        },
+      },
+    ]);
+  });
 
-        const receiver = createEthAccount(web3);
+  itWeb3('Events emitted for transferFrom()', async ({ web3 }) => {
+    const collection = await createCollectionExpectSuccess({
+      mode: { type: 'Fungible', decimalPoints: 0 },
+    });
+    const alice = privateKey('//Alice');
+    const bob = privateKey('//Bob');
 
-        await createFungibleItemExpectSuccess(alice, collection, { Value: 200n });
-        await approveExpectSuccess(collection, 1, alice, bob, 100);
+    const receiver = createEthAccount(web3);
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(fungibleAbi as any, address);
+    await createFungibleItemExpectSuccess(alice, collection, { Value: 200n });
+    await approveExpectSuccess(collection, 1, alice, bob, 100);
 
-        const events = await recordEvents(contract, async () => {
-            await transferFromExpectSuccess(collection, 1, bob, alice, { ethereum: receiver }, 51, 'Fungible');
-        });
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(fungibleAbi as any, address);
 
-        expect(events).to.be.deep.equal([
-            {
-                address,
-                event: 'Transfer',
-                args: {
-                    from: subToEth(alice.address),
-                    to: receiver,
-                    value: '51',
-                }
-            },
-            {
-                address,
-                event: 'Approval',
-                args: {
-                    owner: subToEth(alice.address),
-                    spender: subToEth(bob.address),
-                    value: '49',
-                }
-            }
-        ]);
+    const events = await recordEvents(contract, async () => {
+      await transferFromExpectSuccess(collection, 1, bob, alice, { ethereum: receiver }, 51, 'Fungible');
     });
 
-    itWeb3('Events emitted for transfer()', async ({ web3 }) => {
-        const collection = await createCollectionExpectSuccess({
-            mode: { type: 'Fungible', decimalPoints: 0 }
-        });
-        const alice = privateKey('//Alice');
+    expect(events).to.be.deep.equal([
+      {
+        address,
+        event: 'Transfer',
+        args: {
+          from: subToEth(alice.address),
+          to: receiver,
+          value: '51',
+        },
+      },
+      {
+        address,
+        event: 'Approval',
+        args: {
+          owner: subToEth(alice.address),
+          spender: subToEth(bob.address),
+          value: '49',
+        },
+      },
+    ]);
+  });
 
-        const receiver = createEthAccount(web3);
+  itWeb3('Events emitted for transfer()', async ({ web3 }) => {
+    const collection = await createCollectionExpectSuccess({
+      mode: { type: 'Fungible', decimalPoints: 0 },
+    });
+    const alice = privateKey('//Alice');
 
-        await createFungibleItemExpectSuccess(alice, collection, { Value: 200n });
+    const receiver = createEthAccount(web3);
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(fungibleAbi as any, address);
+    await createFungibleItemExpectSuccess(alice, collection, { Value: 200n });
 
-        const events = await recordEvents(contract, async () => {
-            await transferExpectSuccess(collection, 1, alice, { ethereum: receiver }, 51, 'Fungible');
-        });
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(fungibleAbi as any, address);
 
-        expect(events).to.be.deep.equal([
-            {
-                address,
-                event: 'Transfer',
-                args: {
-                    from: subToEth(alice.address),
-                    to: receiver,
-                    value: '51',
-                }
-            },
-        ]);
+    const events = await recordEvents(contract, async () => {
+      await transferExpectSuccess(collection, 1, alice, { ethereum: receiver }, 51, 'Fungible');
     });
+
+    expect(events).to.be.deep.equal([
+      {
+        address,
+        event: 'Transfer',
+        args: {
+          from: subToEth(alice.address),
+          to: receiver,
+          value: '51',
+        },
+      },
+    ]);
+  });
 });
\ No newline at end of file
modifiedtests/src/eth/metadata.test.tsdiffbeforeafterboth
--- a/tests/src/eth/metadata.test.ts
+++ b/tests/src/eth/metadata.test.ts
@@ -1,53 +1,58 @@
-import { expect } from "chai";
-import privateKey from "../substrate/privateKey";
-import { createCollectionExpectSuccess } from "../util/helpers";
-import { collectionIdToAddress, createEthAccount, itWeb3, transferBalanceToEth } from "./util/helpers";
+//
+// This file is subject to the terms and conditions defined in
+// file 'LICENSE', which is part of this source code package.
+//
+
+import { expect } from 'chai';
+import privateKey from '../substrate/privateKey';
+import { createCollectionExpectSuccess } from '../util/helpers';
+import { collectionIdToAddress, createEthAccount, itWeb3, transferBalanceToEth } from './util/helpers';
 import fungibleMetadataAbi from './fungibleMetadataAbi.json';
 
 describe('Common metadata', () => {
-    itWeb3('Returns collection name', async ({ api, web3 }) => {
-        const collection = await createCollectionExpectSuccess({
-            name: 'token name',
-            mode: { type: 'NFT' }
-        });
-        const caller = createEthAccount(web3);
-        await transferBalanceToEth(api, privateKey('//Alice'), caller, 999999);
-
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(fungibleMetadataAbi as any, address);
-        const name = await contract.methods.name().call({ from: caller });
-
-        expect(name).to.equal('token name');
+  itWeb3('Returns collection name', async ({ api, web3 }) => {
+    const collection = await createCollectionExpectSuccess({
+      name: 'token name',
+      mode: { type: 'NFT' },
     });
+    const caller = createEthAccount(web3);
+    await transferBalanceToEth(api, privateKey('//Alice'), caller, 999999);
 
-    itWeb3('Returns symbol name', async ({ api, web3 }) => {
-        const collection = await createCollectionExpectSuccess({
-            tokenPrefix: 'TOK',
-            mode: { type: 'NFT' }
-        });
-        const caller = createEthAccount(web3);
-        await transferBalanceToEth(api, privateKey('//Alice'), caller, 999999);
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(fungibleMetadataAbi as any, address);
+    const name = await contract.methods.name().call({ from: caller });
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(fungibleMetadataAbi as any, address);
-        const symbol = await contract.methods.symbol().call({ from: caller });
+    expect(name).to.equal('token name');
+  });
 
-        expect(symbol).to.equal('TOK');
+  itWeb3('Returns symbol name', async ({ api, web3 }) => {
+    const collection = await createCollectionExpectSuccess({
+      tokenPrefix: 'TOK',
+      mode: { type: 'NFT' },
     });
+    const caller = createEthAccount(web3);
+    await transferBalanceToEth(api, privateKey('//Alice'), caller, 999999);
+
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(fungibleMetadataAbi as any, address);
+    const symbol = await contract.methods.symbol().call({ from: caller });
+
+    expect(symbol).to.equal('TOK');
+  });
 });
 
 describe('Fungible metadata', () => {
-    itWeb3('Returns fungible decimals', async ({ api, web3 }) => {
-        const collection = await createCollectionExpectSuccess({
-            mode: { type: 'Fungible', decimalPoints: 6 }
-        });
-        const caller = createEthAccount(web3);
-        await transferBalanceToEth(api, privateKey('//Alice'), caller, 999999);
+  itWeb3('Returns fungible decimals', async ({ api, web3 }) => {
+    const collection = await createCollectionExpectSuccess({
+      mode: { type: 'Fungible', decimalPoints: 6 },
+    });
+    const caller = createEthAccount(web3);
+    await transferBalanceToEth(api, privateKey('//Alice'), caller, 999999);
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(fungibleMetadataAbi as any, address);
-        const decimals = await contract.methods.decimals().call({ from: caller });
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(fungibleMetadataAbi as any, address);
+    const decimals = await contract.methods.decimals().call({ from: caller });
 
-        expect(+decimals).to.equal(6);
-    })
-})
\ No newline at end of file
+    expect(+decimals).to.equal(6);
+  });
+});
\ No newline at end of file
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -1,280 +1,285 @@
-import privateKey from "../substrate/privateKey";
-import { approveExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, transferExpectSuccess, transferFromExpectSuccess } from "../util/helpers";
-import { collectionIdToAddress, createEthAccount, itWeb3, normalizeEvents, recordEvents, subToEth, transferBalanceToEth } from "./util/helpers"
+//
+// This file is subject to the terms and conditions defined in
+// file 'LICENSE', which is part of this source code package.
+//
+
+import privateKey from '../substrate/privateKey';
+import { approveExpectSuccess, createCollectionExpectSuccess, createItemExpectSuccess, transferExpectSuccess, transferFromExpectSuccess } from '../util/helpers';
+import { collectionIdToAddress, createEthAccount, itWeb3, normalizeEvents, recordEvents, subToEth, transferBalanceToEth } from './util/helpers';
 import nonFungibleAbi from './nonFungibleAbi.json';
-import { expect } from "chai";
+import { expect } from 'chai';
 
 describe('Information getting', () => {
-    itWeb3('totalSupply', async ({ web3 }) => {
-        const collection = await createCollectionExpectSuccess({
-            mode: { type: 'NFT' }
-        });
-        const alice = privateKey('//Alice');
+  itWeb3('totalSupply', async ({ web3 }) => {
+    const collection = await createCollectionExpectSuccess({
+      mode: { type: 'NFT' },
+    });
+    const alice = privateKey('//Alice');
+
+    await createItemExpectSuccess(alice, collection, 'NFT', { substrate: alice.address });
 
-        await createItemExpectSuccess(alice, collection, 'NFT', { substrate: alice.address });
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
+    const totalSupply = await contract.methods.totalSupply().call();
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
-        const totalSupply = await contract.methods.totalSupply().call();
+    // FIXME: always equals to 0, because this method is not implemented
+    expect(totalSupply).to.equal('0');
+  });
 
-        // FIXME: always equals to 0, because this method is not implemented
-        expect(totalSupply).to.equal('0');
+  itWeb3('balanceOf', async ({ web3 }) => {
+    const collection = await createCollectionExpectSuccess({
+      mode: { type: 'NFT' },
     });
+    const alice = privateKey('//Alice');
 
-    itWeb3('balanceOf', async ({ web3 }) => {
-        const collection = await createCollectionExpectSuccess({
-            mode: { type: 'NFT' }
-        });
-        const alice = privateKey('//Alice');
+    const caller = createEthAccount(web3);
+    await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: caller });
+    await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: caller });
+    await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: caller });
 
-        const caller = createEthAccount(web3);
-        await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: caller });
-        await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: caller });
-        await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: caller });
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
+    const balance = await contract.methods.balanceOf(caller).call();
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
-        const balance = await contract.methods.balanceOf(caller).call();
+    expect(balance).to.equal('3');
+  });
 
-        expect(balance).to.equal('3');
+  itWeb3('ownerOf', async ({ web3 }) => {
+    const collection = await createCollectionExpectSuccess({
+      mode: { type: 'NFT' },
     });
+    const alice = privateKey('//Alice');
 
-    itWeb3('ownerOf', async ({ web3 }) => {
-        const collection = await createCollectionExpectSuccess({
-            mode: { type: 'NFT' }
-        });
-        const alice = privateKey('//Alice');
+    const caller = createEthAccount(web3);
+    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: caller });
 
-        const caller = createEthAccount(web3);
-        const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: caller });
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
+    const owner = await contract.methods.ownerOf(tokenId).call();
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
-        const owner = await contract.methods.ownerOf(tokenId).call();
-
-        expect(owner).to.equal(caller);
-    });
+    expect(owner).to.equal(caller);
+  });
 });
 
 describe.only('Plain calls', () => {
-    itWeb3('Can perform approve()', async ({ web3, api }) => {
-        const collection = await createCollectionExpectSuccess({
-            mode: { type: 'NFT' }
-        });
-        const alice = privateKey('//Alice');
+  itWeb3('Can perform approve()', async ({ web3, api }) => {
+    const collection = await createCollectionExpectSuccess({
+      mode: { type: 'NFT' },
+    });
+    const alice = privateKey('//Alice');
 
-        const owner = createEthAccount(web3);
-        await transferBalanceToEth(api, alice, owner, 999999999999999);
+    const owner = createEthAccount(web3);
+    await transferBalanceToEth(api, alice, owner, 999999999999999);
 
-        const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: owner });
+    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: owner });
 
-        const spender = createEthAccount(web3);
+    const spender = createEthAccount(web3);
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
 
+    {
+      const result = await contract.methods.approve(spender, tokenId).send({ from: owner, gas: '0x1000000', gasPrice: '0x01' });
+      const events = normalizeEvents(result.events);
+
+      expect(events).to.be.deep.equal([
         {
-            const result = await contract.methods.approve(spender, tokenId).send({ from: owner, gas: '0x1000000', gasPrice: '0x01' });
-            const events = normalizeEvents(result.events);
+          address,
+          event: 'Approval',
+          args: {
+            owner,
+            approved: spender,
+            tokenId: tokenId.toString(),
+          },
+        },
+      ]);
+    }
+  });
 
-            expect(events).to.be.deep.equal([
-                {
-                    address,
-                    event: 'Approval',
-                    args: {
-                        owner,
-                        approved: spender,
-                        tokenId: tokenId.toString(),
-                    }
-                }
-            ]);
-        }
+  itWeb3('Can perform transferFrom()', async ({ web3, api }) => {
+    const collection = await createCollectionExpectSuccess({
+      mode: { type: 'NFT' },
     });
-
-    itWeb3('Can perform transferFrom()', async ({ web3, api }) => {
-        const collection = await createCollectionExpectSuccess({
-            mode: { type: 'NFT' }
-        });
-        const alice = privateKey('//Alice');
+    const alice = privateKey('//Alice');
 
-        const owner = createEthAccount(web3);
-        await transferBalanceToEth(api, alice, owner, 999999999999999);
+    const owner = createEthAccount(web3);
+    await transferBalanceToEth(api, alice, owner, 999999999999999);
 
-        const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: owner });
+    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: owner });
 
-        const spender = createEthAccount(web3);
-        await transferBalanceToEth(api, alice, spender, 999999999999999);
+    const spender = createEthAccount(web3);
+    await transferBalanceToEth(api, alice, spender, 999999999999999);
 
-        const receiver = createEthAccount(web3);
+    const receiver = createEthAccount(web3);
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
 
-        await contract.methods.approve(spender, tokenId).send({ from: owner, gas: '0x1000000', gasPrice: '0x01' });
+    await contract.methods.approve(spender, tokenId).send({ from: owner, gas: '0x1000000', gasPrice: '0x01' });
 
+    {
+      const result = await contract.methods.transferFrom(owner, receiver, tokenId).send({ from: spender, gas: '0x1000000', gasPrice: '0x01' });
+      const events = normalizeEvents(result.events);
+      expect(events).to.be.deep.equal([
         {
-            const result = await contract.methods.transferFrom(owner, receiver, tokenId).send({ from: spender, gas: '0x1000000', gasPrice: '0x01' });
-            const events = normalizeEvents(result.events);
-            expect(events).to.be.deep.equal([
-                {
-                    address,
-                    event: 'Transfer',
-                    args: {
-                        from: owner,
-                        to: receiver,
-                        tokenId: tokenId.toString(),
-                    },
-                },
-            ]);
-        }
+          address,
+          event: 'Transfer',
+          args: {
+            from: owner,
+            to: receiver,
+            tokenId: tokenId.toString(),
+          },
+        },
+      ]);
+    }
 
-        {
-            const balance = await contract.methods.balanceOf(receiver).call();
-            expect(+balance).to.equal(1);
-        }
+    {
+      const balance = await contract.methods.balanceOf(receiver).call();
+      expect(+balance).to.equal(1);
+    }
 
-        {
-            const balance = await contract.methods.balanceOf(owner).call();
-            expect(+balance).to.equal(0);
-        }
-    });
+    {
+      const balance = await contract.methods.balanceOf(owner).call();
+      expect(+balance).to.equal(0);
+    }
+  });
 
-    itWeb3('Can perform transfer()', async ({ web3, api }) => {
-        const collection = await createCollectionExpectSuccess({
-            mode: { type: 'NFT' }
-        });
-        const alice = privateKey('//Alice');
+  itWeb3('Can perform transfer()', async ({ web3, api }) => {
+    const collection = await createCollectionExpectSuccess({
+      mode: { type: 'NFT' },
+    });
+    const alice = privateKey('//Alice');
 
-        const owner = createEthAccount(web3);
-        await transferBalanceToEth(api, alice, owner, 999999999999999);
+    const owner = createEthAccount(web3);
+    await transferBalanceToEth(api, alice, owner, 999999999999999);
 
-        const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: owner });
+    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: owner });
 
-        const receiver = createEthAccount(web3);
-        await transferBalanceToEth(api, alice, receiver, 999999999999999);
+    const receiver = createEthAccount(web3);
+    await transferBalanceToEth(api, alice, receiver, 999999999999999);
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
 
+    {
+      const result = await contract.methods.transfer(receiver, tokenId).send({ from: owner, gas: '0x1000000', gasPrice: '0x01' });
+      console.log(result);
+      const events = normalizeEvents(result.events);
+      expect(events).to.be.deep.equal([
         {
-            const result = await contract.methods.transfer(receiver, tokenId).send({ from: owner, gas: '0x1000000', gasPrice: '0x01' });
-            console.log(result);
-            const events = normalizeEvents(result.events);
-            expect(events).to.be.deep.equal([
-                {
-                    address,
-                    event: 'Transfer',
-                    args: {
-                        from: owner,
-                        to: receiver,
-                        tokenId: tokenId.toString(),
-                    }
-                },
-            ])
-        }
+          address,
+          event: 'Transfer',
+          args: {
+            from: owner,
+            to: receiver,
+            tokenId: tokenId.toString(),
+          },
+        },
+      ]);
+    }
 
-        {
-            const balance = await contract.methods.balanceOf(owner).call();
-            expect(+balance).to.equal(0);
-        }
+    {
+      const balance = await contract.methods.balanceOf(owner).call();
+      expect(+balance).to.equal(0);
+    }
 
-        {
-            const balance = await contract.methods.balanceOf(receiver).call();
-            expect(+balance).to.equal(1);
-        }
-    });
+    {
+      const balance = await contract.methods.balanceOf(receiver).call();
+      expect(+balance).to.equal(1);
+    }
+  });
 });
 
 describe('Substrate calls', () => {
-    itWeb3('Events emitted for approve()', async ({ web3 }) => {
-        const collection = await createCollectionExpectSuccess({
-            mode: { type: 'NFT' }
-        });
-        const alice = privateKey('//Alice');
-
-        const receiver = createEthAccount(web3);
+  itWeb3('Events emitted for approve()', async ({ web3 }) => {
+    const collection = await createCollectionExpectSuccess({
+      mode: { type: 'NFT' },
+    });
+    const alice = privateKey('//Alice');
 
-        const tokenId = await createItemExpectSuccess(alice, collection, 'NFT');
+    const receiver = createEthAccount(web3);
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
+    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT');
 
-        const events = await recordEvents(contract, async () => {
-            await approveExpectSuccess(collection, tokenId, alice, { ethereum: receiver }, 1);
-        });
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
 
-        expect(events).to.be.deep.equal([
-            {
-                address,
-                event: 'Approval',
-                args: {
-                    owner: subToEth(alice.address),
-                    approved: receiver,
-                    tokenId: tokenId.toString(),
-                }
-            }
-        ]);
+    const events = await recordEvents(contract, async () => {
+      await approveExpectSuccess(collection, tokenId, alice, { ethereum: receiver }, 1);
     });
 
-    itWeb3('Events emitted for transferFrom()', async ({ web3 }) => {
-        const collection = await createCollectionExpectSuccess({
-            mode: { type: 'NFT' }
-        });
-        const alice = privateKey('//Alice');
-        const bob = privateKey('//Bob');
+    expect(events).to.be.deep.equal([
+      {
+        address,
+        event: 'Approval',
+        args: {
+          owner: subToEth(alice.address),
+          approved: receiver,
+          tokenId: tokenId.toString(),
+        },
+      },
+    ]);
+  });
 
-        const receiver = createEthAccount(web3);
+  itWeb3('Events emitted for transferFrom()', async ({ web3 }) => {
+    const collection = await createCollectionExpectSuccess({
+      mode: { type: 'NFT' },
+    });
+    const alice = privateKey('//Alice');
+    const bob = privateKey('//Bob');
 
-        const tokenId = await createItemExpectSuccess(alice, collection, 'NFT');
-        await approveExpectSuccess(collection, tokenId, alice, bob, 1);
+    const receiver = createEthAccount(web3);
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
+    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT');
+    await approveExpectSuccess(collection, tokenId, alice, bob, 1);
 
-        const events = await recordEvents(contract, async () => {
-            await transferFromExpectSuccess(collection, tokenId, bob, alice, { ethereum: receiver }, 1, 'NFT');
-        });
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
 
-        expect(events).to.be.deep.equal([
-            {
-                address,
-                event: 'Transfer',
-                args: {
-                    from: subToEth(alice.address),
-                    to: receiver,
-                    tokenId: tokenId.toString(),
-                }
-            },
-        ]);
+    const events = await recordEvents(contract, async () => {
+      await transferFromExpectSuccess(collection, tokenId, bob, alice, { ethereum: receiver }, 1, 'NFT');
     });
 
-    itWeb3('Events emitted for transfer()', async ({ web3 }) => {
-        const collection = await createCollectionExpectSuccess({
-            mode: { type: 'NFT' }
-        });
-        const alice = privateKey('//Alice');
+    expect(events).to.be.deep.equal([
+      {
+        address,
+        event: 'Transfer',
+        args: {
+          from: subToEth(alice.address),
+          to: receiver,
+          tokenId: tokenId.toString(),
+        },
+      },
+    ]);
+  });
 
-        const receiver = createEthAccount(web3);
+  itWeb3('Events emitted for transfer()', async ({ web3 }) => {
+    const collection = await createCollectionExpectSuccess({
+      mode: { type: 'NFT' },
+    });
+    const alice = privateKey('//Alice');
 
-        const tokenId = await createItemExpectSuccess(alice, collection, 'NFT');
+    const receiver = createEthAccount(web3);
 
-        const address = collectionIdToAddress(collection);
-        const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
+    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT');
 
-        const events = await recordEvents(contract, async () => {
-            await transferExpectSuccess(collection, tokenId, alice, { ethereum: receiver }, 1, 'NFT');
-        });
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
 
-        expect(events).to.be.deep.equal([
-            {
-                address,
-                event: 'Transfer',
-                args: {
-                    from: subToEth(alice.address),
-                    to: receiver,
-                    tokenId: tokenId.toString(),
-                }
-            },
-        ]);
+    const events = await recordEvents(contract, async () => {
+      await transferExpectSuccess(collection, tokenId, alice, { ethereum: receiver }, 1, 'NFT');
     });
+
+    expect(events).to.be.deep.equal([
+      {
+        address,
+        event: 'Transfer',
+        args: {
+          from: subToEth(alice.address),
+          to: receiver,
+          tokenId: tokenId.toString(),
+        },
+      },
+    ]);
+  });
 });
\ No newline at end of file
modifiedtests/src/eth/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/eth/util/helpers.ts
+++ b/tests/src/eth/util/helpers.ts
@@ -1,70 +1,75 @@
-import { ApiPromise } from "@polkadot/api";
-import { addressToEvm, evmToAddress } from "@polkadot/util-crypto";
-import Web3 from "web3";
-import usingApi, { submitTransactionAsync } from "../../substrate/substrate-api";
+//
+// This file is subject to the terms and conditions defined in
+// file 'LICENSE', which is part of this source code package.
+//
+
+import { ApiPromise } from '@polkadot/api';
+import { addressToEvm, evmToAddress } from '@polkadot/util-crypto';
+import Web3 from 'web3';
+import usingApi, { submitTransactionAsync } from '../../substrate/substrate-api';
 import { IKeyringPair } from '@polkadot/types/types';
-import { expect } from "chai";
-import { getGenericResult } from "../../util/helpers";
+import { expect } from 'chai';
+import { getGenericResult } from '../../util/helpers';
 
 let web3Connected = false;
 export async function usingWeb3<T>(cb: (web3: Web3) => Promise<T> | T): Promise<T> {
-    if (web3Connected) throw new Error('do not nest usingWeb3 calls');
-    web3Connected = true;
+  if (web3Connected) throw new Error('do not nest usingWeb3 calls');
+  web3Connected = true;
 
-    const provider = new Web3.providers.WebsocketProvider("http://localhost:9944");
-    const web3 = new Web3(provider);
+  const provider = new Web3.providers.WebsocketProvider('http://localhost:9944');
+  const web3 = new Web3(provider);
 
-    try {
-        return await cb(web3);
-    } finally {
-        // provider.disconnect(3000, 'normal disconnect');
-        provider.connection.close();
-        web3Connected = false;
-    }
+  try {
+    return await cb(web3);
+  } finally {
+    // provider.disconnect(3000, 'normal disconnect');
+    provider.connection.close();
+    web3Connected = false;
+  }
 }
 
 export function collectionIdToAddress(address: number): string {
-    if (address >= 0xffffffff || address < 0) throw new Error('id overflow');
-    const buf = Buffer.from([0x17, 0xc4, 0xe6, 0x45, 0x3c, 0xc4, 0x9a, 0xaa, 0xae, 0xac, 0xa8, 0x94, 0xe6, 0xd9, 0x68, 0x3e,
-        address >> 24,
-        (address >> 16) & 0xff,
-        (address >> 8) & 0xff,
-        address & 0xff,
-    ]);
-    return Web3.utils.toChecksumAddress('0x' + buf.toString('hex'));
+  if (address >= 0xffffffff || address < 0) throw new Error('id overflow');
+  const buf = Buffer.from([0x17, 0xc4, 0xe6, 0x45, 0x3c, 0xc4, 0x9a, 0xaa, 0xae, 0xac, 0xa8, 0x94, 0xe6, 0xd9, 0x68, 0x3e,
+    address >> 24,
+    (address >> 16) & 0xff,
+    (address >> 8) & 0xff,
+    address & 0xff,
+  ]);
+  return Web3.utils.toChecksumAddress('0x' + buf.toString('hex'));
 }
 
 export function createEthAccount(web3: Web3) {
-    const account = web3.eth.accounts.create();
-    web3.eth.accounts.wallet.add(account.privateKey);
-    return account.address;
+  const account = web3.eth.accounts.create();
+  web3.eth.accounts.wallet.add(account.privateKey);
+  return account.address;
 }
 
 export async function transferBalanceToEth(api: ApiPromise, source: IKeyringPair, target: string, amount: number) {
-    const tx = api.tx.balances.transfer(evmToAddress(target), amount);
-    const events = await submitTransactionAsync(source, tx);
-    const result = getGenericResult(events);
-    expect(result.success).to.be.true;
+  const tx = api.tx.balances.transfer(evmToAddress(target), amount);
+  const events = await submitTransactionAsync(source, tx);
+  const result = getGenericResult(events);
+  expect(result.success).to.be.true;
 }
 
 export async function itWeb3(name: string, cb: (apis: { web3: Web3, api: ApiPromise }) => any, opts: { only?: boolean, skip?: boolean } = {}) {
-    let i: any = it;
-    if (opts.only) i = i.only;
-    else if (opts.skip) i = i.skip;
-    i(name, async () => {
-        await usingApi(async api => {
-            await usingWeb3(async web3 => {
-                await cb({ api, web3 });
-            });
-        });
+  let i: any = it;
+  if (opts.only) i = i.only;
+  else if (opts.skip) i = i.skip;
+  i(name, async () => {
+    await usingApi(async api => {
+      await usingWeb3(async web3 => {
+        await cb({ api, web3 });
+      });
     });
+  });
 }
 itWeb3.only = (name: string, cb: (apis: { web3: Web3, api: ApiPromise }) => any) => itWeb3(name, cb, { only: true });
 itWeb3.skip = (name: string, cb: (apis: { web3: Web3, api: ApiPromise }) => any) => itWeb3(name, cb, { skip: true });
 
 export async function generateSubstrateEthPair(web3: Web3) {
-    let account = web3.eth.accounts.create();
-    const evm = evmToAddress(account.address);
+  const account = web3.eth.accounts.create();
+  evmToAddress(account.address);
 }
 
 type NormalizedEvent = {
@@ -74,43 +79,43 @@
 };
 
 export function normalizeEvents(events: any): NormalizedEvent[] {
-    const output = [];
-    for (let key of Object.keys(events)) {
-        if (key.match(/^[0-9]+$/)) {
-            output.push(events[key]);
-        } else if (Array.isArray(events[key])) {
-            output.push(...events[key]);
-        } else {
-            output.push(events[key]);
-        }
+  const output = [];
+  for (const key of Object.keys(events)) {
+    if (key.match(/^[0-9]+$/)) {
+      output.push(events[key]);
+    } else if (Array.isArray(events[key])) {
+      output.push(...events[key]);
+    } else {
+      output.push(events[key]);
     }
-    output.sort((a, b) => a.logIndex - b.logIndex);
-    return output.map(({ address, event, returnValues }) => {
-        const args: { [key: string]: string } = {};
-        for (let key of Object.keys(returnValues)) {
-            if (!key.match(/^[0-9]+$/)) {
-                args[key] = returnValues[key];
-            }
-        }
-        return {
-            address,
-            event,
-            args,
-        };
-    });
+  }
+  output.sort((a, b) => a.logIndex - b.logIndex);
+  return output.map(({ address, event, returnValues }) => {
+    const args: { [key: string]: string } = {};
+    for (const key of Object.keys(returnValues)) {
+      if (!key.match(/^[0-9]+$/)) {
+        args[key] = returnValues[key];
+      }
+    }
+    return {
+      address,
+      event,
+      args,
+    };
+  });
 }
 
 export async function recordEvents(contract: any, action: () => Promise<void>): Promise<NormalizedEvent[]> {
-    const out: any = [];
-    contract.events.allEvents((_: any, event: any) => {
-        out.push(event);
-    });
-    await action();
-    return normalizeEvents(out);
+  const out: any = [];
+  contract.events.allEvents((_: any, event: any) => {
+    out.push(event);
+  });
+  await action();
+  return normalizeEvents(out);
 }
 
 export function subToEth(eth: string): string {
-    const bytes = addressToEvm(eth);
-    const string = '0x' + Buffer.from(bytes).toString('hex');
-    return Web3.utils.toChecksumAddress(string);
+  const bytes = addressToEvm(eth);
+  const string = '0x' + Buffer.from(bytes).toString('hex');
+  return Web3.utils.toChecksumAddress(string);
 }
\ No newline at end of file
modifiedtests/src/inflation.test.tsdiffbeforeafterboth
--- a/tests/src/inflation.test.ts
+++ b/tests/src/inflation.test.ts
@@ -5,25 +5,13 @@
 
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
-import { default as usingApi } from "./substrate/substrate-api";
-import privateKey from "./substrate/privateKey";
+import { default as usingApi } from './substrate/substrate-api';
 import { BigNumber } from 'bignumber.js';
-import { IKeyringPair } from '@polkadot/types/types';
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
-
-let alice: IKeyringPair;
-let bob: IKeyringPair;
 
 describe('integration test: Inflation', () => {
-  before(async () => {
-    await usingApi(async (api) => {
-      alice = privateKey('//Alice');
-      bob = privateKey('//Bob');
-    });
-  });
-
   it('First year inflation is 10%', async () => {
     await usingApi(async (api) => {
 
modifiedtests/src/overflow.test.tsdiffbeforeafterboth
--- a/tests/src/overflow.test.ts
+++ b/tests/src/overflow.test.ts
@@ -3,65 +3,65 @@
 // file 'LICENSE', which is part of this source code package.
 //
 
-import { IKeyringPair } from "@polkadot/types/types";
+import { IKeyringPair } from '@polkadot/types/types';
 import chai from 'chai';
-import chaiAsPromised from "chai-as-promised";
-import privateKey from "./substrate/privateKey";
-import usingApi from "./substrate/substrate-api";
-import { approveExpectFail, approveExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, getAllowance, getFungibleBalance, transferExpectFail, transferExpectSuccess, transferFromExpectFail, transferFromExpectSuccess, U128_MAX } from "./util/helpers";
+import chaiAsPromised from 'chai-as-promised';
+import privateKey from './substrate/privateKey';
+import usingApi from './substrate/substrate-api';
+import { approveExpectFail, approveExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, getAllowance, getFungibleBalance, transferExpectFail, transferExpectSuccess, transferFromExpectFail, transferFromExpectSuccess, U128_MAX } from './util/helpers';
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
 
 describe('Integration Test fungible overflows', () => {
-    let alice: IKeyringPair;
-    let bob: IKeyringPair;
-    let charlie: IKeyringPair;
+  let alice: IKeyringPair;
+  let bob: IKeyringPair;
+  let charlie: IKeyringPair;
 
-    before(async () => {
-        await usingApi(async () => {
-            alice = privateKey('//Alice');
-            bob = privateKey('//Bob');
-            charlie = privateKey('//Charlie');
-        });
+  before(async () => {
+    await usingApi(async () => {
+      alice = privateKey('//Alice');
+      bob = privateKey('//Bob');
+      charlie = privateKey('//Charlie');
     });
+  });
 
-    it('fails when overflows on transfer', async () => {
-        const fungibleCollectionId = await createCollectionExpectSuccess({ mode: { type: 'Fungible', decimalPoints: 0 } });
+  it('fails when overflows on transfer', async () => {
+    const fungibleCollectionId = await createCollectionExpectSuccess({ mode: { type: 'Fungible', decimalPoints: 0 } });
 
-        await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: U128_MAX });
-        await transferExpectSuccess(fungibleCollectionId, 0, alice, bob, U128_MAX, 'Fungible');
+    await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: U128_MAX });
+    await transferExpectSuccess(fungibleCollectionId, 0, alice, bob, U128_MAX, 'Fungible');
 
-        await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: 1n });
-        await transferExpectFail(fungibleCollectionId, 0, alice, bob, 1, 'Fungible');
+    await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: 1n });
+    await transferExpectFail(fungibleCollectionId, 0, alice, bob, 1, 'Fungible');
 
-        expect(await getFungibleBalance(fungibleCollectionId, alice.address)).to.equal(1n);
-        expect(await getFungibleBalance(fungibleCollectionId, bob.address)).to.equal(U128_MAX);
-    });
+    expect(await getFungibleBalance(fungibleCollectionId, alice.address)).to.equal(1n);
+    expect(await getFungibleBalance(fungibleCollectionId, bob.address)).to.equal(U128_MAX);
+  });
 
-    it('fails on allowance overflow', async () => {
-        const fungibleCollectionId = await createCollectionExpectSuccess({ mode: { type: 'Fungible', decimalPoints: 0 } });
+  it('fails on allowance overflow', async () => {
+    const fungibleCollectionId = await createCollectionExpectSuccess({ mode: { type: 'Fungible', decimalPoints: 0 } });
 
-        await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: U128_MAX });
-        await approveExpectSuccess(fungibleCollectionId, 0, alice, bob, U128_MAX);
-        await approveExpectFail(fungibleCollectionId, 0, alice, bob, U128_MAX);
-    });
+    await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: U128_MAX });
+    await approveExpectSuccess(fungibleCollectionId, 0, alice, bob, U128_MAX);
+    await approveExpectFail(fungibleCollectionId, 0, alice, bob, U128_MAX);
+  });
 
-    it('fails when overflows on transferFrom', async () => {
-        const fungibleCollectionId = await createCollectionExpectSuccess({ mode: { type: 'Fungible', decimalPoints: 0 } });
+  it('fails when overflows on transferFrom', async () => {
+    const fungibleCollectionId = await createCollectionExpectSuccess({ mode: { type: 'Fungible', decimalPoints: 0 } });
 
-        await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: U128_MAX });
-        await approveExpectSuccess(fungibleCollectionId, 0, alice, bob, U128_MAX);
-        await transferFromExpectSuccess(fungibleCollectionId, 0, bob, alice, charlie, U128_MAX, 'Fungible');
+    await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: U128_MAX });
+    await approveExpectSuccess(fungibleCollectionId, 0, alice, bob, U128_MAX);
+    await transferFromExpectSuccess(fungibleCollectionId, 0, bob, alice, charlie, U128_MAX, 'Fungible');
 
-        expect(await getFungibleBalance(fungibleCollectionId, charlie.address)).to.equal(U128_MAX);
-        expect((await getAllowance(fungibleCollectionId, 0, alice.address, bob.address)).toString()).to.equal('0');
+    expect(await getFungibleBalance(fungibleCollectionId, charlie.address)).to.equal(U128_MAX);
+    expect((await getAllowance(fungibleCollectionId, 0, alice.address, bob.address)).toString()).to.equal('0');
 
-        await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: U128_MAX });
-        await approveExpectSuccess(fungibleCollectionId, 0, alice, bob, 1n);
-        await transferFromExpectFail(fungibleCollectionId, 0, bob, alice, charlie, 1);
+    await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: U128_MAX });
+    await approveExpectSuccess(fungibleCollectionId, 0, alice, bob, 1n);
+    await transferFromExpectFail(fungibleCollectionId, 0, bob, alice, charlie, 1);
 
-        expect(await getFungibleBalance(fungibleCollectionId, charlie.address)).to.equal(U128_MAX);
-        expect((await getAllowance(fungibleCollectionId, 0, alice.address, bob.address)).toString()).to.equal('1');
-    });
+    expect(await getFungibleBalance(fungibleCollectionId, charlie.address)).to.equal(U128_MAX);
+    expect((await getAllowance(fungibleCollectionId, 0, alice.address, bob.address)).toString()).to.equal('1');
+  });
 });
modifiedtests/src/pallet-presence.test.tsdiffbeforeafterboth
--- a/tests/src/pallet-presence.test.ts
+++ b/tests/src/pallet-presence.test.ts
@@ -3,9 +3,9 @@
 // file 'LICENSE', which is part of this source code package.
 //
 
-import { ApiPromise } from "@polkadot/api";
-import { expect } from "chai";
-import usingApi from "./substrate/substrate-api";
+import { ApiPromise } from '@polkadot/api';
+import { expect } from 'chai';
+import usingApi from './substrate/substrate-api';
 
 function getModuleNames(api: ApiPromise): string[] {
   return api.runtimeMetadata.asLatest.modules.map(m => m.name.toString().toLowerCase());
@@ -14,12 +14,12 @@
 // Pallets that must always be present
 const requiredPallets = [
   'nft', 'inflation', 'balances', 'contracts', 'randomnesscollectiveflip', 'system', 'timestamp', 'transactionpayment', 'treasury', 'vesting', 'evm', 'ethereum',
-  'scheduler', 'nftpayment', 'charging'
+  'scheduler', 'nftpayment', 'charging',
 ];
 
 // Pallets that depend on consensus and governance configuration
 const consensusPallets = [
-  'sudo', 'aura'
+  'sudo', 'aura',
 ];
 
 describe('Pallet presence', () => {
modifiedtests/src/removeCollectionSponsor.test.tsdiffbeforeafterboth
--- a/tests/src/removeCollectionSponsor.test.ts
+++ b/tests/src/removeCollectionSponsor.test.ts
@@ -5,27 +5,21 @@
 
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
-import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from "./substrate/substrate-api";
+import { default as usingApi, submitTransactionExpectFailAsync } from './substrate/substrate-api';
 import { 
   createCollectionExpectSuccess, 
   setCollectionSponsorExpectSuccess, 
   destroyCollectionExpectSuccess, 
-  setCollectionSponsorExpectFailure,
   confirmSponsorshipExpectSuccess,
   confirmSponsorshipExpectFailure,
   createItemExpectSuccess,
   findUnusedAddress,
-  getGenericResult,
-  enableWhiteListExpectSuccess,
-  enablePublicMintingExpectSuccess,
-  addToWhiteListExpectSuccess,
   removeCollectionSponsorExpectSuccess,
   removeCollectionSponsorExpectFailure,
   normalizeAccountId,
-} from "./util/helpers";
-import { Keyring } from "@polkadot/api";
-import { IKeyringPair } from "@polkadot/types/types";
-import type { AccountId } from '@polkadot/types/interfaces';
+} from './util/helpers';
+import { Keyring } from '@polkadot/api';
+import { IKeyringPair } from '@polkadot/types/types';
 import { BigNumber } from 'bignumber.js';
 
 chai.use(chaiAsPromised);
@@ -33,16 +27,14 @@
 
 let alice: IKeyringPair;
 let bob: IKeyringPair;
-let charlie: IKeyringPair;
 
 describe('integration test: ext. removeCollectionSponsor():', () => {
 
   before(async () => {
-    await usingApi(async (api) => {
+    await usingApi(async () => {
       const keyring = new Keyring({ type: 'sr25519' });
-      alice = keyring.addFromUri(`//Alice`);
-      bob = keyring.addFromUri(`//Bob`);
-      charlie = keyring.addFromUri(`//Charlie`);
+      alice = keyring.addFromUri('//Alice');
+      bob = keyring.addFromUri('//Bob');
     });
   });
 
@@ -65,7 +57,7 @@
       const badTransaction = async function () { 
         await submitTransactionExpectFailAsync(zeroBalance, zeroToAlice);
       };
-      await expect(badTransaction()).to.be.rejectedWith("Inability to pay some fees");
+      await expect(badTransaction()).to.be.rejectedWith('Inability to pay some fees');
       const BsponsorBalance = new BigNumber((await api.query.system.account(bob.address)).data.free.toString());
 
       expect(BsponsorBalance.isEqualTo(AsponsorBalance)).to.be.true;
@@ -95,19 +87,18 @@
 
 describe('(!negative test!) integration test: ext. removeCollectionSponsor():', () => {
   before(async () => {
-    await usingApi(async (api) => {
+    await usingApi(async () => {
       const keyring = new Keyring({ type: 'sr25519' });
-      alice = keyring.addFromUri(`//Alice`);
-      bob = keyring.addFromUri(`//Bob`);
-      charlie = keyring.addFromUri(`//Charlie`);
+      alice = keyring.addFromUri('//Alice');
+      bob = keyring.addFromUri('//Bob');
     });
   });
 
   it('(!negative test!) Remove sponsor for a collection that never existed', async () => {
     // Find the collection that never existed
-    const collectionId = 0;
+    let collectionId = 0;
     await usingApi(async (api) => {
-      const collectionId = parseInt((await api.query.nft.createdCollectionCount()).toString()) + 1;
+      collectionId = parseInt((await api.query.nft.createdCollectionCount()).toString()) + 1;
     });
 
     await removeCollectionSponsorExpectFailure(collectionId);
modifiedtests/src/removeFromContractWhiteList.test.tsdiffbeforeafterboth
--- a/tests/src/removeFromContractWhiteList.test.ts
+++ b/tests/src/removeFromContractWhiteList.test.ts
@@ -3,79 +3,79 @@
 // file 'LICENSE', which is part of this source code package.
 //
 
-import privateKey from "./substrate/privateKey";
-import usingApi from "./substrate/substrate-api";
-import { deployFlipper, toggleFlipValueExpectFailure, toggleFlipValueExpectSuccess } from "./util/contracthelpers";
-import { addToContractWhiteListExpectSuccess, isWhitelistedInContract, removeFromContractWhiteListExpectFailure, removeFromContractWhiteListExpectSuccess, toggleContractWhitelistExpectSuccess } from "./util/helpers";
+import privateKey from './substrate/privateKey';
+import usingApi from './substrate/substrate-api';
+import { deployFlipper, toggleFlipValueExpectFailure, toggleFlipValueExpectSuccess } from './util/contracthelpers';
+import { addToContractWhiteListExpectSuccess, isWhitelistedInContract, removeFromContractWhiteListExpectFailure, removeFromContractWhiteListExpectSuccess, toggleContractWhitelistExpectSuccess } from './util/helpers';
 import { IKeyringPair } from '@polkadot/types/types';
-import { expect } from "chai";
+import { expect } from 'chai';
 
 describe('Integration Test removeFromContractWhiteList', () => {
-    let bob: IKeyringPair;
+  let bob: IKeyringPair;
 
-    before(async () => {
-        await usingApi(async () => {
-            bob = privateKey('//Bob');
-        });
+  before(async () => {
+    await usingApi(async () => {
+      bob = privateKey('//Bob');
     });
+  });
 
-    it('user is no longer whitelisted after removal', async () => {
-        await usingApi(async (api) => {
-            const [flipper, deployer] = await deployFlipper(api);
+  it('user is no longer whitelisted after removal', async () => {
+    await usingApi(async (api) => {
+      const [flipper, deployer] = await deployFlipper(api);
 
-            await addToContractWhiteListExpectSuccess(deployer, flipper.address.toString(), bob.address);
-            await removeFromContractWhiteListExpectSuccess(deployer, flipper.address.toString(), bob.address);
+      await addToContractWhiteListExpectSuccess(deployer, flipper.address.toString(), bob.address);
+      await removeFromContractWhiteListExpectSuccess(deployer, flipper.address.toString(), bob.address);
 
-            expect(await isWhitelistedInContract(flipper.address, bob.address)).to.be.false;
-        });
+      expect(await isWhitelistedInContract(flipper.address, bob.address)).to.be.false;
     });
+  });
 
-    it('user can\'t execute contract after removal', async () => {
-        await usingApi(async (api) => {
-            const [flipper, deployer] = await deployFlipper(api);
-            await toggleContractWhitelistExpectSuccess(deployer, flipper.address.toString(), true);
+  it('user can\'t execute contract after removal', async () => {
+    await usingApi(async (api) => {
+      const [flipper, deployer] = await deployFlipper(api);
+      await toggleContractWhitelistExpectSuccess(deployer, flipper.address.toString(), true);
 
-            await addToContractWhiteListExpectSuccess(deployer, flipper.address.toString(), bob.address);
-            await toggleFlipValueExpectSuccess(bob, flipper);
+      await addToContractWhiteListExpectSuccess(deployer, flipper.address.toString(), bob.address);
+      await toggleFlipValueExpectSuccess(bob, flipper);
 
-            await removeFromContractWhiteListExpectSuccess(deployer, flipper.address.toString(), bob.address);
-            await toggleFlipValueExpectFailure(bob, flipper);
-        });
+      await removeFromContractWhiteListExpectSuccess(deployer, flipper.address.toString(), bob.address);
+      await toggleFlipValueExpectFailure(bob, flipper);
     });
+  });
 
-    it('can be called twice', async () => {
-        await usingApi(async (api) => {
-            const [flipper, deployer] = await deployFlipper(api);
+  it('can be called twice', async () => {
+    await usingApi(async (api) => {
+      const [flipper, deployer] = await deployFlipper(api);
 
-            await addToContractWhiteListExpectSuccess(deployer, flipper.address.toString(), bob.address);
-            await removeFromContractWhiteListExpectSuccess(deployer, flipper.address.toString(), bob.address);
-            await removeFromContractWhiteListExpectSuccess(deployer, flipper.address.toString(), bob.address);
-        });
+      await addToContractWhiteListExpectSuccess(deployer, flipper.address.toString(), bob.address);
+      await removeFromContractWhiteListExpectSuccess(deployer, flipper.address.toString(), bob.address);
+      await removeFromContractWhiteListExpectSuccess(deployer, flipper.address.toString(), bob.address);
     });
+  });
 });
 
 describe('Negative Integration Test removeFromContractWhiteList', () => {
-    let alice: IKeyringPair;
-    let bob: IKeyringPair;
+  let alice: IKeyringPair;
+  let bob: IKeyringPair;
 
-    before(async () => {
-        await usingApi(async () => {
-            alice = privateKey('//Alice');
-            bob = privateKey('//Bob');
-        });
+  before(async () => {
+    await usingApi(async () => {
+      alice = privateKey('//Alice');
+      bob = privateKey('//Bob');
     });
+  });
 
-    it('fails when called with non-contract address', async () => {
-        await usingApi(async () => {
-            await removeFromContractWhiteListExpectFailure(alice, alice.address, bob.address);
-        });
+  it('fails when called with non-contract address', async () => {
+    await usingApi(async () => {
+      await removeFromContractWhiteListExpectFailure(alice, alice.address, bob.address);
     });
+  });
 
-    it('fails when executed by non owner', async () => {
-        await usingApi(async (api) => {
-            const [flipper, _] = await deployFlipper(api);
+  it('fails when executed by non owner', async () => {
+    await usingApi(async (api) => {
+      const [flipper] = await deployFlipper(api);
 
-            await removeFromContractWhiteListExpectFailure(alice, flipper.address.toString(), bob.address);
-        });
+      await removeFromContractWhiteListExpectFailure(alice, flipper.address.toString(), bob.address);
     });
+  });
 });
modifiedtests/src/removeFromWhiteList.test.tsdiffbeforeafterboth
--- a/tests/src/removeFromWhiteList.test.ts
+++ b/tests/src/removeFromWhiteList.test.ts
@@ -16,7 +16,7 @@
   findNotExistingCollection,
   removeFromWhiteListExpectFailure,
   disableWhiteListExpectSuccess,
-  normalizeAccountId
+  normalizeAccountId,
 } from './util/helpers';
 import { IKeyringPair } from '@polkadot/types/types';
 import privateKey from './substrate/privateKey';
@@ -29,7 +29,7 @@
   let bob: IKeyringPair;
 
   before(async () => {
-    await usingApi(async (api) => {
+    await usingApi(async () => {
       alice = privateKey('//Alice');
       bob = privateKey('//Bob');
     });
@@ -63,7 +63,7 @@
   let bob: IKeyringPair;
 
   before(async () => {
-    await usingApi(async (api) => {
+    await usingApi(async () => {
       alice = privateKey('//Alice');
       bob = privateKey('//Bob');
     });
modifiedtests/src/rpc.load.tsdiffbeforeafterboth
--- a/tests/src/rpc.load.ts
+++ b/tests/src/rpc.load.ts
@@ -3,24 +3,22 @@
 // file 'LICENSE', which is part of this source code package.
 //
 
-import { expect, assert } from "chai";
-import usingApi, { submitTransactionAsync, submitTransactionExpectFailAsync } from "./substrate/substrate-api";
-import { IKeyringPair } from "@polkadot/types/types";
-import { Abi, BlueprintPromise as Blueprint, CodePromise, ContractPromise as Contract } from "@polkadot/api-contract";
-import { ApiPromise, Keyring } from "@polkadot/api";
-import { ApiTypes, SubmittableExtrinsic } from "@polkadot/api/types";
+import usingApi, { submitTransactionAsync } from './substrate/substrate-api';
+import { IKeyringPair } from '@polkadot/types/types';
+import { Abi, BlueprintPromise as Blueprint, CodePromise, ContractPromise as Contract } from '@polkadot/api-contract';
+import { ApiPromise, Keyring } from '@polkadot/api';
 import { BigNumber } from 'bignumber.js';
-import { findUnusedAddress } from './util/helpers'
-import fs from "fs";
-import privateKey from "./substrate/privateKey";
+import { findUnusedAddress } from './util/helpers';
+import fs from 'fs';
+import privateKey from './substrate/privateKey';
 
 const value = 0;
 const gasLimit = 500000n * 1000000n;
-const endowment = `1000000000000000`;
-
+const endowment = '1000000000000000';
 
+/*eslint no-async-promise-executor: "off"*/
 function deployBlueprint(alice: IKeyringPair, code: CodePromise): Promise<Blueprint> {
-  return new Promise<Blueprint>(async (resolve, reject) => {
+  return new Promise<Blueprint>(async (resolve) => {
     const unsub = await code
       .createBlueprint()
       .signAndSend(alice, (result) => {
@@ -29,20 +27,21 @@
           resolve(result.blueprint);
           unsub();
         }
-      })
+      });
   });
 }
 
+/*eslint no-async-promise-executor: "off"*/
 function deployContract(alice: IKeyringPair, blueprint: Blueprint) : Promise<any> {
-  return new Promise<any>(async (resolve, reject) => {
+  return new Promise<any>(async (resolve) => {
     const unsub = await blueprint.tx
-    .new(endowment, gasLimit)
-    .signAndSend(alice, (result) => {
-      if (result.status.isInBlock || result.status.isFinalized) {
-        unsub();
-        resolve(result);
-      }
-    });    
+      .new(endowment, gasLimit)
+      .signAndSend(alice, (result) => {
+        if (result.status.isInBlock || result.status.isFinalized) {
+          unsub();
+          resolve(result);
+        }
+      });    
   });
 }
 
@@ -52,7 +51,7 @@
 
   // Transfer balance to it
   const keyring = new Keyring({ type: 'sr25519' });
-  const alice = keyring.addFromUri(`//Alice`);
+  const alice = keyring.addFromUri('//Alice');
   let amount = new BigNumber(endowment);
   amount = amount.plus(1e15);
   const tx = api.tx.balances.transfer(deployer.address, amount.toFixed());
@@ -81,7 +80,7 @@
   const result = await contract.query.get(deployer.address, value, gasLimit);
 
   if(!result.result.isSuccess) {
-    throw `Failed to get value`;
+    throw 'Failed to get value';
   }
   return result.result.asSuccess.data;
 }
@@ -95,6 +94,8 @@
       let microsec1 = hrTime[0] * 1000000 + hrTime[1] / 1000;
       let rate = 0;
       const checkPoint = 1000;
+
+      /* eslint no-constant-condition: "off" */
       while (true) {
         await api.rpc.system.chain();
         count++;
@@ -102,7 +103,7 @@
     
         if (count % checkPoint == 0) {
           hrTime = process.hrtime();
-          let microsec2 = hrTime[0] * 1000000 + hrTime[1] / 1000;
+          const microsec2 = hrTime[0] * 1000000 + hrTime[1] / 1000;
           rate = 1000000*checkPoint/(microsec2 - microsec1);
           microsec1 = microsec2;
         }
@@ -117,7 +118,7 @@
       const [contract, deployer] = await deployLoadTester(api);
 
       // Fill smart contract up with data
-      const bob = privateKey("//Bob");
+      const bob = privateKey('//Bob');
       const tx = contract.tx.bloat(value, gasLimit, 200);
       await submitTransactionAsync(bob, tx);
 
@@ -127,6 +128,8 @@
       let microsec1 = hrTime[0] * 1000000 + hrTime[1] / 1000;
       let rate = 0;
       const checkPoint = 10;
+
+      /* eslint no-constant-condition: "off" */
       while (true) {
         await getScData(contract, deployer);
         count++;
@@ -134,7 +137,7 @@
     
         if (count % checkPoint == 0) {
           hrTime = process.hrtime();
-          let microsec2 = hrTime[0] * 1000000 + hrTime[1] / 1000;
+          const microsec2 = hrTime[0] * 1000000 + hrTime[1] / 1000;
           rate = 1000000*checkPoint/(microsec2 - microsec1);
           microsec1 = microsec2;
         }
modifiedtests/src/scheduler.test.tsdiffbeforeafterboth
--- a/tests/src/scheduler.test.ts
+++ b/tests/src/scheduler.test.ts
@@ -3,7 +3,6 @@
 // file 'LICENSE', which is part of this source code package.
 //
 
-import { IKeyringPair } from '@polkadot/types/types';
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
 import privateKey from './substrate/privateKey';
@@ -11,34 +10,16 @@
 import {
   createItemExpectSuccess,
   createCollectionExpectSuccess,
-  destroyCollectionExpectSuccess,
-  findNotExistingCollection,
-  queryCollectionExpectSuccess,
-  setOffchainSchemaExpectFailure,
-  setOffchainSchemaExpectSuccess,
-  transferExpectSuccess,
   scheduleTransferExpectSuccess,
   setCollectionSponsorExpectSuccess,
-  confirmSponsorshipExpectSuccess
+  confirmSponsorshipExpectSuccess,
 } from './util/helpers';
-
 
 chai.use(chaiAsPromised);
-const expect = chai.expect;
-
-const DATA = [1, 2, 3, 4];
 
 describe('Integration Test scheduler base transaction', () => {
-  let alice: IKeyringPair;
-
-  before(async () => {
+  it('User can transfer owned token with delay (scheduler)', async () => {
     await usingApi(async () => {
-      alice = privateKey('//Alice');
-    });
-  });
-
-  it('User can transfer owned token with delay (scheduler)', async () => {
-    await usingApi(async (api) => {
       const Alice = privateKey('//Alice');
       const Bob = privateKey('//Bob');
       // nft
@@ -50,45 +31,4 @@
       await scheduleTransferExpectSuccess(nftCollectionId, newNftTokenId, Alice, Bob, 1, 'NFT');
     });
   });
-
-  
 });
-
-// describe('Negative Integration Test setOffchainSchema', () => {
-//   let alice: IKeyringPair;
-//   let bob: IKeyringPair;
-
-//   let validCollectionId: number;
-
-//   before(async () => {
-//     await usingApi(async () => {
-//       alice = privateKey('//Alice');
-//       bob = privateKey('//Bob');
-
-//       validCollectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });
-//     });
-//   });
-
-//   it('fails on not existing collection id', async () => {
-//     const nonExistingCollectionId = await usingApi(findNotExistingCollection);
-
-//     await setOffchainSchemaExpectFailure(alice, nonExistingCollectionId, DATA);
-//   });
-
-//   it('fails on destroyed collection id', async () => {
-//     const destroyedCollectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });
-//     await destroyCollectionExpectSuccess(destroyedCollectionId);
-
-//     await setOffchainSchemaExpectFailure(alice, destroyedCollectionId, DATA);
-//   });
-
-//   it('fails on too long data', async () => {
-//     const tooLongData = new Array(4097).fill(0xff);
-
-//     await setOffchainSchemaExpectFailure(alice, validCollectionId, tooLongData);
-//   });
-
-//   it('fails on execution by non-owner', async () => {
-//     await setOffchainSchemaExpectFailure(bob, validCollectionId, DATA);
-//   });
-// });
modifiedtests/src/setCollectionLimits.test.tsdiffbeforeafterboth
--- a/tests/src/setCollectionLimits.test.ts
+++ b/tests/src/setCollectionLimits.test.ts
@@ -50,7 +50,7 @@
           TokenLimit: tokenLimit,
           SponsorTimeout: sponsorTimeout,
           OwnerCanTransfer: true,
-          OwnerCanDestroy: true
+          OwnerCanDestroy: true,
         },
       );
       const events = await submitTransactionAsync(alice, tx);
@@ -73,13 +73,13 @@
   it('Set the same token limit twice', async () => {
     await usingApi(async (api: ApiPromise) => {
 
-      let collectionLimits = {
+      const collectionLimits = {
         AccountTokenOwnershipLimit: accountTokenOwnershipLimit,
         SponsoredMintSize: sponsoredDataSize,
         TokenLimit: tokenLimit,
         SponsorTimeout: sponsorTimeout,
         OwnerCanTransfer: true,
-        OwnerCanDestroy: true
+        OwnerCanDestroy: true,
       };
 
       // The first time
@@ -173,7 +173,7 @@
       TokenLimit: tokenLimit,
       SponsorTimeout: sponsorTimeout,
       OwnerCanTransfer: false,
-      OwnerCanDestroy: true
+      OwnerCanDestroy: true,
     });
     await setCollectionLimitsExpectFailure(alice, collectionId, { 
       AccountTokenOwnershipLimit: accountTokenOwnershipLimit,
@@ -181,7 +181,7 @@
       TokenLimit: tokenLimit,
       SponsorTimeout: sponsorTimeout,
       OwnerCanTransfer: true,
-      OwnerCanDestroy: true
+      OwnerCanDestroy: true,
     });
   });
 
@@ -193,7 +193,7 @@
       TokenLimit: tokenLimit,
       SponsorTimeout: sponsorTimeout,
       OwnerCanTransfer: true,
-      OwnerCanDestroy: false
+      OwnerCanDestroy: false,
     });
     await setCollectionLimitsExpectFailure(alice, collectionId, { 
       AccountTokenOwnershipLimit: accountTokenOwnershipLimit,
@@ -201,21 +201,21 @@
       TokenLimit: tokenLimit,
       SponsorTimeout: sponsorTimeout,
       OwnerCanTransfer: true,
-      OwnerCanDestroy: true
+      OwnerCanDestroy: true,
     });
   });
 
   it('Setting the higher token limit fails', async () => {
-    await usingApi(async (api: ApiPromise) => {
+    await usingApi(async () => {
 
       const collectionId = await createCollectionExpectSuccess();
-      let collectionLimits = {
+      const collectionLimits = {
         AccountTokenOwnershipLimit: accountTokenOwnershipLimit,
         SponsoredMintSize: sponsoredDataSize,
         TokenLimit: tokenLimit,
         SponsorTimeout: sponsorTimeout,
         OwnerCanTransfer: true,
-        OwnerCanDestroy: true
+        OwnerCanDestroy: true,
       };
 
       // The first time
modifiedtests/src/setCollectionSponsor.test.tsdiffbeforeafterboth
--- a/tests/src/setCollectionSponsor.test.ts
+++ b/tests/src/setCollectionSponsor.test.ts
@@ -5,22 +5,21 @@
 
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
-import { default as usingApi } from "./substrate/substrate-api";
-import { createCollectionExpectSuccess, setCollectionSponsorExpectSuccess, destroyCollectionExpectSuccess, setCollectionSponsorExpectFailure } from "./util/helpers";
-import { Keyring } from "@polkadot/api";
-import { IKeyringPair } from "@polkadot/types/types";
+import { default as usingApi } from './substrate/substrate-api';
+import { createCollectionExpectSuccess, setCollectionSponsorExpectSuccess, destroyCollectionExpectSuccess, setCollectionSponsorExpectFailure } from './util/helpers';
+import { Keyring } from '@polkadot/api';
+import { IKeyringPair } from '@polkadot/types/types';
 
 chai.use(chaiAsPromised);
-const expect = chai.expect;
 
 let bob: IKeyringPair;
 
 describe('integration test: ext. setCollectionSponsor():', () => {
 
   before(async () => {
-    await usingApi(async (api) => {
+    await usingApi(async () => {
       const keyring = new Keyring({ type: 'sr25519' });
-      bob = keyring.addFromUri(`//Bob`);
+      bob = keyring.addFromUri('//Bob');
     });
   });
 
@@ -46,7 +45,7 @@
     const collectionId = await createCollectionExpectSuccess();
 
     const keyring = new Keyring({ type: 'sr25519' });
-    const charlie = keyring.addFromUri(`//Charlie`);
+    const charlie = keyring.addFromUri('//Charlie');
     await setCollectionSponsorExpectSuccess(collectionId, bob.address);
     await setCollectionSponsorExpectSuccess(collectionId, charlie.address);
   });
@@ -54,9 +53,9 @@
 
 describe('(!negative test!) integration test: ext. setCollectionSponsor():', () => {
   before(async () => {
-    await usingApi(async (api) => {
+    await usingApi(async () => {
       const keyring = new Keyring({ type: 'sr25519' });
-      bob = keyring.addFromUri(`//Bob`);
+      bob = keyring.addFromUri('//Bob');
     });
   });
 
@@ -66,9 +65,9 @@
   });
   it('(!negative test!) Add sponsor to a collection that never existed', async () => {
     // Find the collection that never existed
-    const collectionId = 0;
+    let collectionId = 0;
     await usingApi(async (api) => {
-      const collectionId = parseInt((await api.query.nft.createdCollectionCount()).toString()) + 1;
+      collectionId = parseInt((await api.query.nft.createdCollectionCount()).toString()) + 1;
     });
 
     await setCollectionSponsorExpectFailure(collectionId, bob.address);
modifiedtests/src/setConstOnChainSchema.test.tsdiffbeforeafterboth
--- a/tests/src/setConstOnChainSchema.test.ts
+++ b/tests/src/setConstOnChainSchema.test.ts
@@ -23,7 +23,7 @@
 let largeShema: any;
 
 before(async () => {
-  await usingApi(async (api) => {
+  await usingApi(async () => {
     const keyring = new Keyring({ type: 'sr25519' });
     Alice = keyring.addFromUri('//Alice');
     Bob = keyring.addFromUri('//Bob');
@@ -35,7 +35,7 @@
 describe('Integration Test ext. setConstOnChainSchema()', () => {
 
   it('Run extrinsic with parameters of the collection id, set the scheme', async () => {
-      await usingApi(async (api) => {
+    await usingApi(async (api) => {
       const collectionId = await createCollectionExpectSuccess();
       const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();
       expect(collection.Owner).to.be.deep.eq(normalizeAccountId(Alice.address));
@@ -45,12 +45,12 @@
   });
 
   it('Checking collection data using the ConstOnChainSchema parameter', async () => {
-      await usingApi(async (api) => {
-        const collectionId = await createCollectionExpectSuccess();
-        const setShema = api.tx.nft.setConstOnChainSchema(collectionId, Shema);
-        await submitTransactionAsync(Alice, setShema);
-        const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();
-        expect(collection.ConstOnChainSchema.toString()).to.be.eq(Shema);
+    await usingApi(async (api) => {
+      const collectionId = await createCollectionExpectSuccess();
+      const setShema = api.tx.nft.setConstOnChainSchema(collectionId, Shema);
+      await submitTransactionAsync(Alice, setShema);
+      const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();
+      expect(collection.ConstOnChainSchema.toString()).to.be.eq(Shema);
 
     });
   });
modifiedtests/src/setContractSponsoringRateLimit.test.tsdiffbeforeafterboth
--- a/tests/src/setContractSponsoringRateLimit.test.ts
+++ b/tests/src/setContractSponsoringRateLimit.test.ts
@@ -59,7 +59,7 @@
 
   it('fails when called by non-owning user', async () => {
     await usingApi(async (api) => {
-      const [flipper, _] = await deployFlipper(api);
+      const [flipper] = await deployFlipper(api);
 
       await setContractSponsoringRateLimitExpectFailure(alice, flipper.address, 1);
     });
modifiedtests/src/setPublicAccessMode.test.tsdiffbeforeafterboth
--- a/tests/src/setPublicAccessMode.test.ts
+++ b/tests/src/setPublicAccessMode.test.ts
@@ -1,95 +1,94 @@
-//
-// This file is subject to the terms and conditions defined in
-// file 'LICENSE', which is part of this source code package.
-//
-
-// https://unique-network.readthedocs.io/en/latest/jsapi.html#setschemaversion
-import { ApiPromise, Keyring } from '@polkadot/api';
-import { IKeyringPair } from '@polkadot/types/types';
-import chai from 'chai';
-import chaiAsPromised from 'chai-as-promised';
-import privateKey from './substrate/privateKey';
-import usingApi, {submitTransactionExpectFailAsync} from './substrate/substrate-api';
-import {
-  addToWhiteListExpectSuccess,
-  createCollectionExpectSuccess,
-  createItemExpectSuccess,
-  destroyCollectionExpectSuccess,
-  enablePublicMintingExpectSuccess,
-  enableWhiteListExpectSuccess,
-  normalizeAccountId,
-} from './util/helpers';
-import { utf16ToStr } from './util/util';
-
-chai.use(chaiAsPromised);
-const expect = chai.expect;
-
-let Alice: IKeyringPair;
-let Bob: IKeyringPair;
-
-describe('Integration Test setPublicAccessMode(): ', () => {
-  before(async () => {
-    await usingApi(async (api) => {
-      Alice = privateKey('//Alice');
-      Bob = privateKey('//Bob');
-    });
-  });
-
-  it('Run extrinsic with collection id parameters, set the whitelist mode for the collection', async () => {
-    await usingApi(async (api: ApiPromise) => {
-      const collectionId: number = await createCollectionExpectSuccess();
-      await enableWhiteListExpectSuccess(Alice, collectionId);
-      await enablePublicMintingExpectSuccess(Alice, collectionId);
-      await addToWhiteListExpectSuccess(Alice, collectionId, Bob.address);
-      await createItemExpectSuccess(Bob, collectionId, 'NFT', Bob.address);
-    });
-  });
-
-  it('Whitelisted collection limits', async () => {
-    await usingApi(async (api: ApiPromise) => {
-      const collectionId = await createCollectionExpectSuccess();
-      await enableWhiteListExpectSuccess(Alice, collectionId);
-      await enablePublicMintingExpectSuccess(Alice, collectionId);
-      const tx = api.tx.nft.createItem(collectionId, normalizeAccountId(Bob.address), 'NFT');
-      await expect(submitTransactionExpectFailAsync(Bob, tx)).to.be.rejected;
-    });
-  });
-});
-
-describe('Negative Integration Test ext. setPublicAccessMode(): ', () => {
-  it('Set a non-existent collection', async () => {
-    await usingApi(async (api: ApiPromise) => {
-      // tslint:disable-next-line: radix
-      const collectionId = parseInt((await api.query.nft.createdCollectionCount()).toString()) + 1;
-      const tx = api.tx.nft.setPublicAccessMode(collectionId, 'WhiteList');
-      await expect(submitTransactionExpectFailAsync(Alice, tx)).to.be.rejected;
-    });
-  });
-
-  it('Set the collection that has been deleted', async () => {
-    await usingApi(async (api: ApiPromise) => {
-      // tslint:disable-next-line: no-bitwise
-      const collectionId = await createCollectionExpectSuccess();
-      await destroyCollectionExpectSuccess(collectionId);
-      const tx = api.tx.nft.setPublicAccessMode(collectionId, 'WhiteList');
-      await expect(submitTransactionExpectFailAsync(Alice, tx)).to.be.rejected;
-    });
-  });
-
-  it('Re-set the list mode already set in quantity', async () => {
-    await usingApi(async (api: ApiPromise) => {
-      const collectionId: number = await createCollectionExpectSuccess();
-      await enableWhiteListExpectSuccess(Alice, collectionId);
-      await enableWhiteListExpectSuccess(Alice, collectionId);
-    });
-  });
-
-  it('Execute method not on behalf of the collection owner', async () => {
-    await usingApi(async (api: ApiPromise) => {
-      // tslint:disable-next-line: no-bitwise
-      const collectionId = await createCollectionExpectSuccess();
-      const tx = api.tx.nft.setPublicAccessMode(collectionId, 'WhiteList');
-      await expect(submitTransactionExpectFailAsync(Bob, tx)).to.be.rejected;
-    });
-  });
-});
+//
+// This file is subject to the terms and conditions defined in
+// file 'LICENSE', which is part of this source code package.
+//
+
+// https://unique-network.readthedocs.io/en/latest/jsapi.html#setschemaversion
+import { ApiPromise } from '@polkadot/api';
+import { IKeyringPair } from '@polkadot/types/types';
+import chai from 'chai';
+import chaiAsPromised from 'chai-as-promised';
+import privateKey from './substrate/privateKey';
+import usingApi, {submitTransactionExpectFailAsync} from './substrate/substrate-api';
+import {
+  addToWhiteListExpectSuccess,
+  createCollectionExpectSuccess,
+  createItemExpectSuccess,
+  destroyCollectionExpectSuccess,
+  enablePublicMintingExpectSuccess,
+  enableWhiteListExpectSuccess,
+  normalizeAccountId,
+} from './util/helpers';
+
+chai.use(chaiAsPromised);
+const expect = chai.expect;
+
+let Alice: IKeyringPair;
+let Bob: IKeyringPair;
+
+describe('Integration Test setPublicAccessMode(): ', () => {
+  before(async () => {
+    await usingApi(async () => {
+      Alice = privateKey('//Alice');
+      Bob = privateKey('//Bob');
+    });
+  });
+
+  it('Run extrinsic with collection id parameters, set the whitelist mode for the collection', async () => {
+    await usingApi(async () => {
+      const collectionId: number = await createCollectionExpectSuccess();
+      await enableWhiteListExpectSuccess(Alice, collectionId);
+      await enablePublicMintingExpectSuccess(Alice, collectionId);
+      await addToWhiteListExpectSuccess(Alice, collectionId, Bob.address);
+      await createItemExpectSuccess(Bob, collectionId, 'NFT', Bob.address);
+    });
+  });
+
+  it('Whitelisted collection limits', async () => {
+    await usingApi(async (api: ApiPromise) => {
+      const collectionId = await createCollectionExpectSuccess();
+      await enableWhiteListExpectSuccess(Alice, collectionId);
+      await enablePublicMintingExpectSuccess(Alice, collectionId);
+      const tx = api.tx.nft.createItem(collectionId, normalizeAccountId(Bob.address), 'NFT');
+      await expect(submitTransactionExpectFailAsync(Bob, tx)).to.be.rejected;
+    });
+  });
+});
+
+describe('Negative Integration Test ext. setPublicAccessMode(): ', () => {
+  it('Set a non-existent collection', async () => {
+    await usingApi(async (api: ApiPromise) => {
+      // tslint:disable-next-line: radix
+      const collectionId = parseInt((await api.query.nft.createdCollectionCount()).toString()) + 1;
+      const tx = api.tx.nft.setPublicAccessMode(collectionId, 'WhiteList');
+      await expect(submitTransactionExpectFailAsync(Alice, tx)).to.be.rejected;
+    });
+  });
+
+  it('Set the collection that has been deleted', async () => {
+    await usingApi(async (api: ApiPromise) => {
+      // tslint:disable-next-line: no-bitwise
+      const collectionId = await createCollectionExpectSuccess();
+      await destroyCollectionExpectSuccess(collectionId);
+      const tx = api.tx.nft.setPublicAccessMode(collectionId, 'WhiteList');
+      await expect(submitTransactionExpectFailAsync(Alice, tx)).to.be.rejected;
+    });
+  });
+
+  it('Re-set the list mode already set in quantity', async () => {
+    await usingApi(async () => {
+      const collectionId: number = await createCollectionExpectSuccess();
+      await enableWhiteListExpectSuccess(Alice, collectionId);
+      await enableWhiteListExpectSuccess(Alice, collectionId);
+    });
+  });
+
+  it('Execute method not on behalf of the collection owner', async () => {
+    await usingApi(async (api: ApiPromise) => {
+      // tslint:disable-next-line: no-bitwise
+      const collectionId = await createCollectionExpectSuccess();
+      const tx = api.tx.nft.setPublicAccessMode(collectionId, 'WhiteList');
+      await expect(submitTransactionExpectFailAsync(Bob, tx)).to.be.rejected;
+    });
+  });
+});
modifiedtests/src/setSchemaVersion.test.tsdiffbeforeafterboth
--- a/tests/src/setSchemaVersion.test.ts
+++ b/tests/src/setSchemaVersion.test.ts
@@ -103,7 +103,7 @@
   it('execute setSchemaVersion with not correct schema version', async () => {
     await usingApi(async (api: ApiPromise) => {
       const consoleError = console.error;
-      console.error = (message: string) => {};
+      console.error = () => {};
       try {
         tx = api.tx.nft.setSchemaVersion(collectionIdForTesting, 'Test');
         await submitTransactionAsync(alice, tx);
modifiedtests/src/setVariableMetaData.test.tsdiffbeforeafterboth
--- a/tests/src/setVariableMetaData.test.ts
+++ b/tests/src/setVariableMetaData.test.ts
@@ -49,7 +49,7 @@
 });
 
 describe('Negative Integration Test setVariableMetaData', () => {
-  let data = [1];
+  const data = [1];
 
   let alice: IKeyringPair;
   let bob: IKeyringPair;
@@ -69,7 +69,7 @@
 
   it('fails on not existing collection id', async () => {
     await usingApi(async api => {
-      let nonExistingCollectionId = await findNotExistingCollection(api);
+      const nonExistingCollectionId = await findNotExistingCollection(api);
       await setVariableMetaDataExpectFailure(alice, nonExistingCollectionId, 1, data);
     });
   });
modifiedtests/src/setVariableOnChainSchema.test.tsdiffbeforeafterboth
--- a/tests/src/setVariableOnChainSchema.test.ts
+++ b/tests/src/setVariableOnChainSchema.test.ts
@@ -23,7 +23,7 @@
 let largeSchema: any;
 
 before(async () => {
-  await usingApi(async (api) => {
+  await usingApi(async () => {
     const keyring = new Keyring({ type: 'sr25519' });
     Alice = keyring.addFromUri('//Alice');
     Bob = keyring.addFromUri('//Bob');
@@ -35,7 +35,7 @@
 describe('Integration Test ext. setVariableOnChainSchema()', () => {
 
   it('Run extrinsic with parameters of the collection id, set the scheme', async () => {
-      await usingApi(async (api) => {
+    await usingApi(async (api) => {
       const collectionId = await createCollectionExpectSuccess();
       const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();
       expect(collection.Owner).to.be.deep.eq(normalizeAccountId(Alice.address));
@@ -45,12 +45,12 @@
   });
 
   it('Checking collection data using the setVariableOnChainSchema parameter', async () => {
-      await usingApi(async (api) => {
-        const collectionId = await createCollectionExpectSuccess();
-        const setSchema = api.tx.nft.setVariableOnChainSchema(collectionId, Schema);
-        await submitTransactionAsync(Alice, setSchema);
-        const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();
-        expect(collection.VariableOnChainSchema.toString()).to.be.eq(Schema);
+    await usingApi(async (api) => {
+      const collectionId = await createCollectionExpectSuccess();
+      const setSchema = api.tx.nft.setVariableOnChainSchema(collectionId, Schema);
+      await submitTransactionAsync(Alice, setSchema);
+      const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();
+      expect(collection.VariableOnChainSchema.toString()).to.be.eq(Schema);
 
     });
   });
modifiedtests/src/substrate/privateKey.tsdiffbeforeafterboth
--- a/tests/src/substrate/privateKey.ts
+++ b/tests/src/substrate/privateKey.ts
@@ -3,8 +3,8 @@
 // file 'LICENSE', which is part of this source code package.
 //
 
-import { Keyring } from "@polkadot/api";
-import { IKeyringPair } from "@polkadot/types/types";
+import { Keyring } from '@polkadot/api';
+import { IKeyringPair } from '@polkadot/types/types';
 
 export default function privateKey(account: string): IKeyringPair {
   const keyring = new Keyring({ type: 'sr25519' });
modifiedtests/src/substrate/promisify-substrate.tsdiffbeforeafterboth
--- a/tests/src/substrate/promisify-substrate.ts
+++ b/tests/src/substrate/promisify-substrate.ts
@@ -3,7 +3,7 @@
 // file 'LICENSE', which is part of this source code package.
 //
 
-import { ApiPromise } from "@polkadot/api";
+import { ApiPromise } from '@polkadot/api';
 
 type PromiseType<T> = T extends PromiseLike<infer TInner> ? TInner : T;
 
modifiedtests/src/substrate/substrate-api.tsdiffbeforeafterboth
--- a/tests/src/substrate/substrate-api.ts
+++ b/tests/src/substrate/substrate-api.ts
@@ -3,32 +3,39 @@
 // file 'LICENSE', which is part of this source code package.
 //
 
-import { WsProvider, ApiPromise } from "@polkadot/api";
+import { WsProvider, ApiPromise } from '@polkadot/api';
 import { EventRecord } from '@polkadot/types/interfaces/system/types';
 import { ExtrinsicStatus } from '@polkadot/types/interfaces/author/types';
-import { IKeyringPair } from "@polkadot/types/types";
+import { IKeyringPair } from '@polkadot/types/types';
 
-import config from "../config";
-import promisifySubstrate from "./promisify-substrate";
-import { ApiOptions, SubmittableExtrinsic, ApiTypes } from "@polkadot/api/types";
-import rtt from "../../../runtime_types.json";
+import config from '../config';
+import promisifySubstrate from './promisify-substrate';
+import { ApiOptions, SubmittableExtrinsic, ApiTypes } from '@polkadot/api/types';
+import rtt from '../../../runtime_types.json';
 
 function defaultApiOptions(): ApiOptions {
   const wsProvider = new WsProvider(config.substrateUrl);
-  return { provider: wsProvider, types: rtt };
+  return {
+    provider: wsProvider, types: rtt, signedExtensions: {
+      ContractHelpers: {
+        extrinsic: {},
+        payload: {},
+      },
+    },
+  };
 }
 
 export default async function usingApi<T = void>(action: (api: ApiPromise) => Promise<T>, settings: ApiOptions | undefined = undefined): Promise<T> {
   settings = settings || defaultApiOptions();
-  let api: ApiPromise = new ApiPromise(settings);
+  const api: ApiPromise = new ApiPromise(settings);
   let result: T = null as unknown as T;
 
   // TODO: Remove, this is temporary: Filter unneeded API output 
   // (Jaco promised it will be removed in the next version)
   const consoleErr = console.error;
   console.error = (message: string) => {
-    if (message.includes("StorageChangeSet:: WebSocket is not connected") || message.includes("2021-")) {}
-    else consoleErr(message);
+    if (!message.includes('StorageChangeSet:: WebSocket is not connected') || message.includes('2021-'))
+      consoleErr(message);
   };
 
   try {
@@ -72,6 +79,7 @@
 
 export function
 submitTransactionAsync(sender: IKeyringPair, transaction: SubmittableExtrinsic<ApiTypes>): Promise<EventRecord[]> {
+  /* eslint no-async-promise-executor: "off" */
   return new Promise(async (resolve, reject) => {
     try {
       await transaction.signAndSend(sender, ({ events = [], status }) => {
@@ -97,6 +105,7 @@
   console.error = () => {};
   console.log = () => {};
 
+  /* eslint no-async-promise-executor: "off" */
   return new Promise<EventRecord[]>(async function(res, rej) {
     const resolve = (rec: EventRecord[]) => {
       setTimeout(() => {
modifiedtests/src/substrate/wait-new-blocks.tsdiffbeforeafterboth
--- a/tests/src/substrate/wait-new-blocks.ts
+++ b/tests/src/substrate/wait-new-blocks.ts
@@ -3,15 +3,16 @@
 // file 'LICENSE', which is part of this source code package.
 //
 
-import { ApiPromise } from "@polkadot/api";
+import { ApiPromise } from '@polkadot/api';
 
-export default function waitNewBlocks(api: ApiPromise, blocksCount: number = 1): Promise<void> {
-  const promise = new Promise<void>(async (resolve, reject) => {
+/* eslint no-async-promise-executor: "off" */
+export default function waitNewBlocks(api: ApiPromise, blocksCount = 1): Promise<void> {
+  const promise = new Promise<void>(async (resolve) => {
     
-    const unsubscribe = await api.rpc.chain.subscribeNewHeads(head => {
-      if(blocksCount > 0) {
+    const unsubscribe = await api.rpc.chain.subscribeNewHeads(() => {
+      if (blocksCount > 0) {
         blocksCount--;
-      }else {
+      } else {
         unsubscribe();
         resolve();
       }
modifiedtests/src/toggleContractWhiteList.test.tsdiffbeforeafterboth
--- a/tests/src/toggleContractWhiteList.test.ts
+++ b/tests/src/toggleContractWhiteList.test.ts
@@ -3,17 +3,17 @@
 // file 'LICENSE', which is part of this source code package.
 //
 
-import chai from "chai";
+import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
-import usingApi, { submitTransactionAsync, submitTransactionExpectFailAsync } from "./substrate/substrate-api";
-import privateKey from "./substrate/privateKey";
+import usingApi, { submitTransactionAsync, submitTransactionExpectFailAsync } from './substrate/substrate-api';
+import privateKey from './substrate/privateKey';
 import {
   deployFlipper,
-  getFlipValue
-} from "./util/contracthelpers";
+  getFlipValue,
+} from './util/contracthelpers';
 import {
-  getGenericResult
-} from "./util/helpers"
+  getGenericResult,
+} from './util/helpers';
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
@@ -23,7 +23,7 @@
 
 describe('Integration Test toggleContractWhiteList', () => {
 
-  it(`Enable white list contract mode`, async () => {
+  it('Enable white list contract mode', async () => {
     await usingApi(async api => {
       const [contract, deployer] = await deployFlipper(api);
 
@@ -38,9 +38,9 @@
     });
   });
 
-  it(`Only whitelisted account can call contract`, async () => {
+  it('Only whitelisted account can call contract', async () => {
     await usingApi(async api => {
-      const bob = privateKey("//Bob");
+      const bob = privateKey('//Bob');
 
       const [contract, deployer] = await deployFlipper(api);
 
@@ -48,59 +48,59 @@
       const flip = contract.tx.flip(value, gasLimit);
       await submitTransactionAsync(bob, flip);
       const flipValueAfter = await getFlipValue(contract,deployer);
-      expect(flipValueAfter).to.be.eq(!flipValueBefore, `Anyone can call new contract.`);
+      expect(flipValueAfter).to.be.eq(!flipValueBefore, 'Anyone can call new contract.');
 
       const deployerCanFlip = async () => {
-        let flipValueBefore = await getFlipValue(contract, deployer);
+        const flipValueBefore = await getFlipValue(contract, deployer);
         const deployerFlip = contract.tx.flip(value, gasLimit);
         await submitTransactionAsync(deployer, deployerFlip);
         const aliceFlip1Response = await getFlipValue(contract, deployer);
-        expect(aliceFlip1Response).to.be.eq(!flipValueBefore, `Deployer always can flip.`);
+        expect(aliceFlip1Response).to.be.eq(!flipValueBefore, 'Deployer always can flip.');
       };
       await deployerCanFlip();
 
       flipValueBefore = await getFlipValue(contract, deployer);
       const enableWhiteListTx = api.tx.nft.toggleContractWhiteList(contract.address, true);
-      const enableResult = await submitTransactionAsync(deployer, enableWhiteListTx);
+      await submitTransactionAsync(deployer, enableWhiteListTx);
       const flipWithEnabledWhiteList = contract.tx.flip(value, gasLimit);
       await expect(submitTransactionExpectFailAsync(bob, flipWithEnabledWhiteList)).to.be.rejected;
       const flipValueAfterEnableWhiteList = await getFlipValue(contract, deployer);
-      expect(flipValueAfterEnableWhiteList).to.be.eq(flipValueBefore, `Enabling whitelist doesn't make it possible to call contract for everyone.`);
+      expect(flipValueAfterEnableWhiteList).to.be.eq(flipValueBefore, 'Enabling whitelist doesn\'t make it possible to call contract for everyone.');
 
       await deployerCanFlip();
 
       flipValueBefore = await getFlipValue(contract, deployer);
       const addBobToWhiteListTx = api.tx.nft.addToContractWhiteList(contract.address, bob.address);
-      const addBobResult = await submitTransactionAsync(deployer, addBobToWhiteListTx);
+      await submitTransactionAsync(deployer, addBobToWhiteListTx);
       const flipWithWhitelistedBob = contract.tx.flip(value, gasLimit);
       await submitTransactionAsync(bob, flipWithWhitelistedBob);
       const flipAfterWhiteListed = await getFlipValue(contract,deployer);
-      expect(flipAfterWhiteListed).to.be.eq(!flipValueBefore, `Bob was whitelisted, now he can flip.`);
+      expect(flipAfterWhiteListed).to.be.eq(!flipValueBefore, 'Bob was whitelisted, now he can flip.');
 
       await deployerCanFlip();
 
       flipValueBefore = await getFlipValue(contract, deployer);
       const removeBobFromWhiteListTx = api.tx.nft.removeFromContractWhiteList(contract.address, bob.address);
-      const removeBobResult = await submitTransactionAsync(deployer, removeBobFromWhiteListTx);
+      await submitTransactionAsync(deployer, removeBobFromWhiteListTx);
       const bobRemoved = contract.tx.flip(value, gasLimit);
       await expect(submitTransactionExpectFailAsync(bob, bobRemoved)).to.be.rejected;
       const afterBobRemoved = await getFlipValue(contract, deployer);
-      expect(afterBobRemoved).to.be.eq(flipValueBefore, `Bob can't call contract, now when he is removeed from white list.`);
+      expect(afterBobRemoved).to.be.eq(flipValueBefore, 'Bob can\'t call contract, now when he is removeed from white list.');
 
       await deployerCanFlip();
 
       flipValueBefore = await getFlipValue(contract, deployer);
       const disableWhiteListTx = api.tx.nft.toggleContractWhiteList(contract.address, false);
-      const disableWhiteListResult = await submitTransactionAsync(deployer, disableWhiteListTx);
+      await submitTransactionAsync(deployer, disableWhiteListTx);
       const whiteListDisabledFlip = contract.tx.flip(value, gasLimit);
       await submitTransactionAsync(bob, whiteListDisabledFlip);
       const afterWhiteListDisabled = await getFlipValue(contract,deployer);
-      expect(afterWhiteListDisabled).to.be.eq(!flipValueBefore, `Anyone can call contract with disabled whitelist.`);
+      expect(afterWhiteListDisabled).to.be.eq(!flipValueBefore, 'Anyone can call contract with disabled whitelist.');
 
     });
   });
 
-  it(`Enabling white list repeatedly should not produce errors`, async () => {
+  it('Enabling white list repeatedly should not produce errors', async () => {
     await usingApi(async api => {
       const [contract, deployer] = await deployFlipper(api);
 
@@ -123,10 +123,10 @@
 
 describe('Negative Integration Test toggleContractWhiteList', () => {
 
-  it(`Enable white list for a non-contract`, async () => {
+  it('Enable white list for a non-contract', async () => {
     await usingApi(async api => {
-      const alice = privateKey("//Alice");
-      const bobGuineaPig = privateKey("//Bob");
+      const alice = privateKey('//Alice');
+      const bobGuineaPig = privateKey('//Bob');
 
       const enabledBefore = (await api.query.nft.contractWhiteListEnabled(bobGuineaPig.address)).toJSON();
       const enableWhiteListTx = api.tx.nft.toggleContractWhiteList(bobGuineaPig.address, true);
@@ -138,10 +138,10 @@
     });
   });
 
-  it(`Enable white list using a non-owner address`, async () => {
+  it('Enable white list using a non-owner address', async () => {
     await usingApi(async api => {
-      const bob = privateKey("//Bob");
-      const [contract, deployer] = await deployFlipper(api);
+      const bob = privateKey('//Bob');
+      const [contract] = await deployFlipper(api);
 
       const enabledBefore = (await api.query.nft.contractWhiteListEnabled(contract.address)).toJSON();
       const enableWhiteListTx = api.tx.nft.toggleContractWhiteList(contract.address, true);
modifiedtests/src/transfer.nload.tsdiffbeforeafterboth
--- a/tests/src/transfer.nload.ts
+++ b/tests/src/transfer.nload.ts
@@ -1,9 +1,14 @@
-import { ApiPromise } from "@polkadot/api";
+//
+// This file is subject to the terms and conditions defined in
+// file 'LICENSE', which is part of this source code package.
+//
+
+import { ApiPromise } from '@polkadot/api';
 import { IKeyringPair } from '@polkadot/types/types';
-import privateKey from "./substrate/privateKey";
-import usingApi, { submitTransactionAsync } from "./substrate/substrate-api";
-import waitNewBlocks from "./substrate/wait-new-blocks";
-import { findUnusedAddresses } from "./util/helpers";
+import privateKey from './substrate/privateKey';
+import usingApi, { submitTransactionAsync } from './substrate/substrate-api';
+import waitNewBlocks from './substrate/wait-new-blocks';
+import { findUnusedAddresses } from './util/helpers';
 import * as cluster from 'cluster';
 import os from 'os';
 
@@ -12,102 +17,102 @@
 
 let counters: { [key: string]: number } = {};
 function increaseCounter(name: string, amount: number) {
-    if (!counters[name]) {
-        counters[name] = 0;
-    }
-    counters[name] += amount;
+  if (!counters[name]) {
+    counters[name] = 0;
+  }
+  counters[name] += amount;
 }
 function flushCounterToMaster() {
-    if (Object.keys(counters).length === 0) {
-        return;
-    }
+  if (Object.keys(counters).length === 0) {
+    return;
+  }
     process.send!(counters);
     counters = {};
 }
 
 async function distributeBalance(source: IKeyringPair, api: ApiPromise, totalAmount: bigint, stages: number) {
-    let accounts = [source];
-    // we don't need source in output array
-    const failedAccounts = [0];
+  const accounts = [source];
+  // we don't need source in output array
+  const failedAccounts = [0];
 
-    const finalUserAmount = 2 ** stages - 1;
-    accounts.push(...await findUnusedAddresses(api, finalUserAmount));
-    // findUnusedAddresses produces at least 1 request per user
-    increaseCounter('requests', finalUserAmount);
+  const finalUserAmount = 2 ** stages - 1;
+  accounts.push(...await findUnusedAddresses(api, finalUserAmount));
+  // findUnusedAddresses produces at least 1 request per user
+  increaseCounter('requests', finalUserAmount);
 
-    for (let stage = 0; stage < stages; stage++) {
-        let usersWithBalance = 2 ** stage;
-        let amount = totalAmount / (2n ** BigInt(stage)) - FEE * BigInt(stage);
-        // console.log(`Stage ${stage}/${stages}, ${usersWithBalance} => ${usersWithBalance * 2} = ${amount}`);
-        let txs = [];
-        for (let i = 0; i < usersWithBalance; i++) {
-            let newUser = accounts[i + usersWithBalance];
-            // console.log(`${accounts[i].address} => ${newUser.address} = ${amountToSplit}`);
-            const tx = api.tx.balances.transfer(newUser.address, amount);
-            txs.push(submitTransactionAsync(accounts[i], tx).catch(e => {
-                failedAccounts.push(i + usersWithBalance);
-                increaseCounter('txFailed', 1);
-            }));
-            increaseCounter('tx', 1);
-        }
-        await Promise.all(txs);
+  for (let stage = 0; stage < stages; stage++) {
+    const usersWithBalance = 2 ** stage;
+    const amount = totalAmount / (2n ** BigInt(stage)) - FEE * BigInt(stage);
+    // console.log(`Stage ${stage}/${stages}, ${usersWithBalance} => ${usersWithBalance * 2} = ${amount}`);
+    const txs = [];
+    for (let i = 0; i < usersWithBalance; i++) {
+      const newUser = accounts[i + usersWithBalance];
+      // console.log(`${accounts[i].address} => ${newUser.address} = ${amountToSplit}`);
+      const tx = api.tx.balances.transfer(newUser.address, amount);
+      txs.push(submitTransactionAsync(accounts[i], tx).catch(() => {
+        failedAccounts.push(i + usersWithBalance);
+        increaseCounter('txFailed', 1);
+      }));
+      increaseCounter('tx', 1);
     }
+    await Promise.all(txs);
+  }
 
-    for (let account of failedAccounts.reverse()) {
-        accounts.splice(account, 1);
-    }
-    return accounts;
+  for (const account of failedAccounts.reverse()) {
+    accounts.splice(account, 1);
+  }
+  return accounts;
 }
 
 if (cluster.isMaster) {
-    let testDone = false;
-    usingApi(async (api) => {
-        let prevCounters: { [key: string]: number } = {};
-        while (!testDone) {
-            for (let name in counters) {
-                if (!(name in prevCounters)) {
-                    prevCounters[name] = 0;
-                }
-                if(counters[name] === prevCounters[name]) {
-                    continue;
-                }
-                console.log(`${name.padEnd(15)} = ${counters[name] - prevCounters[name]}`);
-                prevCounters[name] = counters[name];
-            }
-            await waitNewBlocks(api, 1);
+  let testDone = false;
+  usingApi(async (api) => {
+    const prevCounters: { [key: string]: number } = {};
+    while (!testDone) {
+      for (const name in counters) {
+        if (!(name in prevCounters)) {
+          prevCounters[name] = 0;
+        }
+        if(counters[name] === prevCounters[name]) {
+          continue;
         }
-    });
-    let waiting: Promise<void>[] = [];
-    console.log(`Starting ${os.cpus().length} workers`);
-    usingApi(async (api) => {
-        const alice = privateKey('//Alice');
-        for (let id in os.cpus()) {
-            const WORKER_NAME = `//LoadWorker${id}_${Date.now()}`;
-            const workerAccount = privateKey(WORKER_NAME);
-            const tx = api.tx.balances.transfer(workerAccount.address, 400n * 10n ** 23n);
-            await submitTransactionAsync(alice, tx);
+        console.log(`${name.padEnd(15)} = ${counters[name] - prevCounters[name]}`);
+        prevCounters[name] = counters[name];
+      }
+      await waitNewBlocks(api, 1);
+    }
+  });
+  const waiting: Promise<void>[] = [];
+  console.log(`Starting ${os.cpus().length} workers`);
+  usingApi(async (api) => {
+    const alice = privateKey('//Alice');
+    for (const id in os.cpus()) {
+      const WORKER_NAME = `//LoadWorker${id}_${Date.now()}`;
+      const workerAccount = privateKey(WORKER_NAME);
+      const tx = api.tx.balances.transfer(workerAccount.address, 400n * 10n ** 23n);
+      await submitTransactionAsync(alice, tx);
 
-            let worker = cluster.fork({
-                WORKER_NAME,
-                STAGES: id + 2
-            });
-            worker.on('message', msg => {
-                for (let key in msg) {
-                    increaseCounter(key, msg[key]);
-                }
-            });
-            waiting.push(new Promise(res => worker.on('exit', res)));
+      const worker = cluster.fork({
+        WORKER_NAME,
+        STAGES: id + 2,
+      });
+      worker.on('message', msg => {
+        for (const key in msg) {
+          increaseCounter(key, msg[key]);
         }
-        await Promise.all(waiting);
-        testDone = true;
-    })
+      });
+      waiting.push(new Promise(res => worker.on('exit', res)));
+    }
+    await Promise.all(waiting);
+    testDone = true;
+  });
 } else {
-    increaseCounter('startedWorkers', 1);
-    usingApi(async (api) => {
-        await distributeBalance(privateKey(process.env.WORKER_NAME as string), api, 400n * 10n ** 22n, 10);
-    });
-    const interval = setInterval(() => {
-        flushCounterToMaster();
-    }, 100);
-    interval.unref();
+  increaseCounter('startedWorkers', 1);
+  usingApi(async (api) => {
+    await distributeBalance(privateKey(process.env.WORKER_NAME as string), api, 400n * 10n ** 22n, 10);
+  });
+  const interval = setInterval(() => {
+    flushCounterToMaster();
+  }, 100);
+  interval.unref();
 }
\ No newline at end of file
modifiedtests/src/transfer.test.tsdiffbeforeafterboth
--- a/tests/src/transfer.test.ts
+++ b/tests/src/transfer.test.ts
@@ -64,7 +64,7 @@
   });
 
   it('User can transfer owned token', async () => {
-    await usingApi(async (api) => {
+    await usingApi(async () => {
       const Alice = privateKey('//Alice');
       const Bob = privateKey('//Bob');
       // nft
@@ -77,17 +77,23 @@
       await transferExpectSuccess(fungibleCollectionId, newFungibleTokenId, Alice, Bob, 1, 'Fungible');
       // reFungible
       const reFungibleCollectionId = await
-        createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
+      createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
       const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');
-      await transferExpectSuccess(reFungibleCollectionId,
-        newReFungibleTokenId, Alice, Bob, 100, 'ReFungible');
+      await transferExpectSuccess(
+        reFungibleCollectionId,
+        newReFungibleTokenId,
+        Alice,
+        Bob,
+        100,
+        'ReFungible',
+      );
     });
   });
 });
 
 describe('Negative Integration Test Transfer(recipient, collection_id, item_id, value)', () => {
   before(async () => {
-    await usingApi(async (api: ApiPromise) => {
+    await usingApi(async () => {
       Alice = privateKey('//Alice');
       Bob = privateKey('//Bob');
       Charlie = privateKey('//Charlie');
@@ -119,11 +125,17 @@
     await transferExpectFail(fungibleCollectionId, newFungibleTokenId, Alice, Bob, 1, 'Fungible');
     // reFungible
     const reFungibleCollectionId = await
-      createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
+    createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
     const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');
     await destroyCollectionExpectSuccess(reFungibleCollectionId);
-    await transferExpectFail(reFungibleCollectionId,
-      newReFungibleTokenId, Alice, Bob, 1, 'ReFungible');
+    await transferExpectFail(
+      reFungibleCollectionId,
+      newReFungibleTokenId,
+      Alice,
+      Bob,
+      1,
+      'ReFungible',
+    );
   });
   it('Transfer with not existed item_id', async () => {
     // nft
@@ -134,9 +146,15 @@
     await transferExpectFail(fungibleCollectionId, 2, Alice, Bob, 1, 'Fungible');
     // reFungible
     const reFungibleCollectionId = await
-      createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
-    await transferExpectFail(reFungibleCollectionId,
-      2, Alice, Bob, 1, 'ReFungible');
+    createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
+    await transferExpectFail(
+      reFungibleCollectionId,
+      2,
+      Alice,
+      Bob,
+      1,
+      'ReFungible',
+    );
   });
   it('Transfer with deleted item_id', async () => {
     // nft
@@ -151,11 +169,17 @@
     await transferExpectFail(fungibleCollectionId, newFungibleTokenId, Alice, Bob, 1, 'Fungible');
     // reFungible
     const reFungibleCollectionId = await
-      createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
+    createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
     const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');
     await burnItemExpectSuccess(Alice, reFungibleCollectionId, newReFungibleTokenId, 1);
-    await transferExpectFail(reFungibleCollectionId,
-      newReFungibleTokenId, Alice, Bob, 1, 'ReFungible');
+    await transferExpectFail(
+      reFungibleCollectionId,
+      newReFungibleTokenId,
+      Alice,
+      Bob,
+      1,
+      'ReFungible',
+    );
   });
   it('Transfer with recipient that is not owner', async () => {
     // nft
@@ -168,9 +192,15 @@
     await transferExpectFail(fungibleCollectionId, newFungibleTokenId, Charlie, Bob, 1, 'Fungible');
     // reFungible
     const reFungibleCollectionId = await
-      createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
+    createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
     const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');
-    await transferExpectFail(reFungibleCollectionId,
-      newReFungibleTokenId, Charlie, Bob, 1, 'ReFungible');
+    await transferExpectFail(
+      reFungibleCollectionId,
+      newReFungibleTokenId,
+      Charlie,
+      Bob,
+      1,
+      'ReFungible',
+    );
   });
 });
modifiedtests/src/transferFrom.test.tsdiffbeforeafterboth
--- a/tests/src/transferFrom.test.ts
+++ b/tests/src/transferFrom.test.ts
@@ -14,7 +14,6 @@
   createCollectionExpectSuccess,
   createFungibleItemExpectSuccess,
   createItemExpectSuccess,
-  destroyCollectionExpectSuccess,
   getAllowance,
   transferFromExpectFail,
   transferFromExpectSuccess,
@@ -31,7 +30,7 @@
   let Charlie: IKeyringPair;
 
   before(async () => {
-    await usingApi(async (api) => {
+    await usingApi(async () => {
       Alice = privateKey('//Alice');
       Bob = privateKey('//Bob');
       Charlie = privateKey('//Charlie');
@@ -39,7 +38,7 @@
   });
 
   it('Execute the extrinsic and check nftItemList - owner of token', async () => {
-    await usingApi(async (api: ApiPromise) => {
+    await usingApi(async () => {
       // nft
       const nftCollectionId = await createCollectionExpectSuccess();
       const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');
@@ -52,13 +51,21 @@
       const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');
       await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, Alice, Bob);
       await transferFromExpectSuccess(fungibleCollectionId, newFungibleTokenId, Bob, Alice, Charlie, 1, 'Fungible');
+
       // reFungible
       const reFungibleCollectionId = await
-        createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
+      createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
       const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');
       await approveExpectSuccess(reFungibleCollectionId, newReFungibleTokenId, Alice, Bob, 100);
-      await transferFromExpectSuccess(reFungibleCollectionId,
-        newReFungibleTokenId, Bob, Alice, Charlie, 100, 'ReFungible');
+      await transferFromExpectSuccess(
+        reFungibleCollectionId,
+        newReFungibleTokenId,
+        Bob,
+        Alice,
+        Charlie,
+        100,
+        'ReFungible',
+      );
     });
   });
 
@@ -92,7 +99,7 @@
   let Charlie: IKeyringPair;
 
   before(async () => {
-    await usingApi(async (api) => {
+    await usingApi(async () => {
       Alice = privateKey('//Alice');
       Bob = privateKey('//Bob');
       Charlie = privateKey('//Charlie');
@@ -139,7 +146,7 @@
   }); */
 
   it('transferFrom for not approved address', async () => {
-    await usingApi(async (api: ApiPromise) => {
+    await usingApi(async () => {
       // nft
       const nftCollectionId = await createCollectionExpectSuccess();
       const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');
@@ -152,15 +159,21 @@
       await transferFromExpectFail(fungibleCollectionId, newFungibleTokenId, Bob, Alice, Charlie, 1);
       // reFungible
       const reFungibleCollectionId = await
-        createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
+      createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
       const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');
-      await transferFromExpectFail(reFungibleCollectionId,
-        newReFungibleTokenId, Bob, Alice, Charlie, 1);
+      await transferFromExpectFail(
+        reFungibleCollectionId,
+        newReFungibleTokenId,
+        Bob,
+        Alice,
+        Charlie,
+        1,
+      );
     });
   });
 
   it('transferFrom incorrect token count', async () => {
-    await usingApi(async (api: ApiPromise) => {
+    await usingApi(async () => {
       // nft
       const nftCollectionId = await createCollectionExpectSuccess();
       const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');
@@ -175,16 +188,22 @@
       await transferFromExpectFail(fungibleCollectionId, newFungibleTokenId, Bob, Alice, Charlie, 2);
       // reFungible
       const reFungibleCollectionId = await
-        createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
+      createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
       const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');
       await approveExpectSuccess(reFungibleCollectionId, newReFungibleTokenId, Alice, Bob);
-      await transferFromExpectFail(reFungibleCollectionId,
-        newReFungibleTokenId, Bob, Alice, Charlie, 2);
+      await transferFromExpectFail(
+        reFungibleCollectionId,
+        newReFungibleTokenId,
+        Bob,
+        Alice,
+        Charlie,
+        2,
+      );
     });
   });
 
   it('execute transferFrom from account that is not owner of collection', async () => {
-    await usingApi(async (api: ApiPromise) => {
+    await usingApi(async () => {
       const Dave = privateKey('//Dave');
       // nft
       const nftCollectionId = await createCollectionExpectSuccess();
@@ -211,7 +230,7 @@
       }
       // reFungible
       const reFungibleCollectionId = await
-        createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
+      createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
       const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');
       try {
         await approveExpectFail(reFungibleCollectionId, newReFungibleTokenId, Dave, Bob);
@@ -223,7 +242,7 @@
     });
   });
   it( 'transferFrom burnt token before approve NFT', async () => {
-    await usingApi(async (api: ApiPromise) => {
+    await usingApi(async () => {
       // nft
       const nftCollectionId = await createCollectionExpectSuccess();
       const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');
@@ -233,7 +252,7 @@
     });
   });
   it( 'transferFrom burnt token before approve Fungible', async () => {
-    await usingApi(async (api: ApiPromise) => {
+    await usingApi(async () => {
       const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
       const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');
       await burnItemExpectSuccess(Alice, fungibleCollectionId, 1, 10);
@@ -243,7 +262,7 @@
     });
   }); 
   it( 'transferFrom burnt token before approve ReFungible', async () => {
-    await usingApi(async (api: ApiPromise) => {
+    await usingApi(async () => {
       const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
       const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');
       await burnItemExpectSuccess(Alice, reFungibleCollectionId, newReFungibleTokenId, 1);
@@ -254,7 +273,7 @@
   });
   
   it( 'transferFrom burnt token after approve NFT', async () => {
-    await usingApi(async (api: ApiPromise) => {
+    await usingApi(async () => {
       // nft
       const nftCollectionId = await createCollectionExpectSuccess();
       const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');
@@ -264,7 +283,7 @@
     });
   });
   it( 'transferFrom burnt token after approve Fungible', async () => {
-    await usingApi(async (api: ApiPromise) => {
+    await usingApi(async () => {
       const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
       const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');
       await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, Alice, Bob);
@@ -274,7 +293,7 @@
     });
   }); 
   it( 'transferFrom burnt token after approve ReFungible', async () => {
-    await usingApi(async (api: ApiPromise) => {
+    await usingApi(async () => {
       const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
       const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');
       await approveExpectSuccess(reFungibleCollectionId, newReFungibleTokenId, Alice, Bob);
modifiedtests/src/util/contracthelpers.tsdiffbeforeafterboth
--- a/tests/src/util/contracthelpers.ts
+++ b/tests/src/util/contracthelpers.ts
@@ -3,13 +3,13 @@
 // file 'LICENSE', which is part of this source code package.
 //
 
-import chai from "chai";
+import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
-import { submitTransactionAsync, submitTransactionExpectFailAsync } from "../substrate/substrate-api";
-import fs from "fs";
-import { Abi, BlueprintPromise as Blueprint, CodePromise, ContractPromise as Contract } from "@polkadot/api-contract";
-import { IKeyringPair } from "@polkadot/types/types";
-import { ApiPromise, Keyring } from "@polkadot/api";
+import { submitTransactionAsync, submitTransactionExpectFailAsync } from '../substrate/substrate-api';
+import fs from 'fs';
+import { Abi, CodePromise, ContractPromise as Contract } from '@polkadot/api-contract';
+import { IKeyringPair } from '@polkadot/types/types';
+import { ApiPromise, Keyring } from '@polkadot/api';
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
@@ -20,8 +20,9 @@
 const gasLimit = '200000000000';
 const endowment = '100000000000000000';
 
-function deployContract(alice: IKeyringPair, code: CodePromise, constructor: string = 'default', ...args: any[]): Promise<Contract> {
-  return new Promise<Contract>(async (resolve, reject) => {
+/* eslint no-async-promise-executor: "off" */
+function deployContract(alice: IKeyringPair, code: CodePromise, constructor = 'default', ...args: any[]): Promise<Contract> {
+  return new Promise<Contract>(async (resolve) => {
     const unsub = await (code as any)
       .tx[constructor]({value: endowment, gasLimit}, ...args)
       .signAndSend(alice, (result: any) => {
@@ -30,7 +31,7 @@
           resolve((result as any).contract);
           unsub();
         }
-      })
+      });
   });
 }
 
@@ -40,7 +41,7 @@
 
   // Transfer balance to it
   const keyring = new Keyring({ type: 'sr25519' });
-  const alice = keyring.addFromUri(`//Alice`);
+  const alice = keyring.addFromUri('//Alice');
   let amount = new BigNumber(endowment);
   amount = amount.plus(100e15);
   const tx = api.tx.balances.transfer(deployer.address, amount.toFixed());
@@ -71,7 +72,7 @@
   const result = await contract.query.get(deployer.address, value, gasLimit);
 
   if(!result.result.isOk) {
-    throw `Failed to get flipper value`;
+    throw 'Failed to get flipper value';
   }
   return (result.result.asOk.data[0] == 0x00) ? false : true;
 }
@@ -87,19 +88,6 @@
 export async function toggleFlipValueExpectFailure(sender: IKeyringPair, contract: Contract) {
   const tx = contract.tx.flip(value, gasLimit);
   await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
-}
-
-function instantiateTransferContract(alice: IKeyringPair, blueprint: Blueprint) : Promise<any> {
-  return new Promise<any>(async (resolve, reject) => {
-    const unsub = await blueprint.tx
-    .default(endowment, gasLimit)
-    .signAndSend(alice, (result) => {
-      if (result.status.isInBlock || result.status.isFinalized) {
-        unsub();
-        resolve(result);
-      }
-    });    
-  });
 }
 
 export async function deployTransferContract(api: ApiPromise): Promise<[Contract, IKeyringPair]> {
modifiedtests/src/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -4,22 +4,18 @@
 //
 
 import { ApiPromise, Keyring } from '@polkadot/api';
-import { Enum, Struct } from '@polkadot/types/codec';
-import type { AccountId, BlockNumber, Call, EventRecord } from '@polkadot/types/interfaces';
-import { u128 } from '@polkadot/types/primitive';
+import type { AccountId, EventRecord } from '@polkadot/types/interfaces';
 import { IKeyringPair } from '@polkadot/types/types';
 import { evmToAddress } from '@polkadot/util-crypto';
 import { BigNumber } from 'bignumber.js';
 import BN from 'bn.js';
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
-import { alicesPublicKey, nullPublicKey } from '../accounts';
+import { alicesPublicKey } from '../accounts';
 import privateKey from '../substrate/privateKey';
 import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from '../substrate/substrate-api';
 import { ICollectionInterface } from '../types';
 import { hexToStr, strToUTF16, utf16ToStr } from './util';
-import { Compact, Option, Raw, Vec } from '@polkadot/types/codec';
-// import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, EcdsaSignature, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV1, ExtrinsicPayloadV2, ExtrinsicPayloadV3, ExtrinsicPayloadV4, ExtrinsicSignatureV1, ExtrinsicSignatureV2, ExtrinsicSignatureV3, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV1, ExtrinsicV2, ExtrinsicV3, ExtrinsicV4, Hash, Header, ImmortalEra, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, Moment, MortalEra, MultiSignature, Origin, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Seal, SealV0, Signature, SignedBlock, SignerPayload, Sr25519Signature, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
@@ -44,7 +40,7 @@
   }
 
   // AccountId
-  return {substrate: input.toString()}
+  return {substrate: input.toString()};
 }
 export function toSubstrateAddress(input: string | CrossAccountId | IKeyringPair): string {
   input = normalizeAccountId(input);
@@ -91,10 +87,6 @@
   Owner: number[];
   ConstData: number[];
   VariableData: number[];
-}
-
-interface IFungibleTokenDataType {
-  Value: BN;
 }
 
 interface IGetMessage {
@@ -110,9 +102,9 @@
 }
 
 export function nftEventMessage(events: EventRecord[]): IGetMessage {
-  let checkMsgNftMethod: string = '';
-  let checkMsgTrsMethod: string = '';
-  let checkMsgSysMethod: string = '';
+  let checkMsgNftMethod = '';
+  let checkMsgTrsMethod = '';
+  let checkMsgSysMethod = '';
   events.forEach(({ event: { method, section } }) => {
     if (section === 'nft') {
       checkMsgNftMethod = method;
@@ -134,7 +126,7 @@
   const result: GenericResult = {
     success: false,
   };
-  events.forEach(({ phase, event: { data, method, section } }) => {
+  events.forEach(({ event: { method } }) => {
     // console.log(`    ${phase}: ${section}.${method}:: ${data}`);
     if (method === 'ExtrinsicSuccess') {
       result.success = true;
@@ -147,8 +139,8 @@
 
 export function getCreateCollectionResult(events: EventRecord[]): CreateCollectionResult {
   let success = false;
-  let collectionId: number = 0;
-  events.forEach(({ phase, event: { data, method, section } }) => {
+  let collectionId = 0;
+  events.forEach(({ event: { data, method, section } }) => {
     // console.log(`    ${phase}: ${section}.${method}:: ${data}`);
     if (method == 'ExtrinsicSuccess') {
       success = true;
@@ -165,10 +157,10 @@
 
 export function getCreateItemResult(events: EventRecord[]): CreateItemResult {
   let success = false;
-  let collectionId: number = 0;
-  let itemId: number = 0;
+  let collectionId = 0;
+  let itemId = 0;
   let recipient;
-  events.forEach(({ phase, event: { data, method, section } }) => {
+  events.forEach(({ event: { data, method, section } }) => {
     // console.log(`    ${phase}: ${section}.${method}:: ${data}`);
     if (method == 'ExtrinsicSuccess') {
       success = true;
@@ -241,12 +233,12 @@
   mode: { type: 'NFT' },
   name: 'name',
   tokenPrefix: 'prefix',
-}
+};
 
 export async function createCollectionExpectSuccess(params: Partial<CreateCollectionParams> = {}): Promise<number> {
   const { name, description, mode, tokenPrefix } = { ...defaultCreateCollectionParams, ...params };
 
-  let collectionId: number = 0;
+  let collectionId = 0;
   await usingApi(async (api) => {
     // Get number of collections before the transaction
     const AcollectionCount = parseInt((await api.query.nft.createdCollectionCount()).toString(), 10);
@@ -357,9 +349,8 @@
 }
 
 function getDestroyResult(events: EventRecord[]): boolean {
-  let success: boolean = false;
-  events.forEach(({ phase, event: { data, method, section } }) => {
-    // console.log(`    ${phase}: ${section}.${method}:: ${data}`);
+  let success = false;
+  events.forEach(({ event: { method } }) => {
     if (method == 'ExtrinsicSuccess') {
       success = true;
     }
@@ -367,7 +358,7 @@
   return success;
 }
 
-export async function destroyCollectionExpectFailure(collectionId: number, senderSeed: string = '//Alice') {
+export async function destroyCollectionExpectFailure(collectionId: number, senderSeed = '//Alice') {
   await usingApi(async (api) => {
     // Run the DestroyCollection transaction
     const alicePrivateKey = privateKey(senderSeed);
@@ -376,7 +367,7 @@
   });
 }
 
-export async function destroyCollectionExpectSuccess(collectionId: number, senderSeed: string = '//Alice') {
+export async function destroyCollectionExpectSuccess(collectionId: number, senderSeed = '//Alice') {
   await usingApi(async (api) => {
     // Run the DestroyCollection transaction
     const alicePrivateKey = privateKey(senderSeed);
@@ -471,7 +462,7 @@
   });
 }
 
-export async function setCollectionSponsorExpectFailure(collectionId: number, sponsor: string, senderSeed: string = '//Alice') {
+export async function setCollectionSponsorExpectFailure(collectionId: number, sponsor: string, senderSeed = '//Alice') {
   await usingApi(async (api) => {
 
     // Run the transaction
@@ -481,7 +472,7 @@
   });
 }
 
-export async function confirmSponsorshipExpectSuccess(collectionId: number, senderSeed: string = '//Alice') {
+export async function confirmSponsorshipExpectSuccess(collectionId: number, senderSeed = '//Alice') {
   await usingApi(async (api) => {
 
     // Run the transaction
@@ -502,7 +493,7 @@
 }
 
 
-export async function confirmSponsorshipExpectFailure(collectionId: number, senderSeed: string = '//Alice') {
+export async function confirmSponsorshipExpectFailure(collectionId: number, senderSeed = '//Alice') {
   await usingApi(async (api) => {
 
     // Run the transaction
@@ -552,7 +543,7 @@
   });
 }
 
-export async function toggleContractWhitelistExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, enabled: boolean) {
+export async function toggleContractWhitelistExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string) {
   await usingApi(async (api) => {
     const tx = api.tx.nft.toggleContractWhiteList(contractAddress, true);
     const events = await submitTransactionAsync(sender, tx);
@@ -563,7 +554,7 @@
 }
 
 export async function isWhitelistedInContract(contractAddress: AccountId | string, user: string) {
-  let whitelisted: boolean = false;
+  let whitelisted = false;
   await usingApi(async (api) => {
     whitelisted = (await api.query.nft.contractWhiteList(contractAddress, user)).toJSON() as boolean;
   });
@@ -665,8 +656,10 @@
 }
 
 export async function
-  approveExpectSuccess(collectionId: number,
-    tokenId: number, owner: IKeyringPair, approved: IKeyringPair | CrossAccountId | string, amount: number | bigint = 1) {
+approveExpectSuccess(
+  collectionId: number,
+  tokenId: number, owner: IKeyringPair, approved: IKeyringPair | CrossAccountId | string, amount: number | bigint = 1,
+) {
   await usingApi(async (api: ApiPromise) => {
     approved = normalizeAccountId(approved);
     const allowanceBefore =
@@ -683,21 +676,22 @@
 }
 
 export async function
-  transferFromExpectSuccess(collectionId: number,
-    tokenId: number,
-    accountApproved: IKeyringPair,
-    accountFrom: IKeyringPair | CrossAccountId,
-    accountTo: IKeyringPair | CrossAccountId,
-    value: number | bigint = 1,
-    type: string = 'NFT') {
+transferFromExpectSuccess(
+  collectionId: number,
+  tokenId: number,
+  accountApproved: IKeyringPair,
+  accountFrom: IKeyringPair | CrossAccountId,
+  accountTo: IKeyringPair | CrossAccountId,
+  value: number | bigint = 1,
+  type = 'NFT',
+) {
   await usingApi(async (api: ApiPromise) => {
     const to = normalizeAccountId(accountTo);
     let balanceBefore = new BN(0);
     if (type === 'Fungible') {
       balanceBefore = await api.query.nft.balance(collectionId, toSubstrateAddress(to)) as unknown as BN;
     }
-    const transferFromTx = api.tx.nft.transferFrom(
-      normalizeAccountId(accountFrom), to, collectionId, tokenId, value);
+    const transferFromTx = api.tx.nft.transferFrom(normalizeAccountId(accountFrom), to, collectionId, tokenId, value);
     const events = await submitTransactionAsync(accountApproved, transferFromTx);
     const result = getCreateItemResult(events);
     // tslint:disable-next-line:no-unused-expression
@@ -720,15 +714,16 @@
 }
 
 export async function
-  transferFromExpectFail(collectionId: number,
-    tokenId: number,
-    accountApproved: IKeyringPair,
-    accountFrom: IKeyringPair,
-    accountTo: IKeyringPair,
-    value: number | bigint = 1) {
+transferFromExpectFail(
+  collectionId: number,
+  tokenId: number,
+  accountApproved: IKeyringPair,
+  accountFrom: IKeyringPair,
+  accountTo: IKeyringPair,
+  value: number | bigint = 1,
+) {
   await usingApi(async (api: ApiPromise) => {
-    const transferFromTx = api.tx.nft.transferFrom(
-      normalizeAccountId(accountFrom.address), normalizeAccountId(accountTo.address), collectionId, tokenId, value);
+    const transferFromTx = api.tx.nft.transferFrom(normalizeAccountId(accountFrom.address), normalizeAccountId(accountTo.address), collectionId, tokenId, value);
     const events = await expect(submitTransactionExpectFailAsync(accountApproved, transferFromTx)).to.be.rejected;
     const result = getCreateCollectionResult(events);
     // tslint:disable-next-line:no-unused-expression
@@ -736,36 +731,34 @@
   });
 }
 
+/* eslint no-async-promise-executor: "off" */
 async function getBlockNumber(api: ApiPromise): Promise<number> {
-  return new Promise<number>(async (resolve, reject) => {
+  return new Promise<number>(async (resolve) => {
     const unsubscribe = await api.rpc.chain.subscribeNewHeads((head) => {
-        unsubscribe();
-        resolve(head.number.toNumber());
+      unsubscribe();
+      resolve(head.number.toNumber());
     });
   });
 }
 
 export async function
-scheduleTransferExpectSuccess(collectionId: number,
-                      tokenId: number,
-                      sender: IKeyringPair,
-                      recipient: IKeyringPair,
-                      value: number | bigint = 1,
-                      type: string = 'NFT') {
+scheduleTransferExpectSuccess(
+  collectionId: number,
+  tokenId: number,
+  sender: IKeyringPair,
+  recipient: IKeyringPair,
+  value: number | bigint = 1,
+) {
   await usingApi(async (api: ApiPromise) => {
-    let balanceBefore = new BN(0);
-
-
-    let blockNumber: number | undefined = await getBlockNumber(api);
-    let expectedBlockNumber = blockNumber + 2;
+    const blockNumber: number | undefined = await getBlockNumber(api);
+    const expectedBlockNumber = blockNumber + 2;
 
     expect(blockNumber).to.be.greaterThan(0);
     const transferTx = await api.tx.nft.transfer(recipient.address, collectionId, tokenId, value); 
     const scheduleTx = await api.tx.scheduler.schedule(expectedBlockNumber, null, 0, transferTx);
 
-    const events = await submitTransactionAsync(sender, scheduleTx);
+    await submitTransactionAsync(sender, scheduleTx);
 
-    const sponsorBalanceBefore = new BigNumber((await api.query.system.account(sender.address)).data.free.toString());
     const recipientBalanceBefore = new BigNumber((await api.query.system.account(recipient.address)).data.free.toString());
 
     const nftItemDataBefore = (await api.query.nft.nftItemList(collectionId, tokenId)).toJSON() as unknown as ITokenDataType;
@@ -774,7 +767,6 @@
     // sleep for 2 blocks
     await new Promise(resolve => setTimeout(resolve, 6000 * 2));
 
-    const sponsorBalanceAfter = new BigNumber((await api.query.system.account(sender.address)).data.free.toString());
     const recipientBalanceAfter = new BigNumber((await api.query.system.account(recipient.address)).data.free.toString());
 
     const nftItemData = (await api.query.nft.nftItemList(collectionId, tokenId)).toJSON() as unknown as ITokenDataType;
@@ -785,12 +777,14 @@
 
 
 export async function
-  transferExpectSuccess(collectionId: number,
-    tokenId: number,
-    sender: IKeyringPair,
-    recipient: IKeyringPair | CrossAccountId,
-    value: number | bigint = 1,
-    type: string = 'NFT') {
+transferExpectSuccess(
+  collectionId: number,
+  tokenId: number,
+  sender: IKeyringPair,
+  recipient: IKeyringPair | CrossAccountId,
+  value: number | bigint = 1,
+  type = 'NFT',
+) {
   await usingApi(async (api: ApiPromise) => {
     const to = normalizeAccountId(recipient);
 
@@ -826,12 +820,13 @@
 }
 
 export async function
-  transferExpectFail(collectionId: number,
-    tokenId: number,
-    sender: IKeyringPair,
-    recipient: IKeyringPair,
-    value: number | bigint = 1,
-    type: string = 'NFT') {
+transferExpectFail(
+  collectionId: number,
+  tokenId: number,
+  sender: IKeyringPair,
+  recipient: IKeyringPair,
+  value: number | bigint = 1,
+) {
   await usingApi(async (api: ApiPromise) => {
     const transferTx = api.tx.nft.transfer(normalizeAccountId(recipient.address), collectionId, tokenId, value);
     const events = await expect(submitTransactionExpectFailAsync(sender, transferTx)).to.be.rejected;
@@ -844,8 +839,10 @@
 }
 
 export async function
-  approveExpectFail(collectionId: number,
-    tokenId: number, owner: IKeyringPair, approved: IKeyringPair, amount: number | bigint = 1) {
+approveExpectFail(
+  collectionId: number,
+  tokenId: number, owner: IKeyringPair, approved: IKeyringPair, amount: number | bigint = 1,
+) {
   await usingApi(async (api: ApiPromise) => {
     const approveNftTx = api.tx.nft.approve(normalizeAccountId(approved.address), collectionId, tokenId, amount);
     const events = await expect(submitTransactionExpectFailAsync(owner, approveNftTx)).to.be.rejected;
@@ -882,9 +879,8 @@
   });
 }
 
-export async function createItemExpectSuccess(
-  sender: IKeyringPair, collectionId: number, createMode: string, owner: CrossAccountId | string = sender.address) {
-  let newItemId: number = 0;
+export async function createItemExpectSuccess(sender: IKeyringPair, collectionId: number, createMode: string, owner: CrossAccountId | string = sender.address) {
+  let newItemId = 0;
   await usingApi(async (api) => {
     const to = normalizeAccountId(owner);
     const AItemCount = parseInt((await api.query.nft.itemListIndex(collectionId)).toString(), 10);
@@ -925,8 +921,7 @@
   return newItemId;
 }
 
-export async function createItemExpectFailure(
-  sender: IKeyringPair, collectionId: number, createMode: string, owner: string = sender.address) {
+export async function createItemExpectFailure(sender: IKeyringPair, collectionId: number, createMode: string, owner: string = sender.address) {
   await usingApi(async (api) => {
     const tx = api.tx.nft.createItem(collectionId, normalizeAccountId(owner), createMode);
     
@@ -1000,7 +995,7 @@
 }
 
 export async function isWhitelisted(collectionId: number, address: string) {
-  let whitelisted: boolean = false;
+  let whitelisted = false;
   await usingApi(async (api) => {
     whitelisted = (await api.query.nft.whiteList(collectionId, address)).toJSON() as unknown as boolean;
   });
modifiedtests/src/util/util.tsdiffbeforeafterboth
--- a/tests/src/util/util.ts
+++ b/tests/src/util/util.ts
@@ -4,7 +4,7 @@
 //
 
 export function strToUTF16(str: string): any {
-  let buf: number[] = [];
+  const buf: number[] = [];
   for (let i=0, strLen=str.length; i < strLen; i++) {
     buf.push(str.charCodeAt(i));
   }
@@ -12,7 +12,7 @@
 }
 
 export function utf16ToStr(buf: number[]): string {
-  let str: string = "";
+  let str = '';
   for (let i=0, strLen=buf.length; i < strLen; i++) {
     if (buf[i] != 0) str += String.fromCharCode(buf[i]);
     else break;
@@ -21,13 +21,13 @@
 }
 
 export function hexToStr(buf: string): string {
-  let str: string = "";
-  let hexStart = buf.indexOf("0x");
+  let str = '';
+  let hexStart = buf.indexOf('0x');
   if (hexStart < 0) hexStart = 0;
   else hexStart = 2;  
   for (let i=hexStart, strLen=buf.length; i < strLen; i+=2) {
-    let ch = buf[i] + buf[i+1];
-    let num = parseInt(ch, 16);
+    const ch = buf[i] + buf[i+1];
+    const num = parseInt(ch, 16);
     if (num != 0) str += String.fromCharCode(num);
     else break;
   }