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
--- a/pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
+++ b/pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
@@ -21,9 +21,19 @@
 	}
 }
 
+/// @dev inlined interface
+contract 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
-contract ContractHelpers is Dummy, ERC165 {
+contract 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
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
before · tests/src/eth/api/ContractHelpers.sol
1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56/// @dev common stubs holder7interface Dummy {89}1011interface ERC165 is Dummy {12	function supportsInterface(bytes4 interfaceID) external view returns (bool);13}1415/// @title Magic contract, which allows users to reconfigure other contracts16/// @dev the ERC-165 identifier for this interface is 0xd77fab7017interface ContractHelpers is Dummy, ERC165 {18	/// Get user, which deployed specified contract19	/// @dev May return zero address in case if contract is deployed20	///  using uniquenetwork evm-migration pallet, or using other terms not21	///  intended by pallet-evm22	/// @dev Returns zero address if contract does not exists23	/// @param contractAddress Contract to get owner of24	/// @return address Owner of contract25	/// @dev EVM selector for this function is: 0x5152b14c,26	///  or in textual repr: contractOwner(address)27	function contractOwner(address contractAddress)28		external29		view30		returns (address);3132	/// Set sponsor.33	/// @param contractAddress Contract for which a sponsor is being established.34	/// @param sponsor User address who set as pending sponsor.35	/// @dev EVM selector for this function is: 0xf01fba93,36	///  or in textual repr: setSponsor(address,address)37	function setSponsor(address contractAddress, address sponsor) external;3839	/// Set contract as self sponsored.40	///41	/// @param contractAddress Contract for which a self sponsoring is being enabled.42	/// @dev EVM selector for this function is: 0x89f7d9ae,43	///  or in textual repr: selfSponsoredEnable(address)44	function selfSponsoredEnable(address contractAddress) external;4546	/// Remove sponsor.47	///48	/// @param contractAddress Contract for which a sponsorship is being removed.49	/// @dev EVM selector for this function is: 0xef784250,50	///  or in textual repr: removeSponsor(address)51	function removeSponsor(address contractAddress) external;5253	/// Confirm sponsorship.54	///55	/// @dev Caller must be same that set via [`setSponsor`].56	///57	/// @param contractAddress Сontract for which need to confirm sponsorship.58	/// @dev EVM selector for this function is: 0xabc00001,59	///  or in textual repr: confirmSponsorship(address)60	function confirmSponsorship(address contractAddress) external;6162	/// Get current sponsor.63	///64	/// @param contractAddress The contract for which a sponsor is requested.65	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.66	/// @dev EVM selector for this function is: 0x743fc745,67	///  or in textual repr: getSponsor(address)68	function getSponsor(address contractAddress)69		external70		view71		returns (Tuple0 memory);7273	/// Check tat contract has confirmed sponsor.74	///75	/// @param contractAddress The contract for which the presence of a confirmed sponsor is checked.76	/// @return **true** if contract has confirmed sponsor.77	/// @dev EVM selector for this function is: 0x97418603,78	///  or in textual repr: hasSponsor(address)79	function hasSponsor(address contractAddress) external view returns (bool);8081	/// Check tat contract has pending sponsor.82	///83	/// @param contractAddress The contract for which the presence of a pending sponsor is checked.84	/// @return **true** if contract has pending sponsor.85	/// @dev EVM selector for this function is: 0x39b9b242,86	///  or in textual repr: hasPendingSponsor(address)87	function hasPendingSponsor(address contractAddress)88		external89		view90		returns (bool);9192	/// @dev EVM selector for this function is: 0x6027dc61,93	///  or in textual repr: sponsoringEnabled(address)94	function sponsoringEnabled(address contractAddress)95		external96		view97		returns (bool);9899	/// @dev EVM selector for this function is: 0xfde8a560,100	///  or in textual repr: setSponsoringMode(address,uint8)101	function setSponsoringMode(address contractAddress, uint8 mode) external;102103	/// Get current contract sponsoring rate limit104	/// @param contractAddress Contract to get sponsoring mode of105	/// @return uint32 Amount of blocks between two sponsored transactions106	/// @dev EVM selector for this function is: 0x610cfabd,107	///  or in textual repr: getSponsoringRateLimit(address)108	function getSponsoringRateLimit(address contractAddress)109		external110		view111		returns (uint32);112113	/// Set contract sponsoring rate limit114	/// @dev Sponsoring rate limit - is a minimum amount of blocks that should115	///  pass between two sponsored transactions116	/// @param contractAddress Contract to change sponsoring rate limit of117	/// @param rateLimit Target rate limit118	/// @dev Only contract owner can change this setting119	/// @dev EVM selector for this function is: 0x77b6c908,120	///  or in textual repr: setSponsoringRateLimit(address,uint32)121	function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)122		external;123124	/// Is specified user present in contract allow list125	/// @dev Contract owner always implicitly included126	/// @param contractAddress Contract to check allowlist of127	/// @param user User to check128	/// @return bool Is specified users exists in contract allowlist129	/// @dev EVM selector for this function is: 0x5c658165,130	///  or in textual repr: allowed(address,address)131	function allowed(address contractAddress, address user)132		external133		view134		returns (bool);135136	/// Toggle user presence in contract allowlist137	/// @param contractAddress Contract to change allowlist of138	/// @param user Which user presence should be toggled139	/// @param isAllowed `true` if user should be allowed to be sponsored140	///  or call this contract, `false` otherwise141	/// @dev Only contract owner can change this setting142	/// @dev EVM selector for this function is: 0x4706cc1c,143	///  or in textual repr: toggleAllowed(address,address,bool)144	function toggleAllowed(145		address contractAddress,146		address user,147		bool isAllowed148	) external;149150	/// Is this contract has allowlist access enabled151	/// @dev Allowlist always can have users, and it is used for two purposes:152	///  in case of allowlist sponsoring mode, users will be sponsored if they exist in allowlist153	///  in case of allowlist access enabled, only users from allowlist may call this contract154	/// @param contractAddress Contract to get allowlist access of155	/// @return bool Is specified contract has allowlist access enabled156	/// @dev EVM selector for this function is: 0xc772ef6c,157	///  or in textual repr: allowlistEnabled(address)158	function allowlistEnabled(address contractAddress)159		external160		view161		returns (bool);162163	/// Toggle contract allowlist access164	/// @param contractAddress Contract to change allowlist access of165	/// @param enabled Should allowlist access to be enabled?166	/// @dev EVM selector for this function is: 0x36de20f5,167	///  or in textual repr: toggleAllowlist(address,bool)168	function toggleAllowlist(address contractAddress, bool enabled) external;169}170171/// @dev anonymous struct172struct Tuple0 {173	address field_0;174	uint256 field_1;175}
after · tests/src/eth/api/ContractHelpers.sol
1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56/// @dev common stubs holder7interface Dummy {89}1011interface ERC165 is Dummy {12	function supportsInterface(bytes4 interfaceID) external view returns (bool);13}1415/// @dev inlined interface16interface ContractHelpersEvents {17	event ContractSponsorSet(address indexed contractAddress, address sponsor);18	event ContractSponsorshipConfirmed(19		address indexed contractAddress,20		address sponsor21	);22	event ContractSponsorRemoved(address indexed contractAddress);23}2425/// @title Magic contract, which allows users to reconfigure other contracts26/// @dev the ERC-165 identifier for this interface is 0xd77fab7027interface ContractHelpers is Dummy, ERC165, ContractHelpersEvents {28	/// Get user, which deployed specified contract29	/// @dev May return zero address in case if contract is deployed30	///  using uniquenetwork evm-migration pallet, or using other terms not31	///  intended by pallet-evm32	/// @dev Returns zero address if contract does not exists33	/// @param contractAddress Contract to get owner of34	/// @return address Owner of contract35	/// @dev EVM selector for this function is: 0x5152b14c,36	///  or in textual repr: contractOwner(address)37	function contractOwner(address contractAddress)38		external39		view40		returns (address);4142	/// Set sponsor.43	/// @param contractAddress Contract for which a sponsor is being established.44	/// @param sponsor User address who set as pending sponsor.45	/// @dev EVM selector for this function is: 0xf01fba93,46	///  or in textual repr: setSponsor(address,address)47	function setSponsor(address contractAddress, address sponsor) external;4849	/// Set contract as self sponsored.50	///51	/// @param contractAddress Contract for which a self sponsoring is being enabled.52	/// @dev EVM selector for this function is: 0x89f7d9ae,53	///  or in textual repr: selfSponsoredEnable(address)54	function selfSponsoredEnable(address contractAddress) external;5556	/// Remove sponsor.57	///58	/// @param contractAddress Contract for which a sponsorship is being removed.59	/// @dev EVM selector for this function is: 0xef784250,60	///  or in textual repr: removeSponsor(address)61	function removeSponsor(address contractAddress) external;6263	/// Confirm sponsorship.64	///65	/// @dev Caller must be same that set via [`setSponsor`].66	///67	/// @param contractAddress Сontract for which need to confirm sponsorship.68	/// @dev EVM selector for this function is: 0xabc00001,69	///  or in textual repr: confirmSponsorship(address)70	function confirmSponsorship(address contractAddress) external;7172	/// Get current sponsor.73	///74	/// @param contractAddress The contract for which a sponsor is requested.75	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.76	/// @dev EVM selector for this function is: 0x743fc745,77	///  or in textual repr: getSponsor(address)78	function getSponsor(address contractAddress)79		external80		view81		returns (Tuple0 memory);8283	/// Check tat contract has confirmed sponsor.84	///85	/// @param contractAddress The contract for which the presence of a confirmed sponsor is checked.86	/// @return **true** if contract has confirmed sponsor.87	/// @dev EVM selector for this function is: 0x97418603,88	///  or in textual repr: hasSponsor(address)89	function hasSponsor(address contractAddress) external view returns (bool);9091	/// Check tat contract has pending sponsor.92	///93	/// @param contractAddress The contract for which the presence of a pending sponsor is checked.94	/// @return **true** if contract has pending sponsor.95	/// @dev EVM selector for this function is: 0x39b9b242,96	///  or in textual repr: hasPendingSponsor(address)97	function hasPendingSponsor(address contractAddress)98		external99		view100		returns (bool);101102	/// @dev EVM selector for this function is: 0x6027dc61,103	///  or in textual repr: sponsoringEnabled(address)104	function sponsoringEnabled(address contractAddress)105		external106		view107		returns (bool);108109	/// @dev EVM selector for this function is: 0xfde8a560,110	///  or in textual repr: setSponsoringMode(address,uint8)111	function setSponsoringMode(address contractAddress, uint8 mode) external;112113	/// Get current contract sponsoring rate limit114	/// @param contractAddress Contract to get sponsoring mode of115	/// @return uint32 Amount of blocks between two sponsored transactions116	/// @dev EVM selector for this function is: 0x610cfabd,117	///  or in textual repr: getSponsoringRateLimit(address)118	function getSponsoringRateLimit(address contractAddress)119		external120		view121		returns (uint32);122123	/// Set contract sponsoring rate limit124	/// @dev Sponsoring rate limit - is a minimum amount of blocks that should125	///  pass between two sponsored transactions126	/// @param contractAddress Contract to change sponsoring rate limit of127	/// @param rateLimit Target rate limit128	/// @dev Only contract owner can change this setting129	/// @dev EVM selector for this function is: 0x77b6c908,130	///  or in textual repr: setSponsoringRateLimit(address,uint32)131	function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)132		external;133134	/// Is specified user present in contract allow list135	/// @dev Contract owner always implicitly included136	/// @param contractAddress Contract to check allowlist of137	/// @param user User to check138	/// @return bool Is specified users exists in contract allowlist139	/// @dev EVM selector for this function is: 0x5c658165,140	///  or in textual repr: allowed(address,address)141	function allowed(address contractAddress, address user)142		external143		view144		returns (bool);145146	/// Toggle user presence in contract allowlist147	/// @param contractAddress Contract to change allowlist of148	/// @param user Which user presence should be toggled149	/// @param isAllowed `true` if user should be allowed to be sponsored150	///  or call this contract, `false` otherwise151	/// @dev Only contract owner can change this setting152	/// @dev EVM selector for this function is: 0x4706cc1c,153	///  or in textual repr: toggleAllowed(address,address,bool)154	function toggleAllowed(155		address contractAddress,156		address user,157		bool isAllowed158	) external;159160	/// Is this contract has allowlist access enabled161	/// @dev Allowlist always can have users, and it is used for two purposes:162	///  in case of allowlist sponsoring mode, users will be sponsored if they exist in allowlist163	///  in case of allowlist access enabled, only users from allowlist may call this contract164	/// @param contractAddress Contract to get allowlist access of165	/// @return bool Is specified contract has allowlist access enabled166	/// @dev EVM selector for this function is: 0xc772ef6c,167	///  or in textual repr: allowlistEnabled(address)168	function allowlistEnabled(address contractAddress)169		external170		view171		returns (bool);172173	/// Toggle contract allowlist access174	/// @param contractAddress Contract to change allowlist access of175	/// @param enabled Should allowlist access to be enabled?176	/// @dev EVM selector for this function is: 0x36de20f5,177	///  or in textual repr: toggleAllowlist(address,bool)178	function toggleAllowlist(address contractAddress, bool enabled) external;179}180181/// @dev anonymous struct182struct Tuple0 {183	address field_0;184	uint256 field_1;185}
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",