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

difftreelog

CORE-302 Fix compile after rebase

Trubnikov Sergey2022-05-20parent: #34309ac.patch.diff
in: master

6 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6818,11 +6818,15 @@
 name = "pallet-unique"
 version = "0.1.0"
 dependencies = [
+ "ethereum",
+ "evm-coder",
  "frame-benchmarking",
  "frame-support",
  "frame-system",
  "pallet-common",
  "pallet-evm",
+ "pallet-evm-coder-substrate",
+ "pallet-nonfungible",
  "parity-scale-codec 3.1.2",
  "scale-info",
  "serde",
modifiedpallets/unique/Cargo.tomldiffbeforeafterboth
--- a/pallets/unique/Cargo.toml
+++ b/pallets/unique/Cargo.toml
@@ -33,6 +33,22 @@
 limit-testing = ["up-data-structs/limit-testing"]
 
 ################################################################################
+# Standart Dependencies
+
+[dependencies.serde]
+default-features = false
+features = ['derive']
+version = '1.0.130'
+
+[dependencies.serde-json-core]
+default-features = false
+version = "0.4"
+
+[dependencies.ethereum]
+version = "0.12.0"
+default-features = false
+
+################################################################################
 # Substrate Dependencies
 
 [dependencies.codec]
@@ -66,15 +82,6 @@
 # default-features = false
 # git = "https://github.com/paritytech/substrate"
 # branch = "polkadot-v0.9.21"
-
-[dependencies.serde]
-default-features = false
-features = ['derive']
-version = '1.0.130'
-
-[dependencies.serde-json-core]
-default-features = false
-version = "0.4"
 
 [dependencies.sp-runtime]
 default-features = false
@@ -90,7 +97,6 @@
 default-features = false
 git = "https://github.com/paritytech/substrate"
 branch = "polkadot-v0.9.21"
-
 
 ################################################################################
 # Local Dependencies
@@ -101,3 +107,6 @@
 ] }
 pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
 pallet-common = { default-features = false, path = "../common" }
