git.delta.rocks / unique-network / refs/commits / 8138c78fd9cb

difftreelog

Merge branch 'feature/app-staking' of https://github.com/UniqueNetwork/unique-chain into feature/app-staking

PraetorP2022-09-06parents: #fc5b26a #837c29c.patch.diff
in: master

11 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5735,6 +5735,7 @@
 name = "pallet-evm-contract-helpers"
 version = "0.2.0"
 dependencies = [
+ "ethereum",
  "evm-coder",
  "fp-evm-mapping",
  "frame-support",
modifiedpallets/evm-contract-helpers/Cargo.tomldiffbeforeafterboth
--- a/pallets/evm-contract-helpers/Cargo.toml
+++ b/pallets/evm-contract-helpers/Cargo.toml
@@ -9,6 +9,7 @@
     "derive",
 ] }
 log = { default-features = false, version = "0.4.14" }
+ethereum = { version = "0.12.0", default-features = false }
 
 # Substrate
 frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -17,7 +17,9 @@
 //! Implementation of magic contract
 
 use core::marker::PhantomData;
-use evm_coder::{abi::AbiWriter, execution::Result, generate_stubgen, solidity_interface, types::*};
+use evm_coder::{
+	abi::AbiWriter, execution::Result, generate_stubgen, solidity_interface, types::*, ToLog,
+};
 use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder, dispatch_to_evm};
 use pallet_evm::{
 	ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure, PrecompileHandle,
@@ -33,6 +35,35 @@
 use up_sponsorship::SponsorshipHandler;
 use sp_std::vec::Vec;
 
+/// Pallet events.
+#[derive(ToLog)]
+pub enum ContractHelpersEvents {
+	/// Contract sponsor was set.
+	ContractSponsorSet {
+		/// Contract address of the affected collection.
+		#[indexed]
+		contract_address: address,
+		/// New sponsor address.
+		sponsor: address,
+	},
+
+	/// New sponsor was confirm.
+	ContractSponsorshipConfirmed {
+		/// Contract address of the affected collection.
+		#[indexed]
+		contract_address: address,
+		/// New sponsor address.
+		sponsor: address,
+	},
+
+	/// Collection sponsor was removed.
+	ContractSponsorRemoved {
+		/// Contract address of the affected collection.
+		#[indexed]
+		contract_address: address,
+	},
+}
+
 /// See [`ContractHelpersCall`]
 pub struct ContractHelpers<T: Config>(SubstrateRecorder<T>);
 impl<T: Config> WithRecorder<T> for ContractHelpers<T> {
@@ -46,7 +77,7 @@
 }
 
 /// @title Magic contract, which allows users to reconfigure other contracts
-#[solidity_interface(name = ContractHelpers)]
+#[solidity_interface(name = ContractHelpers, events(ContractHelpersEvents))]
 impl<T: Config> ContractHelpers<T>
 where
 	T::AccountId: AsRef<[u8; 32]>,
@@ -91,8 +122,12 @@
 		self.recorder().consume_sload()?;
 		self.recorder().consume_sstore()?;
 
-		Pallet::<T>::self_sponsored_enable(&T::CrossAccountId::from_eth(caller), contract_address)
-			.map_err(dispatch_to_evm::<T>)?;
+		Pallet::<T>::force_set_sponsor(
+			&T::CrossAccountId::from_eth(caller),
+			contract_address,
+			&T::CrossAccountId::from_eth(contract_address),
+		)
+		.map_err(dispatch_to_evm::<T>)?;
 
 		Ok(())
 	}
modifiedpallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/lib.rs
+++ b/pallets/evm-contract-helpers/src/lib.rs
@@ -16,7 +16,7 @@
 
 #![doc = include_str!("../README.md")]
 #![cfg_attr(not(feature = "std"), no_std)]
-#![deny(missing_docs)]
+#![warn(missing_docs)]
 
 use codec::{Decode, Encode, MaxEncodedLen};
 pub use pallet::*;
