git.delta.rocks / unique-network / refs/commits / f67911cddbac

difftreelog

CORE-302 Add EvmCollection Pallet

Trubnikov Sergey2022-04-18parent: #f15380e.patch.diff
in: master

24 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5504,6 +5504,7 @@
  "pallet-ethereum",
  "pallet-evm",
  "pallet-evm-coder-substrate",
+ "pallet-evm-collection",
  "pallet-evm-contract-helpers",
  "pallet-evm-migration",
  "pallet-evm-transaction-payment",
@@ -6075,6 +6076,28 @@
 ]
 
 [[package]]
+name = "pallet-evm-collection"
+version = "0.1.0"
+dependencies = [
+ "ethereum",
+ "evm-coder",
+ "fp-evm-mapping",
+ "frame-support",
+ "frame-system",
+ "log",
+ "pallet-common",
+ "pallet-evm",
+ "pallet-evm-coder-substrate",
+ "pallet-nonfungible",
+ "parity-scale-codec",
+ "scale-info",
+ "sp-core",
+ "sp-runtime",
+ "sp-std",
+ "up-data-structs",
+]
+
+[[package]]
 name = "pallet-evm-contract-helpers"
 version = "0.1.0"
 dependencies = [
@@ -8784,6 +8807,7 @@
  "pallet-ethereum",
  "pallet-evm",
  "pallet-evm-coder-substrate",
+ "pallet-evm-collection",
  "pallet-evm-contract-helpers",
  "pallet-evm-migration",
  "pallet-evm-transaction-payment",
@@ -12845,6 +12869,7 @@
  "pallet-ethereum",
  "pallet-evm",
  "pallet-evm-coder-substrate",
+ "pallet-evm-collection",
  "pallet-evm-contract-helpers",
  "pallet-evm-migration",
  "pallet-evm-transaction-payment",
modifiedMakefilediffbeforeafterboth
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,9 @@
 CONTRACT_HELPERS_STUBS=./pallets/evm-contract-helpers/src/stubs/
 CONTRACT_HELPERS_ABI=./tests/src/eth/util/contractHelpersAbi.json
 
+COLLECTION_STUBS=./pallets/evm-collection/src/stubs/
+COLLECTION_ABI=./tests/src/eth/collectionAbi.json
+
 TESTS_API=./tests/src/eth/api/
 
 .PHONY: regenerate_solidity
@@ -32,6 +35,10 @@
 	PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh
 	PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_impl OUTPUT=$(CONTRACT_HELPERS_STUBS)/$@ ./.maintain/scripts/generate_sol.sh
 
+Collection.sol:
+	PACKAGE=pallet-evm-collection NAME=eth::contract_helpers_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh
+	PACKAGE=pallet-evm-collection NAME=eth::contract_helpers_impl OUTPUT=$(COLLECTION_STUBS)/$@ ./.maintain/scripts/generate_sol.sh
+
 UniqueFungible: UniqueFungible.sol
 	INPUT=$(FUNGIBLE_EVM_STUBS)/$< OUTPUT=$(FUNGIBLE_EVM_STUBS)/UniqueFungible.raw ./.maintain/scripts/compile_stub.sh
 	INPUT=$(FUNGIBLE_EVM_STUBS)/$< OUTPUT=$(FUNGIBLE_EVM_ABI) ./.maintain/scripts/generate_abi.sh
@@ -44,7 +51,11 @@
 	INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw ./.maintain/scripts/compile_stub.sh
 	INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_ABI) ./.maintain/scripts/generate_abi.sh
 
-evm_stubs: UniqueFungible UniqueNFT ContractHelpers
+Collection: Collection.sol
+	INPUT=$(COLLECTION_STUBS)/$< OUTPUT=$(COLLECTION_STUBS)/Collection.raw ./.maintain/scripts/compile_stub.sh
+	INPUT=$(COLLECTION_STUBS)/$< OUTPUT=$(COLLECTION_ABI) ./.maintain/scripts/generate_abi.sh
+
+evm_stubs: UniqueFungible UniqueNFT ContractHelpers Collection
 
 .PHONY: _bench
 _bench:
addedpallets/evm-collection/Cargo.tomldiffbeforeafterboth
--- /dev/null
+++ b/pallets/evm-collection/Cargo.toml
@@ -0,0 +1,49 @@
+[package]
+name = "pallet-evm-collection"
+version = "0.1.0"
+license = "GPLv3"
+edition = "2021"
+
+[dependencies]
+scale-info = { version = "2.0.1", default-features = false, features = [
+    "derive",
+] }
+ethereum = { version = "0.12.0", default-features = false }
+log = { default-features = false, version = "0.4.14" }
+
+# Substrate
+frame-support = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.21' }
+frame-system = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.21' }
+sp-runtime = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.21' }
+sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.21' }
+sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.21' }
+
+# Unique
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.21-logs" }
+fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.21-logs" }
+
+# Locals
+evm-coder = { default-features = false, path = '../../crates/evm-coder' }
+pallet-common = { default-features = false, path = '../../pallets/common' }
+pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }
+pallet-nonfungible = { default-features = false, path = '../../pallets/nonfungible' }
+up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
+
+[dependencies.codec]
+default-features = false
+features = ['derive']
+package = 'parity-scale-codec'
+version = '3.1.2'
+
+[features]
+default = ["std"]
+std = [
+    "frame-support/std",
+    "frame-system/std",
+    "sp-runtime/std",
+    "sp-std/std",
+    "sp-core/std",
+    "evm-coder/std",
+    "pallet-evm-coder-substrate/std",
+    "pallet-evm/std",
+]
addedpallets/evm-collection/src/eth.rsdiffbeforeafterboth
--- /dev/null
+++ b/pallets/evm-collection/src/eth.rs
@@ -0,0 +1,169 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+use core::marker::PhantomData;
+use evm_coder::{abi::AbiWriter, execution::*, generate_stubgen, solidity_interface, types::*, ToLog};
+use ethereum as _;
+use pallet_common::CollectionById;
+use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
+use pallet_evm::{
+	ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure,
+	account::CrossAccountId, Pallet as PalletEvm,
+};
+use sp_core::H160;
+use up_data_structs::{
+	CreateCollectionData, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
+	MAX_COLLECTION_NAME_LENGTH,
+};
+use crate::{Config, Pallet};
+use frame_support::traits::Get;
+
+use sp_std::vec::Vec;
+use alloc::format;
+
+struct EvmCollection<T: Config>(SubstrateRecorder<T>);
+impl<T: Config> WithRecorder<T> for EvmCollection<T> {
+	fn recorder(&self) -> &SubstrateRecorder<T> {
+		&self.0
+	}
+
+	fn into_recorder(self) -> SubstrateRecorder<T> {
+		self.0
+	}
+}
+
+#[derive(ToLog)]
+pub enum CollectionEvent {
+	CollectionCreated {
+		#[indexed]
+		owner: address,
+		#[indexed]
+		collection_id: address,
+	},
+}
+
+#[solidity_interface(name = "Collection")]
+impl<T: Config> EvmCollection<T> {
+	fn create_721_collection(
+		&self,
+		caller: caller,
+		name: string,
+		description: string,
+		token_prefix: string,
+	) -> Result<address> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let name = name
+			.encode_utf16()
+			.collect::<Vec<u16>>()
+			.try_into()
+			.map_err(|_| error_feild_too_long("name", MAX_COLLECTION_NAME_LENGTH))?;
+		let description = description
+			.encode_utf16()
+			.collect::<Vec<u16>>()
+			.try_into()
+			.map_err(|_| error_feild_too_long("description", MAX_COLLECTION_DESCRIPTION_LENGTH))?;
+		let token_prefix = token_prefix
+			.into_bytes()
+			.try_into()
+			.map_err(|_| error_feild_too_long("token_prefix", MAX_TOKEN_PREFIX_LENGTH))?;
+
+		let data = CreateCollectionData {
+			name,
+			description,
+			token_prefix,
+			..Default::default()
+		};
+
+		let collection_id =
+			<pallet_nonfungible::Pallet<T>>::init_collection(caller.as_sub().clone(), data)
+				.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
+
+		let address = pallet_common::eth::collection_id_to_address(collection_id);
+		<PalletEvm<T>>::deposit_log(
+			CollectionEvent::CollectionCreated {
+				owner: *caller.as_eth(),
+				collection_id: address,
+			}
+			.to_log(address),
+		);
+		Ok(address)
+	}
+
+	// fn set_sponsor(collection_id: address, sponsor: address) -> Result<void> {
+	// 	let collection_id =
+	// 		pallet_common::eth::map_eth_to_id(&collection_id).ok_or(Error::Revert("".into()))?;
+	// 	let mut collection = <CollectionById<T>>::get(collection_id).ok_or(Error::Revert("".into()))?;
+	// 	let sponsor = T::CrossAccountId::from_eth(sponsor);
+	// 	collection.sponsorship = SponsorshipState::Unconfirmed(sponsor.as_sub().clone());
+	// 	<CollectionById<T>>::insert(collection_id, collection);
+	// 	Ok(())
+	// }
+
+	// fn set_offchain_shema(shema: string) -> Result<void> {
+	// 	Ok(())
+	// }
+
+	// fn set_const_on_chain_schema(shema: string) -> Result<void> {
+	// 	Ok(())
+	// }
+
+	// fn set_variable_on_chain_schema(shema: string) -> Result<void> {
+	// 	Ok(())
+	// }
+
+	// fn set_limits(limits: string) -> Result<void> {
+	// 	Ok(())
+	// }
+}
+
+fn error_feild_too_long(feild: &str, bound: u32) -> Error {
+	Error::Revert(format!("{} is too long. Max length is {}.", feild, bound))
+}
+
+pub struct CollectionOnMethodCall<T: Config>(PhantomData<*const T>);
+impl<T: Config> OnMethodCall<T> for CollectionOnMethodCall<T> {
+	fn is_reserved(contract: &sp_core::H160) -> bool {
+		contract == &T::ContractAddress::get()
+	}
+
+	fn is_used(contract: &sp_core::H160) -> bool {
+		contract == &T::ContractAddress::get()
+	}
+
+	fn call(
+		source: &sp_core::H160,
+		target: &sp_core::H160,
+		gas_left: u64,
+		input: &[u8],
+		value: sp_core::U256,
+	) -> Option<PrecompileResult> {
+		// TODO: Extract to another OnMethodCall handler
+		if target != &T::ContractAddress::get() {
+			return None;
+		}
+
+		let helpers = EvmCollection::<T>(SubstrateRecorder::<T>::new(gas_left));
+		pallet_evm_coder_substrate::call(*source, helpers, value, input)
+	}
+
+	fn get_code(contract: &sp_core::H160) -> Option<Vec<u8>> {
+		(contract == &T::ContractAddress::get())
+			.then(|| include_bytes!("./stubs/Collection.raw").to_vec())
+	}
+}
+
+generate_stubgen!(collection_impl, CollectionCall<()>, true);
+generate_stubgen!(collection_iface, CollectionCall<()>, false);
addedpallets/evm-collection/src/lib.rsdiffbeforeafterboth
--- /dev/null
+++ b/pallets/evm-collection/src/lib.rs
@@ -0,0 +1,53 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+#![cfg_attr(not(feature = "std"), no_std)]
+
+extern crate alloc;
+
+use codec::{Decode, Encode, MaxEncodedLen};
+pub use pallet::*;
+pub use eth::*;
+use scale_info::TypeInfo;
+pub mod eth;
+
+#[frame_support::pallet]
+pub mod pallet {
+	pub use super::*;
+	use evm_coder::execution::Result;
+	use frame_support::pallet_prelude::*;
+	use sp_core::H160;
+
+	#[pallet::config]
+	pub trait Config:
+		frame_system::Config + pallet_evm_coder_substrate::Config + pallet_evm::account::Config + pallet_nonfungible::Config
+	{
+		type ContractAddress: Get<H160>;
+	}
+
+	#[pallet::error]
+	pub enum Error<T> {
+		/// This method is only executable by owner
+		NoPermission,
+	}
+
+	#[pallet::pallet]
+	// #[pallet::generate_store(pub(super) trait Store)]
+	pub struct Pallet<T>(_);
+
+
+	impl<T: Config> Pallet<T> {}
+}
addedpallets/evm-collection/src/stubs/Collection.rawdiffbeforeafterboth

binary blob — no preview