+evm-coder = { default-features = false, path = '../../crates/evm-coder' }
+pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }
+pallet-nonfungible = { default-features = false, path = '../../pallets/nonfungible' }
modifiedpallets/unique/src/eth/mod.rsdiffbeforeafterboth
before · pallets/unique/src/eth/mod.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/>.1617pub mod sponsoring;1819use fp_evm::PrecompileResult;20use pallet_common::{21	CollectionById,22	erc::CommonEvmHandler,23	eth::{map_eth_to_id, map_eth_to_token_id},24};25use pallet_fungible::FungibleHandle;26use pallet_nonfungible::NonfungibleHandle;27use pallet_refungible::{RefungibleHandle, erc::RefungibleTokenHandle};28use sp_std::borrow::ToOwned;29use sp_std::vec::Vec;30use sp_core::{H160, U256};31use crate::{CollectionMode, Config, dispatch::Dispatched};32use pallet_common::CollectionHandle;3334pub struct UniqueErcSupport<T: Config>(core::marker::PhantomData<T>);3536impl<T: Config> pallet_evm::OnMethodCall<T> for UniqueErcSupport<T> {37	fn is_reserved(target: &H160) -> bool {38		map_eth_to_id(target).is_some()39	}40	fn is_used(target: &H160) -> bool {41		map_eth_to_id(target)42			.map(<CollectionById<T>>::contains_key)43			.unwrap_or(false)44	}45	fn get_code(target: &H160) -> Option<Vec<u8>> {46		if let Some(collection_id) = map_eth_to_id(target) {47			let collection = <CollectionById<T>>::get(collection_id)?;48			Some(49				match collection.mode {50					CollectionMode::NFT => <NonfungibleHandle<T>>::CODE,51					CollectionMode::Fungible(_) => <FungibleHandle<T>>::CODE,52					CollectionMode::ReFungible => <RefungibleHandle<T>>::CODE,53				}54				.to_owned(),55			)56		} else if let Some((collection_id, _token_id)) = map_eth_to_token_id(target) {57			let collection = <CollectionById<T>>::get(collection_id)?;58			if collection.mode != CollectionMode::ReFungible {59				return None;60			}61			// TODO: check token existence62			Some(<RefungibleTokenHandle<T>>::CODE.to_owned())63		} else {64			None65		}66	}67	fn call(68		source: &H160,69		target: &H160,70		gas_limit: u64,71		input: &[u8],72		value: U256,73	) -> Option<PrecompileResult> {74		if let Some(collection_id) = map_eth_to_id(target) {75			let collection = <CollectionHandle<T>>::new_with_gas_limit(collection_id, gas_limit)?;76			let dispatched = Dispatched::dispatch(collection);7778			match dispatched {79				Dispatched::Fungible(h) => h.call(source, input, value),80				Dispatched::Nonfungible(h) => h.call(source, input, value),81				Dispatched::Refungible(h) => h.call(source, input, value),82			}83		} else if let Some((collection_id, token_id)) = map_eth_to_token_id(target) {84			let collection = <CollectionHandle<T>>::new_with_gas_limit(collection_id, gas_limit)?;85			if collection.mode != CollectionMode::ReFungible {86				return None;87			}8889			let handle = RefungibleHandle::cast(collection);90			// TODO: check token existence91			RefungibleTokenHandle(handle, token_id).call(source, input, value)92		} else {93			None94		}95	}96}9798pub mod evm_collection {99	use core::marker::PhantomData;100	use evm_coder::{execution::*, generate_stubgen, solidity_interface, types::*, ToLog};101	use ethereum as _;102	use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};103	use pallet_evm::{OnMethodCall, PrecompileResult, account::CrossAccountId};104	use up_data_structs::{105		CreateCollectionData, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,106		MAX_COLLECTION_NAME_LENGTH,107	};108	use frame_support::traits::Get;109	use sp_core::H160;110	use pallet_common::{CollectionHandle, save_eth, pallet::CollectionById};111	112	use sp_std::{vec::Vec, rc::Rc};113	use alloc::format;114	115	pub trait Config:116		frame_system::Config117		+ pallet_evm_coder_substrate::Config118		+ pallet_evm::account::Config119		+ pallet_nonfungible::Config120	{121		type ContractAddress: Get<H160>;122	}123124	struct EvmCollectionHelper<T: Config>(Rc<SubstrateRecorder<T>>);125	impl<T: Config> WithRecorder<T> for EvmCollectionHelper<T> {126		fn recorder(&self) -> &SubstrateRecorder<T> {127			&self.0128		}129	130		fn into_recorder(self) -> Rc<SubstrateRecorder<T>> {131			self.0132		}133	}134135	#[solidity_interface(name = "CollectionHelper")]136	impl<T: Config> EvmCollectionHelper<T> {137		fn create_721_collection(138			&self,139			caller: caller,140			name: string,141			description: string,142			token_prefix: string,143		) -> Result<address> {144			let caller = T::CrossAccountId::from_eth(caller);145			let name = name146				.encode_utf16()147				.collect::<Vec<u16>>()148				.try_into()149				.map_err(|_| error_feild_too_long(stringify!(name), MAX_COLLECTION_NAME_LENGTH))?;150			let description = description151				.encode_utf16()152				.collect::<Vec<u16>>()153				.try_into()154				.map_err(|_| {155					error_feild_too_long(stringify!(description), MAX_COLLECTION_DESCRIPTION_LENGTH)156				})?;157			let token_prefix = token_prefix158				.into_bytes()159				.try_into()160				.map_err(|_| error_feild_too_long(stringify!(token_prefix), MAX_TOKEN_PREFIX_LENGTH))?;161	162			let data = CreateCollectionData {163				name,164				description,165				token_prefix,166				..Default::default()167			};168	169			let collection_id =170				<pallet_nonfungible::Pallet<T>>::init_collection(caller.as_sub().clone(), data)171					.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;172	173			let address = pallet_common::eth::collection_id_to_address(collection_id);174			self.0.log_mirrored(EthCollectionEvent::CollectionCreated {175				owner: *caller.as_eth(),176				collection_id: address,177			});178			Ok(address)179		}180181		fn is_collection_exist(&self, _caller: caller, collection_address: address) -> Result<bool> {182			if let Some(id) = pallet_common::eth::map_eth_to_id(&collection_address) {183				let collection_id = id;184				return Ok(<CollectionById<T>>::contains_key(collection_id));185			}186187			Ok(false)188		}189	}190	191	struct EvmCollection<T: Config>(Rc<SubstrateRecorder<T>>);192	impl<T: Config> WithRecorder<T> for EvmCollection<T> {193		fn recorder(&self) -> &SubstrateRecorder<T> {194			&self.0195		}196	197		fn into_recorder(self) -> Rc<SubstrateRecorder<T>> {198			self.0199		}200	}201	202	#[derive(ToLog)]203	pub enum EthCollectionEvent {204		CollectionCreated {205			#[indexed]206			owner: address,207			#[indexed]208			collection_id: address,209		},210	}211	212	#[solidity_interface(name = "Collection")]213	impl<T: Config> EvmCollection<T> {214		fn set_sponsor(215			&self,216			caller: caller,217			sponsor: address,218		) -> Result<void> {219			let mut collection = collection_from_address(self.contract_address(caller).unwrap(), &self.0)?;220			check_is_owner(caller, &collection)?;221	222			let sponsor = T::CrossAccountId::from_eth(sponsor);223			collection.set_sponsor(sponsor.as_sub().clone());224			save_eth(collection)225		}226	227		fn confirm_sponsorship(&self, caller: caller) -> Result<void> {228			let mut collection = collection_from_address(self.contract_address(caller).unwrap(), &self.0)?;229			let caller = T::CrossAccountId::from_eth(caller);230			if !collection.confirm_sponsorship(caller.as_sub()) {231				return Err(Error::Revert("Caller is not set as sponsor".into()));232			}233			save_eth(collection)234		}235	236		fn set_limits(237			&self,238			caller: caller,239			limits_json: string,240		) -> Result<void> {241			let mut collection = collection_from_address(self.contract_address(caller).unwrap(), &self.0)?;242			check_is_owner(caller, &collection)?;243	244			let limits = serde_json_core::from_str(limits_json.as_ref())245				.map_err(|e| Error::Revert(format!("Parse JSON error: {}", e)))?;246			collection.limits = limits.0;247			save_eth(collection)248		}249250		fn contract_address(&self, _caller: caller) -> Result<address> {251			Ok(self.0.contract())252		}253	}254	255	fn error_feild_too_long(feild: &str, bound: u32) -> Error {256		Error::Revert(format!("{} is too long. Max length is {}.", feild, bound))257	}258	259	fn collection_from_address<T: Config>(260		collection_address: address,261		recorder: &Rc<SubstrateRecorder<T>>,262	) -> Result<CollectionHandle<T>> {263		let collection_id = pallet_common::eth::map_eth_to_id(&collection_address)264			.ok_or(Error::Revert("Contract is not an unique collection".into()))?;265		let collection =266			pallet_common::CollectionHandle::new_with_recorder(collection_id, recorder.clone())267				.ok_or(Error::Revert("Create collection handle error".into()))?;268		Ok(collection)269	}270	271	fn check_is_owner<T: Config>(caller: caller, collection: &CollectionHandle<T>) -> Result<()> {272		let caller = T::CrossAccountId::from_eth(caller);273		collection274			.check_is_owner(&caller)275			.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;276		Ok(())277	}278279	pub struct CollectionHelperOnMethodCall<T: Config>(PhantomData<*const T>);280	impl<T: Config> OnMethodCall<T> for CollectionHelperOnMethodCall<T> {281		fn is_reserved(contract: &sp_core::H160) -> bool {282			contract == &T::ContractAddress::get()283		}284	285		fn is_used(contract: &sp_core::H160) -> bool {286			contract == &T::ContractAddress::get()287		}288	289		fn call(290			source: &sp_core::H160,291			target: &sp_core::H160,292			gas_left: u64,293			input: &[u8],294			value: sp_core::U256,295		) -> Option<PrecompileResult> {296			if target != &T::ContractAddress::get() {297				return None;298			}299	300			let helpers = EvmCollectionHelper::<T>(Rc::new(SubstrateRecorder::<T>::new(*target, gas_left)));301			pallet_evm_coder_substrate::call(*source, helpers, value, input)302		}303	304		fn get_code(contract: &sp_core::H160) -> Option<Vec<u8>> {305			(contract == &T::ContractAddress::get())306				.then(|| include_bytes!("./stubs/CollectionHelper.raw").to_vec())307		}308	}309	310	generate_stubgen!(collection_helper_impl, CollectionHelperCall<()>, true);311	generate_stubgen!(collection_helper_iface, CollectionHelperCall<()>, false);312	313	pub struct CollectionOnMethodCall<T: Config>(PhantomData<*const T>);314	impl<T: Config> OnMethodCall<T> for CollectionOnMethodCall<T> {315		fn is_reserved(contract: &sp_core::H160) -> bool {316			contract == &T::ContractAddress::get()317		}318	319		fn is_used(contract: &sp_core::H160) -> bool {320			contract == &T::ContractAddress::get()321		}322	323		fn call(324			source: &sp_core::H160,325			target: &sp_core::H160,326			gas_left: u64,327			input: &[u8],328			value: sp_core::U256,329		) -> Option<PrecompileResult> {330			if !pallet_common::eth::is_collection(target) {331				return None;332			}333334			let helpers = EvmCollection::<T>(Rc::new(SubstrateRecorder::<T>::new(*target, gas_left)));335			pallet_evm_coder_substrate::call(*source, helpers, value, input)336		}337	338		fn get_code(contract: &sp_core::H160) -> Option<Vec<u8>> {339			(contract == &T::ContractAddress::get())340				.then(|| include_bytes!("./stubs/Collection.raw").to_vec())341		}342	}343	344	generate_stubgen!(collection_impl, CollectionCall<()>, true);345	generate_stubgen!(collection_iface, CollectionCall<()>, false);346}
after · pallets/unique/src/eth/mod.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/>.1617pub mod evm_collection {18	use core::marker::PhantomData;19	use evm_coder::{execution::*, generate_stubgen, solidity_interface, types::*, ToLog};20	use ethereum as _;21	use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};22	use pallet_evm::{OnMethodCall, PrecompileResult, account::CrossAccountId, Pallet as PalletEvm};23	use up_data_structs::{24		CreateCollectionData, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,25		MAX_COLLECTION_NAME_LENGTH,26	};27	use frame_support::traits::Get;28	use sp_core::H160;29	use pallet_common::{CollectionHandle, CollectionById};30	31	use sp_std::{vec::Vec, rc::Rc};32	use alloc::format;33	34	pub trait Config:35		frame_system::Config36		+ pallet_evm_coder_substrate::Config37		+ pallet_evm::account::Config38		+ pallet_nonfungible::Config39	{40		type ContractAddress: Get<H160>;41	}4243	struct EvmCollectionHelper<T: Config>(SubstrateRecorder<T>);44	impl<T: Config> WithRecorder<T> for EvmCollectionHelper<T> {45		fn recorder(&self) -> &SubstrateRecorder<T> {46			&self.047		}48	49		fn into_recorder(self) -> SubstrateRecorder<T> {50			self.051		}52	}5354	#[solidity_interface(name = "CollectionHelper")]55	impl<T: Config> EvmCollectionHelper<T> {56		fn create_721_collection(57			&self,58			caller: caller,59			name: string,60			description: string,61			token_prefix: string,62		) -> Result<address> {63			let caller = T::CrossAccountId::from_eth(caller);64			let name = name65				.encode_utf16()66				.collect::<Vec<u16>>()67				.try_into()68				.map_err(|_| error_feild_too_long(stringify!(name), MAX_COLLECTION_NAME_LENGTH))?;69			let description = description70				.encode_utf16()71				.collect::<Vec<u16>>()72				.try_into()73				.map_err(|_| {74					error_feild_too_long(stringify!(description), MAX_COLLECTION_DESCRIPTION_LENGTH)75				})?;76			let token_prefix = token_prefix77				.into_bytes()78				.try_into()79				.map_err(|_| error_feild_too_long(stringify!(token_prefix), MAX_TOKEN_PREFIX_LENGTH))?;80	81			let data = CreateCollectionData {82				name,83				description,84				token_prefix,85				..Default::default()86			};87	88			let collection_id =89				<pallet_nonfungible::Pallet<T>>::init_collection(caller.as_sub().clone(), data)90					.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;91	92			let address = pallet_common::eth::collection_id_to_address(collection_id);93			<PalletEvm<T>>::deposit_log(94				EthCollectionEvent::CollectionCreated {95					owner: *caller.as_eth(),96					collection_id: address,97				}98				.to_log(address),99			);100			Ok(address)101		}102103		fn is_collection_exist(&self, _caller: caller, collection_address: address) -> Result<bool> {104			if let Some(id) = pallet_common::eth::map_eth_to_id(&collection_address) {105				let collection_id = id;106				return Ok(<CollectionById<T>>::contains_key(collection_id));107			}108109			Ok(false)110		}111	}112	113	struct EvmCollection<T: Config>(H160, SubstrateRecorder<T>);114	impl<T: Config> WithRecorder<T> for EvmCollection<T> {115		fn recorder(&self) -> &SubstrateRecorder<T> {116			&self.1117		}118	119		fn into_recorder(self) -> SubstrateRecorder<T> {120			self.1121		}122	}123	124	#[derive(ToLog)]125	pub enum EthCollectionEvent {126		CollectionCreated {127			#[indexed]128			owner: address,129			#[indexed]130			collection_id: address,131		},132	}133	134	#[solidity_interface(name = "Collection")]135	impl<T: Config> EvmCollection<T> {136		fn set_sponsor(137			&self,138			caller: caller,139			sponsor: address,140		) -> Result<void> {141			let mut collection = collection_from_address::<T>(self.contract_address(caller).unwrap(), self.1.gas_left())?;142			check_is_owner(caller, &collection)?;143	144			let sponsor = T::CrossAccountId::from_eth(sponsor);145			collection.set_sponsor(sponsor.as_sub().clone());146			collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;147		Ok(())148		}149	150		fn confirm_sponsorship(&self, caller: caller) -> Result<void> {151			let mut collection = collection_from_address::<T>(self.contract_address(caller).unwrap(), self.1.gas_left())?;152			let caller = T::CrossAccountId::from_eth(caller);153			if !collection.confirm_sponsorship(caller.as_sub()) {154				return Err(Error::Revert("Caller is not set as sponsor".into()));155			}156			collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;157		Ok(())158		}159	160		fn set_limits(161			&self,162			caller: caller,163			limits_json: string,164		) -> Result<void> {165			let mut collection = collection_from_address::<T>(self.contract_address(caller).unwrap(), self.1.gas_left())?;166			check_is_owner(caller, &collection)?;167	168			let limits = serde_json_core::from_str(limits_json.as_ref())169				.map_err(|e| Error::Revert(format!("Parse JSON error: {}", e)))?;170			collection.limits = limits.0;171			collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;172		Ok(())173		}174175		fn contract_address(&self, _caller: caller) -> Result<address> {176			Ok(self.0)177		}178	}179	180	fn error_feild_too_long(feild: &str, bound: u32) -> Error {181		Error::Revert(format!("{} is too long. Max length is {}.", feild, bound))182	}183	184	fn collection_from_address<T: Config>(185		collection_address: address,186		gas_limit: u64187	) -> Result<CollectionHandle<T>> {188		let collection_id = pallet_common::eth::map_eth_to_id(&collection_address)189		.ok_or(Error::Revert("Contract is not an unique collection".into()))?;190		let recorder = <SubstrateRecorder<T>>::new(gas_limit);191		let collection =192			pallet_common::CollectionHandle::new_with_recorder(collection_id, recorder)193				.ok_or(Error::Revert("Create collection handle error".into()))?;194		Ok(collection)195	}196	197	fn check_is_owner<T: Config>(caller: caller, collection: &CollectionHandle<T>) -> Result<()> {198		let caller = T::CrossAccountId::from_eth(caller);199		collection200			.check_is_owner(&caller)201			.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;202		Ok(())203	}204205	pub struct CollectionHelperOnMethodCall<T: Config>(PhantomData<*const T>);206	impl<T: Config> OnMethodCall<T> for CollectionHelperOnMethodCall<T> {207		fn is_reserved(contract: &sp_core::H160) -> bool {208			contract == &T::ContractAddress::get()209		}210	211		fn is_used(contract: &sp_core::H160) -> bool {212			contract == &T::ContractAddress::get()213		}214	215		fn call(216			source: &sp_core::H160,217			target: &sp_core::H160,218			gas_left: u64,219			input: &[u8],220			value: sp_core::U256,221		) -> Option<PrecompileResult> {222			if target != &T::ContractAddress::get() {223				return None;224			}225	226			let helpers = EvmCollectionHelper::<T>(SubstrateRecorder::<T>::new(gas_left));227			pallet_evm_coder_substrate::call(*source, helpers, value, input)228		}229	230		fn get_code(contract: &sp_core::H160) -> Option<Vec<u8>> {231			(contract == &T::ContractAddress::get())232				.then(|| include_bytes!("./stubs/CollectionHelper.raw").to_vec())233		}234	}235	236	generate_stubgen!(collection_helper_impl, CollectionHelperCall<()>, true);237	generate_stubgen!(collection_helper_iface, CollectionHelperCall<()>, false);238	239	pub struct CollectionOnMethodCall<T: Config>(PhantomData<*const T>);240	impl<T: Config> OnMethodCall<T> for CollectionOnMethodCall<T> {241		fn is_reserved(contract: &sp_core::H160) -> bool {242			contract == &T::ContractAddress::get()243		}244	245		fn is_used(contract: &sp_core::H160) -> bool {246			contract == &T::ContractAddress::get()247		}248	249		fn call(250			source: &sp_core::H160,251			target: &sp_core::H160,252			gas_left: u64,253			input: &[u8],254			value: sp_core::U256,255		) -> Option<PrecompileResult> {256			if !pallet_common::eth::is_collection(target) {257				return None;258			}259260			let helpers = EvmCollection::<T>(*target, SubstrateRecorder::<T>::new(gas_left));261			pallet_evm_coder_substrate::call(*source, helpers, value, input)262		}263	264		fn get_code(contract: &sp_core::H160) -> Option<Vec<u8>> {265			(contract == &T::ContractAddress::get())266				.then(|| include_bytes!("./stubs/Collection.raw").to_vec())267		}268	}269	270	generate_stubgen!(collection_impl, CollectionCall<()>, true);271	generate_stubgen!(collection_iface, CollectionCall<()>, false);272}
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -22,6 +22,8 @@
 	clippy::unused_unit
 )]
 
+extern crate alloc;
+
 use frame_support::{
 	decl_module, decl_storage, decl_error, decl_event,
 	dispatch::DispatchResult,
@@ -46,7 +48,7 @@
 	CollectionHandle, Pallet as PalletCommon, CommonWeightInfo, dispatch::dispatch_call,
 	dispatch::CollectionDispatch,
 };
-pub use eth::evm_collection;
+pub mod eth;
 
 #[cfg(feature = "runtime-benchmarks")]
 mod benchmarking;
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -66,7 +66,6 @@
 		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,
 	},
 };
