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

difftreelog

doc(pallet-evm-contract-helpers): document public api

Yaroslav Bolyukin2022-07-12parent: #c098935.patch.diff
in: master

7 files changed

addedpallets/evm-contract-helpers/README.mddiffbeforeafterboth
--- /dev/null
+++ b/pallets/evm-contract-helpers/README.md
@@ -0,0 +1,13 @@
+# EVM Contract Helpers
+
+This pallet extends pallet-evm contracts with several new functions.
+
+## Overview
+
+Evm contract helpers pallet provides ability to
+
+- Tracking and getting of user, which deployed contract
+- Sponsoring EVM contract calls (Make transaction calls to be free for users, instead making them being paid from contract address)
+- Allowlist access mode
+
+As most of those functions are intented to be consumed by ethereum users, only API provided by this pallet is [ContractHelpers magic contract](./src/stubs/ContractHelpers.sol)
\ No newline at end of file
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -14,6 +14,8 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
+//! Implementation of magic contract
+
 use core::marker::PhantomData;
 use evm_coder::{abi::AbiWriter, execution::Result, generate_stubgen, solidity_interface, types::*};
 use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder, dispatch_to_evm};
@@ -31,7 +33,8 @@
 use up_sponsorship::SponsorshipHandler;
 use sp_std::vec::Vec;
 
-struct ContractHelpers<T: Config>(SubstrateRecorder<T>);
+/// See [`ContractHelpersCall`]
+pub struct ContractHelpers<T: Config>(SubstrateRecorder<T>);
 impl<T: Config> WithRecorder<T> for ContractHelpers<T> {
 	fn recorder(&self) -> &SubstrateRecorder<T> {
 		&self.0
@@ -42,21 +45,24 @@
 	}
 }
 