addedpallets/evm-collection/src/stubs/Collection.soldiffbeforeafterboth
--- /dev/null
+++ b/pallets/evm-collection/src/stubs/Collection.sol
@@ -0,0 +1,161 @@
+// SPDX-License-Identifier: OTHER
+// This code is automatically generated
+
+pragma solidity >=0.8.0 <0.9.0;
+
+// Common stubs holder
+contract Dummy {
+	uint8 dummy;
+	string stub_error = "this contract is implemented in native";
+}
+
+contract ERC165 is Dummy {
+	function supportsInterface(bytes4 interfaceID)
+		external
+		view
+		returns (bool)
+	{
+		require(false, stub_error);
+		interfaceID;
+		return true;
+	}
+}
+
+// Selector: ee5467a8
+contract Collection is Dummy, ERC165 {
+	// Selector: contractOwner(address) 5152b14c
+	function contractOwner(address contractAddress)
+		public
+		view
+		returns (address)
+	{
+		require(false, stub_error);
+		contractAddress;
+		dummy;
+		return 0x0000000000000000000000000000000000000000;
+	}
+
+	// Selector: sponsoringEnabled(address) 6027dc61
+	function sponsoringEnabled(address contractAddress)
+		public
+		view
+		returns (bool)
+	{
+		require(false, stub_error);
+		contractAddress;
+		dummy;
+		return false;
+	}
+
+	// Deprecated
+	//
+	// Selector: toggleSponsoring(address,bool) fcac6d86
+	function toggleSponsoring(address contractAddress, bool enabled) public {
+		require(false, stub_error);
+		contractAddress;
+		enabled;
+		dummy = 0;
+	}
+
+	// Selector: setSponsoringMode(address,uint8) fde8a560
+	function setSponsoringMode(address contractAddress, uint8 mode) public {
+		require(false, stub_error);
+		contractAddress;
+		mode;
+		dummy = 0;
+	}
+
+	// Selector: sponsoringMode(address) b70c7267
+	function sponsoringMode(address contractAddress)
+		public
+		view
+		returns (uint8)
+	{
+		require(false, stub_error);
+		contractAddress;
+		dummy;
+		return 0;
+	}
+
+	// Selector: setSponsoringRateLimit(address,uint32) 77b6c908
+	function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)
+		public
+	{
+		require(false, stub_error);
+		contractAddress;
+		rateLimit;
+		dummy = 0;
+	}
+
+	// Selector: getSponsoringRateLimit(address) 610cfabd
+	function getSponsoringRateLimit(address contractAddress)
+		public
+		view
+		returns (uint32)
+	{
+		require(false, stub_error);
+		contractAddress;
+		dummy;
+		return 0;
+	}
+
+	// Selector: allowed(address,address) 5c658165
+	function allowed(address contractAddress, address user)
+		public
+		view
+		returns (bool)
+	{
+		require(false, stub_error);
+		contractAddress;
+		user;
+		dummy;
+		return false;
+	}
+
+	// Selector: allowlistEnabled(address) c772ef6c
+	function allowlistEnabled(address contractAddress)
+		public
+		view
+		returns (bool)
+	{
+		require(false, stub_error);
+		contractAddress;
+		dummy;
+		return false;
+	}
+
+	// Selector: toggleAllowlist(address,bool) 36de20f5
+	function toggleAllowlist(address contractAddress, bool enabled) public {
+		require(false, stub_error);
+		contractAddress;
+		enabled;
+		dummy = 0;
+	}
+
+	// Selector: toggleAllowed(address,address,bool) 4706cc1c
+	function toggleAllowed(
+		address contractAddress,
+		address user,
+		bool allowed
+	) public {
+		require(false, stub_error);
+		contractAddress;
+		user;
+		allowed;
+		dummy = 0;
+	}
+
+	// Selector: create721Collection(string,string,string) 951c0151
+	function create721Collection(
+		string memory name,
+		string memory description,
+		string memory tokenPrefix
+	) public view returns (address) {
+		require(false, stub_error);
+		name;
+		description;
+		tokenPrefix;
+		dummy;
+		return 0x0000000000000000000000000000000000000000;
+	}
+}
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -20,20 +20,15 @@
 use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
 use pallet_evm::{
 	ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure,
-	account::CrossAccountId, Pallet as PalletEvm
+	account::CrossAccountId
 };
 use sp_core::H160;
-use up_data_structs::{
-	CreateCollectionData, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
-	MAX_COLLECTION_NAME_LENGTH,
-};
 use crate::{
 	AllowlistEnabled, Config, Owner, Pallet, SponsorBasket, SponsoringRateLimit, SponsoringModeT,
 };
 use frame_support::traits::Get;
 use up_sponsorship::SponsorshipHandler;
 use sp_std::vec::Vec;
-use alloc::format;
 
 struct ContractHelpers<T: Config>(SubstrateRecorder<T>);
 impl<T: Config> WithRecorder<T> for ContractHelpers<T> {
@@ -142,56 +137,6 @@
 		<Pallet<T>>::toggle_allowed(contract_address, user, allowed);
 		Ok(())
 	}
-
-	fn create_721_collection(
-		&self,
-		caller: caller,
-		name: string,
-		description: string,
-		token_prefix: string,
-	) -> Result<address> {
-		let caller = T::CrossAccountId::from_eth(caller);
-		let name = name
-			.encode_utf16()
-			.collect::<Vec<u16>>()
-			.try_into()
-			.map_err(|_| error_feild_too_long("name", MAX_COLLECTION_NAME_LENGTH))?;
-		let description = description
-			.encode_utf16()
-			.collect::<Vec<u16>>()
-			.try_into()
-			.map_err(|_| error_feild_too_long("description", MAX_COLLECTION_DESCRIPTION_LENGTH))?;
-		let token_prefix = token_prefix
-			.into_bytes()
-			.try_into()
-			.map_err(|_| error_feild_too_long("token_prefix", MAX_TOKEN_PREFIX_LENGTH))?;
-
-		let data = CreateCollectionData {
-			name,
-			description,
-			token_prefix,
-			..Default::default()
-		};
-
-		let collection_id =
-			<pallet_nonfungible::Pallet<T>>::init_collection(caller.as_sub().clone(), data)
-				.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
-
-		let address = pallet_common::eth::collection_id_to_address(collection_id);
-
-		<PalletEvm<T>>::deposit_log(
-			ContractHelperEvent::CollectionCreated {
-				owner: *caller.as_eth(),
-				collection_id: address,
-			}
-			.to_log(address),
-		);
-		Ok(address)
-	}
-}
-
-fn error_feild_too_long(feild: &str, bound: u32) -> Error {
-	Error::Revert(format!("{} is too long. Max length is {}.", feild, bound))
 }
 
 pub struct HelpersOnMethodCall<T: Config>(PhantomData<*const T>);
modifiedpallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/lib.rs
+++ b/pallets/evm-contract-helpers/src/lib.rs
@@ -16,9 +16,6 @@
 
 #![cfg_attr(not(feature = "std"), no_std)]
 
-#[macro_use(format)]
-extern crate alloc;
-
 use codec::{Decode, Encode, MaxEncodedLen};
 pub use pallet::*;
 pub use eth::*;
addedpallets/evm-contract-helpers/src/stubs/Collection.soldiffbeforeafterboth
--- /dev/null
+++ b/pallets/evm-contract-helpers/src/stubs/Collection.sol
@@ -0,0 +1,192 @@
+// SPDX-License-Identifier: OTHER
+// This code is automatically generated
+
+pragma solidity >=0.8.0 <0.9.0;
+
+// Common stubs holder
+contract Dummy {
+	uint8 dummy;
+	string stub_error = "this contract is implemented in native";
+}
+
+contract ERC165 is Dummy {
+	function supportsInterface(bytes4 interfaceID)
+		external
+		view
+		returns (bool)
+	{
+		require(false, stub_error);
+		interfaceID;
+		return true;
+	}
+}
+
+// Selector: 61f17ed8
+contract ContractHelpers is Dummy, ERC165 {
+	// Selector: contractOwner(address) 5152b14c
+	function contractOwner(address contractAddress)
+		public
+		view
+		returns (address)
+	{
+		require(false, stub_error);
+		contractAddress;
+		dummy;
+		return 0x0000000000000000000000000000000000000000;
+	}
+
+	// Selector: sponsoringEnabled(address) 6027dc61
+	function sponsoringEnabled(address contractAddress)
+		public
+		view
+		returns (bool)
+	{
+		require(false, stub_error);
+		contractAddress;
+		dummy;
+		return false;
+	}
+
+	// Deprecated
+	//
+	// Selector: toggleSponsoring(address,bool) fcac6d86
+	function toggleSponsoring(address contractAddress, bool enabled) public {
+		require(false, stub_error);
+		contractAddress;
+		enabled;
+		dummy = 0;
+	}
+
+	// Selector: setSponsoringMode(address,uint8) fde8a560
+	function setSponsoringMode(address contractAddress, uint8 mode) public {
+		require(false, stub_error);
+		contractAddress;
+		mode;
+		dummy = 0;
+	}
+
+	// Selector: sponsoringMode(address) b70c7267
+	function sponsoringMode(address contractAddress)
+		public
+		view
+		returns (uint8)
+	{
+		require(false, stub_error);
+		contractAddress;
+		dummy;
+		return 0;
+	}
+
+	// Selector: setSponsoringRateLimit(address,uint32) 77b6c908
+	function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)
+		public
+	{
+		require(false, stub_error);
+		contractAddress;
+		rateLimit;
+		dummy = 0;
+	}
+
+	// Selector: getSponsoringRateLimit(address) 610cfabd
+	function getSponsoringRateLimit(address contractAddress)
+		public
+		view
+		returns (uint32)
+	{
+		require(false, stub_error);
+		contractAddress;
+		dummy;
+		return 0;
+	}
+
+	// Selector: allowed(address,address) 5c658165
+	function allowed(address contractAddress, address user)
+		public
+		view
+		returns (bool)
+	{
+		require(false, stub_error);
+		contractAddress;
+		user;
+		dummy;
+		return false;
+	}
+
+	// Selector: allowlistEnabled(address) c772ef6c
+	function allowlistEnabled(address contractAddress)
+		public
+		view
+		returns (bool)
+	{
+		require(false, stub_error);
+		contractAddress;
+		dummy;
+		return false;
+	}
+
+	// Selector: toggleAllowlist(address,bool) 36de20f5
+	function toggleAllowlist(address contractAddress, bool enabled) public {
+		require(false, stub_error);
+		contractAddress;
+		enabled;
+		dummy = 0;
+	}
+
+	// Selector: toggleAllowed(address,address,bool) 4706cc1c
+	function toggleAllowed(
+		address contractAddress,
+		address user,
+		bool allowed
+	) public {
+		require(false, stub_error);
+		contractAddress;
+		user;
+		allowed;
+		dummy = 0;
+	}
+
+	// Selector: create721Collection(string,string,string) 951c0151
+	function create721Collection(
+		string memory name,
+		string memory description,
+		string memory tokenPrefix
+	) public view returns (address) {
+		require(false, stub_error);
+		name;
+		description;
+		tokenPrefix;
+		dummy;
+		return 0x0000000000000000000000000000000000000000;
+	}
+
+	// Selector: setSponsor(address,address) f01fba93
+	function setSponsor(address collectionId, address sponsor) public pure {
+		require(false, stub_error);
+		collectionId;
+		sponsor;
+	}
+
+	// Selector: setOffchainShema(string) c3aa408b
+	function setOffchainShema(string memory shema) public pure {
+		require(false, stub_error);
+		shema;
+	}
+
+	// Selector: setConstOnChainSchema(string) b284d8df
+	function setConstOnChainSchema(string memory shema) public pure {
+		require(false, stub_error);
+		shema;
+	}
+
+	// Selector: setVariableOnChainSchema(string) 7c5f0fea
+	function setVariableOnChainSchema(string memory shema) public pure {
+		require(false, stub_error);
+		shema;
+	}
+
+	// Selector: setLimits(string) 72cb345d
+	function setLimits(string memory limits) public pure {
+		require(false, stub_error);
+		limits;
+	}
+}
modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.soldiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
+++ b/pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
@@ -21,7 +21,7 @@
 	}
 }
 
-// Selector: ee5467a8
+// Selector: 7b4866f9
 contract ContractHelpers is Dummy, ERC165 {
 	// Selector: contractOwner(address) 5152b14c
 	function contractOwner(address contractAddress)
@@ -143,19 +143,5 @@
 		user;
 		allowed;
 		dummy = 0;
-	}
-
-	// Selector: create721Collection(string,string,string) 951c0151
-	function create721Collection(
-		string memory name,
-		string memory description,
-		string memory tokenPrefix
-	) public view returns (address) {
-		require(false, stub_error);
-		name;
-		description;
-		tokenPrefix;
-		dummy;
-		return 0x0000000000000000000000000000000000000000;
 	}
 }
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -74,6 +74,7 @@
     'pallet-evm/std',
     'pallet-evm-migration/std',
     'pallet-evm-contract-helpers/std',
+    'pallet-evm-collection/std',
     'pallet-evm-transaction-payment/std',
     'pallet-evm-coder-substrate/std',
     'pallet-ethereum/std',
@@ -417,6 +418,7 @@
 pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.21", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
 pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
 pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }
+pallet-evm-collection = { path = '../../pallets/evm-collection', default-features = false }
 pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
 pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
 pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -49,7 +49,7 @@
 // A few exports that help ease life for downstream crates.
 pub use pallet_balances::Call as BalancesCall;
 pub use pallet_evm::{
-	EnsureAddressTruncated, HashedAddressMapping, Runner, account::CrossAccountId as _,
+	EnsureAddressTruncated, HashedAddressMapping, Runner, account::CrossAccountId as _, OnMethodCall,
 };
 pub use frame_support::{
 	construct_runtime, match_types,
@@ -306,6 +306,7 @@
 		pallet_evm_migration::OnMethodCall<Self>,
 		pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,
 		CollectionDispatchT<Self>,
+		pallet_evm_collection::CollectionOnMethodCall<Self>,
 	);
 	type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;
 	type ChainId = ChainId;
@@ -974,6 +975,11 @@
 	pub const HelpersContractAddress: H160 = H160([
 		0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,
 	]);
