git.delta.rocks / unique-network / refs/commits / 0707cc7cb0a8

difftreelog

chore move contract address and transaction data to call context

Grigoriy Simonov2022-09-13parent: #f5580aa.patch.diff
in: master

13 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6360,7 +6360,7 @@
 [[package]]
 name = "pallet-template-transaction-payment"
 version = "3.0.0"
-source = "git+https://github.com/uniquenetwork/pallet-sponsoring?rev=9ee7d6e57e03a2575cbab79431774b56f170018e#9ee7d6e57e03a2575cbab79431774b56f170018e"
+source = "git+https://github.com/uniquenetwork/pallet-sponsoring?branch=polkadot-v0.9.27#853766d6033ceb68a2bef196790b962dd0663a04"
 dependencies = [
  "frame-benchmarking",
  "frame-support",
@@ -12528,7 +12528,7 @@
 [[package]]
 name = "up-sponsorship"
 version = "0.1.0"
-source = "git+https://github.com/uniquenetwork/pallet-sponsoring?rev=9ee7d6e57e03a2575cbab79431774b56f170018e#9ee7d6e57e03a2575cbab79431774b56f170018e"
+source = "git+https://github.com/uniquenetwork/pallet-sponsoring?branch=polkadot-v0.9.27#853766d6033ceb68a2bef196790b962dd0663a04"
 dependencies = [
  "impl-trait-for-tuples",
 ]
modifiedpallets/evm-contract-helpers/Cargo.tomldiffbeforeafterboth
--- a/pallets/evm-contract-helpers/Cargo.toml
+++ b/pallets/evm-contract-helpers/Cargo.toml
@@ -21,7 +21,7 @@
 # Unique
 pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
-up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="9ee7d6e57e03a2575cbab79431774b56f170018e" }
+up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27" }
 
 # Locals
 evm-coder = { default-features = false, path = '../../crates/evm-coder' }
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -379,27 +379,26 @@
 
 /// Bridge to pallet-sponsoring
 pub struct HelpersContractSponsoring<T: Config>(PhantomData<*const T>);