@@ -27,18 +27,24 @@
 #[frame_support::pallet]
 pub mod pallet {
 	pub use super::*;
+	use crate::eth::ContractHelpersEvents;
 	use frame_support::pallet_prelude::*;
 	use pallet_evm_coder_substrate::DispatchResult;
 	use sp_core::H160;
-	use pallet_evm::account::CrossAccountId;
+	use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
 	use up_data_structs::SponsorshipState;
+	use evm_coder::ToLog;
 
 	#[pallet::config]
 	pub trait Config:
 		frame_system::Config + pallet_evm_coder_substrate::Config + pallet_evm::account::Config
 	{
+		/// Overarching event type.
+		type Event: IsType<<Self as frame_system::Config>::Event> + From<Event<Self>>;
+
 		/// 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>;
@@ -150,6 +156,32 @@
 		QueryKind = ValueQuery,
 	>;
 
+	#[pallet::event]
+	#[pallet::generate_deposit(pub fn deposit_event)]
+	pub enum Event<T: Config> {
+		/// Contract sponsor was set.
+		ContractSponsorSet(
+			/// Contract address of the affected collection.
+			H160,
+			/// New sponsor address.
+			T::AccountId,
+		),
+
+		/// New sponsor was confirm.
+		ContractSponsorshipConfirmed(
+			/// Contract address of the affected collection.
+			H160,
+			/// New sponsor address.
+			T::AccountId,
+		),
+
+		/// Collection sponsor was removed.
+		ContractSponsorRemoved(
+			/// Contract address of the affected collection.
+			H160,
+		),
+	}
+
 	impl<T: Config> Pallet<T> {
 		/// Get contract owner.
 		pub fn contract_owner(contract: H160) -> H160 {
@@ -169,43 +201,108 @@
 				contract,
 				SponsorshipState::<T::CrossAccountId>::Unconfirmed(sponsor.clone()),
 			);
+
+			<Pallet<T>>::deposit_event(Event::<T>::ContractSponsorSet(
+				contract,
+				sponsor.as_sub().clone(),
+			));
+			<PalletEvm<T>>::deposit_log(
+				ContractHelpersEvents::ContractSponsorSet {
+					contract_address: contract,
+					sponsor: *sponsor.as_eth(),
+				}
+				.to_log(contract),
+			);
 			Ok(())
 		}
 
-		/// Set `contract` as self sponsored.
+		/// Set sponsor as already confirmed.
 		///
 		/// `sender` must be owner of contract.
-		pub fn self_sponsored_enable(sender: &T::CrossAccountId, contract: H160) -> DispatchResult {
-			Pallet::<T>::ensure_owner(contract, *sender.as_eth())?;
+		pub fn force_set_sponsor(
+			sender: &T::CrossAccountId,
+			contract_address: H160,
+			sponsor: &T::CrossAccountId,
+		) -> DispatchResult {
+			Pallet::<T>::ensure_owner(contract_address, *sender.as_eth())?;
 			Sponsoring::<T>::insert(
-				contract,
+				contract_address,
 				SponsorshipState::<T::CrossAccountId>::Confirmed(T::CrossAccountId::from_eth(
-					contract,
+					contract_address,
 				)),
 			);
+
+			let eth_sponsor = *sponsor.as_eth();
+			let sub_sponsor = sponsor.as_sub().clone();
+
+			<Pallet<T>>::deposit_event(Event::<T>::ContractSponsorSet(
+				contract_address,
+				sub_sponsor.clone(),
+			));
+			<PalletEvm<T>>::deposit_log(
+				ContractHelpersEvents::ContractSponsorSet {
+					contract_address,
+					sponsor: eth_sponsor,
+				}
+				.to_log(contract_address),
+			);
+
+			<Pallet<T>>::deposit_event(Event::<T>::ContractSponsorshipConfirmed(
+				contract_address,
+				sub_sponsor,
+			));
+			<PalletEvm<T>>::deposit_log(
+				ContractHelpersEvents::ContractSponsorshipConfirmed {
+					contract_address,
+					sponsor: eth_sponsor,
+				}
+				.to_log(contract_address),
+			);
+
 			Ok(())
 		}
 
 		/// Remove sponsor for `contract`.
 		///
 		/// `sender` must be owner of contract.
-		pub fn remove_sponsor(sender: &T::CrossAccountId, contract: H160) -> DispatchResult {
-			Pallet::<T>::ensure_owner(contract, *sender.as_eth())?;
-			Sponsoring::<T>::remove(contract);
+		pub fn remove_sponsor(sender: &T::CrossAccountId, contract_address: H160) -> DispatchResult {
+			Pallet::<T>::ensure_owner(contract_address, *sender.as_eth())?;
+			Sponsoring::<T>::remove(contract_address);
+
+			<Pallet<T>>::deposit_event(Event::<T>::ContractSponsorRemoved(contract_address));
+			<PalletEvm<T>>::deposit_log(
+				ContractHelpersEvents::ContractSponsorRemoved { contract_address }.to_log(contract_address),
+			);
+
 			Ok(())
 		}
 
 		/// Confirm sponsorship.
 		///
 		/// `sender` must be same that set via [`set_sponsor`].
-		pub fn confirm_sponsorship(sender: &T::CrossAccountId, contract: H160) -> DispatchResult {
-			match Sponsoring::<T>::get(contract) {
+		pub fn confirm_sponsorship(sender: &T::CrossAccountId, contract_address: H160) -> DispatchResult {
+			match Sponsoring::<T>::get(contract_address) {
 				SponsorshipState::Unconfirmed(sponsor) => {
 					ensure!(sponsor == *sender, Error::<T>::NoPermission);
+					let eth_sponsor = *sponsor.as_eth();
+					let sub_sponsor = sponsor.as_sub().clone();
 					Sponsoring::<T>::insert(
-						contract,
+						contract_address,
 						SponsorshipState::<T::CrossAccountId>::Confirmed(sponsor),
 					);
+
+					<Pallet<T>>::deposit_event(Event::<T>::ContractSponsorshipConfirmed(
+						contract_address,
+						sub_sponsor,
+					));
+					<PalletEvm<T>>::deposit_log(
+						ContractHelpersEvents::ContractSponsorshipConfirmed {
+							contract_address,
+							sponsor: eth_sponsor,
+						}
+						.to_log(contract_address),
+					);
+
 					Ok(())
 				}
 				SponsorshipState::Disabled | SponsorshipState::Confirmed(_) => {
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 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}
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/// @dev inlined interface25contract ContractHelpersEvents {26	event ContractSponsorSet(address indexed contractAddress, address sponsor);27	event ContractSponsorshipConfirmed(28		address indexed contractAddress,29		address sponsor30	);31	event ContractSponsorRemoved(address indexed contractAddress);32}3334/// @title Magic contract, which allows users to reconfigure other contracts35/// @dev the ERC-165 identifier for this interface is 0xd77fab7036contract ContractHelpers is Dummy, ERC165, ContractHelpersEvents {37	/// Get user, which deployed specified contract38	/// @dev May return zero address in case if contract is deployed39	///  using uniquenetwork evm-migration pallet, or using other terms not40	///  intended by pallet-evm41	/// @dev Returns zero address if contract does not exists42	/// @param contractAddress Contract to get owner of43	/// @return address Owner of contract44	/// @dev EVM selector for this function is: 0x5152b14c,45	///  or in textual repr: contractOwner(address)46	function contractOwner(address contractAddress)47		public48		view49		returns (address)50	{51		require(false, stub_error);52		contractAddress;53		dummy;54		return 0x0000000000000000000000000000000000000000;55	}5657	/// Set sponsor.58	/// @param contractAddress Contract for which a sponsor is being established.59	/// @param sponsor User address who set as pending sponsor.60	/// @dev EVM selector for this function is: 0xf01fba93,61	///  or in textual repr: setSponsor(address,address)62	function setSponsor(address contractAddress, address sponsor) public {63		require(false, stub_error);64		contractAddress;65		sponsor;66		dummy = 0;67	}6869	/// Set contract as self sponsored.70	///71	/// @param contractAddress Contract for which a self sponsoring is being enabled.72	/// @dev EVM selector for this function is: 0x89f7d9ae,73	///  or in textual repr: selfSponsoredEnable(address)74	function selfSponsoredEnable(address contractAddress) public {75		require(false, stub_error);76		contractAddress;77		dummy = 0;78	}7980	/// Remove sponsor.81	///82	/// @param contractAddress Contract for which a sponsorship is being removed.83	/// @dev EVM selector for this function is: 0xef784250,84	///  or in textual repr: removeSponsor(address)85	function removeSponsor(address contractAddress) public {86		require(false, stub_error);87		contractAddress;88		dummy = 0;89	}9091	/// Confirm sponsorship.92	///93	/// @dev Caller must be same that set via [`setSponsor`].94	///95	/// @param contractAddress Сontract for which need to confirm sponsorship.96	/// @dev EVM selector for this function is: 0xabc00001,97	///  or in textual repr: confirmSponsorship(address)98	function confirmSponsorship(address contractAddress) public {99		require(false, stub_error);100		contractAddress;101		dummy = 0;102	}103104	/// Get current sponsor.105	///106	/// @param contractAddress The contract for which a sponsor is requested.107	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.108	/// @dev EVM selector for this function is: 0x743fc745,109	///  or in textual repr: getSponsor(address)110	function getSponsor(address contractAddress)111		public112		view113		returns (Tuple0 memory)114	{115		require(false, stub_error);116		contractAddress;117		dummy;118		return Tuple0(0x0000000000000000000000000000000000000000, 0);119	}120121	/// Check tat contract has confirmed sponsor.122	///123	/// @param contractAddress The contract for which the presence of a confirmed sponsor is checked.124	/// @return **true** if contract has confirmed sponsor.125	/// @dev EVM selector for this function is: 0x97418603,126	///  or in textual repr: hasSponsor(address)127	function hasSponsor(address contractAddress) public view returns (bool) {128		require(false, stub_error);129		contractAddress;130		dummy;131		return false;132	}133134	/// Check tat contract has pending sponsor.135	///136	/// @param contractAddress The contract for which the presence of a pending sponsor is checked.137	/// @return **true** if contract has pending sponsor.138	/// @dev EVM selector for this function is: 0x39b9b242,139	///  or in textual repr: hasPendingSponsor(address)140	function hasPendingSponsor(address contractAddress)141		public142		view143		returns (bool)144	{145		require(false, stub_error);146		contractAddress;147		dummy;148		return false;149	}150151	/// @dev EVM selector for this function is: 0x6027dc61,152	///  or in textual repr: sponsoringEnabled(address)153	function sponsoringEnabled(address contractAddress)154		public155		view156		returns (bool)157	{158		require(false, stub_error);159		contractAddress;160		dummy;161		return false;162	}163164	/// @dev EVM selector for this function is: 0xfde8a560,165	///  or in textual repr: setSponsoringMode(address,uint8)166	function setSponsoringMode(address contractAddress, uint8 mode) public {167		require(false, stub_error);168		contractAddress;169		mode;170		dummy = 0;171	}172173	/// Get current contract sponsoring rate limit174	/// @param contractAddress Contract to get sponsoring mode of175	/// @return uint32 Amount of blocks between two sponsored transactions176	/// @dev EVM selector for this function is: 0x610cfabd,177	///  or in textual repr: getSponsoringRateLimit(address)178	function getSponsoringRateLimit(address contractAddress)179		public180		view181		returns (uint32)182	{183		require(false, stub_error);184		contractAddress;185		dummy;186		return 0;187	}188189	/// Set contract sponsoring rate limit190	/// @dev Sponsoring rate limit - is a minimum amount of blocks that should191	///  pass between two sponsored transactions192	/// @param contractAddress Contract to change sponsoring rate limit of193	/// @param rateLimit Target rate limit194	/// @dev Only contract owner can change this setting195	/// @dev EVM selector for this function is: 0x77b6c908,196	///  or in textual repr: setSponsoringRateLimit(address,uint32)197	function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)198		public199	{200		require(false, stub_error);201		contractAddress;202		rateLimit;203		dummy = 0;204	}205206	/// Is specified user present in contract allow list207	/// @dev Contract owner always implicitly included208	/// @param contractAddress Contract to check allowlist of209	/// @param user User to check210	/// @return bool Is specified users exists in contract allowlist211	/// @dev EVM selector for this function is: 0x5c658165,212	///  or in textual repr: allowed(address,address)213	function allowed(address contractAddress, address user)214		public215		view216		returns (bool)217	{218		require(false, stub_error);219		contractAddress;220		user;221		dummy;222		return false;223	}224225	/// Toggle user presence in contract allowlist226	/// @param contractAddress Contract to change allowlist of227	/// @param user Which user presence should be toggled228	/// @param isAllowed `true` if user should be allowed to be sponsored229	///  or call this contract, `false` otherwise230	/// @dev Only contract owner can change this setting231	/// @dev EVM selector for this function is: 0x4706cc1c,232	///  or in textual repr: toggleAllowed(address,address,bool)233	function toggleAllowed(234		address contractAddress,235		address user,236		bool isAllowed237	) public {238		require(false, stub_error);239		contractAddress;240		user;241		isAllowed;242		dummy = 0;243	}244245	/// Is this contract has allowlist access enabled246	/// @dev Allowlist always can have users, and it is used for two purposes:247	///  in case of allowlist sponsoring mode, users will be sponsored if they exist in allowlist248	///  in case of allowlist access enabled, only users from allowlist may call this contract249	/// @param contractAddress Contract to get allowlist access of250	/// @return bool Is specified contract has allowlist access enabled251	/// @dev EVM selector for this function is: 0xc772ef6c,252	///  or in textual repr: allowlistEnabled(address)253	function allowlistEnabled(address contractAddress)254		public255		view256		returns (bool)257	{258		require(false, stub_error);259		contractAddress;260		dummy;261		return false;262	}263264	/// Toggle contract allowlist access265	/// @param contractAddress Contract to change allowlist access of266	/// @param enabled Should allowlist access to be enabled?267	/// @dev EVM selector for this function is: 0x36de20f5,268	///  or in textual repr: toggleAllowlist(address,bool)269	function toggleAllowlist(address contractAddress, bool enabled) public {270		require(false, stub_error);271		contractAddress;272		enabled;273		dummy = 0;274	}275}276277/// @dev anonymous struct278struct Tuple0 {279	address field_0;280	uint256 field_1;281}
modifiedruntime/common/config/ethereum.rsdiffbeforeafterboth
--- a/runtime/common/config/ethereum.rs
+++ b/runtime/common/config/ethereum.rs
@@ -112,6 +112,7 @@
 }
 
 impl pallet_evm_contract_helpers::Config for Runtime {
+	type Event = Event;
 	type ContractAddress = HelpersContractAddress;
 	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;
 }
modifiedruntime/common/construct_runtime/mod.rsdiffbeforeafterboth
--- a/runtime/common/construct_runtime/mod.rs
+++ b/runtime/common/construct_runtime/mod.rs
@@ -85,7 +85,7 @@
                 Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,
 
                 EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,
-                EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,
+                EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage, Event<T>} = 151,
                 EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,
                 EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,
             }
modifiedtests/src/eth/api/ContractHelpers.soldiffbeforeafterboth
--- a/tests/src/eth/api/ContractHelpers.sol
+++ b/tests/src/eth/api/ContractHelpers.sol
@@ -12,9 +12,19 @@
 	function supportsInterface(bytes4 interfaceID) external view returns (bool);
 }
 
+/// @dev inlined interface
+interface ContractHelpersEvents {
+	event ContractSponsorSet(address indexed contractAddress, address sponsor);
+	event ContractSponsorshipConfirmed(
+		address indexed contractAddress,
+		address sponsor
+	);
+	event ContractSponsorRemoved(address indexed contractAddress);
+}
+
 /// @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 {
+interface ContractHelpers is Dummy, ERC165, ContractHelpersEvents {
 	/// 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
modifiedtests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth
--- a/tests/src/eth/contractSponsoring.test.ts
+++ b/tests/src/eth/contractSponsoring.test.ts
@@ -24,6 +24,7 @@
   SponsoringMode,
   createEthAccount,
   ethBalanceViaSub,
+  normalizeEvents,
 } from './util/helpers';
 
 describe('Sponsoring EVM contracts', () => {
@@ -36,6 +37,33 @@
     expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;
   });
 
+  itWeb3.only('Set self sponsored events', async ({api, web3, privateKeyWrapper}) => {
+    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+    const flipper = await deployFlipper(web3, owner);
+    const helpers = contractHelpers(web3, owner);
+    
+    const result = await helpers.methods.selfSponsoredEnable(flipper.options.address).send();
+    const events = normalizeEvents(result.events);
+    expect(events).to.be.deep.equal([
+      {
+        address: flipper.options.address,
+        event: 'ContractSponsorSet',
+        args: {
+          contractAddress: flipper.options.address,
+          sponsor: flipper.options.address,
+        },
+      },
+      {
+        address: flipper.options.address,
+        event: 'ContractSponsorshipConfirmed',
+        args: {
+          contractAddress: flipper.options.address,
+          sponsor: flipper.options.address,
+        },
+      },
+    ]);
+  });
+
   itWeb3('Self sponsored can not be set by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
@@ -75,6 +103,26 @@
     expect(await helpers.methods.hasPendingSponsor(flipper.options.address).call()).to.be.true;
   });
   
+  itWeb3('Set sponsor event', async ({api, web3, privateKeyWrapper}) => {
+    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+    const flipper = await deployFlipper(web3, owner);
+    const helpers = contractHelpers(web3, owner);
+    
+    const result = await helpers.methods.setSponsor(flipper.options.address, sponsor).send();
+    const events = normalizeEvents(result.events);
+    expect(events).to.be.deep.equal([
+      {
+        address: flipper.options.address,
+        event: 'ContractSponsorSet',
+        args: {
+          contractAddress: flipper.options.address,
+          sponsor: sponsor,
+        },
+      },
+    ]);
+  });
+  
   itWeb3('Sponsor can not be set by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
@@ -97,6 +145,26 @@
     expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;
   });
 
+  itWeb3('Confirm sponsorship event', async ({api, web3, privateKeyWrapper}) => {
+    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+    const flipper = await deployFlipper(web3, owner);
+    const helpers = contractHelpers(web3, owner);
+    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).send()).to.be.not.rejected;
+    const result = await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});
+    const events = normalizeEvents(result.events);
+    expect(events).to.be.deep.equal([
+      {
+        address: flipper.options.address,
+        event: 'ContractSponsorshipConfirmed',
+        args: {
+          contractAddress: flipper.options.address,
+          sponsor: sponsor,
+        },
+      },
+    ]);
+  });
+
   itWeb3('Sponsorship can not be confirmed by the address that not pending as sponsor', async ({api, web3, privateKeyWrapper}) => {
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
@@ -160,6 +228,28 @@
     expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;
   });
 