+/// @title Magic contract, which allows users to reconfigure other contracts
 #[solidity_interface(name = ContractHelpers)]
 impl<T: Config> ContractHelpers<T>
 where
 	T::AccountId: AsRef<[u8; 32]>,
 {
-	/// Get contract ovner
-	///
-	/// @param contractAddress contract for which the owner is being determined.
-	/// @return Contract owner.
+	/// Get user, which deployed specified contract
+	/// @dev May return zero address in case if contract is deployed
+	///  using uniquenetwork evm-migration pallet, or using other terms not
+	///  intended by pallet-evm
+	/// @dev Returns zero address if contract does not exists
+	/// @param contractAddress Contract to get owner of
+	/// @return address Owner of contract
 	fn contract_owner(&self, contract_address: address) -> Result<address> {
 		Ok(<Owner<T>>::get(contract_address))
 	}
 
 	/// Set sponsor.
-	///
 	/// @param contractAddress Contract for which a sponsor is being established.
 	/// @param sponsor User address who set as pending sponsor.
 	fn set_sponsor(
@@ -163,6 +169,7 @@
 		&mut self,
 		caller: caller,
 		contract_address: address,
+		// TODO: implement support for enums in evm-coder
 		mode: uint8,
 	) -> Result<void> {
 		self.recorder().consume_sload()?;
@@ -175,10 +182,21 @@
 		Ok(())
 	}
 
-	fn sponsoring_mode(&self, contract_address: address) -> Result<uint8> {
-		Ok(<Pallet<T>>::sponsoring_mode(contract_address).to_eth())
+	/// Get current contract sponsoring rate limit
+	/// @param contractAddress Contract to get sponsoring mode of
+	/// @return uint32 Amount of blocks between two sponsored transactions
+	fn get_sponsoring_rate_limit(&self, contract_address: address) -> Result<uint32> {
+		Ok(<SponsoringRateLimit<T>>::get(contract_address)
+			.try_into()
+			.map_err(|_| "rate limit > u32::MAX")?)
 	}
 
+	/// Set contract sponsoring rate limit
+	/// @dev Sponsoring rate limit - is a minimum amount of blocks that should
+	///  pass between two sponsored transactions
+	/// @param contractAddress Contract to change sponsoring rate limit of
+	/// @param rateLimit Target rate limit
+	/// @dev Only contract owner can change this setting
 	fn set_sponsoring_rate_limit(
 		&mut self,
 		caller: caller,
@@ -190,57 +208,70 @@
 
 		<Pallet<T>>::ensure_owner(contract_address, caller).map_err(dispatch_to_evm::<T>)?;
 		<Pallet<T>>::set_sponsoring_rate_limit(contract_address, rate_limit.into());
-
 		Ok(())
 	}
 
-	fn get_sponsoring_rate_limit(&self, contract_address: address) -> Result<uint32> {
-		Ok(<SponsoringRateLimit<T>>::get(contract_address)
-			.try_into()
-			.map_err(|_| "rate limit > u32::MAX")?)
-	}
-
+	/// Is specified user present in contract allow list
+	/// @dev Contract owner always implicitly included
+	/// @param contractAddress Contract to check allowlist of
+	/// @param user User to check
+	/// @return bool Is specified users exists in contract allowlist
 	fn allowed(&self, contract_address: address, user: address) -> Result<bool> {
 		self.0.consume_sload()?;
 		Ok(<Pallet<T>>::allowed(contract_address, user))
 	}
 
-	fn allowlist_enabled(&self, contract_address: address) -> Result<bool> {
-		Ok(<AllowlistEnabled<T>>::get(contract_address))
-	}
-
-	fn toggle_allowlist(
+	/// Toggle user presence in contract allowlist
+	/// @param contractAddress Contract to change allowlist of
+	/// @param user Which user presence should be toggled
+	/// @param isAllowed `true` if user should be allowed to be sponsored
+	///  or call this contract, `false` otherwise
+	/// @dev Only contract owner can change this setting
+	fn toggle_allowed(
 		&mut self,
 		caller: caller,
 		contract_address: address,
-		enabled: bool,
+		user: address,
+		is_allowed: bool,
 	) -> Result<void> {
 		self.recorder().consume_sload()?;
 		self.recorder().consume_sstore()?;
 
 		<Pallet<T>>::ensure_owner(contract_address, caller).map_err(dispatch_to_evm::<T>)?;
-		<Pallet<T>>::toggle_allowlist(contract_address, enabled);
+		<Pallet<T>>::toggle_allowed(contract_address, user, is_allowed);
 
 		Ok(())
 	}
 
-	fn toggle_allowed(
+	/// Is this contract has allowlist access enabled
+	/// @dev Allowlist always can have users, and it is used for two purposes:
+	///  in case of allowlist sponsoring mode, users will be sponsored if they exist in allowlist
+	///  in case of allowlist access enabled, only users from allowlist may call this contract
+	/// @param contractAddress Contract to get allowlist access of
+	/// @return bool Is specified contract has allowlist access enabled
+	fn allowlist_enabled(&self, contract_address: address) -> Result<bool> {
+		Ok(<AllowlistEnabled<T>>::get(contract_address))
+	}
+
+	/// Toggle contract allowlist access
+	/// @param contractAddress Contract to change allowlist access of
+	/// @param enabled Should allowlist access to be enabled?
+	fn toggle_allowlist(
 		&mut self,
 		caller: caller,
 		contract_address: address,
-		user: address,
-		is_allowed: bool,
+		enabled: bool,
 	) -> Result<void> {
 		self.recorder().consume_sload()?;
 		self.recorder().consume_sstore()?;
 
 		<Pallet<T>>::ensure_owner(contract_address, caller).map_err(dispatch_to_evm::<T>)?;
-		<Pallet<T>>::toggle_allowed(contract_address, user, is_allowed);
-
+		<Pallet<T>>::toggle_allowlist(contract_address, enabled);
 		Ok(())
 	}
 }
 
+/// Implements [`OnMethodCall`], which delegates call to [`ContractHelpers`]
 pub struct HelpersOnMethodCall<T: Config>(PhantomData<*const T>);
 impl<T: Config> OnMethodCall<T> for HelpersOnMethodCall<T>
 where
@@ -283,6 +314,7 @@
 	}
 }
 
+/// Hooks into contract creation, storing owner of newly deployed contract
 pub struct HelpersOnCreate<T: Config>(PhantomData<*const T>);
 impl<T: Config> OnCreate<T> for HelpersOnCreate<T> {
 	fn on_create(owner: H160, contract: H160) {
@@ -290,6 +322,7 @@
 	}
 }
 
+/// Bridge to pallet-sponsoring
 pub struct HelpersContractSponsoring<T: Config>(PhantomData<*const T>);
 impl<T: Config> SponsorshipHandler<T::CrossAccountId, (H160, Vec<u8>)>
 	for HelpersContractSponsoring<T>
modifiedpallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/lib.rs
+++ b/pallets/evm-contract-helpers/src/lib.rs
@@ -14,7 +14,9 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
+#![doc = include_str!("../README.md")]
 #![cfg_attr(not(feature = "std"), no_std)]
+#![deny(missing_docs)]
 
 use codec::{Decode, Encode, MaxEncodedLen};
 pub use pallet::*;
@@ -35,13 +37,16 @@
 	pub trait Config:
 		frame_system::Config + pallet_evm_coder_substrate::Config + pallet_evm::account::Config
 	{
+		/// Address, under which magic contract will be available
 		type ContractAddress: Get<H160>;
+		/// In case of enabled sponsoring, but no sponsoring rate limit set,
+		/// this value will be used implicitly
 		type DefaultSponsoringRateLimit: Get<Self::BlockNumber>;
 	}
 
 	#[pallet::error]
 	pub enum Error<T> {
-		/// This method is only executable by owner.
+		/// This method is only executable by contract owner
 		NoPermission,
 
 		/// No pending sponsor for contract.
@@ -217,6 +222,7 @@
 			}
 		}
 