-impl<T: Config> SponsorshipHandler<T::CrossAccountId, (H160, Vec<u8>), CallContext>
+impl<T: Config> SponsorshipHandler<T::CrossAccountId, CallContext>
 	for HelpersContractSponsoring<T>
 {
 	fn get_sponsor(
 		who: &T::CrossAccountId,
-		call: &(H160, Vec<u8>),
 		call_context: &CallContext,
 	) -> Option<T::CrossAccountId> {
-		let (contract_address, _) = call;
-		let mode = <Pallet<T>>::sponsoring_mode(*contract_address);
+		let contract_address = call_context.contract_address;
+		let mode = <Pallet<T>>::sponsoring_mode(contract_address);
 		if mode == SponsoringModeT::Disabled {
 			return None;
 		}
 
-		let sponsor = match <Pallet<T>>::get_sponsor(*contract_address) {
+		let sponsor = match <Pallet<T>>::get_sponsor(contract_address) {
 			Some(sponsor) => sponsor,
 			None => return None,
 		};
 
 		if mode == SponsoringModeT::Allowlisted
-			&& !<Pallet<T>>::allowed(*contract_address, *who.as_eth())
+			&& !<Pallet<T>>::allowed(contract_address, *who.as_eth())
 		{
 			return None;
 		}
modifiedpallets/evm-transaction-payment/Cargo.tomldiffbeforeafterboth
--- a/pallets/evm-transaction-payment/Cargo.toml
+++ b/pallets/evm-transaction-payment/Cargo.toml
@@ -17,7 +17,7 @@
 pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
-up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev = "9ee7d6e57e03a2575cbab79431774b56f170018e" }
+up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27" }
 fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 
 [dependencies.codec]
modifiedpallets/evm-transaction-payment/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-transaction-payment/src/lib.rs
+++ b/pallets/evm-transaction-payment/src/lib.rs
@@ -35,6 +35,10 @@
 
 	/// Contains call data
 	pub struct CallContext {
+		/// Contract address
+		pub contract_address: H160,
+		/// Transaction data
+		pub input: Vec<u8>,
 		/// Max fee for transaction - gasLimit * gasPrice
 		pub max_fee: U256,
 	}
@@ -42,11 +46,7 @@
 	#[pallet::config]
 	pub trait Config: frame_system::Config + pallet_evm::account::Config {
 		/// Loosly-coupled handlers for evm call sponsoring
-		type EvmSponsorshipHandler: SponsorshipHandler<
-			Self::CrossAccountId,
-			(H160, Vec<u8>),
-			CallContext,
-		>;
+		type EvmSponsorshipHandler: SponsorshipHandler<Self::CrossAccountId, CallContext>;
 	}
 
 	#[pallet::pallet]
@@ -65,12 +65,12 @@
 		match reason {
 			WithdrawReason::Call { target, input } => {
 				let origin_sub = T::CrossAccountId::from_eth(origin);
-				let call_context = CallContext { max_fee };
-				T::EvmSponsorshipHandler::get_sponsor(
-					&origin_sub,
-					&(*target, input.clone()),
-					&call_context,
-				)
+				let call_context = CallContext {
+					contract_address: *target,
+					input: input.clone(),
+					max_fee,
+				};
+				T::EvmSponsorshipHandler::get_sponsor(&origin_sub, &call_context)
 			}
 			_ => None,
 		}
@@ -79,12 +79,12 @@
 
 /// Implements sponsoring for evm calls performed from pallet-evm (via api.tx.ethereum.transact/api.tx.evm.call)
 pub struct BridgeSponsorshipHandler<T>(PhantomData<T>);
-impl<T, C> SponsorshipHandler<T::AccountId, C, ()> for BridgeSponsorshipHandler<T>
+impl<T, C> SponsorshipHandler<T::AccountId, C> for BridgeSponsorshipHandler<T>
 where
 	T: Config + pallet_evm::Config,
 	C: IsSubType<pallet_evm::Call<T>>,
 {
-	fn get_sponsor(who: &T::AccountId, call: &C, _call_context: &()) -> Option<T::AccountId> {
+	fn get_sponsor(who: &T::AccountId, call: &C) -> Option<T::AccountId> {
 		match call.is_sub_type()? {
 			pallet_evm::Call::call {
 				source,
@@ -101,16 +101,16 @@
 				.ok()?;
 				let who = T::CrossAccountId::from_sub(who.clone());
 				let max_fee = max_fee_per_gas.saturating_mul((*gas_limit).into());
-				let call_context = CallContext { max_fee };
+				let call_context = CallContext {
+					contract_address: *target,
+					input: input.clone(),
+					max_fee,
+				};
 				// Effects from EvmSponsorshipHandler are applied by pallet_evm::runner
 				// TODO: Should we implement simulation mode (test, but do not apply effects) in `up-sponsorship`?
 				let sponsor = frame_support::storage::with_transaction(|| {
 					TransactionOutcome::Rollback(Ok::<_, DispatchError>(
-						T::EvmSponsorshipHandler::get_sponsor(
-							&who,
-							&(*target, input.clone()),
-							&call_context,
-						),
+						T::EvmSponsorshipHandler::get_sponsor(&who, &call_context),
 					))
 				})
 				// FIXME: it may fail with DispatchError in case of depth limit
modifiedpallets/scheduler/Cargo.tomldiffbeforeafterboth
--- a/pallets/scheduler/Cargo.toml
+++ b/pallets/scheduler/Cargo.toml
@@ -24,7 +24,7 @@
 sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.27' }
 frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 
-up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="9ee7d6e57e03a2575cbab79431774b56f170018e" }
+up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27" }
 log = { version = "0.4.14", default-features = false }
 
 [dev-dependencies]
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/>.1617//! Implementation of CollectionHelpers contract.1819use core::marker::PhantomData;20use ethereum as _;21use evm_coder::{execution::*, generate_stubgen, solidity_interface, solidity, weight, types::*};22use frame_support::traits::Get;23use pallet_common::{24	CollectionById, CollectionHandle,25	dispatch::CollectionDispatch,26	erc::{27		CollectionHelpersEvents,28		static_property::{key, value as property_value},29	},30	Pallet as PalletCommon,31};32use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};33use pallet_evm::{account::CrossAccountId, OnMethodCall, PrecompileHandle, PrecompileResult};34use pallet_evm_coder_substrate::dispatch_to_evm;35use up_data_structs::{36	CollectionName, CollectionDescription, CollectionTokenPrefix, CreateCollectionData,37	CollectionMode, PropertyKeyPermission, PropertyPermission, PropertyScope, PropertyValue,38};3940use crate::{Config, SelfWeightOf, weights::WeightInfo};4142use sp_std::{vec, vec::Vec};43use alloc::format;4445/// See [`CollectionHelpersCall`]46pub struct EvmCollectionHelpers<T: Config>(SubstrateRecorder<T>);47impl<T: Config> WithRecorder<T> for EvmCollectionHelpers<T> {48	fn recorder(&self) -> &SubstrateRecorder<T> {49		&self.050	}5152	fn into_recorder(self) -> SubstrateRecorder<T> {53		self.054	}55}5657fn convert_data<T: Config>(58	caller: caller,59	name: string,60	description: string,61	token_prefix: string,62	base_uri: string,63) -> Result<(64	T::CrossAccountId,65	CollectionName,66	CollectionDescription,67	CollectionTokenPrefix,68	PropertyValue,69)> {70	let caller = T::CrossAccountId::from_eth(caller);71	let name = name72		.encode_utf16()73		.collect::<Vec<u16>>()74		.try_into()75		.map_err(|_| error_field_too_long(stringify!(name), CollectionName::bound()))?;76	let description = description77		.encode_utf16()78		.collect::<Vec<u16>>()79		.try_into()80		.map_err(|_| {81			error_field_too_long(stringify!(description), CollectionDescription::bound())82		})?;83	let token_prefix = token_prefix.into_bytes().try_into().map_err(|_| {84		error_field_too_long(stringify!(token_prefix), CollectionTokenPrefix::bound())85	})?;86	let base_uri_value = base_uri87		.into_bytes()88		.try_into()89		.map_err(|_| error_field_too_long(stringify!(token_prefix), PropertyValue::bound()))?;90	Ok((caller, name, description, token_prefix, base_uri_value))91}9293fn make_data<T: Config>(94	name: CollectionName,95	mode: CollectionMode,96	description: CollectionDescription,97	token_prefix: CollectionTokenPrefix,98	base_uri_value: PropertyValue,99	add_properties: bool,100) -> Result<CreateCollectionData<T::AccountId>> {101	let mut properties = up_data_structs::CollectionPropertiesVec::default();102	let mut token_property_permissions =103		up_data_structs::CollectionPropertiesPermissionsVec::default();104105	token_property_permissions106		.try_push(up_data_structs::PropertyKeyPermission {107			key: key::url(),108			permission: up_data_structs::PropertyPermission {109				mutable: false,110				collection_admin: true,111				token_owner: false,112			},113		})114		.map_err(|e| Error::Revert(format!("{:?}", e)))?;115116	if add_properties {117		token_property_permissions118			.try_push(up_data_structs::PropertyKeyPermission {119				key: key::suffix(),120				permission: up_data_structs::PropertyPermission {121					mutable: false,122					collection_admin: true,123					token_owner: false,124				},125			})126			.map_err(|e| Error::Revert(format!("{:?}", e)))?;127128		properties129			.try_push(up_data_structs::Property {130				key: key::schema_name(),131				value: property_value::erc721(),132			})133			.map_err(|e| Error::Revert(format!("{:?}", e)))?;134135		if !base_uri_value.is_empty() {136			properties137				.try_push(up_data_structs::Property {138					key: key::base_uri(),139					value: base_uri_value,140				})141				.map_err(|e| Error::Revert(format!("{:?}", e)))?;142		}143	}144145	let data = CreateCollectionData {146		name,147		mode,148		description,149		token_prefix,150		token_property_permissions,151		properties,152		..Default::default()153	};154	Ok(data)155}156157fn create_refungible_collection_internal<158	T: Config + pallet_nonfungible::Config + pallet_refungible::Config,159>(160	caller: caller,161	name: string,162	description: string,163	token_prefix: string,164	base_uri: string,165	add_properties: bool,166) -> Result<address> {167	let (caller, name, description, token_prefix, base_uri_value) =168		convert_data::<T>(caller, name, description, token_prefix, base_uri)?;169	let data = make_data::<T>(170		name,171		CollectionMode::ReFungible,172		description,173		token_prefix,174		base_uri_value,175		add_properties,176	)?;177178	let collection_id = T::CollectionDispatch::create(caller.clone(), data)179		.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;180	let address = pallet_common::eth::collection_id_to_address(collection_id);181	Ok(address)182}183184/// @title Contract, which allows users to operate with collections185#[solidity_interface(name = CollectionHelpers, events(CollectionHelpersEvents))]186impl<T> EvmCollectionHelpers<T>187where188	T: Config + pallet_nonfungible::Config + pallet_refungible::Config,189{190	/// Create an NFT collection191	/// @param name Name of the collection192	/// @param description Informative description of the collection193	/// @param tokenPrefix Token prefix to represent the collection tokens in UI and user applications194	/// @return address Address of the newly created collection195	#[weight(<SelfWeightOf<T>>::create_collection())]196	fn create_nonfungible_collection(197		&mut self,198		caller: caller,199		name: string,200		description: string,201		token_prefix: string,202	) -> Result<address> {203		let (caller, name, description, token_prefix, _base_uri_value) =204			convert_data::<T>(caller, name, description, token_prefix, "".into())?;205		let data = make_data::<T>(206			name,207			CollectionMode::NFT,208			description,209			token_prefix,210			Default::default(),211			false,212		)?;213		let collection_id = T::CollectionDispatch::create(caller, data)214			.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;215216		let address = pallet_common::eth::collection_id_to_address(collection_id);217		Ok(address)218	}219220	#[weight(<SelfWeightOf<T>>::create_collection())]221	#[solidity(rename_selector = "createERC721MetadataCompatibleCollection")]222	fn create_nonfungible_collection_with_properties(223		&mut self,224		caller: caller,225		name: string,226		description: string,227		token_prefix: string,228		base_uri: string,229	) -> Result<address> {230		let (caller, name, description, token_prefix, base_uri_value) =231			convert_data::<T>(caller, name, description, token_prefix, base_uri)?;232		let data = make_data::<T>(233			name,234			CollectionMode::NFT,235			description,236			token_prefix,237			base_uri_value,238			true,239		)?;240		let collection_id = T::CollectionDispatch::create(caller, data)241			.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;242243		let address = pallet_common::eth::collection_id_to_address(collection_id);244		Ok(address)245	}246247	#[weight(<SelfWeightOf<T>>::create_collection())]248	fn create_refungible_collection(249		&mut self,250		caller: caller,251		name: string,252		description: string,253		token_prefix: string,254	) -> Result<address> {255		create_refungible_collection_internal::<T>(256			caller,257			name,258			description,259			token_prefix,260			Default::default(),261			false,262		)263	}264265	#[weight(<SelfWeightOf<T>>::create_collection())]266	#[solidity(rename_selector = "createERC721MetadataCompatibleRFTCollection")]267	fn create_refungible_collection_with_properties(268		&mut self,269		caller: caller,270		name: string,271		description: string,272		token_prefix: string,273		base_uri: string,274	) -> Result<address> {275		create_refungible_collection_internal::<T>(276			caller,277			name,278			description,279			token_prefix,280			base_uri,281			true,282		)283	}284285	/// Check if a collection exists286	/// @param collectionAddress Address of the collection in question287	/// @return bool Does the collection exist?288	fn is_collection_exist(&self, _caller: caller, collection_address: address) -> Result<bool> {289		if let Some(id) = pallet_common::eth::map_eth_to_id(&collection_address) {290			let collection_id = id;291			return Ok(<CollectionById<T>>::contains_key(collection_id));292		}293294		Ok(false)295	}296}297298/// Implements [`OnMethodCall`], which delegates call to [`EvmCollectionHelpers`]299pub struct CollectionHelpersOnMethodCall<T: Config>(PhantomData<*const T>);300impl<T: Config + pallet_nonfungible::Config + pallet_refungible::Config> OnMethodCall<T>301	for CollectionHelpersOnMethodCall<T>302{303	fn is_reserved(contract: &sp_core::H160) -> bool {304		contract == &T::ContractAddress::get()305	}306307	fn is_used(contract: &sp_core::H160) -> bool {308		contract == &T::ContractAddress::get()309	}310311	fn call(handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {312		if handle.code_address() != T::ContractAddress::get() {313			return None;314		}315316		let helpers =317			EvmCollectionHelpers::<T>(SubstrateRecorder::<T>::new(handle.remaining_gas()));318		pallet_evm_coder_substrate::call(handle, helpers)319	}320321	fn get_code(contract: &sp_core::H160) -> Option<Vec<u8>> {322		(contract == &T::ContractAddress::get())323			.then(|| include_bytes!("./stubs/CollectionHelpers.raw").to_vec())324	}325}326327generate_stubgen!(collection_helper_impl, CollectionHelpersCall<()>, true);328generate_stubgen!(collection_helper_iface, CollectionHelpersCall<()>, false);329330fn error_field_too_long(feild: &str, bound: usize) -> Error {331	Error::Revert(format!("{} is too long. Max length is {}.", feild, bound))332}
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/>.1617//! Implementation of CollectionHelpers contract.1819use core::marker::PhantomData;20use ethereum as _;21use evm_coder::{execution::*, generate_stubgen, solidity_interface, solidity, weight, types::*};22use frame_support::traits::Get;23use pallet_common::{24	CollectionById,25	dispatch::CollectionDispatch,26	erc::{27		CollectionHelpersEvents,28		static_property::{key, value as property_value},29	},30};31use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};32use pallet_evm::{account::CrossAccountId, OnMethodCall, PrecompileHandle, PrecompileResult};33use up_data_structs::{34	CollectionName, CollectionDescription, CollectionTokenPrefix, CreateCollectionData,35	CollectionMode, PropertyValue,36};3738use crate::{Config, SelfWeightOf, weights::WeightInfo};3940use sp_std::vec::Vec;41use alloc::format;4243/// See [`CollectionHelpersCall`]44pub struct EvmCollectionHelpers<T: Config>(SubstrateRecorder<T>);45impl<T: Config> WithRecorder<T> for EvmCollectionHelpers<T> {46	fn recorder(&self) -> &SubstrateRecorder<T> {47		&self.048	}4950	fn into_recorder(self) -> SubstrateRecorder<T> {51		self.052	}53}5455fn convert_data<T: Config>(56	caller: caller,57	name: string,58	description: string,59	token_prefix: string,60	base_uri: string,61) -> Result<(62	T::CrossAccountId,63	CollectionName,64	CollectionDescription,65	CollectionTokenPrefix,66	PropertyValue,67)> {68	let caller = T::CrossAccountId::from_eth(caller);69	let name = name70		.encode_utf16()71		.collect::<Vec<u16>>()72		.try_into()73		.map_err(|_| error_field_too_long(stringify!(name), CollectionName::bound()))?;74	let description = description75		.encode_utf16()76		.collect::<Vec<u16>>()77		.try_into()78		.map_err(|_| {79			error_field_too_long(stringify!(description), CollectionDescription::bound())80		})?;81	let token_prefix = token_prefix.into_bytes().try_into().map_err(|_| {82		error_field_too_long(stringify!(token_prefix), CollectionTokenPrefix::bound())83	})?;84	let base_uri_value = base_uri85		.into_bytes()86		.try_into()87		.map_err(|_| error_field_too_long(stringify!(token_prefix), PropertyValue::bound()))?;88	Ok((caller, name, description, token_prefix, base_uri_value))89}9091fn make_data<T: Config>(92	name: CollectionName,93	mode: CollectionMode,94	description: CollectionDescription,95	token_prefix: CollectionTokenPrefix,96	base_uri_value: PropertyValue,97	add_properties: bool,98) -> Result<CreateCollectionData<T::AccountId>> {99	let mut properties = up_data_structs::CollectionPropertiesVec::default();100	let mut token_property_permissions =101		up_data_structs::CollectionPropertiesPermissionsVec::default();102103	token_property_permissions104		.try_push(up_data_structs::PropertyKeyPermission {105			key: key::url(),106			permission: up_data_structs::PropertyPermission {107				mutable: false,108				collection_admin: true,109				token_owner: false,110			},111		})112		.map_err(|e| Error::Revert(format!("{:?}", e)))?;113114	if add_properties {115		token_property_permissions116			.try_push(up_data_structs::PropertyKeyPermission {117				key: key::suffix(),118				permission: up_data_structs::PropertyPermission {119					mutable: false,120					collection_admin: true,121					token_owner: false,122				},123			})124			.map_err(|e| Error::Revert(format!("{:?}", e)))?;125126		properties127			.try_push(up_data_structs::Property {128				key: key::schema_name(),129				value: property_value::erc721(),130			})131			.map_err(|e| Error::Revert(format!("{:?}", e)))?;132133		if !base_uri_value.is_empty() {134			properties135				.try_push(up_data_structs::Property {136					key: key::base_uri(),137					value: base_uri_value,138				})139				.map_err(|e| Error::Revert(format!("{:?}", e)))?;140		}141	}142143	let data = CreateCollectionData {144		name,145		mode,146		description,147		token_prefix,148		token_property_permissions,149		properties,150		..Default::default()151	};152	Ok(data)153}154155fn create_refungible_collection_internal<156	T: Config + pallet_nonfungible::Config + pallet_refungible::Config,157>(158	caller: caller,159	name: string,160	description: string,161	token_prefix: string,162	base_uri: string,163	add_properties: bool,164) -> Result<address> {165	let (caller, name, description, token_prefix, base_uri_value) =166		convert_data::<T>(caller, name, description, token_prefix, base_uri)?;167	let data = make_data::<T>(168		name,169		CollectionMode::ReFungible,170		description,171		token_prefix,172		base_uri_value,173		add_properties,174	)?;175176	let collection_id = T::CollectionDispatch::create(caller.clone(), data)177		.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;178	let address = pallet_common::eth::collection_id_to_address(collection_id);179	Ok(address)180}181182/// @title Contract, which allows users to operate with collections183#[solidity_interface(name = CollectionHelpers, events(CollectionHelpersEvents))]184impl<T> EvmCollectionHelpers<T>185where186	T: Config + pallet_nonfungible::Config + pallet_refungible::Config,187{188	/// Create an NFT collection189	/// @param name Name of the collection190	/// @param description Informative description of the collection191	/// @param tokenPrefix Token prefix to represent the collection tokens in UI and user applications192	/// @return address Address of the newly created collection193	#[weight(<SelfWeightOf<T>>::create_collection())]194	fn create_nonfungible_collection(195		&mut self,196		caller: caller,197		name: string,198		description: string,199		token_prefix: string,200	) -> Result<address> {201		let (caller, name, description, token_prefix, _base_uri_value) =202			convert_data::<T>(caller, name, description, token_prefix, "".into())?;203		let data = make_data::<T>(204			name,205			CollectionMode::NFT,206			description,207			token_prefix,208			Default::default(),209			false,210		)?;211		let collection_id = T::CollectionDispatch::create(caller, data)212			.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;213214		let address = pallet_common::eth::collection_id_to_address(collection_id);215		Ok(address)216	}217218	#[weight(<SelfWeightOf<T>>::create_collection())]219	#[solidity(rename_selector = "createERC721MetadataCompatibleCollection")]220	fn create_nonfungible_collection_with_properties(221		&mut self,222		caller: caller,223		name: string,224		description: string,225		token_prefix: string,226		base_uri: string,227	) -> Result<address> {228		let (caller, name, description, token_prefix, base_uri_value) =229			convert_data::<T>(caller, name, description, token_prefix, base_uri)?;230		let data = make_data::<T>(231			name,232			CollectionMode::NFT,233			description,234			token_prefix,235			base_uri_value,236			true,237		)?;238		let collection_id = T::CollectionDispatch::create(caller, data)239			.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;240241		let address = pallet_common::eth::collection_id_to_address(collection_id);242		Ok(address)243	}244245	#[weight(<SelfWeightOf<T>>::create_collection())]246	fn create_refungible_collection(247		&mut self,248		caller: caller,249		name: string,250		description: string,251		token_prefix: string,252	) -> Result<address> {253		create_refungible_collection_internal::<T>(254			caller,255			name,256			description,257			token_prefix,258			Default::default(),259			false,260		)261	}262263	#[weight(<SelfWeightOf<T>>::create_collection())]264	#[solidity(rename_selector = "createERC721MetadataCompatibleRFTCollection")]265	fn create_refungible_collection_with_properties(266		&mut self,267		caller: caller,268		name: string,269		description: string,270		token_prefix: string,271		base_uri: string,272	) -> Result<address> {273		create_refungible_collection_internal::<T>(274			caller,275			name,276			description,277			token_prefix,278			base_uri,279			true,280		)281	}282283	/// Check if a collection exists284	/// @param collectionAddress Address of the collection in question285	/// @return bool Does the collection exist?286	fn is_collection_exist(&self, _caller: caller, collection_address: address) -> Result<bool> {287		if let Some(id) = pallet_common::eth::map_eth_to_id(&collection_address) {288			let collection_id = id;289			return Ok(<CollectionById<T>>::contains_key(collection_id));290		}291292		Ok(false)293	}294}295296/// Implements [`OnMethodCall`], which delegates call to [`EvmCollectionHelpers`]297pub struct CollectionHelpersOnMethodCall<T: Config>(PhantomData<*const T>);298impl<T: Config + pallet_nonfungible::Config + pallet_refungible::Config> OnMethodCall<T>299	for CollectionHelpersOnMethodCall<T>300{301	fn is_reserved(contract: &sp_core::H160) -> bool {302		contract == &T::ContractAddress::get()303	}304305	fn is_used(contract: &sp_core::H160) -> bool {306		contract == &T::ContractAddress::get()307	}308309	fn call(handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {310		if handle.code_address() != T::ContractAddress::get() {311			return None;312		}313314		let helpers =315			EvmCollectionHelpers::<T>(SubstrateRecorder::<T>::new(handle.remaining_gas()));316		pallet_evm_coder_substrate::call(handle, helpers)317	}318319	fn get_code(contract: &sp_core::H160) -> Option<Vec<u8>> {320		(contract == &T::ContractAddress::get())321			.then(|| include_bytes!("./stubs/CollectionHelpers.raw").to_vec())322	}323}324325generate_stubgen!(collection_helper_impl, CollectionHelpersCall<()>, true);326generate_stubgen!(collection_helper_iface, CollectionHelpersCall<()>, false);327328fn error_field_too_long(feild: &str, bound: usize) -> Error {329	Error::Revert(format!("{} is too long. Max length is {}.", feild, bound))330}
modifiedruntime/common/ethereum/sponsoring.rsdiffbeforeafterboth
--- a/runtime/common/ethereum/sponsoring.rs
+++ b/runtime/common/ethereum/sponsoring.rs
@@ -34,7 +34,6 @@
 };
 use pallet_refungible::Config as RefungibleConfig;
 use pallet_unique::Config as UniqueConfig;
-use sp_core::H160;
 use sp_std::prelude::*;
 use up_data_structs::{CollectionMode, CreateItemData, CreateNftData, TokenId};
 use up_sponsorship::SponsorshipHandler;
@@ -48,18 +47,16 @@
 
 pub struct UniqueEthSponsorshipHandler<T: UniqueConfig>(PhantomData<*const T>);
 impl<T: UniqueConfig + FungibleConfig + NonfungibleConfig + RefungibleConfig>
-	SponsorshipHandler<T::CrossAccountId, (H160, Vec<u8>), CallContext>
-	for UniqueEthSponsorshipHandler<T>
+	SponsorshipHandler<T::CrossAccountId, CallContext> for UniqueEthSponsorshipHandler<T>
 {
 	fn get_sponsor(
 		who: &T::CrossAccountId,
-		call: &(H160, Vec<u8>),
-		_fee_limit: &CallContext,
+		call_context: &CallContext,
 	) -> Option<T::CrossAccountId> {
-		let collection_id = map_eth_to_id(&call.0)?;
+		let collection_id = map_eth_to_id(&call_context.contract_address)?;
 		let collection = <CollectionHandle<T>>::new(collection_id)?;
 		let sponsor = collection.sponsorship.sponsor()?.clone();
-		let (method_id, mut reader) = AbiReader::new_call(&call.1).ok()?;
+		let (method_id, mut reader) = AbiReader::new_call(&call_context.input).ok()?;
 		Some(T::CrossAccountId::from_sub(match &collection.mode {
 			CollectionMode::NFT => {
 				let call = <UniqueNFTCall<T>>::parse(method_id, &mut reader).ok()??;
modifiedruntime/common/sponsoring.rsdiffbeforeafterboth
--- a/runtime/common/sponsoring.rs
+++ b/runtime/common/sponsoring.rs
@@ -224,12 +224,12 @@
 }
 
 pub struct UniqueSponsorshipHandler<T>(PhantomData<T>);
-impl<T, C> SponsorshipHandler<T::AccountId, C, ()> for UniqueSponsorshipHandler<T>
+impl<T, C> SponsorshipHandler<T::AccountId, C> for UniqueSponsorshipHandler<T>
 where
 	T: Config,
 	C: IsSubType<UniqueCall<T>>,
 {
-	fn get_sponsor(who: &T::AccountId, call: &C, _call_context: &()) -> Option<T::AccountId> {
+	fn get_sponsor(who: &T::AccountId, call: &C) -> Option<T::AccountId> {
 		match IsSubType::<UniqueCall<T>>::is_sub_type(call)? {
 			UniqueCall::set_token_properties {
 				collection_id,
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -431,7 +431,7 @@
 pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
 pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
 # pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
-pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="9ee7d6e57e03a2575cbab79431774b56f170018e", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
+pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27", 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-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
@@ -442,7 +442,7 @@
 fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 evm-coder = { default-features = false, path = '../../crates/evm-coder' }
-up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="9ee7d6e57e03a2575cbab79431774b56f170018e" }
+up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27" }
 
 ################################################################################
 # Build Dependencies
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -432,7 +432,7 @@
 pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
 pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
 # pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
-pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="9ee7d6e57e03a2575cbab79431774b56f170018e", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
+pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27", 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-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
@@ -443,7 +443,7 @@
 fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 evm-coder = { default-features = false, path = '../../crates/evm-coder' }
-up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="9ee7d6e57e03a2575cbab79431774b56f170018e" }
+up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27" }
 
 ################################################################################
 # Build Dependencies
modifiedruntime/tests/Cargo.tomldiffbeforeafterboth
--- a/runtime/tests/Cargo.toml
+++ b/runtime/tests/Cargo.toml
@@ -43,4 +43,4 @@
 scale-info = "*"
 
 evm-coder = { default-features = false, path = '../../crates/evm-coder' }
-up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="9ee7d6e57e03a2575cbab79431774b56f170018e" }
+up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27" }
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -425,7 +425,7 @@
 pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
 pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
 # pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
-pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="9ee7d6e57e03a2575cbab79431774b56f170018e", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
+pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27", 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-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
@@ -437,7 +437,7 @@
 fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 evm-coder = { default-features = false, path = '../../crates/evm-coder' }
-up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="9ee7d6e57e03a2575cbab79431774b56f170018e" }
+up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27" }
 
 ################################################################################
 # Build Dependencies