+	
+	// 0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f
+	pub const EvmCollectionAddress: H160 = H160([
+		0x6c, 0x4e, 0x9f, 0xe1, 0xae, 0x37, 0xa4, 0x1e, 0x93, 0xce, 0xe4, 0x29, 0xe8, 0xe1, 0x88, 0x1a, 0xbd, 0xcb, 0xb5, 0x4f,
+	]);
 }
 
 impl pallet_evm_contract_helpers::Config for Runtime {
@@ -981,6 +987,10 @@
 	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;
 }
 
+impl pallet_evm_collection::Config for Runtime {
+	type ContractAddress = EvmCollectionAddress;
+}
+
 construct_runtime!(
 	pub enum Runtime where
 		Block = Block,
@@ -1033,6 +1043,7 @@
 		EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,
 		EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,
 		EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,
+		EvmCollection: pallet_evm_collection::{Pallet} = 154,
 	}
 );
 
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -74,6 +74,7 @@
     'pallet-evm/std',
     'pallet-evm-migration/std',
     'pallet-evm-contract-helpers/std',
+    'pallet-evm-collection/std',
     'pallet-evm-transaction-payment/std',
     'pallet-evm-coder-substrate/std',
     'pallet-ethereum/std',
@@ -422,6 +423,7 @@
 pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.21", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
 pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
 pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }
+pallet-evm-collection = { path = '../../pallets/evm-collection', default-features = false }
 pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
 pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
 pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