-use unique_runtime_common::dispatch::{CollectionDispatchT, CollectionDispatch};
 use up_data_structs::*;
 // use pallet_contracts::weights::WeightInfo;
 // #[cfg(any(feature = "std", test))]
@@ -79,8 +78,8 @@
 };
 use smallvec::smallvec;
 use codec::{Encode, Decode};
-use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};
-use pallet_unique::evm_collection;
+use pallet_unique::eth::evm_collection;
+use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping};
 use fp_rpc::TransactionStatus;
 use sp_runtime::{
 	traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},
@@ -117,7 +116,15 @@
 //use xcm_executor::traits::MatchesFungible;
 use sp_runtime::traits::CheckedConversion;
 
-use unique_runtime_common::{impl_common_runtime_apis, types::*, constants::*};
+use unique_runtime_common::{
+	impl_common_runtime_apis,
+	types::*,
+	constants::*,
+	dispatch::{CollectionDispatchT, CollectionDispatch},
+	sponsoring::UniqueSponsorshipHandler,
+	eth_sponsoring::UniqueEthSponsorshipHandler,
+	weights::CommonWeights,
+};
 
 pub const RUNTIME_NAME: &str = "quartz";
 pub const TOKEN_SYMBOL: &str = "QTZ";
@@ -894,6 +901,7 @@
 impl pallet_unique::Config for Runtime {
 	type Event = Event;
 	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
+	type CommonWeightInfo = CommonWeights<Self>;
 }
 
 parameter_types! {
@@ -915,11 +923,11 @@
 // }
 
 type EvmSponsorshipHandler = (
-	pallet_unique::UniqueEthSponsorshipHandler<Runtime>,
+	UniqueEthSponsorshipHandler<Runtime>,
 	pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,
 );
 type SponsorshipHandler = (
-	pallet_unique::UniqueSponsorshipHandler<Runtime>,
+	UniqueSponsorshipHandler<Runtime>,
 	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,
 	pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,
 );
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -50,6 +50,7 @@
 pub use pallet_balances::Call as BalancesCall;
 pub use pallet_evm::{
 	EnsureAddressTruncated, HashedAddressMapping, Runner, account::CrossAccountId as _, OnMethodCall,
+	Account as EVMAccount, FeeCalculator, GasWeightMapping,
 };
 pub use frame_support::{
 	construct_runtime, match_types,
@@ -84,8 +85,7 @@
 };
 use smallvec::smallvec;
 use codec::{Encode, Decode};
-use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};
-use pallet_unique::evm_collection;
+use pallet_unique::eth::evm_collection;
 use fp_rpc::TransactionStatus;
 use sp_runtime::{
 	traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},
@@ -121,7 +121,15 @@
 //use xcm_executor::traits::MatchesFungible;
 use sp_runtime::traits::CheckedConversion;
 
-use unique_runtime_common::{impl_common_runtime_apis, types::*, constants::*};
+use unique_runtime_common::{
+	impl_common_runtime_apis,
+	types::*,
+	constants::*,
+	dispatch::{CollectionDispatchT, CollectionDispatch},
+	sponsoring::UniqueSponsorshipHandler,
+	eth_sponsoring::UniqueEthSponsorshipHandler,
+	weights::CommonWeights,
+};
 
 pub const RUNTIME_NAME: &str = "unique";
 pub const TOKEN_SYMBOL: &str = "UNQ";