+  itWeb3('Remove sponsor event', async ({api, web3, privateKeyWrapper}) => {
+    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+    const flipper = await deployFlipper(web3, owner);
+    const helpers = contractHelpers(web3, owner);
+
+    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();
+    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});
+    
+    const result = await helpers.methods.removeSponsor(flipper.options.address).send();
+    const events = normalizeEvents(result.events);
+    expect(events).to.be.deep.equal([
+      {
+        address: flipper.options.address,
+        event: 'ContractSponsorRemoved',
+        args: {
+          contractAddress: flipper.options.address,
+        },
+      },
+    ]);
+  });
+
   itWeb3('Sponsor can not be removed by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
modifiedtests/src/eth/util/contractHelpersAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/util/contractHelpersAbi.json
+++ b/tests/src/eth/util/contractHelpersAbi.json
@@ -1,5 +1,56 @@
 [
   {
+    "anonymous": false,
+    "inputs": [
+      {
+        "indexed": true,
+        "internalType": "address",
+        "name": "contractAddress",
+        "type": "address"
+      }
+    ],
+    "name": "ContractSponsorRemoved",
+    "type": "event"
+  },
+  {
+    "anonymous": false,
+    "inputs": [
+      {
+        "indexed": true,
+        "internalType": "address",
+        "name": "contractAddress",
+        "type": "address"
+      },
+      {
+        "indexed": false,
+        "internalType": "address",
+        "name": "sponsor",
+        "type": "address"
+      }
+    ],
+    "name": "ContractSponsorSet",
+    "type": "event"
+  },
+  {
+    "anonymous": false,
+    "inputs": [
+      {
+        "indexed": true,
+        "internalType": "address",
+        "name": "contractAddress",
+        "type": "address"
+      },
+      {
+        "indexed": false,
+        "internalType": "address",
+        "name": "sponsor",
+        "type": "address"
+      }
+    ],
+    "name": "ContractSponsorshipConfirmed",
+    "type": "event"
+  },
+  {
     "inputs": [
       {
         "internalType": "address",