before · runtime/quartz/src/lib.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617//! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.1819#![cfg_attr(not(feature = "std"), no_std)]20// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.21#![recursion_limit = "1024"]22#![allow(clippy::from_over_into, clippy::identity_op)]23#![allow(clippy::fn_to_numeric_cast_with_truncation)]24// Make the WASM binary available.25#[cfg(feature = "std")]26include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));2728use sp_api::impl_runtime_apis;29use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};30use sp_runtime::DispatchError;31// #[cfg(any(feature = "std", test))]32// pub use sp_runtime::BuildStorage;3334use sp_runtime::{35	Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,36	traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, AccountIdConversion, Zero},37	transaction_validity::{TransactionSource, TransactionValidity},38	ApplyExtrinsicResult, RuntimeAppPublic,39};4041use sp_std::prelude::*;4243#[cfg(feature = "std")]44use sp_version::NativeVersion;45use sp_version::RuntimeVersion;46pub use pallet_transaction_payment::{47	Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,48};49// A few exports that help ease life for downstream crates.50pub use pallet_balances::Call as BalancesCall;51pub use pallet_evm::{52	EnsureAddressTruncated, HashedAddressMapping, Runner, account::CrossAccountId as _,53};54pub use frame_support::{55	construct_runtime, match_types,56	dispatch::DispatchResult,57	PalletId, parameter_types, StorageValue, ConsensusEngineId,58	traits::{59		tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Everything,60		Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier,61		OnUnbalanced, Randomness, FindAuthor, ConstU32, Imbalance,62	},63	weights::{64		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},65		DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,66		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,67	},68};69use unique_runtime_common::dispatch::{CollectionDispatchT, CollectionDispatch};70use up_data_structs::*;71// use pallet_contracts::weights::WeightInfo;72// #[cfg(any(feature = "std", test))]73use frame_system::{74	self as frame_system, EnsureRoot, EnsureSigned,75	limits::{BlockWeights, BlockLength},76};77use sp_arithmetic::{78	traits::{BaseArithmetic, Unsigned},79};80use smallvec::smallvec;81use codec::{Encode, Decode};82use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping};83use fp_rpc::TransactionStatus;84use sp_runtime::{85	traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},86	transaction_validity::TransactionValidityError,87	SaturatedConversion,88};8990// pub use pallet_timestamp::Call as TimestampCall;91pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;9293// Polkadot imports94use pallet_xcm::XcmPassthrough;95use polkadot_parachain::primitives::Sibling;96use up_data_structs::mapping::{CrossTokenAddressMapping, EvmTokenAddressMapping};97use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};98use xcm_builder::{99	AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,100	EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,101	RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,102	SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,103	ParentIsPreset,104};105use xcm_executor::{Config, XcmExecutor, Assets};106use sp_std::{marker::PhantomData};107108use xcm::latest::{109	//	Xcm,110	AssetId::{Concrete},111	Fungibility::Fungible as XcmFungible,112	MultiAsset,113	Error as XcmError,114};115use xcm_executor::traits::{MatchesFungible, WeightTrader};116//use xcm_executor::traits::MatchesFungible;117use sp_runtime::traits::CheckedConversion;118119use unique_runtime_common::{impl_common_runtime_apis, types::*, constants::*};120121pub const RUNTIME_NAME: &str = "quartz";122pub const TOKEN_SYMBOL: &str = "QTZ";123124type CrossAccountId = pallet_evm::account::BasicCrossAccountId<Runtime>;125126impl RuntimeInstance for Runtime {127	type CrossAccountId = self::CrossAccountId;128129	type TransactionConverter = self::TransactionConverter;130131	fn get_transaction_converter() -> TransactionConverter {132		TransactionConverter133	}134}135136/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know137/// the specifics of the runtime. They can then be made to be agnostic over specific formats138/// of data like extrinsics, allowing for them to continue syncing the network through upgrades139/// to even the core data structures.140pub mod opaque {141	use sp_std::prelude::*;142	use sp_runtime::impl_opaque_keys;143	use super::Aura;144145	pub use unique_runtime_common::types::*;146147	impl_opaque_keys! {148		pub struct SessionKeys {149			pub aura: Aura,150		}151	}152}153154/// This runtime version.155pub const VERSION: RuntimeVersion = RuntimeVersion {156	spec_name: create_runtime_str!(RUNTIME_NAME),157	impl_name: create_runtime_str!(RUNTIME_NAME),158	authoring_version: 1,159	spec_version: 920000,160	impl_version: 0,161	apis: RUNTIME_API_VERSIONS,162	transaction_version: 1,163	state_version: 0,164};165166#[derive(codec::Encode, codec::Decode)]167pub enum XCMPMessage<XAccountId, XBalance> {168	/// Transfer tokens to the given account from the Parachain account.169	TransferToken(XAccountId, XBalance),170}171172/// The version information used to identify this runtime when compiled natively.173#[cfg(feature = "std")]174pub fn native_version() -> NativeVersion {175	NativeVersion {176		runtime_version: VERSION,177		can_author_with: Default::default(),178	}179}180181type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;182183pub struct DealWithFees;184impl OnUnbalanced<NegativeImbalance> for DealWithFees {185	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {186		if let Some(fees) = fees_then_tips.next() {187			// for fees, 100% to treasury188			let mut split = fees.ration(100, 0);189			if let Some(tips) = fees_then_tips.next() {190				// for tips, if any, 100% to treasury191				tips.ration_merge_into(100, 0, &mut split);192			}193			Treasury::on_unbalanced(split.0);194			// Author::on_unbalanced(split.1);195		}196	}197}198199parameter_types! {200	pub const BlockHashCount: BlockNumber = 2400;201	pub RuntimeBlockLength: BlockLength =202		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);203	pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);204	pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;205	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()206		.base_block(BlockExecutionWeight::get())207		.for_class(DispatchClass::all(), |weights| {208			weights.base_extrinsic = ExtrinsicBaseWeight::get();209		})210		.for_class(DispatchClass::Normal, |weights| {211			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);212		})213		.for_class(DispatchClass::Operational, |weights| {214			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);215			// Operational transactions have some extra reserved space, so that they216			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.217			weights.reserved = Some(218				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT219			);220		})221		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)222		.build_or_panic();223	pub const Version: RuntimeVersion = VERSION;224	pub const SS58Prefix: u8 = 255;225}226227parameter_types! {228	pub const ChainId: u64 = 8881;229}230231pub struct FixedFee;232impl FeeCalculator for FixedFee {233	fn min_gas_price() -> U256 {234		MIN_GAS_PRICE.into()235	}236}237238// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case239// (contract, which only writes a lot of data),240// approximating on top of our real store write weight241parameter_types! {242	pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;243	pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;244	pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();245}246247/// Limiting EVM execution to 50% of block for substrate users and management tasks248/// EVM transaction consumes more weight than substrate's, so we can't rely on them being249/// scheduled fairly250const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);251parameter_types! {252	pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());253}254255pub enum FixedGasWeightMapping {}256impl GasWeightMapping for FixedGasWeightMapping {257	fn gas_to_weight(gas: u64) -> Weight {258		gas.saturating_mul(WeightPerGas::get())259	}260	fn weight_to_gas(weight: Weight) -> u64 {261		weight / WeightPerGas::get()262	}263}264265impl pallet_evm::Config for Runtime {266	type BlockGasLimit = BlockGasLimit;267	type FeeCalculator = FixedFee;268	type GasWeightMapping = FixedGasWeightMapping;269	type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;270	type CallOrigin = EnsureAddressTruncated<Self>;271	type WithdrawOrigin = EnsureAddressTruncated<Self>;272	type AddressMapping = HashedAddressMapping<Self::Hashing>;273	type PrecompilesType = ();274	type PrecompilesValue = ();275	type Currency = Balances;276	type Event = Event;277	type OnMethodCall = (278		pallet_evm_migration::OnMethodCall<Self>,279		pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,280		CollectionDispatchT<Self>,281	);282	type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;283	type ChainId = ChainId;284	type Runner = pallet_evm::runner::stack::Runner<Self>;285	type OnChargeTransaction = pallet_evm::EVMCurrencyAdapter<Balances, DealWithFees>;286	type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;287	type FindAuthor = EthereumFindAuthor<Aura>;288}289290impl pallet_evm_migration::Config for Runtime {291	type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;292}293294pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);295impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {296	fn find_author<'a, I>(digests: I) -> Option<H160>297	where298		I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,299	{300		if let Some(author_index) = F::find_author(digests) {301			let authority_id = Aura::authorities()[author_index as usize].clone();302			return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));303		}304		None305	}306}307308impl pallet_ethereum::Config for Runtime {309	type Event = Event;310	type StateRoot = pallet_ethereum::IntermediateStateRoot<Self>;311}312313impl pallet_randomness_collective_flip::Config for Runtime {}314315impl frame_system::Config for Runtime {316	/// The data to be stored in an account.317	type AccountData = pallet_balances::AccountData<Balance>;318	/// The identifier used to distinguish between accounts.319	type AccountId = AccountId;320	/// The basic call filter to use in dispatchable.321	type BaseCallFilter = Everything;322	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).323	type BlockHashCount = BlockHashCount;324	/// The maximum length of a block (in bytes).325	type BlockLength = RuntimeBlockLength;326	/// The index type for blocks.327	type BlockNumber = BlockNumber;328	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.329	type BlockWeights = RuntimeBlockWeights;330	/// The aggregated dispatch type that is available for extrinsics.331	type Call = Call;332	/// The weight of database operations that the runtime can invoke.333	type DbWeight = RocksDbWeight;334	/// The ubiquitous event type.335	type Event = Event;336	/// The type for hashing blocks and tries.337	type Hash = Hash;338	/// The hashing algorithm used.339	type Hashing = BlakeTwo256;340	/// The header type.341	type Header = generic::Header<BlockNumber, BlakeTwo256>;342	/// The index type for storing how many extrinsics an account has signed.343	type Index = Index;344	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.345	type Lookup = AccountIdLookup<AccountId, ()>;346	/// What to do if an account is fully reaped from the system.347	type OnKilledAccount = ();348	/// What to do if a new account is created.349	type OnNewAccount = ();350	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;351	/// The ubiquitous origin type.352	type Origin = Origin;353	/// This type is being generated by `construct_runtime!`.354	type PalletInfo = PalletInfo;355	/// This is used as an identifier of the chain. 42 is the generic substrate prefix.356	type SS58Prefix = SS58Prefix;357	/// Weight information for the extrinsics of this pallet.358	type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;359	/// Version of the runtime.360	type Version = Version;361	type MaxConsumers = ConstU32<16>;362}363364parameter_types! {365	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;366}367368impl pallet_timestamp::Config for Runtime {369	/// A timestamp: milliseconds since the unix epoch.370	type Moment = u64;371	type OnTimestampSet = ();372	type MinimumPeriod = MinimumPeriod;373	type WeightInfo = ();374}375376parameter_types! {377	// pub const ExistentialDeposit: u128 = 500;378	pub const ExistentialDeposit: u128 = 0;379	pub const MaxLocks: u32 = 50;380}381382impl pallet_balances::Config for Runtime {383	type MaxLocks = MaxLocks;384	type MaxReserves = ();385	type ReserveIdentifier = [u8; 8];386	/// The type for recording an account's balance.387	type Balance = Balance;388	/// The ubiquitous event type.389	type Event = Event;390	type DustRemoval = Treasury;391	type ExistentialDeposit = ExistentialDeposit;392	type AccountStore = System;393	type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;394}395396pub const fn deposit(items: u32, bytes: u32) -> Balance {397	items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE398}399400/*401parameter_types! {402	pub TombstoneDeposit: Balance = deposit(403		1,404		sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,405	);406	pub DepositPerContract: Balance = TombstoneDeposit::get();407	pub const DepositPerStorageByte: Balance = deposit(0, 1);408	pub const DepositPerStorageItem: Balance = deposit(1, 0);409	pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);410	pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;411	pub const SignedClaimHandicap: u32 = 2;412	pub const MaxDepth: u32 = 32;413	pub const MaxValueSize: u32 = 16 * 1024;414	pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb415	// The lazy deletion runs inside on_initialize.416	pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *417		RuntimeBlockWeights::get().max_block;418	// The weight needed for decoding the queue should be less or equal than a fifth419	// of the overall weight dedicated to the lazy deletion.420	pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (421			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -422			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)423		)) / 5) as u32;424	pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();425}426427impl pallet_contracts::Config for Runtime {428	type Time = Timestamp;429	type Randomness = RandomnessCollectiveFlip;430	type Currency = Balances;431	type Event = Event;432	type RentPayment = ();433	type SignedClaimHandicap = SignedClaimHandicap;434	type TombstoneDeposit = TombstoneDeposit;435	type DepositPerContract = DepositPerContract;436	type DepositPerStorageByte = DepositPerStorageByte;437	type DepositPerStorageItem = DepositPerStorageItem;438	type RentFraction = RentFraction;439	type SurchargeReward = SurchargeReward;440	type WeightPrice = pallet_transaction_payment::Pallet<Self>;441	type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;442	type ChainExtension = NFTExtension;443	type DeletionQueueDepth = DeletionQueueDepth;444	type DeletionWeightLimit = DeletionWeightLimit;445	type Schedule = Schedule;446	type CallStack = [pallet_contracts::Frame<Self>; 31];447}448*/449450parameter_types! {451	/// This value increases the priority of `Operational` transactions by adding452	/// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.453	pub const OperationalFeeMultiplier: u8 = 5;454}455456/// Linear implementor of `WeightToFeePolynomial`457pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);458459impl<T> WeightToFeePolynomial for LinearFee<T>460where461	T: BaseArithmetic + From<u32> + Copy + Unsigned,462{463	type Balance = T;464465	fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {466		smallvec!(WeightToFeeCoefficient {467			// Targeting 0.1 Unique per NFT transfer468			coeff_integer: WEIGHT_TO_FEE_COEFF.into(),469			coeff_frac: Perbill::zero(),470			negative: false,471			degree: 1,472		})473	}474}475476impl pallet_transaction_payment::Config for Runtime {477	type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;478	type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;479	type OperationalFeeMultiplier = OperationalFeeMultiplier;480	type WeightToFee = LinearFee<Balance>;481	type FeeMultiplierUpdate = ();482}483484parameter_types! {485	pub const ProposalBond: Permill = Permill::from_percent(5);486	pub const ProposalBondMinimum: Balance = 1 * UNIQUE;487	pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;488	pub const SpendPeriod: BlockNumber = 5 * MINUTES;489	pub const Burn: Permill = Permill::from_percent(0);490	pub const TipCountdown: BlockNumber = 1 * DAYS;491	pub const TipFindersFee: Percent = Percent::from_percent(20);492	pub const TipReportDepositBase: Balance = 1 * UNIQUE;493	pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;494	pub const BountyDepositBase: Balance = 1 * UNIQUE;495	pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;496	pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");497	pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;498	pub const MaximumReasonLength: u32 = 16384;499	pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);500	pub const BountyValueMinimum: Balance = 5 * UNIQUE;501	pub const MaxApprovals: u32 = 100;502}503504impl pallet_treasury::Config for Runtime {505	type PalletId = TreasuryModuleId;506	type Currency = Balances;507	type ApproveOrigin = EnsureRoot<AccountId>;508	type RejectOrigin = EnsureRoot<AccountId>;509	type Event = Event;510	type OnSlash = ();511	type ProposalBond = ProposalBond;512	type ProposalBondMinimum = ProposalBondMinimum;513	type ProposalBondMaximum = ProposalBondMaximum;514	type SpendPeriod = SpendPeriod;515	type Burn = Burn;516	type BurnDestination = ();517	type SpendFunds = ();518	type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;519	type MaxApprovals = MaxApprovals;520}521522impl pallet_sudo::Config for Runtime {523	type Event = Event;524	type Call = Call;525}526527pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);528529impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider530	for RelayChainBlockNumberProvider<T>531{532	type BlockNumber = BlockNumber;533534	fn current_block_number() -> Self::BlockNumber {535		cumulus_pallet_parachain_system::Pallet::<T>::validation_data()536			.map(|d| d.relay_parent_number)537			.unwrap_or_default()538	}539}540541parameter_types! {542	pub const MinVestedTransfer: Balance = 10 * UNIQUE;543	pub const MaxVestingSchedules: u32 = 28;544}545546impl orml_vesting::Config for Runtime {547	type Event = Event;548	type Currency = pallet_balances::Pallet<Runtime>;549	type MinVestedTransfer = MinVestedTransfer;550	type VestedTransferOrigin = EnsureSigned<AccountId>;551	type WeightInfo = ();552	type MaxVestingSchedules = MaxVestingSchedules;553	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;554}555556parameter_types! {557	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;558	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;559}560561impl cumulus_pallet_parachain_system::Config for Runtime {562	type Event = Event;563	type SelfParaId = parachain_info::Pallet<Self>;564	type OnSystemEvent = ();565	// type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<566	// 	MaxDownwardMessageWeight,567	// 	XcmExecutor<XcmConfig>,568	// 	Call,569	// >;570	type OutboundXcmpMessageSource = XcmpQueue;571	type DmpMessageHandler = DmpQueue;572	type ReservedDmpWeight = ReservedDmpWeight;573	type ReservedXcmpWeight = ReservedXcmpWeight;574	type XcmpMessageHandler = XcmpQueue;575}576577impl parachain_info::Config for Runtime {}578579impl cumulus_pallet_aura_ext::Config for Runtime {}580581parameter_types! {582	pub const RelayLocation: MultiLocation = MultiLocation::parent();583	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;584	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();585	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();586}587588/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used589/// when determining ownership of accounts for asset transacting and when attempting to use XCM590/// `Transact` in order to determine the dispatch Origin.591pub type LocationToAccountId = (592	// The parent (Relay-chain) origin converts to the default `AccountId`.593	ParentIsPreset<AccountId>,594	// Sibling parachain origins convert to AccountId via the `ParaId::into`.595	SiblingParachainConvertsVia<Sibling, AccountId>,596	// Straight up local `AccountId32` origins just alias directly to `AccountId`.597	AccountId32Aliases<RelayNetwork, AccountId>,598);599600pub struct OnlySelfCurrency;601impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {602	fn matches_fungible(a: &MultiAsset) -> Option<B> {603		match (&a.id, &a.fun) {604			(Concrete(_), XcmFungible(ref amount)) => CheckedConversion::checked_from(*amount),605			_ => None,606		}607	}608}609610/// Means for transacting assets on this chain.611pub type LocalAssetTransactor = CurrencyAdapter<612	// Use this currency:613	Balances,614	// Use this currency when it is a fungible asset matching the given location or name:615	OnlySelfCurrency,616	// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:617	LocationToAccountId,618	// Our chain's account ID type (we can't get away without mentioning it explicitly):619	AccountId,620	// We don't track any teleports.621	(),622>;623624/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,625/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can626/// biases the kind of local `Origin` it will become.627pub type XcmOriginToTransactDispatchOrigin = (628	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location629	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for630	// foreign chains who want to have a local sovereign account on this chain which they control.631	SovereignSignedViaLocation<LocationToAccountId, Origin>,632	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when633	// recognised.634	RelayChainAsNative<RelayOrigin, Origin>,635	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when636	// recognised.637	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,638	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a639	// transaction from the Root origin.640	ParentAsSuperuser<Origin>,641	// Native signed account converter; this just converts an `AccountId32` origin into a normal642	// `Origin::Signed` origin of the same 32-byte value.643	SignedAccountId32AsNative<RelayNetwork, Origin>,644	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.645	XcmPassthrough<Origin>,646);647648parameter_types! {649	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.650	pub UnitWeightCost: Weight = 1_000_000;651	// 1200 UNIQUEs buy 1 second of weight.652	pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);653	pub const MaxInstructions: u32 = 100;654	pub const MaxAuthorities: u32 = 100_000;655}656657match_types! {658	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {659		MultiLocation { parents: 1, interior: Here } |660		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }661	};662}663664pub type Barrier = (665	TakeWeightCredit,666	AllowTopLevelPaidExecutionFrom<Everything>,667	AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,668	// ^^^ Parent & its unit plurality gets free execution669);670671pub struct UsingOnlySelfCurrencyComponents<672	WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,673	AssetId: Get<MultiLocation>,674	AccountId,675	Currency: CurrencyT<AccountId>,676	OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,677>(678	Weight,679	Currency::Balance,680	PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,681);682impl<683		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,684		AssetId: Get<MultiLocation>,685		AccountId,686		Currency: CurrencyT<AccountId>,687		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,688	> WeightTrader689	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>690{691	fn new() -> Self {692		Self(0, Zero::zero(), PhantomData)693	}694695	fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {696		let amount = WeightToFee::calc(&weight);697		let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?;698699		// location to this parachain through relay chain700		let option1: xcm::v1::AssetId = Concrete(MultiLocation {701			parents: 1,702			interior: X1(Parachain(ParachainInfo::parachain_id().into())),703		});704		// direct location705		let option2: xcm::v1::AssetId = Concrete(MultiLocation {706			parents: 0,707			interior: Here,708		});709710		let required = if payment.fungible.contains_key(&option1) {711			(option1, u128_amount).into()712		} else if payment.fungible.contains_key(&option2) {713			(option2, u128_amount).into()714		} else {715			(Concrete(MultiLocation::default()), u128_amount).into()716		};717718		let unused = payment719			.checked_sub(required)720			.map_err(|_| XcmError::TooExpensive)?;721		self.0 = self.0.saturating_add(weight);722		self.1 = self.1.saturating_add(amount);723		Ok(unused)724	}725726	fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {727		let weight = weight.min(self.0);728		let amount = WeightToFee::calc(&weight);729		self.0 -= weight;730		self.1 = self.1.saturating_sub(amount);731		let amount: u128 = amount.saturated_into();732		if amount > 0 {733			Some((AssetId::get(), amount).into())734		} else {735			None736		}737	}738}739impl<740		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,741		AssetId: Get<MultiLocation>,742		AccountId,743		Currency: CurrencyT<AccountId>,744		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,745	> Drop746	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>747{748	fn drop(&mut self) {749		OnUnbalanced::on_unbalanced(Currency::issue(self.1));750	}751}752753pub struct XcmConfig;754impl Config for XcmConfig {755	type Call = Call;756	type XcmSender = XcmRouter;757	// How to withdraw and deposit an asset.758	type AssetTransactor = LocalAssetTransactor;759	type OriginConverter = XcmOriginToTransactDispatchOrigin;760	type IsReserve = NativeAsset;761	type IsTeleporter = (); // Teleportation is disabled762	type LocationInverter = LocationInverter<Ancestry>;763	type Barrier = Barrier;764	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;765	type Trader = UsingOnlySelfCurrencyComponents<766		IdentityFee<Balance>,767		RelayLocation,768		AccountId,769		Balances,770		(),771	>;772	type ResponseHandler = (); // Don't handle responses for now.773	type SubscriptionService = PolkadotXcm;774775	type AssetTrap = PolkadotXcm;776	type AssetClaims = PolkadotXcm;777}778779// parameter_types! {780// 	pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;781// }782783/// No local origins on this chain are allowed to dispatch XCM sends/executions.784pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);785786/// The means for routing XCM messages which are not for local execution into the right message787/// queues.788pub type XcmRouter = (789	// Two routers - use UMP to communicate with the relay chain:790	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,791	// ..and XCMP to communicate with the sibling chains.792	XcmpQueue,793);794795impl pallet_evm_coder_substrate::Config for Runtime {796	type GasWeightMapping = FixedGasWeightMapping;797}798799impl pallet_xcm::Config for Runtime {800	type Event = Event;801	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;802	type XcmRouter = XcmRouter;803	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;804	type XcmExecuteFilter = Everything;805	type XcmExecutor = XcmExecutor<XcmConfig>;806	type XcmTeleportFilter = Everything;807	type XcmReserveTransferFilter = Everything;808	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;809	type LocationInverter = LocationInverter<Ancestry>;810	type Origin = Origin;811	type Call = Call;812	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;813	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;814}815816impl cumulus_pallet_xcm::Config for Runtime {817	type Event = Event;818	type XcmExecutor = XcmExecutor<XcmConfig>;819}820821impl cumulus_pallet_xcmp_queue::Config for Runtime {822	type WeightInfo = ();823	type Event = Event;824	type XcmExecutor = XcmExecutor<XcmConfig>;825	type ChannelInfo = ParachainSystem;826	type VersionWrapper = ();827	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;828	type ControllerOrigin = EnsureRoot<AccountId>;829	type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;830}831832impl cumulus_pallet_dmp_queue::Config for Runtime {833	type Event = Event;834	type XcmExecutor = XcmExecutor<XcmConfig>;835	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;836}837838impl pallet_aura::Config for Runtime {839	type AuthorityId = AuraId;840	type DisabledValidators = ();841	type MaxAuthorities = MaxAuthorities;842}843844parameter_types! {845	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();846	pub const CollectionCreationPrice: Balance = 2 * UNIQUE;847}848849impl pallet_common::Config for Runtime {850	type Event = Event;851852	type Currency = Balances;853	type CollectionCreationPrice = CollectionCreationPrice;854	type TreasuryAccountId = TreasuryAccountId;855	type CollectionDispatch = CollectionDispatchT<Self>;856857	type EvmTokenAddressMapping = EvmTokenAddressMapping;858	type CrossTokenAddressMapping = CrossTokenAddressMapping<Self::AccountId>;859}860861impl pallet_structure::Config for Runtime {862	type Event = Event;863	type Call = Call;864	type WeightInfo = pallet_structure::weights::SubstrateWeight<Self>;865}866867impl pallet_evm::account::Config for Runtime {868	type CrossAccountId = pallet_evm::account::BasicCrossAccountId<Self>;869	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;870	type EvmBackwardsAddressMapping = fp_evm_mapping::MapBackwardsAddressTruncated;871}872873impl pallet_fungible::Config for Runtime {874	type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;875}876impl pallet_refungible::Config for Runtime {877	type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;878}879impl pallet_nonfungible::Config for Runtime {880	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;881}882883impl pallet_proxy_rmrk_core::Config for Runtime {884	type Event = Event;885}886887impl pallet_proxy_rmrk_equip::Config for Runtime {888	type Event = Event;889}890891impl pallet_unique::Config for Runtime {892	type Event = Event;893	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;894}895896parameter_types! {897	pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied898}899900/// Used for the pallet inflation901impl pallet_inflation::Config for Runtime {902	type Currency = Balances;903	type TreasuryAccountId = TreasuryAccountId;904	type InflationBlockInterval = InflationBlockInterval;905	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;906}907908// parameter_types! {909// 	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *910// 		RuntimeBlockWeights::get().max_block;911// 	pub const MaxScheduledPerBlock: u32 = 50;912// }913914type EvmSponsorshipHandler = (915	pallet_unique::UniqueEthSponsorshipHandler<Runtime>,916	pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,917);918type SponsorshipHandler = (919	pallet_unique::UniqueSponsorshipHandler<Runtime>,920	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,921	pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,922);923924// impl pallet_unq_scheduler::Config for Runtime {925// 	type Event = Event;926// 	type Origin = Origin;927// 	type PalletsOrigin = OriginCaller;928// 	type Call = Call;929// 	type MaximumWeight = MaximumSchedulerWeight;930// 	type ScheduleOrigin = EnsureSigned<AccountId>;931// 	type MaxScheduledPerBlock = MaxScheduledPerBlock;932// 	type SponsorshipHandler = SponsorshipHandler;933// 	type WeightInfo = ();934// }935936impl pallet_evm_transaction_payment::Config for Runtime {937	type EvmSponsorshipHandler = EvmSponsorshipHandler;938	type Currency = Balances;939}940941impl pallet_charge_transaction::Config for Runtime {942	type SponsorshipHandler = SponsorshipHandler;943}944945// impl pallet_contract_helpers::Config for Runtime {946//	 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;947// }948949parameter_types! {950	// 0x842899ECF380553E8a4de75bF534cdf6fBF64049951	pub const HelpersContractAddress: H160 = H160([952		0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,953	]);954}955956impl pallet_evm_contract_helpers::Config for Runtime {957	type ContractAddress = HelpersContractAddress;958	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;959}960961construct_runtime!(962	pub enum Runtime where963		Block = Block,964		NodeBlock = opaque::Block,965		UncheckedExtrinsic = UncheckedExtrinsic966	{967		ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,968		ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,969970		Aura: pallet_aura::{Pallet, Config<T>} = 22,971		AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,972973		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,974		RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,975		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,976		TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,977		Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,978		Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,979		System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 36,980		Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,981		// Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,982		// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,983984		// XCM helpers.985		XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,986		PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,987		CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,988		DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,989990		// Unique Pallets991		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,992		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,993		// Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,994		// free = 63995		Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,996		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,997		Common: pallet_common::{Pallet, Storage, Event<T>} = 66,998		Fungible: pallet_fungible::{Pallet, Storage} = 67,999		Refungible: pallet_refungible::{Pallet, Storage} = 68,1000		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,1001		Structure: pallet_structure::{Pallet, Call, Storage, Event<T>} = 70,1002		RmrkCore: pallet_proxy_rmrk_core::{Pallet, Call, Storage, Event<T>} = 71,1003		RmrkEquip: pallet_proxy_rmrk_equip::{Pallet, Call, Storage, Event<T>} = 72,10041005		// Frontier1006		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,1007		Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,10081009		EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,1010		EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,1011		EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,1012		EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,1013	}1014);10151016pub struct TransactionConverter;10171018impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {1019	fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {1020		UncheckedExtrinsic::new_unsigned(1021			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1022		)1023	}1024}10251026impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {1027	fn convert_transaction(1028		&self,1029		transaction: pallet_ethereum::Transaction,1030	) -> opaque::UncheckedExtrinsic {1031		let extrinsic = UncheckedExtrinsic::new_unsigned(1032			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1033		);1034		let encoded = extrinsic.encode();1035		opaque::UncheckedExtrinsic::decode(&mut &encoded[..])1036			.expect("Encoded extrinsic is always valid")1037	}1038}10391040/// The address format for describing accounts.1041pub type Address = sp_runtime::MultiAddress<AccountId, ()>;1042/// Block header type as expected by this runtime.1043pub type Header = generic::Header<BlockNumber, BlakeTwo256>;1044/// Block type as expected by this runtime.1045pub type Block = generic::Block<Header, UncheckedExtrinsic>;1046/// A Block signed with a Justification1047pub type SignedBlock = generic::SignedBlock<Block>;1048/// BlockId type as expected by this runtime.1049pub type BlockId = generic::BlockId<Block>;1050/// The SignedExtension to the basic transaction logic.1051pub type SignedExtra = (1052	frame_system::CheckSpecVersion<Runtime>,1053	// system::CheckTxVersion<Runtime>,1054	frame_system::CheckGenesis<Runtime>,1055	frame_system::CheckEra<Runtime>,1056	frame_system::CheckNonce<Runtime>,1057	frame_system::CheckWeight<Runtime>,1058	pallet_charge_transaction::ChargeTransactionPayment<Runtime>,1059	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,1060	pallet_ethereum::FakeTransactionFinalizer<Runtime>,1061);1062/// Unchecked extrinsic type as expected by this runtime.1063pub type UncheckedExtrinsic =1064	fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;1065/// Extrinsic type that has already been checked.1066pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;1067/// Executive: handles dispatch to the various modules.1068pub type Executive = frame_executive::Executive<1069	Runtime,1070	Block,1071	frame_system::ChainContext<Runtime>,1072	Runtime,1073	AllPalletsReversedWithSystemFirst,1074>;10751076impl_opaque_keys! {1077	pub struct SessionKeys {1078		pub aura: Aura,1079	}1080}10811082impl fp_self_contained::SelfContainedCall for Call {1083	type SignedInfo = H160;10841085	fn is_self_contained(&self) -> bool {1086		match self {1087			Call::Ethereum(call) => call.is_self_contained(),1088			_ => false,1089		}1090	}10911092	fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {1093		match self {1094			Call::Ethereum(call) => call.check_self_contained(),1095			_ => None,1096		}1097	}10981099	fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {1100		match self {1101			Call::Ethereum(call) => call.validate_self_contained(info),1102			_ => None,1103		}1104	}11051106	fn pre_dispatch_self_contained(1107		&self,1108		info: &Self::SignedInfo,1109	) -> Option<Result<(), TransactionValidityError>> {1110		match self {1111			Call::Ethereum(call) => call.pre_dispatch_self_contained(info),1112			_ => None,1113		}1114	}11151116	fn apply_self_contained(1117		self,1118		info: Self::SignedInfo,1119	) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {1120		match self {1121			call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(1122				Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),1123			)),1124			_ => None,1125		}1126	}1127}11281129macro_rules! dispatch_unique_runtime {1130	($collection:ident.$method:ident($($name:ident),*)) => {{1131		let collection = <Runtime as pallet_common::Config>::CollectionDispatch::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);1132		let dispatch = collection.as_dyn();11331134		Ok::<_, DispatchError>(dispatch.$method($($name),*))1135	}};1136}11371138impl_common_runtime_apis!();11391140struct CheckInherents;11411142impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {1143	fn check_inherents(1144		block: &Block,1145		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,1146	) -> sp_inherents::CheckInherentsResult {1147		let relay_chain_slot = relay_state_proof1148			.read_slot()1149			.expect("Could not read the relay chain slot from the proof");11501151		let inherent_data =1152			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(1153				relay_chain_slot,1154				sp_std::time::Duration::from_secs(6),1155			)1156			.create_inherent_data()1157			.expect("Could not create the timestamp inherent data");11581159		inherent_data.check_extrinsics(block)1160	}1161}11621163cumulus_pallet_parachain_system::register_validate_block!(1164	Runtime = Runtime,1165	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,1166	CheckInherents = CheckInherents,1167);
after · runtime/quartz/src/lib.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617//! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.1819#![cfg_attr(not(feature = "std"), no_std)]20// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.21#![recursion_limit = "1024"]22#![allow(clippy::from_over_into, clippy::identity_op)]23#![allow(clippy::fn_to_numeric_cast_with_truncation)]24// Make the WASM binary available.25#[cfg(feature = "std")]26include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));2728use sp_api::impl_runtime_apis;29use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};30use sp_runtime::DispatchError;31// #[cfg(any(feature = "std", test))]32// pub use sp_runtime::BuildStorage;3334use sp_runtime::{35	Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,36	traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, AccountIdConversion, Zero},37	transaction_validity::{TransactionSource, TransactionValidity},38	ApplyExtrinsicResult, RuntimeAppPublic,39};4041use sp_std::prelude::*;4243#[cfg(feature = "std")]44use sp_version::NativeVersion;45use sp_version::RuntimeVersion;46pub use pallet_transaction_payment::{47	Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,48};49// A few exports that help ease life for downstream crates.50pub use pallet_balances::Call as BalancesCall;51pub use pallet_evm::{52	EnsureAddressTruncated, HashedAddressMapping, Runner, account::CrossAccountId as _,53};54pub use frame_support::{55	construct_runtime, match_types,56	dispatch::DispatchResult,57	PalletId, parameter_types, StorageValue, ConsensusEngineId,58	traits::{59		tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Everything,60		Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier,61		OnUnbalanced, Randomness, FindAuthor, ConstU32, Imbalance,62	},63	weights::{64		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},65		DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,66		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,67	},68};69use unique_runtime_common::dispatch::{CollectionDispatchT, CollectionDispatch};70use up_data_structs::*;71// use pallet_contracts::weights::WeightInfo;72// #[cfg(any(feature = "std", test))]73use frame_system::{74	self as frame_system, EnsureRoot, EnsureSigned,75	limits::{BlockWeights, BlockLength},76};77use sp_arithmetic::{78	traits::{BaseArithmetic, Unsigned},79};80use smallvec::smallvec;81use codec::{Encode, Decode};82use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};83use fp_rpc::TransactionStatus;84use sp_runtime::{85	traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},86	transaction_validity::TransactionValidityError,87	SaturatedConversion,88};8990// pub use pallet_timestamp::Call as TimestampCall;91pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;9293// Polkadot imports94use pallet_xcm::XcmPassthrough;95use polkadot_parachain::primitives::Sibling;96use up_data_structs::mapping::{CrossTokenAddressMapping, EvmTokenAddressMapping};97use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};98use xcm_builder::{99	AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,100	EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,101	RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,102	SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,103	ParentIsPreset,104};105use xcm_executor::{Config, XcmExecutor, Assets};106use sp_std::{marker::PhantomData};107108use xcm::latest::{109	//	Xcm,110	AssetId::{Concrete},111	Fungibility::Fungible as XcmFungible,112	MultiAsset,113	Error as XcmError,114};115use xcm_executor::traits::{MatchesFungible, WeightTrader};116//use xcm_executor::traits::MatchesFungible;117use sp_runtime::traits::CheckedConversion;118119use unique_runtime_common::{impl_common_runtime_apis, types::*, constants::*};120121pub const RUNTIME_NAME: &str = "quartz";122pub const TOKEN_SYMBOL: &str = "QTZ";123124type CrossAccountId = pallet_evm::account::BasicCrossAccountId<Runtime>;125126impl RuntimeInstance for Runtime {127	type CrossAccountId = self::CrossAccountId;128129	type TransactionConverter = self::TransactionConverter;130131	fn get_transaction_converter() -> TransactionConverter {132		TransactionConverter133	}134}135136/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know137/// the specifics of the runtime. They can then be made to be agnostic over specific formats138/// of data like extrinsics, allowing for them to continue syncing the network through upgrades139/// to even the core data structures.140pub mod opaque {141	use sp_std::prelude::*;142	use sp_runtime::impl_opaque_keys;143	use super::Aura;144145	pub use unique_runtime_common::types::*;146147	impl_opaque_keys! {148		pub struct SessionKeys {149			pub aura: Aura,150		}151	}152}153154/// This runtime version.155pub const VERSION: RuntimeVersion = RuntimeVersion {156	spec_name: create_runtime_str!(RUNTIME_NAME),157	impl_name: create_runtime_str!(RUNTIME_NAME),158	authoring_version: 1,159	spec_version: 920000,160	impl_version: 0,161	apis: RUNTIME_API_VERSIONS,162	transaction_version: 1,163	state_version: 0,164};165166#[derive(codec::Encode, codec::Decode)]167pub enum XCMPMessage<XAccountId, XBalance> {168	/// Transfer tokens to the given account from the Parachain account.169	TransferToken(XAccountId, XBalance),170}171172/// The version information used to identify this runtime when compiled natively.173#[cfg(feature = "std")]174pub fn native_version() -> NativeVersion {175	NativeVersion {176		runtime_version: VERSION,177		can_author_with: Default::default(),178	}179}180181type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;182183pub struct DealWithFees;184impl OnUnbalanced<NegativeImbalance> for DealWithFees {185	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {186		if let Some(fees) = fees_then_tips.next() {187			// for fees, 100% to treasury188			let mut split = fees.ration(100, 0);189			if let Some(tips) = fees_then_tips.next() {190				// for tips, if any, 100% to treasury191				tips.ration_merge_into(100, 0, &mut split);192			}193			Treasury::on_unbalanced(split.0);194			// Author::on_unbalanced(split.1);195		}196	}197}198199parameter_types! {200	pub const BlockHashCount: BlockNumber = 2400;201	pub RuntimeBlockLength: BlockLength =202		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);203	pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);204	pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;205	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()206		.base_block(BlockExecutionWeight::get())207		.for_class(DispatchClass::all(), |weights| {208			weights.base_extrinsic = ExtrinsicBaseWeight::get();209		})210		.for_class(DispatchClass::Normal, |weights| {211			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);212		})213		.for_class(DispatchClass::Operational, |weights| {214			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);215			// Operational transactions have some extra reserved space, so that they216			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.217			weights.reserved = Some(218				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT219			);220		})221		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)222		.build_or_panic();223	pub const Version: RuntimeVersion = VERSION;224	pub const SS58Prefix: u8 = 255;225}226227parameter_types! {228	pub const ChainId: u64 = 8881;229}230231pub struct FixedFee;232impl FeeCalculator for FixedFee {233	fn min_gas_price() -> U256 {234		MIN_GAS_PRICE.into()235	}236}237238// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case239// (contract, which only writes a lot of data),240// approximating on top of our real store write weight241parameter_types! {242	pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;243	pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;244	pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();245}246247/// Limiting EVM execution to 50% of block for substrate users and management tasks248/// EVM transaction consumes more weight than substrate's, so we can't rely on them being249/// scheduled fairly250const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);251parameter_types! {252	pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());253}254255pub enum FixedGasWeightMapping {}256impl GasWeightMapping for FixedGasWeightMapping {257	fn gas_to_weight(gas: u64) -> Weight {258		gas.saturating_mul(WeightPerGas::get())259	}260	fn weight_to_gas(weight: Weight) -> u64 {261		weight / WeightPerGas::get()262	}263}264265impl pallet_evm::Config for Runtime {266	type BlockGasLimit = BlockGasLimit;267	type FeeCalculator = FixedFee;268	type GasWeightMapping = FixedGasWeightMapping;269	type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;270	type CallOrigin = EnsureAddressTruncated<Self>;271	type WithdrawOrigin = EnsureAddressTruncated<Self>;272	type AddressMapping = HashedAddressMapping<Self::Hashing>;273	type PrecompilesType = ();274	type PrecompilesValue = ();275	type Currency = Balances;276	type Event = Event;277	type OnMethodCall = (278		pallet_evm_migration::OnMethodCall<Self>,279		pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,280		CollectionDispatchT<Self>,281		pallet_evm_collection::CollectionOnMethodCall<Self>,282	);283	type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;284	type ChainId = ChainId;285	type Runner = pallet_evm::runner::stack::Runner<Self>;286	type OnChargeTransaction = pallet_evm::EVMCurrencyAdapter<Balances, DealWithFees>;287	type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;288	type FindAuthor = EthereumFindAuthor<Aura>;289}290291impl pallet_evm_migration::Config for Runtime {292	type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;293}294295pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);296impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {297	fn find_author<'a, I>(digests: I) -> Option<H160>298	where299		I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,300	{301		if let Some(author_index) = F::find_author(digests) {302			let authority_id = Aura::authorities()[author_index as usize].clone();303			return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));304		}305		None306	}307}308309impl pallet_ethereum::Config for Runtime {310	type Event = Event;311	type StateRoot = pallet_ethereum::IntermediateStateRoot<Self>;312}313314impl pallet_randomness_collective_flip::Config for Runtime {}315316impl frame_system::Config for Runtime {317	/// The data to be stored in an account.318	type AccountData = pallet_balances::AccountData<Balance>;319	/// The identifier used to distinguish between accounts.320	type AccountId = AccountId;321	/// The basic call filter to use in dispatchable.322	type BaseCallFilter = Everything;323	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).324	type BlockHashCount = BlockHashCount;325	/// The maximum length of a block (in bytes).326	type BlockLength = RuntimeBlockLength;327	/// The index type for blocks.328	type BlockNumber = BlockNumber;329	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.330	type BlockWeights = RuntimeBlockWeights;331	/// The aggregated dispatch type that is available for extrinsics.332	type Call = Call;333	/// The weight of database operations that the runtime can invoke.334	type DbWeight = RocksDbWeight;335	/// The ubiquitous event type.336	type Event = Event;337	/// The type for hashing blocks and tries.338	type Hash = Hash;339	/// The hashing algorithm used.340	type Hashing = BlakeTwo256;341	/// The header type.342	type Header = generic::Header<BlockNumber, BlakeTwo256>;343	/// The index type for storing how many extrinsics an account has signed.344	type Index = Index;345	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.346	type Lookup = AccountIdLookup<AccountId, ()>;347	/// What to do if an account is fully reaped from the system.348	type OnKilledAccount = ();349	/// What to do if a new account is created.350	type OnNewAccount = ();351	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;352	/// The ubiquitous origin type.353	type Origin = Origin;354	/// This type is being generated by `construct_runtime!`.355	type PalletInfo = PalletInfo;356	/// This is used as an identifier of the chain. 42 is the generic substrate prefix.357	type SS58Prefix = SS58Prefix;358	/// Weight information for the extrinsics of this pallet.359	type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;360	/// Version of the runtime.361	type Version = Version;362	type MaxConsumers = ConstU32<16>;363}364365parameter_types! {366	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;367}368369impl pallet_timestamp::Config for Runtime {370	/// A timestamp: milliseconds since the unix epoch.371	type Moment = u64;372	type OnTimestampSet = ();373	type MinimumPeriod = MinimumPeriod;374	type WeightInfo = ();375}376377parameter_types! {378	// pub const ExistentialDeposit: u128 = 500;379	pub const ExistentialDeposit: u128 = 0;380	pub const MaxLocks: u32 = 50;381}382383impl pallet_balances::Config for Runtime {384	type MaxLocks = MaxLocks;385	type MaxReserves = ();386	type ReserveIdentifier = [u8; 8];387	/// The type for recording an account's balance.388	type Balance = Balance;389	/// The ubiquitous event type.390	type Event = Event;391	type DustRemoval = Treasury;392	type ExistentialDeposit = ExistentialDeposit;393	type AccountStore = System;394	type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;395}396397pub const fn deposit(items: u32, bytes: u32) -> Balance {398	items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE399}400401/*402parameter_types! {403	pub TombstoneDeposit: Balance = deposit(404		1,405		sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,406	);407	pub DepositPerContract: Balance = TombstoneDeposit::get();408	pub const DepositPerStorageByte: Balance = deposit(0, 1);409	pub const DepositPerStorageItem: Balance = deposit(1, 0);410	pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);411	pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;412	pub const SignedClaimHandicap: u32 = 2;413	pub const MaxDepth: u32 = 32;414	pub const MaxValueSize: u32 = 16 * 1024;415	pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb416	// The lazy deletion runs inside on_initialize.417	pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *418		RuntimeBlockWeights::get().max_block;419	// The weight needed for decoding the queue should be less or equal than a fifth420	// of the overall weight dedicated to the lazy deletion.421	pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (422			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -423			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)424		)) / 5) as u32;425	pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();426}427428impl pallet_contracts::Config for Runtime {429	type Time = Timestamp;430	type Randomness = RandomnessCollectiveFlip;431	type Currency = Balances;432	type Event = Event;433	type RentPayment = ();434	type SignedClaimHandicap = SignedClaimHandicap;435	type TombstoneDeposit = TombstoneDeposit;436	type DepositPerContract = DepositPerContract;437	type DepositPerStorageByte = DepositPerStorageByte;438	type DepositPerStorageItem = DepositPerStorageItem;439	type RentFraction = RentFraction;440	type SurchargeReward = SurchargeReward;441	type WeightPrice = pallet_transaction_payment::Pallet<Self>;442	type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;443	type ChainExtension = NFTExtension;444	type DeletionQueueDepth = DeletionQueueDepth;445	type DeletionWeightLimit = DeletionWeightLimit;446	type Schedule = Schedule;447	type CallStack = [pallet_contracts::Frame<Self>; 31];448}449*/450451parameter_types! {452	/// This value increases the priority of `Operational` transactions by adding453	/// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.454	pub const OperationalFeeMultiplier: u8 = 5;455}456457/// Linear implementor of `WeightToFeePolynomial`458pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);459460impl<T> WeightToFeePolynomial for LinearFee<T>461where462	T: BaseArithmetic + From<u32> + Copy + Unsigned,463{464	type Balance = T;465466	fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {467		smallvec!(WeightToFeeCoefficient {468			// Targeting 0.1 Unique per NFT transfer469			coeff_integer: WEIGHT_TO_FEE_COEFF.into(),470			coeff_frac: Perbill::zero(),471			negative: false,472			degree: 1,473		})474	}475}476477impl pallet_transaction_payment::Config for Runtime {478	type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;479	type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;480	type OperationalFeeMultiplier = OperationalFeeMultiplier;481	type WeightToFee = LinearFee<Balance>;482	type FeeMultiplierUpdate = ();483}484485parameter_types! {486	pub const ProposalBond: Permill = Permill::from_percent(5);487	pub const ProposalBondMinimum: Balance = 1 * UNIQUE;488	pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;489	pub const SpendPeriod: BlockNumber = 5 * MINUTES;490	pub const Burn: Permill = Permill::from_percent(0);491	pub const TipCountdown: BlockNumber = 1 * DAYS;492	pub const TipFindersFee: Percent = Percent::from_percent(20);493	pub const TipReportDepositBase: Balance = 1 * UNIQUE;494	pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;495	pub const BountyDepositBase: Balance = 1 * UNIQUE;496	pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;497	pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");498	pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;499	pub const MaximumReasonLength: u32 = 16384;500	pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);501	pub const BountyValueMinimum: Balance = 5 * UNIQUE;502	pub const MaxApprovals: u32 = 100;503}504505impl pallet_treasury::Config for Runtime {506	type PalletId = TreasuryModuleId;507	type Currency = Balances;508	type ApproveOrigin = EnsureRoot<AccountId>;509	type RejectOrigin = EnsureRoot<AccountId>;510	type Event = Event;511	type OnSlash = ();512	type ProposalBond = ProposalBond;513	type ProposalBondMinimum = ProposalBondMinimum;514	type ProposalBondMaximum = ProposalBondMaximum;515	type SpendPeriod = SpendPeriod;516	type Burn = Burn;517	type BurnDestination = ();518	type SpendFunds = ();519	type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;520	type MaxApprovals = MaxApprovals;521}522523impl pallet_sudo::Config for Runtime {524	type Event = Event;525	type Call = Call;526}527528pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);529530impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider531	for RelayChainBlockNumberProvider<T>532{533	type BlockNumber = BlockNumber;534535	fn current_block_number() -> Self::BlockNumber {536		cumulus_pallet_parachain_system::Pallet::<T>::validation_data()537			.map(|d| d.relay_parent_number)538			.unwrap_or_default()539	}540}541542parameter_types! {543	pub const MinVestedTransfer: Balance = 10 * UNIQUE;544	pub const MaxVestingSchedules: u32 = 28;545}546547impl orml_vesting::Config for Runtime {548	type Event = Event;549	type Currency = pallet_balances::Pallet<Runtime>;550	type MinVestedTransfer = MinVestedTransfer;551	type VestedTransferOrigin = EnsureSigned<AccountId>;552	type WeightInfo = ();553	type MaxVestingSchedules = MaxVestingSchedules;554	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;555}556557parameter_types! {558	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;559	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;560}561562impl cumulus_pallet_parachain_system::Config for Runtime {563	type Event = Event;564	type SelfParaId = parachain_info::Pallet<Self>;565	type OnSystemEvent = ();566	// type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<567	// 	MaxDownwardMessageWeight,568	// 	XcmExecutor<XcmConfig>,569	// 	Call,570	// >;571	type OutboundXcmpMessageSource = XcmpQueue;572	type DmpMessageHandler = DmpQueue;573	type ReservedDmpWeight = ReservedDmpWeight;574	type ReservedXcmpWeight = ReservedXcmpWeight;575	type XcmpMessageHandler = XcmpQueue;576}577578impl parachain_info::Config for Runtime {}579580impl cumulus_pallet_aura_ext::Config for Runtime {}581582parameter_types! {583	pub const RelayLocation: MultiLocation = MultiLocation::parent();584	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;585	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();586	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();587}588589/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used590/// when determining ownership of accounts for asset transacting and when attempting to use XCM591/// `Transact` in order to determine the dispatch Origin.592pub type LocationToAccountId = (593	// The parent (Relay-chain) origin converts to the default `AccountId`.594	ParentIsPreset<AccountId>,595	// Sibling parachain origins convert to AccountId via the `ParaId::into`.596	SiblingParachainConvertsVia<Sibling, AccountId>,597	// Straight up local `AccountId32` origins just alias directly to `AccountId`.598	AccountId32Aliases<RelayNetwork, AccountId>,599);600601pub struct OnlySelfCurrency;602impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {603	fn matches_fungible(a: &MultiAsset) -> Option<B> {604		match (&a.id, &a.fun) {605			(Concrete(_), XcmFungible(ref amount)) => CheckedConversion::checked_from(*amount),606			_ => None,607		}608	}609}610611/// Means for transacting assets on this chain.612pub type LocalAssetTransactor = CurrencyAdapter<613	// Use this currency:614	Balances,615	// Use this currency when it is a fungible asset matching the given location or name:616	OnlySelfCurrency,617	// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:618	LocationToAccountId,619	// Our chain's account ID type (we can't get away without mentioning it explicitly):620	AccountId,621	// We don't track any teleports.622	(),623>;624625/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,626/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can627/// biases the kind of local `Origin` it will become.628pub type XcmOriginToTransactDispatchOrigin = (629	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location630	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for631	// foreign chains who want to have a local sovereign account on this chain which they control.632	SovereignSignedViaLocation<LocationToAccountId, Origin>,633	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when634	// recognised.635	RelayChainAsNative<RelayOrigin, Origin>,636	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when637	// recognised.638	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,639	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a640	// transaction from the Root origin.641	ParentAsSuperuser<Origin>,642	// Native signed account converter; this just converts an `AccountId32` origin into a normal643	// `Origin::Signed` origin of the same 32-byte value.644	SignedAccountId32AsNative<RelayNetwork, Origin>,645	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.646	XcmPassthrough<Origin>,647);648649parameter_types! {650	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.651	pub UnitWeightCost: Weight = 1_000_000;652	// 1200 UNIQUEs buy 1 second of weight.653	pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);654	pub const MaxInstructions: u32 = 100;655	pub const MaxAuthorities: u32 = 100_000;656}657658match_types! {659	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {660		MultiLocation { parents: 1, interior: Here } |661		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }662	};663}664665pub type Barrier = (666	TakeWeightCredit,667	AllowTopLevelPaidExecutionFrom<Everything>,668	AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,669	// ^^^ Parent & its unit plurality gets free execution670);671672pub struct UsingOnlySelfCurrencyComponents<673	WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,674	AssetId: Get<MultiLocation>,675	AccountId,676	Currency: CurrencyT<AccountId>,677	OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,678>(679	Weight,680	Currency::Balance,681	PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,682);683impl<684		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,685		AssetId: Get<MultiLocation>,686		AccountId,687		Currency: CurrencyT<AccountId>,688		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,689	> WeightTrader690	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>691{692	fn new() -> Self {693		Self(0, Zero::zero(), PhantomData)694	}695696	fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {697		let amount = WeightToFee::calc(&weight);698		let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?;699700		// location to this parachain through relay chain701		let option1: xcm::v1::AssetId = Concrete(MultiLocation {702			parents: 1,703			interior: X1(Parachain(ParachainInfo::parachain_id().into())),704		});705		// direct location706		let option2: xcm::v1::AssetId = Concrete(MultiLocation {707			parents: 0,708			interior: Here,709		});710711		let required = if payment.fungible.contains_key(&option1) {712			(option1, u128_amount).into()713		} else if payment.fungible.contains_key(&option2) {714			(option2, u128_amount).into()715		} else {716			(Concrete(MultiLocation::default()), u128_amount).into()717		};718719		let unused = payment720			.checked_sub(required)721			.map_err(|_| XcmError::TooExpensive)?;722		self.0 = self.0.saturating_add(weight);723		self.1 = self.1.saturating_add(amount);724		Ok(unused)725	}726727	fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {728		let weight = weight.min(self.0);729		let amount = WeightToFee::calc(&weight);730		self.0 -= weight;731		self.1 = self.1.saturating_sub(amount);732		let amount: u128 = amount.saturated_into();733		if amount > 0 {734			Some((AssetId::get(), amount).into())735		} else {736			None737		}738	}739}740impl<741		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,742		AssetId: Get<MultiLocation>,743		AccountId,744		Currency: CurrencyT<AccountId>,745		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,746	> Drop747	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>748{749	fn drop(&mut self) {750		OnUnbalanced::on_unbalanced(Currency::issue(self.1));751	}752}753754pub struct XcmConfig;755impl Config for XcmConfig {756	type Call = Call;757	type XcmSender = XcmRouter;758	// How to withdraw and deposit an asset.759	type AssetTransactor = LocalAssetTransactor;760	type OriginConverter = XcmOriginToTransactDispatchOrigin;761	type IsReserve = NativeAsset;762	type IsTeleporter = (); // Teleportation is disabled763	type LocationInverter = LocationInverter<Ancestry>;764	type Barrier = Barrier;765	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;766	type Trader = UsingOnlySelfCurrencyComponents<767		IdentityFee<Balance>,768		RelayLocation,769		AccountId,770		Balances,771		(),772	>;773	type ResponseHandler = (); // Don't handle responses for now.774	type SubscriptionService = PolkadotXcm;775776	type AssetTrap = PolkadotXcm;777	type AssetClaims = PolkadotXcm;778}779780// parameter_types! {781// 	pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;782// }783784/// No local origins on this chain are allowed to dispatch XCM sends/executions.785pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);786787/// The means for routing XCM messages which are not for local execution into the right message788/// queues.789pub type XcmRouter = (790	// Two routers - use UMP to communicate with the relay chain:791	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,792	// ..and XCMP to communicate with the sibling chains.793	XcmpQueue,794);795796impl pallet_evm_coder_substrate::Config for Runtime {797	type GasWeightMapping = FixedGasWeightMapping;798}799800impl pallet_xcm::Config for Runtime {801	type Event = Event;802	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;803	type XcmRouter = XcmRouter;804	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;805	type XcmExecuteFilter = Everything;806	type XcmExecutor = XcmExecutor<XcmConfig>;807	type XcmTeleportFilter = Everything;808	type XcmReserveTransferFilter = Everything;809	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;810	type LocationInverter = LocationInverter<Ancestry>;811	type Origin = Origin;812	type Call = Call;813	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;814	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;815}816817impl cumulus_pallet_xcm::Config for Runtime {818	type Event = Event;819	type XcmExecutor = XcmExecutor<XcmConfig>;820}821822impl cumulus_pallet_xcmp_queue::Config for Runtime {823	type WeightInfo = ();824	type Event = Event;825	type XcmExecutor = XcmExecutor<XcmConfig>;826	type ChannelInfo = ParachainSystem;827	type VersionWrapper = ();828	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;829	type ControllerOrigin = EnsureRoot<AccountId>;830	type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;831}832833impl cumulus_pallet_dmp_queue::Config for Runtime {834	type Event = Event;835	type XcmExecutor = XcmExecutor<XcmConfig>;836	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;837}838839impl pallet_aura::Config for Runtime {840	type AuthorityId = AuraId;841	type DisabledValidators = ();842	type MaxAuthorities = MaxAuthorities;843}844845parameter_types! {846	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();847	pub const CollectionCreationPrice: Balance = 2 * UNIQUE;848}849850impl pallet_common::Config for Runtime {851	type Event = Event;852853	type Currency = Balances;854	type CollectionCreationPrice = CollectionCreationPrice;855	type TreasuryAccountId = TreasuryAccountId;856	type CollectionDispatch = CollectionDispatchT<Self>;857858	type EvmTokenAddressMapping = EvmTokenAddressMapping;859	type CrossTokenAddressMapping = CrossTokenAddressMapping<Self::AccountId>;860}861862impl pallet_structure::Config for Runtime {863	type Event = Event;864	type Call = Call;865	type WeightInfo = pallet_structure::weights::SubstrateWeight<Self>;866}867868impl pallet_evm::account::Config for Runtime {869	type CrossAccountId = pallet_evm::account::BasicCrossAccountId<Self>;870	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;871	type EvmBackwardsAddressMapping = fp_evm_mapping::MapBackwardsAddressTruncated;872}873874impl pallet_fungible::Config for Runtime {875	type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;876}877impl pallet_refungible::Config for Runtime {878	type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;879}880impl pallet_nonfungible::Config for Runtime {881	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;882}883884impl pallet_proxy_rmrk_core::Config for Runtime {885	type Event = Event;886}887888impl pallet_proxy_rmrk_equip::Config for Runtime {889	type Event = Event;890}891892impl pallet_unique::Config for Runtime {893	type Event = Event;894	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;895}896897parameter_types! {898	pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied899}900901/// Used for the pallet inflation902impl pallet_inflation::Config for Runtime {903	type Currency = Balances;904	type TreasuryAccountId = TreasuryAccountId;905	type InflationBlockInterval = InflationBlockInterval;906	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;907}908909// parameter_types! {910// 	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *911// 		RuntimeBlockWeights::get().max_block;912// 	pub const MaxScheduledPerBlock: u32 = 50;913// }914915type EvmSponsorshipHandler = (916	pallet_unique::UniqueEthSponsorshipHandler<Runtime>,917	pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,918);919type SponsorshipHandler = (920	pallet_unique::UniqueSponsorshipHandler<Runtime>,921	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,922	pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,923);924925// impl pallet_unq_scheduler::Config for Runtime {926// 	type Event = Event;927// 	type Origin = Origin;928// 	type PalletsOrigin = OriginCaller;929// 	type Call = Call;930// 	type MaximumWeight = MaximumSchedulerWeight;931// 	type ScheduleOrigin = EnsureSigned<AccountId>;932// 	type MaxScheduledPerBlock = MaxScheduledPerBlock;933// 	type SponsorshipHandler = SponsorshipHandler;934// 	type WeightInfo = ();935// }936937impl pallet_evm_transaction_payment::Config for Runtime {938	type EvmSponsorshipHandler = EvmSponsorshipHandler;939	type Currency = Balances;940}941942impl pallet_charge_transaction::Config for Runtime {943	type SponsorshipHandler = SponsorshipHandler;944}945946// impl pallet_contract_helpers::Config for Runtime {947//	 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;948// }949950parameter_types! {951	// 0x842899ECF380553E8a4de75bF534cdf6fBF64049952	pub const HelpersContractAddress: H160 = H160([953		0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,954	]);955		956	// 0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f957	pub const EvmCollectionAddress: H160 = H160([958		0x6c, 0x4e, 0x9f, 0xe1, 0xae, 0x37, 0xa4, 0x1e, 0x93, 0xce, 0xe4, 0x29, 0xe8, 0xe1, 0x88, 0x1a, 0xbd, 0xcb, 0xb5, 0x4f,959	]);960}961962impl pallet_evm_contract_helpers::Config for Runtime {963	type ContractAddress = HelpersContractAddress;964	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;965}966967impl pallet_evm_collection::Config for Runtime {968	type ContractAddress = EvmCollectionAddress;969}970971construct_runtime!(972	pub enum Runtime where973		Block = Block,974		NodeBlock = opaque::Block,975		UncheckedExtrinsic = UncheckedExtrinsic976	{977		ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,978		ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,979980		Aura: pallet_aura::{Pallet, Config<T>} = 22,981		AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,982983		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,984		RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,985		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,986		TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,987		Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,988		Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,989		System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 36,990		Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,991		// Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,992		// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,993994		// XCM helpers.995		XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,996		PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,997		CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,998		DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,9991000		// Unique Pallets1001		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,1002		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,1003		// Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,1004		// free = 631005		Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,1006		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,1007		Common: pallet_common::{Pallet, Storage, Event<T>} = 66,1008		Fungible: pallet_fungible::{Pallet, Storage} = 67,1009		Refungible: pallet_refungible::{Pallet, Storage} = 68,1010		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,1011		Structure: pallet_structure::{Pallet, Call, Storage, Event<T>} = 70,1012		RmrkCore: pallet_proxy_rmrk_core::{Pallet, Call, Storage, Event<T>} = 71,1013		RmrkEquip: pallet_proxy_rmrk_equip::{Pallet, Call, Storage, Event<T>} = 72,10141015		// Frontier1016		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,1017		Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,10181019		EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,1020		EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,1021		EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,1022		EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,1023		EvmCollection: pallet_evm_collection::{Pallet} = 154,1024	}1025);10261027pub struct TransactionConverter;10281029impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {1030	fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {1031		UncheckedExtrinsic::new_unsigned(1032			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1033		)1034	}1035}10361037impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {1038	fn convert_transaction(1039		&self,1040		transaction: pallet_ethereum::Transaction,1041	) -> opaque::UncheckedExtrinsic {1042		let extrinsic = UncheckedExtrinsic::new_unsigned(1043			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1044		);1045		let encoded = extrinsic.encode();1046		opaque::UncheckedExtrinsic::decode(&mut &encoded[..])1047			.expect("Encoded extrinsic is always valid")1048	}1049}10501051/// The address format for describing accounts.1052pub type Address = sp_runtime::MultiAddress<AccountId, ()>;1053/// Block header type as expected by this runtime.1054pub type Header = generic::Header<BlockNumber, BlakeTwo256>;1055/// Block type as expected by this runtime.1056pub type Block = generic::Block<Header, UncheckedExtrinsic>;1057/// A Block signed with a Justification1058pub type SignedBlock = generic::SignedBlock<Block>;1059/// BlockId type as expected by this runtime.1060pub type BlockId = generic::BlockId<Block>;1061/// The SignedExtension to the basic transaction logic.1062pub type SignedExtra = (1063	frame_system::CheckSpecVersion<Runtime>,1064	// system::CheckTxVersion<Runtime>,1065	frame_system::CheckGenesis<Runtime>,1066	frame_system::CheckEra<Runtime>,1067	frame_system::CheckNonce<Runtime>,1068	frame_system::CheckWeight<Runtime>,1069	pallet_charge_transaction::ChargeTransactionPayment<Runtime>,1070	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,1071	pallet_ethereum::FakeTransactionFinalizer<Runtime>,1072);1073/// Unchecked extrinsic type as expected by this runtime.1074pub type UncheckedExtrinsic =1075	fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;1076/// Extrinsic type that has already been checked.1077pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;1078/// Executive: handles dispatch to the various modules.1079pub type Executive = frame_executive::Executive<1080	Runtime,1081	Block,1082	frame_system::ChainContext<Runtime>,1083	Runtime,1084	AllPalletsReversedWithSystemFirst,1085>;10861087impl_opaque_keys! {1088	pub struct SessionKeys {1089		pub aura: Aura,1090	}1091}10921093impl fp_self_contained::SelfContainedCall for Call {1094	type SignedInfo = H160;10951096	fn is_self_contained(&self) -> bool {1097		match self {1098			Call::Ethereum(call) => call.is_self_contained(),1099			_ => false,1100		}1101	}11021103	fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {1104		match self {1105			Call::Ethereum(call) => call.check_self_contained(),1106			_ => None,1107		}1108	}11091110	fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {1111		match self {1112			Call::Ethereum(call) => call.validate_self_contained(info),1113			_ => None,1114		}1115	}11161117	fn pre_dispatch_self_contained(1118		&self,1119		info: &Self::SignedInfo,1120	) -> Option<Result<(), TransactionValidityError>> {1121		match self {1122			Call::Ethereum(call) => call.pre_dispatch_self_contained(info),1123			_ => None,1124		}1125	}11261127	fn apply_self_contained(1128		self,1129		info: Self::SignedInfo,1130	) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {1131		match self {1132			call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(1133				Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),1134			)),1135			_ => None,1136		}1137	}1138}11391140macro_rules! dispatch_unique_runtime {1141	($collection:ident.$method:ident($($name:ident),*)) => {{1142		let collection = <Runtime as pallet_common::Config>::CollectionDispatch::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);1143		let dispatch = collection.as_dyn();11441145		Ok::<_, DispatchError>(dispatch.$method($($name),*))1146	}};1147}11481149impl_common_runtime_apis!();11501151struct CheckInherents;11521153impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {1154	fn check_inherents(1155		block: &Block,1156		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,1157	) -> sp_inherents::CheckInherentsResult {1158		let relay_chain_slot = relay_state_proof1159			.read_slot()1160			.expect("Could not read the relay chain slot from the proof");11611162		let inherent_data =1163			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(1164				relay_chain_slot,1165				sp_std::time::Duration::from_secs(6),1166			)1167			.create_inherent_data()1168			.expect("Could not create the timestamp inherent data");11691170		inherent_data.check_extrinsics(block)1171	}1172}11731174cumulus_pallet_parachain_system::register_validate_block!(1175	Runtime = Runtime,1176	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,1177	CheckInherents = CheckInherents,1178);
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -75,6 +75,7 @@
     'pallet-evm/std',
     'pallet-evm-migration/std',
     'pallet-evm-contract-helpers/std',