+		/// Get current sponsoring mode, performing lazy migration from legacy storage
 		pub fn sponsoring_mode(contract: H160) -> SponsoringModeT {
 			<SponsoringMode<T>>::get(contract)
 				.or_else(|| {
@@ -225,6 +231,7 @@
 				.unwrap_or_default()
 		}
 
+		/// Reconfigure contract sponsoring mode
 		pub fn set_sponsoring_mode(contract: H160, mode: SponsoringModeT) {
 			if mode == SponsoringModeT::Disabled {
 				<SponsoringMode<T>>::remove(contract);
@@ -234,22 +241,27 @@
 			<SelfSponsoring<T>>::remove(contract)
 		}
 
+		/// Set duration between two sponsored contract calls
 		pub fn set_sponsoring_rate_limit(contract: H160, rate_limit: T::BlockNumber) {
 			<SponsoringRateLimit<T>>::insert(contract, rate_limit);
 		}
 
+		/// Is user added to allowlist, or he is owner of specified contract
 		pub fn allowed(contract: H160, user: H160) -> bool {
 			<Allowlist<T>>::get(&contract, &user) || <Owner<T>>::get(&contract) == user
 		}
 
+		/// Toggle contract allowlist access
 		pub fn toggle_allowlist(contract: H160, enabled: bool) {
 			<AllowlistEnabled<T>>::insert(contract, enabled)
 		}
 
+		/// Toggle user presence in contract's allowlist
 		pub fn toggle_allowed(contract: H160, user: H160, allowed: bool) {
 			<Allowlist<T>>::insert(contract, user, allowed);
 		}
 
+		/// Throw error if user is not allowed to reconfigure target contract
 		pub fn ensure_owner(contract: H160, user: H160) -> DispatchResult {
 			ensure!(<Owner<T>>::get(&contract) == user, Error::<T>::NoPermission);
 			Ok(())
@@ -257,10 +269,15 @@
 	}
 }
 
-#[derive(Encode, Decode, PartialEq, TypeInfo, MaxEncodedLen)]
+/// Available contract sponsoring modes
+#[derive(Encode, Decode, PartialEq, TypeInfo, MaxEncodedLen, Default)]
 pub enum SponsoringModeT {
+	/// Sponsoring is disabled
+	#[default]
 	Disabled,
+	/// Only users from allowlist will be sponsored
 	Allowlisted,
+	/// All users will be sponsored
 	Generous,
 }
 
@@ -279,11 +296,5 @@
 			SponsoringModeT::Allowlisted => 1,
 			SponsoringModeT::Generous => 2,
 		}
-	}
-}
-
-impl Default for SponsoringModeT {
-	fn default() -> Self {
-		Self::Disabled
 	}
 }
modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.soldiffbeforeafterboth
before · pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56/// @dev anonymous struct7struct Tuple0 {8	address field_0;9	uint256 field_1;10}1112/// @dev common stubs holder13contract Dummy {14	uint8 dummy;15	string stub_error = "this contract is implemented in native";16}1718contract ERC165 is Dummy {19	function supportsInterface(bytes4 interfaceID)20		external21		view22		returns (bool)23	{24		require(false, stub_error);25		interfaceID;26		return true;27	}28}2930/// @dev the ERC-165 identifier for this interface is 0x6073d91731contract ContractHelpers is Dummy, ERC165 {32	/// Get contract ovner33	///34	/// @param contractAddress contract for which the owner is being determined.35	/// @return Contract owner.36	///37	/// Selector: contractOwner(address) 5152b14c38	function contractOwner(address contractAddress)39		public40		view41		returns (address)42	{43		require(false, stub_error);44		contractAddress;45		dummy;46		return 0x0000000000000000000000000000000000000000;47	}4849	/// Set sponsor.50	///51	/// @param contractAddress Contract for which a sponsor is being established.52	/// @param sponsor User address who set as pending sponsor.53	///54	/// Selector: setSponsor(address,address) f01fba9355	function setSponsor(address contractAddress, address sponsor) public {56		require(false, stub_error);57		contractAddress;58		sponsor;59		dummy = 0;60	}6162	/// Set contract as self sponsored.63	///64	/// @param contractAddress Contract for which a self sponsoring is being enabled.65	///66	/// Selector: selfSponsoredEnable(address) 89f7d9ae67	function selfSponsoredEnable(address contractAddress) public {68		require(false, stub_error);69		contractAddress;70		dummy = 0;71	}7273	/// Remove sponsor.74	///75	/// @param contractAddress Contract for which a sponsorship is being removed.76	///77	/// Selector: removeSponsor(address) ef78425078	function removeSponsor(address contractAddress) public {79		require(false, stub_error);80		contractAddress;81		dummy = 0;82	}8384	/// Confirm sponsorship.85	///86	/// @dev Caller must be same that set via [`setSponsor`].87	///88	/// @param contractAddress Сontract for which need to confirm sponsorship.89	///90	/// Selector: confirmSponsorship(address) abc0000191	function confirmSponsorship(address contractAddress) public {92		require(false, stub_error);93		contractAddress;94		dummy = 0;95	}9697	/// Get current sponsor.98	///99	/// @param contractAddress The contract for which a sponsor is requested.100	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.101	///102	/// Selector: getSponsor(address) 743fc745103	function getSponsor(address contractAddress)104		public105		view106		returns (Tuple0 memory)107	{108		require(false, stub_error);109		contractAddress;110		dummy;111		return Tuple0(0x0000000000000000000000000000000000000000, 0);112	}113114	/// Check tat contract has confirmed sponsor.115	///116	/// @param contractAddress The contract for which the presence of a confirmed sponsor is checked.117	/// @return **true** if contract has confirmed sponsor.118	///119	/// Selector: hasSponsor(address) 97418603120	function hasSponsor(address contractAddress) public view returns (bool) {121		require(false, stub_error);122		contractAddress;123		dummy;124		return false;125	}126127	/// Check tat contract has pending sponsor.128	///129	/// @param contractAddress The contract for which the presence of a pending sponsor is checked.130	/// @return **true** if contract has pending sponsor.131	///132	/// Selector: hasPendingSponsor(address) 39b9b242133	function hasPendingSponsor(address contractAddress)134		public135		view136		returns (bool)137	{138		require(false, stub_error);139		contractAddress;140		dummy;141		return false;142	}143144	/// Selector: sponsoringEnabled(address) 6027dc61145	function sponsoringEnabled(address contractAddress)146		public147		view148		returns (bool)149	{150		require(false, stub_error);151		contractAddress;152		dummy;153		return false;154	}155156	/// Selector: setSponsoringMode(address,uint8) fde8a560157	function setSponsoringMode(address contractAddress, uint8 mode) public {158		require(false, stub_error);159		contractAddress;160		mode;161		dummy = 0;162	}163164	/// Selector: sponsoringMode(address) b70c7267165	function sponsoringMode(address contractAddress)166		public167		view168		returns (uint8)169	{170		require(false, stub_error);171		contractAddress;172		dummy;173		return 0;174	}175176	/// Selector: setSponsoringRateLimit(address,uint32) 77b6c908177	function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)178		public179	{180		require(false, stub_error);181		contractAddress;182		rateLimit;183		dummy = 0;184	}185186	/// Selector: getSponsoringRateLimit(address) 610cfabd187	function getSponsoringRateLimit(address contractAddress)188		public189		view190		returns (uint32)191	{192		require(false, stub_error);193		contractAddress;194		dummy;195		return 0;196	}197198	/// Selector: allowed(address,address) 5c658165199	function allowed(address contractAddress, address user)200		public201		view202		returns (bool)203	{204		require(false, stub_error);205		contractAddress;206		user;207		dummy;208		return false;209	}210211	/// Selector: allowlistEnabled(address) c772ef6c212	function allowlistEnabled(address contractAddress)213		public214		view215		returns (bool)216	{217		require(false, stub_error);218		contractAddress;219		dummy;220		return false;221	}222223	/// Selector: toggleAllowlist(address,bool) 36de20f5224	function toggleAllowlist(address contractAddress, bool enabled) public {225		require(false, stub_error);226		contractAddress;227		enabled;228		dummy = 0;229	}230231	/// Selector: toggleAllowed(address,address,bool) 4706cc1c232	function toggleAllowed(233		address contractAddress,234		address user,235		bool isAllowed236	) public {237		require(false, stub_error);238		contractAddress;239		user;240		isAllowed;241		dummy = 0;242	}243}
after · pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56/// @dev common stubs holder7contract Dummy {8	uint8 dummy;9	string stub_error = "this contract is implemented in native";10}1112contract ERC165 is Dummy {13	function supportsInterface(bytes4 interfaceID)14		external15		view16		returns (bool)17	{18		require(false, stub_error);19		interfaceID;20		return true;21	}22}2324/// @title Magic contract, which allows users to reconfigure other contracts25/// @dev the ERC-165 identifier for this interface is 0xd77fab7026contract ContractHelpers is Dummy, ERC165 {27	/// Get user, which deployed specified contract28	/// @dev May return zero address in case if contract is deployed29	///  using uniquenetwork evm-migration pallet, or using other terms not30	///  intended by pallet-evm31	/// @dev Returns zero address if contract does not exists32	/// @param contractAddress Contract to get owner of33	/// @return address Owner of contract34	/// @dev EVM selector for this function is: 0x5152b14c,35	///  or in textual repr: contractOwner(address)36	function contractOwner(address contractAddress)37		public38		view39		returns (address)40	{41		require(false, stub_error);42		contractAddress;43		dummy;44		return 0x0000000000000000000000000000000000000000;45	}4647	/// Set sponsor.48	/// @param contractAddress Contract for which a sponsor is being established.49	/// @param sponsor User address who set as pending sponsor.50	/// @dev EVM selector for this function is: 0xf01fba93,51	///  or in textual repr: setSponsor(address,address)52	function setSponsor(address contractAddress, address sponsor) public {53		require(false, stub_error);54		contractAddress;55		sponsor;56		dummy = 0;57	}5859	/// Set contract as self sponsored.60	///61	/// @param contractAddress Contract for which a self sponsoring is being enabled.62	/// @dev EVM selector for this function is: 0x89f7d9ae,63	///  or in textual repr: selfSponsoredEnable(address)64	function selfSponsoredEnable(address contractAddress) public {65		require(false, stub_error);66		contractAddress;67		dummy = 0;68	}6970	/// Remove sponsor.71	///72	/// @param contractAddress Contract for which a sponsorship is being removed.73	/// @dev EVM selector for this function is: 0xef784250,74	///  or in textual repr: removeSponsor(address)75	function removeSponsor(address contractAddress) public {76		require(false, stub_error);77		contractAddress;78		dummy = 0;79	}8081	/// Confirm sponsorship.82	///83	/// @dev Caller must be same that set via [`setSponsor`].84	///85	/// @param contractAddress Сontract for which need to confirm sponsorship.86	/// @dev EVM selector for this function is: 0xabc00001,87	///  or in textual repr: confirmSponsorship(address)88	function confirmSponsorship(address contractAddress) public {89		require(false, stub_error);90		contractAddress;91		dummy = 0;92	}9394	/// Get current sponsor.95	///96	/// @param contractAddress The contract for which a sponsor is requested.97	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.98	/// @dev EVM selector for this function is: 0x743fc745,99	///  or in textual repr: getSponsor(address)100	function getSponsor(address contractAddress)101		public102		view103		returns (Tuple0 memory)104	{105		require(false, stub_error);106		contractAddress;107		dummy;108		return Tuple0(0x0000000000000000000000000000000000000000, 0);109	}110111	/// Check tat contract has confirmed sponsor.112	///113	/// @param contractAddress The contract for which the presence of a confirmed sponsor is checked.114	/// @return **true** if contract has confirmed sponsor.115	/// @dev EVM selector for this function is: 0x97418603,116	///  or in textual repr: hasSponsor(address)117	function hasSponsor(address contractAddress) public view returns (bool) {118		require(false, stub_error);119		contractAddress;120		dummy;121		return false;122	}123124	/// Check tat contract has pending sponsor.125	///126	/// @param contractAddress The contract for which the presence of a pending sponsor is checked.127	/// @return **true** if contract has pending sponsor.128	/// @dev EVM selector for this function is: 0x39b9b242,129	///  or in textual repr: hasPendingSponsor(address)130	function hasPendingSponsor(address contractAddress)131		public132		view133		returns (bool)134	{135		require(false, stub_error);136		contractAddress;137		dummy;138		return false;139	}140141	/// @dev EVM selector for this function is: 0x6027dc61,142	///  or in textual repr: sponsoringEnabled(address)143	function sponsoringEnabled(address contractAddress)144		public145		view146		returns (bool)147	{148		require(false, stub_error);149		contractAddress;150		dummy;151		return false;152	}153154	/// @dev EVM selector for this function is: 0xfde8a560,155	///  or in textual repr: setSponsoringMode(address,uint8)156	function setSponsoringMode(address contractAddress, uint8 mode) public {157		require(false, stub_error);158		contractAddress;159		mode;160		dummy = 0;161	}162163	/// Get current contract sponsoring rate limit164	/// @param contractAddress Contract to get sponsoring mode of165	/// @return uint32 Amount of blocks between two sponsored transactions166	/// @dev EVM selector for this function is: 0x610cfabd,167	///  or in textual repr: getSponsoringRateLimit(address)168	function getSponsoringRateLimit(address contractAddress)169		public170		view171		returns (uint32)172	{173		require(false, stub_error);174		contractAddress;175		dummy;176		return 0;177	}178179	/// Set contract sponsoring rate limit180	/// @dev Sponsoring rate limit - is a minimum amount of blocks that should181	///  pass between two sponsored transactions182	/// @param contractAddress Contract to change sponsoring rate limit of183	/// @param rateLimit Target rate limit184	/// @dev Only contract owner can change this setting185	/// @dev EVM selector for this function is: 0x77b6c908,186	///  or in textual repr: setSponsoringRateLimit(address,uint32)187	function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)188		public189	{190		require(false, stub_error);191		contractAddress;192		rateLimit;193		dummy = 0;194	}195196	/// Is specified user present in contract allow list197	/// @dev Contract owner always implicitly included198	/// @param contractAddress Contract to check allowlist of199	/// @param user User to check200	/// @return bool Is specified users exists in contract allowlist201	/// @dev EVM selector for this function is: 0x5c658165,202	///  or in textual repr: allowed(address,address)203	function allowed(address contractAddress, address user)204		public205		view206		returns (bool)207	{208		require(false, stub_error);209		contractAddress;210		user;211		dummy;212		return false;213	}214215	/// Toggle user presence in contract allowlist216	/// @param contractAddress Contract to change allowlist of217	/// @param user Which user presence should be toggled218	/// @param isAllowed `true` if user should be allowed to be sponsored219	///  or call this contract, `false` otherwise220	/// @dev Only contract owner can change this setting221	/// @dev EVM selector for this function is: 0x4706cc1c,222	///  or in textual repr: toggleAllowed(address,address,bool)223	function toggleAllowed(224		address contractAddress,225		address user,226		bool isAllowed227	) public {228		require(false, stub_error);229		contractAddress;230		user;231		isAllowed;232		dummy = 0;233	}234235	/// Is this contract has allowlist access enabled236	/// @dev Allowlist always can have users, and it is used for two purposes:237	///  in case of allowlist sponsoring mode, users will be sponsored if they exist in allowlist238	///  in case of allowlist access enabled, only users from allowlist may call this contract239	/// @param contractAddress Contract to get allowlist access of240	/// @return bool Is specified contract has allowlist access enabled241	/// @dev EVM selector for this function is: 0xc772ef6c,242	///  or in textual repr: allowlistEnabled(address)243	function allowlistEnabled(address contractAddress)244		public245		view246		returns (bool)247	{248		require(false, stub_error);249		contractAddress;250		dummy;251		return false;252	}253254	/// Toggle contract allowlist access255	/// @param contractAddress Contract to change allowlist access of256	/// @param enabled Should allowlist access to be enabled?257	/// @dev EVM selector for this function is: 0x36de20f5,258	///  or in textual repr: toggleAllowlist(address,bool)259	function toggleAllowlist(address contractAddress, bool enabled) public {260		require(false, stub_error);261		contractAddress;262		enabled;263		dummy = 0;264	}265}266267/// @dev anonymous struct268struct Tuple0 {269	address field_0;270	uint256 field_1;271}
modifiedtests/src/eth/api/ContractHelpers.soldiffbeforeafterboth
--- a/tests/src/eth/api/ContractHelpers.sol
+++ b/tests/src/eth/api/ContractHelpers.sol
@@ -3,12 +3,6 @@
 
 pragma solidity >=0.8.0 <0.9.0;
 