+    'pallet-evm-collection/std',
     'pallet-evm-transaction-payment/std',
     'pallet-evm-coder-substrate/std',
     'pallet-ethereum/std',
@@ -414,6 +415,7 @@
 pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.21", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
 pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
 pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }
+pallet-evm-collection = { path = '../../pallets/evm-collection', default-features = false }
 pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
 pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
 pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -49,7 +49,7 @@
 // A few exports that help ease life for downstream crates.
 pub use pallet_balances::Call as BalancesCall;
 pub use pallet_evm::{
-	EnsureAddressTruncated, HashedAddressMapping, Runner, account::CrossAccountId as _,
+	EnsureAddressTruncated, HashedAddressMapping, Runner, account::CrossAccountId as _, OnMethodCall,
 };
 pub use frame_support::{
 	construct_runtime, match_types,
@@ -282,6 +282,7 @@
 		pallet_evm_migration::OnMethodCall<Self>,
 		pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,
 		CollectionDispatchT<Self>,
+		pallet_evm_collection::CollectionOnMethodCall<Self>,
 	);
 	type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;
 	type ChainId = ChainId;
@@ -956,6 +957,11 @@
 	pub const HelpersContractAddress: H160 = H160([
 		0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,
 	]);
+		
+	// 0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f
+	pub const EvmCollectionAddress: H160 = H160([
+		0x6c, 0x4e, 0x9f, 0xe1, 0xae, 0x37, 0xa4, 0x1e, 0x93, 0xce, 0xe4, 0x29, 0xe8, 0xe1, 0x88, 0x1a, 0xbd, 0xcb, 0xb5, 0x4f,
+	]);
 }
 
 impl pallet_evm_contract_helpers::Config for Runtime {
@@ -963,6 +969,10 @@
 	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;
 }
 
+impl pallet_evm_collection::Config for Runtime {
+	type ContractAddress = EvmCollectionAddress;
+}
+
 construct_runtime!(
 	pub enum Runtime where
 		Block = Block,
@@ -1015,6 +1025,7 @@
 		EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,
 		EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,
 		EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,
+		EvmCollection: pallet_evm_collection::{Pallet} = 154,
 	}
 );
 
addedtests/src/eth/api/Collection.soldiffbeforeafterboth
--- /dev/null
+++ b/tests/src/eth/api/Collection.sol
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: OTHER
+// This code is automatically generated
+
+pragma solidity >=0.8.0 <0.9.0;
+
+// Common stubs holder
+interface Dummy {
+
+}
+
+interface ERC165 is Dummy {
+	function supportsInterface(bytes4 interfaceID) external view returns (bool);
+}
+
+// Selector: ee5467a8
+interface Collection is Dummy, ERC165 {
+	// Selector: contractOwner(address) 5152b14c
+	function contractOwner(address contractAddress)
+		external
+		view
+		returns (address);
+
+	// Selector: sponsoringEnabled(address) 6027dc61
+	function sponsoringEnabled(address contractAddress)
+		external
+		view
+		returns (bool);
+
+	// Deprecated
+	//
+	// Selector: toggleSponsoring(address,bool) fcac6d86
+	function toggleSponsoring(address contractAddress, bool enabled) external;
+
+	// Selector: setSponsoringMode(address,uint8) fde8a560
+	function setSponsoringMode(address contractAddress, uint8 mode) external;
+
+	// Selector: sponsoringMode(address) b70c7267
+	function sponsoringMode(address contractAddress)
+		external
+		view
+		returns (uint8);
+
+	// Selector: setSponsoringRateLimit(address,uint32) 77b6c908
+	function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)
+		external;
+
+	// Selector: getSponsoringRateLimit(address) 610cfabd
+	function getSponsoringRateLimit(address contractAddress)
+		external
+		view
+		returns (uint32);
+
+	// Selector: allowed(address,address) 5c658165
+	function allowed(address contractAddress, address user)
+		external
+		view
+		returns (bool);
+
+	// Selector: allowlistEnabled(address) c772ef6c
+	function allowlistEnabled(address contractAddress)
+		external
+		view
+		returns (bool);
+
+	// Selector: toggleAllowlist(address,bool) 36de20f5
+	function toggleAllowlist(address contractAddress, bool enabled) external;
+
+	// Selector: toggleAllowed(address,address,bool) 4706cc1c
+	function toggleAllowed(
+		address contractAddress,
+		address user,
+		bool allowed
+	) external;
+
+	// Selector: create721Collection(string,string,string) 951c0151
+	function create721Collection(
+		string memory name,
+		string memory description,
+		string memory tokenPrefix
+	) external view returns (address);
+}
modifiedtests/src/eth/api/ContractHelpers.soldiffbeforeafterboth
--- a/tests/src/eth/api/ContractHelpers.sol
+++ b/tests/src/eth/api/ContractHelpers.sol
@@ -12,7 +12,7 @@
 	function supportsInterface(bytes4 interfaceID) external view returns (bool);
 }
 