-/// @dev anonymous struct
-struct Tuple0 {
-	address field_0;
-	uint256 field_1;
-}
-
 /// @dev common stubs holder
 interface Dummy {
 
@@ -18,39 +12,42 @@
 	function supportsInterface(bytes4 interfaceID) external view returns (bool);
 }
 
-/// @dev the ERC-165 identifier for this interface is 0x6073d917
+/// @title Magic contract, which allows users to reconfigure other contracts
+/// @dev the ERC-165 identifier for this interface is 0xd77fab70
 interface ContractHelpers is Dummy, ERC165 {
-	/// Get contract ovner
-	///
-	/// @param contractAddress contract for which the owner is being determined.
-	/// @return Contract owner.
-	///
-	/// Selector: contractOwner(address) 5152b14c
+	/// Get user, which deployed specified contract
+	/// @dev May return zero address in case if contract is deployed
+	///  using uniquenetwork evm-migration pallet, or using other terms not
+	///  intended by pallet-evm
+	/// @dev Returns zero address if contract does not exists
+	/// @param contractAddress Contract to get owner of
+	/// @return address Owner of contract
+	/// @dev EVM selector for this function is: 0x5152b14c,
+	///  or in textual repr: contractOwner(address)
 	function contractOwner(address contractAddress)
 		external
 		view
 		returns (address);
 
 	/// Set sponsor.
-	///
 	/// @param contractAddress Contract for which a sponsor is being established.
 	/// @param sponsor User address who set as pending sponsor.
-	///
-	/// Selector: setSponsor(address,address) f01fba93
+	/// @dev EVM selector for this function is: 0xf01fba93,
+	///  or in textual repr: setSponsor(address,address)
 	function setSponsor(address contractAddress, address sponsor) external;
 
 	/// Set contract as self sponsored.
 	///
 	/// @param contractAddress Contract for which a self sponsoring is being enabled.
-	///
-	/// Selector: selfSponsoredEnable(address) 89f7d9ae
+	/// @dev EVM selector for this function is: 0x89f7d9ae,
+	///  or in textual repr: selfSponsoredEnable(address)
 	function selfSponsoredEnable(address contractAddress) external;
 
 	/// Remove sponsor.
 	///
 	/// @param contractAddress Contract for which a sponsorship is being removed.
-	///
-	/// Selector: removeSponsor(address) ef784250
+	/// @dev EVM selector for this function is: 0xef784250,
+	///  or in textual repr: removeSponsor(address)
 	function removeSponsor(address contractAddress) external;
 
 	/// Confirm sponsorship.
@@ -58,16 +55,16 @@
 	/// @dev Caller must be same that set via [`setSponsor`].
 	///
 	/// @param contractAddress Сontract for which need to confirm sponsorship.
-	///
-	/// Selector: confirmSponsorship(address) abc00001
+	/// @dev EVM selector for this function is: 0xabc00001,
+	///  or in textual repr: confirmSponsorship(address)
 	function confirmSponsorship(address contractAddress) external;
 
 	/// Get current sponsor.
 	///
 	/// @param contractAddress The contract for which a sponsor is requested.
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
-	///
-	/// Selector: getSponsor(address) 743fc745
+	/// @dev EVM selector for this function is: 0x743fc745,
+	///  or in textual repr: getSponsor(address)
 	function getSponsor(address contractAddress)
 		external
 		view
@@ -77,65 +74,102 @@
 	///
 	/// @param contractAddress The contract for which the presence of a confirmed sponsor is checked.
 	/// @return **true** if contract has confirmed sponsor.
-	///
-	/// Selector: hasSponsor(address) 97418603
+	/// @dev EVM selector for this function is: 0x97418603,
+	///  or in textual repr: hasSponsor(address)
 	function hasSponsor(address contractAddress) external view returns (bool);
 
 	/// Check tat contract has pending sponsor.
 	///
 	/// @param contractAddress The contract for which the presence of a pending sponsor is checked.
 	/// @return **true** if contract has pending sponsor.
-	///
-	/// Selector: hasPendingSponsor(address) 39b9b242
+	/// @dev EVM selector for this function is: 0x39b9b242,
+	///  or in textual repr: hasPendingSponsor(address)
 	function hasPendingSponsor(address contractAddress)
 		external
 		view
 		returns (bool);
 
-	/// Selector: sponsoringEnabled(address) 6027dc61
+	/// @dev EVM selector for this function is: 0x6027dc61,
+	///  or in textual repr: sponsoringEnabled(address)
 	function sponsoringEnabled(address contractAddress)
 		external
 		view
 		returns (bool);
 
-	/// Selector: setSponsoringMode(address,uint8) fde8a560
+	/// @dev EVM selector for this function is: 0xfde8a560,
+	///  or in textual repr: setSponsoringMode(address,uint8)
 	function setSponsoringMode(address contractAddress, uint8 mode) external;
 
-	/// Selector: sponsoringMode(address) b70c7267
-	function sponsoringMode(address contractAddress)
+	/// Get current contract sponsoring rate limit
+	/// @param contractAddress Contract to get sponsoring mode of
+	/// @return uint32 Amount of blocks between two sponsored transactions
+	/// @dev EVM selector for this function is: 0x610cfabd,
+	///  or in textual repr: getSponsoringRateLimit(address)
+	function getSponsoringRateLimit(address contractAddress)
 		external
 		view
-		returns (uint8);
+		returns (uint32);
 
-	/// Selector: setSponsoringRateLimit(address,uint32) 77b6c908
+	/// Set contract sponsoring rate limit
+	/// @dev Sponsoring rate limit - is a minimum amount of blocks that should
+	///  pass between two sponsored transactions
+	/// @param contractAddress Contract to change sponsoring rate limit of
+	/// @param rateLimit Target rate limit
+	/// @dev Only contract owner can change this setting
+	/// @dev EVM selector for this function is: 0x77b6c908,
+	///  or in textual repr: setSponsoringRateLimit(address,uint32)
 	function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)
 		external;
 