-// Selector: ee5467a8
+// Selector: 7b4866f9
 interface ContractHelpers is Dummy, ERC165 {
 	// Selector: contractOwner(address) 5152b14c
 	function contractOwner(address contractAddress)
@@ -71,11 +71,4 @@
 		address user,
 		bool allowed
 	) external;
-
-	// Selector: create721Collection(string,string,string) 951c0151
-	function create721Collection(
-		string memory name,
-		string memory description,
-		string memory tokenPrefix
-	) external view returns (address);
 }
addedtests/src/eth/collectionAbi.jsondiffbeforeafterboth
--- /dev/null
+++ b/tests/src/eth/collectionAbi.json
@@ -0,0 +1,172 @@
+[
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "contractAddress",
+        "type": "address"
+      },
+      { "internalType": "address", "name": "user", "type": "address" }
+    ],
+    "name": "allowed",
+    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "contractAddress",
+        "type": "address"
+      }
+    ],
+    "name": "allowlistEnabled",
+    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "contractAddress",
+        "type": "address"
+      }
+    ],
+    "name": "contractOwner",
+    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      { "internalType": "string", "name": "name", "type": "string" },
+      { "internalType": "string", "name": "description", "type": "string" },
+      { "internalType": "string", "name": "tokenPrefix", "type": "string" }
+    ],
+    "name": "create721Collection",
+    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "contractAddress",
+        "type": "address"
+      }
+    ],
+    "name": "getSponsoringRateLimit",
+    "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "contractAddress",
+        "type": "address"
+      },
+      { "internalType": "uint8", "name": "mode", "type": "uint8" }
+    ],
+    "name": "setSponsoringMode",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "contractAddress",
+        "type": "address"
+      },
+      { "internalType": "uint32", "name": "rateLimit", "type": "uint32" }
+    ],
+    "name": "setSponsoringRateLimit",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "contractAddress",
+        "type": "address"
+      }
+    ],
+    "name": "sponsoringEnabled",
+    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "contractAddress",
+        "type": "address"
+      }
+    ],
+    "name": "sponsoringMode",
+    "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
+    ],
+    "name": "supportsInterface",
+    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "contractAddress",
+        "type": "address"
+      },
+      { "internalType": "address", "name": "user", "type": "address" },
+      { "internalType": "bool", "name": "allowed", "type": "bool" }
+    ],
+    "name": "toggleAllowed",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "contractAddress",
+        "type": "address"
+      },
+      { "internalType": "bool", "name": "enabled", "type": "bool" }
+    ],
+    "name": "toggleAllowlist",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "contractAddress",
+        "type": "address"
+      },
+      { "internalType": "bool", "name": "enabled", "type": "bool" }
+    ],
+    "name": "toggleSponsoring",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  }
+]
modifiedtests/src/eth/createCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createCollection.test.ts
+++ b/tests/src/eth/createCollection.test.ts
@@ -16,12 +16,12 @@
 
 import {expect} from 'chai';
 import {getCreatedCollectionCount, getDetailedCollectionInfo} from '../util/helpers';
-import {collectionIdFromAddress, contractHelpers, createEthAccountWithBalance, itWeb3} from './util/helpers';
+import {collectionHelper, collectionIdFromAddress, contractHelpers, createEthAccountWithBalance, itWeb3} from './util/helpers';
 
 describe('Create collection from EVM', () => {
   itWeb3('Create collection', async ({api, web3}) => {
     const owner = await createEthAccountWithBalance(api, web3);
-    const helpers = contractHelpers(web3, owner);
+    const helpers = collectionHelper(web3, owner);
     const collectionName = 'CollectionEVM';
     const description = 'Some description';
     const tokenPrefix = 'token prefix';
modifiedtests/src/eth/util/contractHelpersAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/util/contractHelpersAbi.json
+++ b/tests/src/eth/util/contractHelpersAbi.json
@@ -41,17 +41,6 @@
   },
   {
     "inputs": [
-      { "internalType": "string", "name": "name", "type": "string" },
-      { "internalType": "string", "name": "description", "type": "string" },
-      { "internalType": "string", "name": "tokenPrefix", "type": "string" }
-    ],
-    "name": "create721Collection",
-    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
-    "stateMutability": "view",
-    "type": "function"
-  },
-  {
-    "inputs": [
       {
         "internalType": "address",
         "name": "contractAddress",
modifiedtests/src/eth/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/eth/util/helpers.ts
+++ b/tests/src/eth/util/helpers.ts
@@ -28,6 +28,7 @@
 import config from '../../config';
 import privateKey from '../../substrate/privateKey';
 import contractHelpersAbi from './contractHelpersAbi.json';
+import collectionAbi from '../collectionAbi.json';
 import getBalance from '../../substrate/get-balance';
 import waitNewBlocks from '../../substrate/wait-new-blocks';
 
@@ -273,6 +274,16 @@
   return new web3.eth.Contract(contractHelpersAbi as any, '0x842899ECF380553E8a4de75bF534cdf6fBF64049', {from: caller, ...GAS_ARGS});
 }
 
+/** 
+ * pallet evm_collection
+ * @param web3 
+ * @param caller - eth address
+ * @returns 
+ */
+export function collectionHelper(web3: Web3, caller: string) {
+  return new web3.eth.Contract(collectionAbi as any, '0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f', {from: caller, ...GAS_ARGS});
+}
+
 /**
  * Execute ethereum method call using substrate account
  * @param to target contract