-	/// Selector: getSponsoringRateLimit(address) 610cfabd
-	function getSponsoringRateLimit(address contractAddress)
-		external
-		view
-		returns (uint32);
-
-	/// Selector: allowed(address,address) 5c658165
+	/// Is specified user present in contract allow list
+	/// @dev Contract owner always implicitly included
+	/// @param contractAddress Contract to check allowlist of
+	/// @param user User to check
+	/// @return bool Is specified users exists in contract allowlist
+	/// @dev EVM selector for this function is: 0x5c658165,
+	///  or in textual repr: allowed(address,address)
 	function allowed(address contractAddress, address user)
 		external
 		view
 		returns (bool);
 
-	/// Selector: allowlistEnabled(address) c772ef6c
+	/// Toggle user presence in contract allowlist
+	/// @param contractAddress Contract to change allowlist of
+	/// @param user Which user presence should be toggled
+	/// @param isAllowed `true` if user should be allowed to be sponsored
+	///  or call this contract, `false` otherwise
+	/// @dev Only contract owner can change this setting
+	/// @dev EVM selector for this function is: 0x4706cc1c,
+	///  or in textual repr: toggleAllowed(address,address,bool)
+	function toggleAllowed(
+		address contractAddress,
+		address user,
+		bool isAllowed
+	) external;
+
+	/// Is this contract has allowlist access enabled
+	/// @dev Allowlist always can have users, and it is used for two purposes:
+	///  in case of allowlist sponsoring mode, users will be sponsored if they exist in allowlist
+	///  in case of allowlist access enabled, only users from allowlist may call this contract
+	/// @param contractAddress Contract to get allowlist access of
+	/// @return bool Is specified contract has allowlist access enabled
+	/// @dev EVM selector for this function is: 0xc772ef6c,
+	///  or in textual repr: allowlistEnabled(address)
 	function allowlistEnabled(address contractAddress)
 		external
 		view
 		returns (bool);
 
-	/// Selector: toggleAllowlist(address,bool) 36de20f5
+	/// Toggle contract allowlist access
+	/// @param contractAddress Contract to change allowlist access of
+	/// @param enabled Should allowlist access to be enabled?
+	/// @dev EVM selector for this function is: 0x36de20f5,
+	///  or in textual repr: toggleAllowlist(address,bool)
 	function toggleAllowlist(address contractAddress, bool enabled) external;
+}
 
-	/// Selector: toggleAllowed(address,address,bool) 4706cc1c
-	function toggleAllowed(
-		address contractAddress,
-		address user,
-		bool isAllowed
-	) external;
+/// @dev anonymous struct
+struct Tuple0 {
+	address field_0;
+	uint256 field_1;
 }
modifiedtests/src/eth/util/contractHelpersAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/util/contractHelpersAbi.json
+++ b/tests/src/eth/util/contractHelpersAbi.json
@@ -197,19 +197,6 @@
   },
   {
     "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",