git.delta.rocks / unique-network / refs/commits / 065efcff5337

difftreelog

Merge pull request #598 from UniqueNetwork/fix/rename_method_to_collectionSponsor

Yaroslav Bolyukin2022-09-19parents: #25e3cfa #2319928.patch.diff
in: master

24 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -194,7 +194,7 @@
 	/// Get current sponsor.
 	///
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
-	fn get_collection_sponsor(&self) -> Result<(address, uint256)> {
+	fn collection_sponsor(&self) -> Result<(address, uint256)> {
 		let sponsor = match self.collection.sponsorship.sponsor() {
 			Some(sponsor) => sponsor,
 			None => return Ok(Default::default()),
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -169,7 +169,7 @@
 	///
 	/// @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.
-	fn get_sponsor(&self, contract_address: address) -> Result<(address, uint256)> {
+	fn sponsor(&self, contract_address: address) -> Result<(address, uint256)> {
 		let sponsor =
 			Pallet::<T>::get_sponsor(contract_address).ok_or("Contract has no sponsor")?;
 		Ok(pallet_common::eth::convert_cross_account_to_tuple::<T>(
@@ -220,7 +220,7 @@
 	/// Get current contract sponsoring rate limit
 	/// @param contractAddress Contract to get sponsoring rate limit of
 	/// @return uint32 Amount of blocks between two sponsored transactions
-	fn get_sponsoring_rate_limit(&self, contract_address: address) -> Result<uint32> {
+	fn sponsoring_rate_limit(&self, contract_address: address) -> Result<uint32> {
 		self.recorder().consume_sload()?;
 
 		Ok(<SponsoringRateLimit<T>>::get(contract_address)
@@ -273,7 +273,7 @@
 	/// @param contractAddress Contract to get sponsoring fee limit of
 	/// @return uint256 Maximum amount of fee that could be spent by single
 	///  transaction
-	fn get_sponsoring_fee_limit(&self, contract_address: address) -> Result<uint256> {
+	fn sponsoring_fee_limit(&self, contract_address: address) -> Result<uint256> {
 		self.recorder().consume_sload()?;
 
 		Ok(get_sponsoring_fee_limit::<T>(contract_address))
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
@@ -10,11 +10,7 @@
 }
 
 contract ERC165 is Dummy {
-	function supportsInterface(bytes4 interfaceID)
-		external
-		view
-		returns (bool)
-	{
+	function supportsInterface(bytes4 interfaceID) external view returns (bool) {
 		require(false, stub_error);
 		interfaceID;
 		return true;
@@ -24,15 +20,12 @@
 /// @dev inlined interface
 contract ContractHelpersEvents {
 	event ContractSponsorSet(address indexed contractAddress, address sponsor);
-	event ContractSponsorshipConfirmed(
-		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 0x172cb4fb
+/// @dev the ERC-165 identifier for this interface is 0x30afad04
 contract ContractHelpers is Dummy, ERC165, ContractHelpersEvents {
 	/// Get user, which deployed specified contract
 	/// @dev May return zero address in case if contract is deployed
@@ -43,11 +36,7 @@
 	/// @return address Owner of contract
 	/// @dev EVM selector for this function is: 0x5152b14c,
 	///  or in textual repr: contractOwner(address)
-	function contractOwner(address contractAddress)
-		public
-		view
-		returns (address)
-	{
+	function contractOwner(address contractAddress) public view returns (address) {
 		require(false, stub_error);
 		contractAddress;
 		dummy;
@@ -105,13 +94,9 @@
 	///
 	/// @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.
-	/// @dev EVM selector for this function is: 0x743fc745,
-	///  or in textual repr: getSponsor(address)
-	function getSponsor(address contractAddress)
-		public
-		view
-		returns (Tuple0 memory)
-	{
+	/// @dev EVM selector for this function is: 0x766c4f37,
+	///  or in textual repr: sponsor(address)
+	function sponsor(address contractAddress) public view returns (Tuple0 memory) {
 		require(false, stub_error);
 		contractAddress;
 		dummy;
@@ -137,11 +122,7 @@
 	/// @return **true** if contract has pending sponsor.
 	/// @dev EVM selector for this function is: 0x39b9b242,
 	///  or in textual repr: hasPendingSponsor(address)
-	function hasPendingSponsor(address contractAddress)
-		public
-		view
-		returns (bool)
-	{
+	function hasPendingSponsor(address contractAddress) public view returns (bool) {
 		require(false, stub_error);
 		contractAddress;
 		dummy;
@@ -150,11 +131,7 @@
 
 	/// @dev EVM selector for this function is: 0x6027dc61,
 	///  or in textual repr: sponsoringEnabled(address)
-	function sponsoringEnabled(address contractAddress)
-		public
-		view
-		returns (bool)
-	{
+	function sponsoringEnabled(address contractAddress) public view returns (bool) {
 		require(false, stub_error);
 		contractAddress;
 		dummy;
@@ -173,13 +150,9 @@
 	/// Get current contract sponsoring rate limit
 	/// @param contractAddress Contract to get sponsoring rate limit 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)
-		public
-		view
-		returns (uint32)
-	{
+	/// @dev EVM selector for this function is: 0xf29694d8,
+	///  or in textual repr: sponsoringRateLimit(address)
+	function sponsoringRateLimit(address contractAddress) public view returns (uint32) {
 		require(false, stub_error);
 		contractAddress;
 		dummy;
@@ -194,9 +167,7 @@
 	/// @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)
-		public
-	{
+	function setSponsoringRateLimit(address contractAddress, uint32 rateLimit) public {
 		require(false, stub_error);
 		contractAddress;
 		rateLimit;
@@ -211,9 +182,7 @@
 	/// @dev Only contract owner can change this setting
 	/// @dev EVM selector for this function is: 0x03aed665,
 	///  or in textual repr: setSponsoringFeeLimit(address,uint256)
-	function setSponsoringFeeLimit(address contractAddress, uint256 feeLimit)
-		public
-	{
+	function setSponsoringFeeLimit(address contractAddress, uint256 feeLimit) public {
 		require(false, stub_error);
 		contractAddress;
 		feeLimit;
@@ -224,13 +193,9 @@
 	/// @param contractAddress Contract to get sponsoring fee limit of
 	/// @return uint256 Maximum amount of fee that could be spent by single
 	///  transaction
-	/// @dev EVM selector for this function is: 0xc3fdc9ee,
-	///  or in textual repr: getSponsoringFeeLimit(address)
-	function getSponsoringFeeLimit(address contractAddress)
-		public
-		view
-		returns (uint256)
-	{
+	/// @dev EVM selector for this function is: 0x75b73606,
+	///  or in textual repr: sponsoringFeeLimit(address)
+	function sponsoringFeeLimit(address contractAddress) public view returns (uint256) {
 		require(false, stub_error);
 		contractAddress;
 		dummy;
@@ -244,11 +209,7 @@
 	/// @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)
-		public
-		view
-		returns (bool)
-	{
+	function allowed(address contractAddress, address user) public view returns (bool) {
 		require(false, stub_error);
 		contractAddress;
 		user;
@@ -284,11 +245,7 @@
 	/// @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)
-		public
-		view
-		returns (bool)
-	{
+	function allowlistEnabled(address contractAddress) public view returns (bool) {
 		require(false, stub_error);
 		contractAddress;
 		dummy;
modifiedpallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
--- a/pallets/fungible/src/stubs/UniqueFungible.sol
+++ b/pallets/fungible/src/stubs/UniqueFungible.sol
@@ -10,11 +10,7 @@
 }
 
 contract ERC165 is Dummy {
-	function supportsInterface(bytes4 interfaceID)
-		external
-		view
-		returns (bool)
-	{
+	function supportsInterface(bytes4 interfaceID) external view returns (bool) {
 		require(false, stub_error);
 		interfaceID;
 		return true;
@@ -22,7 +18,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x9f70d4e0
+/// @dev the ERC-165 identifier for this interface is 0x47dbc105
 contract Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -30,9 +26,7 @@
 	/// @param value Propery value.
 	/// @dev EVM selector for this function is: 0x2f073f66,
 	///  or in textual repr: setCollectionProperty(string,bytes)
-	function setCollectionProperty(string memory key, bytes memory value)
-		public
-	{
+	function setCollectionProperty(string memory key, bytes memory value) public {
 		require(false, stub_error);
 		key;
 		value;
@@ -58,11 +52,7 @@
 	/// @return bytes The property corresponding to the key.
 	/// @dev EVM selector for this function is: 0xcf24fd6d,
 	///  or in textual repr: collectionProperty(string)
-	function collectionProperty(string memory key)
-		public
-		view
-		returns (bytes memory)
-	{
+	function collectionProperty(string memory key) public view returns (bytes memory) {
 		require(false, stub_error);
 		key;
 		dummy;
@@ -95,6 +85,7 @@
 		dummy = 0;
 	}
 
+	/// Whether there is a pending sponsor.
 	/// @dev EVM selector for this function is: 0x058ac185,
 	///  or in textual repr: hasCollectionPendingSponsor()
 	function hasCollectionPendingSponsor() public view returns (bool) {
@@ -124,9 +115,9 @@
 	/// Get current sponsor.
 	///
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
-	/// @dev EVM selector for this function is: 0xb66bbc14,
-	///  or in textual repr: getCollectionSponsor()
-	function getCollectionSponsor() public view returns (Tuple6 memory) {
+	/// @dev EVM selector for this function is: 0x6ec0a9f1,
+	///  or in textual repr: collectionSponsor()
+	function collectionSponsor() public view returns (Tuple6 memory) {
 		require(false, stub_error);
 		dummy;
 		return Tuple6(0x0000000000000000000000000000000000000000, 0);
@@ -234,9 +225,7 @@
 	/// @param collections Addresses of collections that will be available for nesting.
 	/// @dev EVM selector for this function is: 0x64872396,
 	///  or in textual repr: setCollectionNesting(bool,address[])
-	function setCollectionNesting(bool enable, address[] memory collections)
-		public
-	{
+	function setCollectionNesting(bool enable, address[] memory collections) public {
 		require(false, stub_error);
 		enable;
 		collections;
@@ -353,9 +342,9 @@
 	/// @return `Fungible` or `NFT` or `ReFungible`
 	/// @dev EVM selector for this function is: 0xd34b55b8,
 	///  or in textual repr: uniqueCollectionType()
-	function uniqueCollectionType() public returns (string memory) {
+	function uniqueCollectionType() public view returns (string memory) {
 		require(false, stub_error);
-		dummy = 0;
+		dummy;
 		return "";
 	}
 
@@ -450,11 +439,7 @@
 /// @dev inlined interface
 contract ERC20Events {
 	event Transfer(address indexed from, address indexed to, uint256 value);
-	event Approval(
-		address indexed owner,
-		address indexed spender,
-		uint256 value
-	);
+	event Approval(address indexed owner, address indexed spender, uint256 value);
 }
 
 /// @dev the ERC-165 identifier for this interface is 0x942e8b22
@@ -537,11 +522,7 @@
 
 	/// @dev EVM selector for this function is: 0xdd62ed3e,
 	///  or in textual repr: allowance(address,address)
-	function allowance(address owner, address spender)
-		public
-		view
-		returns (uint256)
-	{
+	function allowance(address owner, address spender) public view returns (uint256) {
 		require(false, stub_error);
 		owner;
 		spender;
@@ -550,11 +531,4 @@
 	}
 }
 
-contract UniqueFungible is
-	Dummy,
-	ERC165,
-	ERC20,
-	ERC20Mintable,
-	ERC20UniqueExtensions,
-	Collection
-{}
+contract UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -10,11 +10,7 @@
 }
 
 contract ERC165 is Dummy {
-	function supportsInterface(bytes4 interfaceID)
-		external
-		view
-		returns (bool)
-	{
+	function supportsInterface(bytes4 interfaceID) external view returns (bool) {
 		require(false, stub_error);
 		interfaceID;
 		return true;
@@ -85,11 +81,7 @@
 	/// @return Property value bytes
 	/// @dev EVM selector for this function is: 0x7228c327,
 	///  or in textual repr: property(uint256,string)
-	function property(uint256 tokenId, string memory key)
-		public
-		view
-		returns (bytes memory)
-	{
+	function property(uint256 tokenId, string memory key) public view returns (bytes memory) {
 		require(false, stub_error);
 		tokenId;
 		key;
@@ -99,7 +91,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x9f70d4e0
+/// @dev the ERC-165 identifier for this interface is 0x47dbc105
 contract Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -107,9 +99,7 @@
 	/// @param value Propery value.
 	/// @dev EVM selector for this function is: 0x2f073f66,
 	///  or in textual repr: setCollectionProperty(string,bytes)
-	function setCollectionProperty(string memory key, bytes memory value)
-		public
-	{
+	function setCollectionProperty(string memory key, bytes memory value) public {
 		require(false, stub_error);
 		key;
 		value;
@@ -135,11 +125,7 @@
 	/// @return bytes The property corresponding to the key.
 	/// @dev EVM selector for this function is: 0xcf24fd6d,
 	///  or in textual repr: collectionProperty(string)
-	function collectionProperty(string memory key)
-		public
-		view
-		returns (bytes memory)
-	{
+	function collectionProperty(string memory key) public view returns (bytes memory) {
 		require(false, stub_error);
 		key;
 		dummy;
@@ -172,6 +158,7 @@
 		dummy = 0;
 	}
 
+	/// Whether there is a pending sponsor.
 	/// @dev EVM selector for this function is: 0x058ac185,
 	///  or in textual repr: hasCollectionPendingSponsor()
 	function hasCollectionPendingSponsor() public view returns (bool) {
@@ -201,9 +188,9 @@
 	/// Get current sponsor.
 	///
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
-	/// @dev EVM selector for this function is: 0xb66bbc14,
-	///  or in textual repr: getCollectionSponsor()
-	function getCollectionSponsor() public view returns (Tuple17 memory) {
+	/// @dev EVM selector for this function is: 0x6ec0a9f1,
+	///  or in textual repr: collectionSponsor()
+	function collectionSponsor() public view returns (Tuple17 memory) {
 		require(false, stub_error);
 		dummy;
 		return Tuple17(0x0000000000000000000000000000000000000000, 0);
@@ -311,9 +298,7 @@
 	/// @param collections Addresses of collections that will be available for nesting.
 	/// @dev EVM selector for this function is: 0x64872396,
 	///  or in textual repr: setCollectionNesting(bool,address[])
-	function setCollectionNesting(bool enable, address[] memory collections)
-		public
-	{
+	function setCollectionNesting(bool enable, address[] memory collections) public {
 		require(false, stub_error);
 		enable;
 		collections;
@@ -430,9 +415,9 @@
 	/// @return `Fungible` or `NFT` or `ReFungible`
 	/// @dev EVM selector for this function is: 0xd34b55b8,
 	///  or in textual repr: uniqueCollectionType()
-	function uniqueCollectionType() public returns (string memory) {
+	function uniqueCollectionType() public view returns (string memory) {
 		require(false, stub_error);
-		dummy = 0;
+		dummy;
 		return "";
 	}
 
@@ -605,10 +590,7 @@
 	/// @param tokenIds IDs of the minted NFTs
 	/// @dev EVM selector for this function is: 0x44a9945e,
 	///  or in textual repr: mintBulk(address,uint256[])
-	function mintBulk(address to, uint256[] memory tokenIds)
-		public
-		returns (bool)
-	{
+	function mintBulk(address to, uint256[] memory tokenIds) public returns (bool) {
 		require(false, stub_error);
 		to;
 		tokenIds;
@@ -623,10 +605,7 @@
 	/// @param tokens array of pairs of token ID and token URI for minted tokens
 	/// @dev EVM selector for this function is: 0x36543006,
 	///  or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
-	function mintBulkWithTokenURI(address to, Tuple8[] memory tokens)
-		public
-		returns (bool)
-	{
+	function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) public returns (bool) {
 		require(false, stub_error);
 		to;
 		tokens;
@@ -661,11 +640,7 @@
 	/// @dev Not implemented
 	/// @dev EVM selector for this function is: 0x2f745c59,
 	///  or in textual repr: tokenOfOwnerByIndex(address,uint256)
-	function tokenOfOwnerByIndex(address owner, uint256 index)
-		public
-		view
-		returns (uint256)
-	{
+	function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {
 		require(false, stub_error);
 		owner;
 		index;
@@ -728,21 +703,9 @@
 
 /// @dev inlined interface
 contract ERC721Events {
-	event Transfer(
-		address indexed from,
-		address indexed to,
-		uint256 indexed tokenId
-	);
-	event Approval(
-		address indexed owner,
-		address indexed approved,
-		uint256 indexed tokenId
-	);
-	event ApprovalForAll(
-		address indexed owner,
-		address indexed operator,
-		bool approved
-	);
+	event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
+	event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
+	event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
 }
 
 /// @title ERC-721 Non-Fungible Token Standard
@@ -870,11 +833,7 @@
 	/// @dev Not implemented
 	/// @dev EVM selector for this function is: 0xe985e9c5,
 	///  or in textual repr: isApprovedForAll(address,address)
-	function isApprovedForAll(address owner, address operator)
-		public
-		view
-		returns (address)
-	{
+	function isApprovedForAll(address owner, address operator) public view returns (address) {
 		require(false, stub_error);
 		owner;
 		operator;
modifiedpallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth
--- a/pallets/refungible/src/stubs/UniqueRefungible.sol
+++ b/pallets/refungible/src/stubs/UniqueRefungible.sol
@@ -10,11 +10,7 @@
 }
 
 contract ERC165 is Dummy {
-	function supportsInterface(bytes4 interfaceID)
-		external
-		view
-		returns (bool)
-	{
+	function supportsInterface(bytes4 interfaceID) external view returns (bool) {
 		require(false, stub_error);
 		interfaceID;
 		return true;
@@ -85,11 +81,7 @@
 	/// @return Property value bytes
 	/// @dev EVM selector for this function is: 0x7228c327,
 	///  or in textual repr: property(uint256,string)
-	function property(uint256 tokenId, string memory key)
-		public
-		view
-		returns (bytes memory)
-	{
+	function property(uint256 tokenId, string memory key) public view returns (bytes memory) {
 		require(false, stub_error);
 		tokenId;
 		key;
@@ -99,7 +91,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x9f70d4e0
+/// @dev the ERC-165 identifier for this interface is 0x47dbc105
 contract Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -107,9 +99,7 @@
 	/// @param value Propery value.
 	/// @dev EVM selector for this function is: 0x2f073f66,
 	///  or in textual repr: setCollectionProperty(string,bytes)
-	function setCollectionProperty(string memory key, bytes memory value)
-		public
-	{
+	function setCollectionProperty(string memory key, bytes memory value) public {
 		require(false, stub_error);
 		key;
 		value;
@@ -135,11 +125,7 @@
 	/// @return bytes The property corresponding to the key.
 	/// @dev EVM selector for this function is: 0xcf24fd6d,
 	///  or in textual repr: collectionProperty(string)
-	function collectionProperty(string memory key)
-		public
-		view
-		returns (bytes memory)
-	{
+	function collectionProperty(string memory key) public view returns (bytes memory) {
 		require(false, stub_error);
 		key;
 		dummy;
@@ -172,6 +158,7 @@
 		dummy = 0;
 	}
 
+	/// Whether there is a pending sponsor.
 	/// @dev EVM selector for this function is: 0x058ac185,
 	///  or in textual repr: hasCollectionPendingSponsor()
 	function hasCollectionPendingSponsor() public view returns (bool) {
@@ -201,9 +188,9 @@
 	/// Get current sponsor.
 	///
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
-	/// @dev EVM selector for this function is: 0xb66bbc14,
-	///  or in textual repr: getCollectionSponsor()
-	function getCollectionSponsor() public view returns (Tuple17 memory) {
+	/// @dev EVM selector for this function is: 0x6ec0a9f1,
+	///  or in textual repr: collectionSponsor()
+	function collectionSponsor() public view returns (Tuple17 memory) {
 		require(false, stub_error);
 		dummy;
 		return Tuple17(0x0000000000000000000000000000000000000000, 0);
@@ -311,9 +298,7 @@
 	/// @param collections Addresses of collections that will be available for nesting.
 	/// @dev EVM selector for this function is: 0x64872396,
 	///  or in textual repr: setCollectionNesting(bool,address[])
-	function setCollectionNesting(bool enable, address[] memory collections)
-		public
-	{
+	function setCollectionNesting(bool enable, address[] memory collections) public {
 		require(false, stub_error);
 		enable;
 		collections;
@@ -430,9 +415,9 @@
 	/// @return `Fungible` or `NFT` or `ReFungible`
 	/// @dev EVM selector for this function is: 0xd34b55b8,
 	///  or in textual repr: uniqueCollectionType()
-	function uniqueCollectionType() public returns (string memory) {
+	function uniqueCollectionType() public view returns (string memory) {
 		require(false, stub_error);
-		dummy = 0;
+		dummy;
 		return "";
 	}
 
@@ -607,10 +592,7 @@
 	/// @param tokenIds IDs of the minted RFTs
 	/// @dev EVM selector for this function is: 0x44a9945e,
 	///  or in textual repr: mintBulk(address,uint256[])
-	function mintBulk(address to, uint256[] memory tokenIds)
-		public
-		returns (bool)
-	{
+	function mintBulk(address to, uint256[] memory tokenIds) public returns (bool) {
 		require(false, stub_error);
 		to;
 		tokenIds;
@@ -625,10 +607,7 @@
 	/// @param tokens array of pairs of token ID and token URI for minted tokens
 	/// @dev EVM selector for this function is: 0x36543006,
 	///  or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
-	function mintBulkWithTokenURI(address to, Tuple8[] memory tokens)
-		public
-		returns (bool)
-	{
+	function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) public returns (bool) {
 		require(false, stub_error);
 		to;
 		tokens;
@@ -675,11 +654,7 @@
 	/// Not implemented
 	/// @dev EVM selector for this function is: 0x2f745c59,
 	///  or in textual repr: tokenOfOwnerByIndex(address,uint256)
-	function tokenOfOwnerByIndex(address owner, uint256 index)
-		public
-		view
-		returns (uint256)
-	{
+	function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {
 		require(false, stub_error);
 		owner;
 		index;
@@ -740,21 +715,9 @@
 
 /// @dev inlined interface
 contract ERC721Events {
-	event Transfer(
-		address indexed from,
-		address indexed to,
-		uint256 indexed tokenId
-	);
-	event Approval(
-		address indexed owner,
-		address indexed approved,
-		uint256 indexed tokenId
-	);
-	event ApprovalForAll(
-		address indexed owner,
-		address indexed operator,
-		bool approved
-	);
+	event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
+	event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
+	event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
 }
 
 /// @title ERC-721 Non-Fungible Token Standard
@@ -880,11 +843,7 @@
 	/// @dev Not implemented
 	/// @dev EVM selector for this function is: 0xe985e9c5,
 	///  or in textual repr: isApprovedForAll(address,address)
-	function isApprovedForAll(address owner, address operator)
-		public
-		view
-		returns (address)
-	{
+	function isApprovedForAll(address owner, address operator) public view returns (address) {
 		require(false, stub_error);
 		owner;
 		operator;
modifiedpallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungibleToken.soldiffbeforeafterboth
--- a/pallets/refungible/src/stubs/UniqueRefungibleToken.sol
+++ b/pallets/refungible/src/stubs/UniqueRefungibleToken.sol
@@ -10,11 +10,7 @@
 }
 
 contract ERC165 is Dummy {
-	function supportsInterface(bytes4 interfaceID)
-		external
-		view
-		returns (bool)
-	{
+	function supportsInterface(bytes4 interfaceID) external view returns (bool) {
 		require(false, stub_error);
 		interfaceID;
 		return true;
@@ -72,11 +68,7 @@
 /// @dev inlined interface
 contract ERC20Events {
 	event Transfer(address indexed from, address indexed to, uint256 value);
-	event Approval(
-		address indexed owner,
-		address indexed spender,
-		uint256 value
-	);
+	event Approval(address indexed owner, address indexed spender, uint256 value);
 }
 
 /// @title Standard ERC20 token
@@ -188,11 +180,7 @@
 	/// @return A uint256 specifying the amount of tokens still available for the spender.
 	/// @dev EVM selector for this function is: 0xdd62ed3e,
 	///  or in textual repr: allowance(address,address)
-	function allowance(address owner, address spender)
-		public
-		view
-		returns (uint256)
-	{
+	function allowance(address owner, address spender) public view returns (uint256) {
 		require(false, stub_error);
 		owner;
 		spender;
@@ -201,10 +189,4 @@
 	}
 }
 
-contract UniqueRefungibleToken is
-	Dummy,
-	ERC165,
-	ERC20,
-	ERC20UniqueExtensions,
-	ERC1633
-{}
+contract UniqueRefungibleToken is Dummy, ERC165, ERC20, ERC20UniqueExtensions, ERC1633 {}
modifiedpallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedtests/src/eth/api/ContractHelpers.soldiffbeforeafterboth
--- a/tests/src/eth/api/ContractHelpers.sol
+++ b/tests/src/eth/api/ContractHelpers.sol
@@ -15,15 +15,12 @@
 /// @dev inlined interface
 interface ContractHelpersEvents {
 	event ContractSponsorSet(address indexed contractAddress, address sponsor);
-	event ContractSponsorshipConfirmed(
-		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 0x172cb4fb
+/// @dev the ERC-165 identifier for this interface is 0x30afad04
 interface ContractHelpers is Dummy, ERC165, ContractHelpersEvents {
 	/// Get user, which deployed specified contract
 	/// @dev May return zero address in case if contract is deployed
@@ -34,10 +31,7 @@
 	/// @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);
+	function contractOwner(address contractAddress) external view returns (address);
 
 	/// Set sponsor.
 	/// @param contractAddress Contract for which a sponsor is being established.
@@ -73,12 +67,9 @@
 	///
 	/// @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.
-	/// @dev EVM selector for this function is: 0x743fc745,
-	///  or in textual repr: getSponsor(address)
-	function getSponsor(address contractAddress)
-		external
-		view
-		returns (Tuple0 memory);
+	/// @dev EVM selector for this function is: 0x766c4f37,
+	///  or in textual repr: sponsor(address)
+	function sponsor(address contractAddress) external view returns (Tuple0 memory);
 
 	/// Check tat contract has confirmed sponsor.
 	///
@@ -94,17 +85,11 @@
 	/// @return **true** if contract has pending sponsor.
 	/// @dev EVM selector for this function is: 0x39b9b242,
 	///  or in textual repr: hasPendingSponsor(address)
-	function hasPendingSponsor(address contractAddress)
-		external
-		view
-		returns (bool);
+	function hasPendingSponsor(address contractAddress) external view returns (bool);
 
 	/// @dev EVM selector for this function is: 0x6027dc61,
 	///  or in textual repr: sponsoringEnabled(address)
-	function sponsoringEnabled(address contractAddress)
-		external
-		view
-		returns (bool);
+	function sponsoringEnabled(address contractAddress) external view returns (bool);
 
 	/// @dev EVM selector for this function is: 0xfde8a560,
 	///  or in textual repr: setSponsoringMode(address,uint8)
@@ -113,12 +98,9 @@
 	/// Get current contract sponsoring rate limit
 	/// @param contractAddress Contract to get sponsoring rate limit 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 (uint32);
+	/// @dev EVM selector for this function is: 0xf29694d8,
+	///  or in textual repr: sponsoringRateLimit(address)
+	function sponsoringRateLimit(address contractAddress) external view returns (uint32);
 
 	/// Set contract sponsoring rate limit
 	/// @dev Sponsoring rate limit - is a minimum amount of blocks that should
@@ -128,8 +110,7 @@
 	/// @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;
+	function setSponsoringRateLimit(address contractAddress, uint32 rateLimit) external;
 
 	/// Set contract sponsoring fee limit
 	/// @dev Sponsoring fee limit - is maximum fee that could be spent by
@@ -139,19 +120,15 @@
 	/// @dev Only contract owner can change this setting
 	/// @dev EVM selector for this function is: 0x03aed665,
 	///  or in textual repr: setSponsoringFeeLimit(address,uint256)
-	function setSponsoringFeeLimit(address contractAddress, uint256 feeLimit)
-		external;
+	function setSponsoringFeeLimit(address contractAddress, uint256 feeLimit) external;
 
 	/// Get current contract sponsoring fee limit
 	/// @param contractAddress Contract to get sponsoring fee limit of
 	/// @return uint256 Maximum amount of fee that could be spent by single
 	///  transaction
-	/// @dev EVM selector for this function is: 0xc3fdc9ee,
-	///  or in textual repr: getSponsoringFeeLimit(address)
-	function getSponsoringFeeLimit(address contractAddress)
-		external
-		view
-		returns (uint256);
+	/// @dev EVM selector for this function is: 0x75b73606,
+	///  or in textual repr: sponsoringFeeLimit(address)
+	function sponsoringFeeLimit(address contractAddress) external view returns (uint256);
 
 	/// Is specified user present in contract allow list
 	/// @dev Contract owner always implicitly included
@@ -160,10 +137,7 @@
 	/// @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);
+	function allowed(address contractAddress, address user) external view returns (bool);
 
 	/// Toggle user presence in contract allowlist
 	/// @param contractAddress Contract to change allowlist of
@@ -187,10 +161,7 @@
 	/// @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);
+	function allowlistEnabled(address contractAddress) external view returns (bool);
 
 	/// Toggle contract allowlist access
 	/// @param contractAddress Contract to change allowlist access of
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -13,7 +13,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x9f70d4e0
+/// @dev the ERC-165 identifier for this interface is 0x47dbc105
 interface Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -21,8 +21,7 @@
 	/// @param value Propery value.
 	/// @dev EVM selector for this function is: 0x2f073f66,
 	///  or in textual repr: setCollectionProperty(string,bytes)
-	function setCollectionProperty(string memory key, bytes memory value)
-		external;
+	function setCollectionProperty(string memory key, bytes memory value) external;
 
 	/// Delete collection property.
 	///
@@ -39,10 +38,7 @@
 	/// @return bytes The property corresponding to the key.
 	/// @dev EVM selector for this function is: 0xcf24fd6d,
 	///  or in textual repr: collectionProperty(string)
-	function collectionProperty(string memory key)
-		external
-		view
-		returns (bytes memory);
+	function collectionProperty(string memory key) external view returns (bytes memory);
 
 	/// Set the sponsor of the collection.
 	///
@@ -62,6 +58,7 @@
 	///  or in textual repr: setCollectionSponsorSubstrate(uint256)
 	function setCollectionSponsorSubstrate(uint256 sponsor) external;
 
+	/// Whether there is a pending sponsor.
 	/// @dev EVM selector for this function is: 0x058ac185,
 	///  or in textual repr: hasCollectionPendingSponsor()
 	function hasCollectionPendingSponsor() external view returns (bool);
@@ -81,9 +78,9 @@
 	/// Get current sponsor.
 	///
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
-	/// @dev EVM selector for this function is: 0xb66bbc14,
-	///  or in textual repr: getCollectionSponsor()
-	function getCollectionSponsor() external view returns (Tuple6 memory);
+	/// @dev EVM selector for this function is: 0x6ec0a9f1,
+	///  or in textual repr: collectionSponsor()
+	function collectionSponsor() external view returns (Tuple6 memory);
 
 	/// Set limits for the collection.
 	/// @dev Throws error if limit not found.
@@ -153,8 +150,7 @@
 	/// @param collections Addresses of collections that will be available for nesting.
 	/// @dev EVM selector for this function is: 0x64872396,
 	///  or in textual repr: setCollectionNesting(bool,address[])
-	function setCollectionNesting(bool enable, address[] memory collections)
-		external;
+	function setCollectionNesting(bool enable, address[] memory collections) external;
 
 	/// Set the collection access method.
 	/// @param mode Access mode
@@ -227,7 +223,7 @@
 	/// @return `Fungible` or `NFT` or `ReFungible`
 	/// @dev EVM selector for this function is: 0xd34b55b8,
 	///  or in textual repr: uniqueCollectionType()
-	function uniqueCollectionType() external returns (string memory);
+	function uniqueCollectionType() external view returns (string memory);
 
 	/// Get collection owner.
 	///
@@ -291,11 +287,7 @@
 /// @dev inlined interface
 interface ERC20Events {
 	event Transfer(address indexed from, address indexed to, uint256 value);
-	event Approval(
-		address indexed owner,
-		address indexed spender,
-		uint256 value
-	);
+	event Approval(address indexed owner, address indexed spender, uint256 value);
 }
 
 /// @dev the ERC-165 identifier for this interface is 0x942e8b22
@@ -338,17 +330,7 @@
 
 	/// @dev EVM selector for this function is: 0xdd62ed3e,
 	///  or in textual repr: allowance(address,address)
-	function allowance(address owner, address spender)
-		external
-		view
-		returns (uint256);
+	function allowance(address owner, address spender) external view returns (uint256);
 }
 
-interface UniqueFungible is
-	Dummy,
-	ERC165,
-	ERC20,
-	ERC20Mintable,
-	ERC20UniqueExtensions,
-	Collection
-{}
+interface UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -58,14 +58,11 @@
 	/// @return Property value bytes
 	/// @dev EVM selector for this function is: 0x7228c327,
 	///  or in textual repr: property(uint256,string)
-	function property(uint256 tokenId, string memory key)
-		external
-		view
-		returns (bytes memory);
+	function property(uint256 tokenId, string memory key) external view returns (bytes memory);
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x9f70d4e0
+/// @dev the ERC-165 identifier for this interface is 0x47dbc105
 interface Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -73,8 +70,7 @@
 	/// @param value Propery value.
 	/// @dev EVM selector for this function is: 0x2f073f66,
 	///  or in textual repr: setCollectionProperty(string,bytes)
-	function setCollectionProperty(string memory key, bytes memory value)
-		external;
+	function setCollectionProperty(string memory key, bytes memory value) external;
 
 	/// Delete collection property.
 	///
@@ -91,10 +87,7 @@
 	/// @return bytes The property corresponding to the key.
 	/// @dev EVM selector for this function is: 0xcf24fd6d,
 	///  or in textual repr: collectionProperty(string)
-	function collectionProperty(string memory key)
-		external
-		view
-		returns (bytes memory);
+	function collectionProperty(string memory key) external view returns (bytes memory);
 
 	/// Set the sponsor of the collection.
 	///
@@ -114,6 +107,7 @@
 	///  or in textual repr: setCollectionSponsorSubstrate(uint256)
 	function setCollectionSponsorSubstrate(uint256 sponsor) external;
 
+	/// Whether there is a pending sponsor.
 	/// @dev EVM selector for this function is: 0x058ac185,
 	///  or in textual repr: hasCollectionPendingSponsor()
 	function hasCollectionPendingSponsor() external view returns (bool);
@@ -133,9 +127,9 @@
 	/// Get current sponsor.
 	///
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
-	/// @dev EVM selector for this function is: 0xb66bbc14,
-	///  or in textual repr: getCollectionSponsor()
-	function getCollectionSponsor() external view returns (Tuple17 memory);
+	/// @dev EVM selector for this function is: 0x6ec0a9f1,
+	///  or in textual repr: collectionSponsor()
+	function collectionSponsor() external view returns (Tuple17 memory);
 
 	/// Set limits for the collection.
 	/// @dev Throws error if limit not found.
@@ -205,8 +199,7 @@
 	/// @param collections Addresses of collections that will be available for nesting.
 	/// @dev EVM selector for this function is: 0x64872396,
 	///  or in textual repr: setCollectionNesting(bool,address[])
-	function setCollectionNesting(bool enable, address[] memory collections)
-		external;
+	function setCollectionNesting(bool enable, address[] memory collections) external;
 
 	/// Set the collection access method.
 	/// @param mode Access mode
@@ -279,7 +272,7 @@
 	/// @return `Fungible` or `NFT` or `ReFungible`
 	/// @dev EVM selector for this function is: 0xd34b55b8,
 	///  or in textual repr: uniqueCollectionType()
-	function uniqueCollectionType() external returns (string memory);
+	function uniqueCollectionType() external view returns (string memory);
 
 	/// Get collection owner.
 	///
@@ -399,9 +392,7 @@
 	/// @param tokenIds IDs of the minted NFTs
 	/// @dev EVM selector for this function is: 0x44a9945e,
 	///  or in textual repr: mintBulk(address,uint256[])
-	function mintBulk(address to, uint256[] memory tokenIds)
-		external
-		returns (bool);
+	function mintBulk(address to, uint256[] memory tokenIds) external returns (bool);
 
 	/// @notice Function to mint multiple tokens with the given tokenUris.
 	/// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive
@@ -410,9 +401,7 @@
 	/// @param tokens array of pairs of token ID and token URI for minted tokens
 	/// @dev EVM selector for this function is: 0x36543006,
 	///  or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
-	function mintBulkWithTokenURI(address to, Tuple8[] memory tokens)
-		external
-		returns (bool);
+	function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) external returns (bool);
 }
 
 /// @dev anonymous struct
@@ -436,10 +425,7 @@
 	/// @dev Not implemented
 	/// @dev EVM selector for this function is: 0x2f745c59,
 	///  or in textual repr: tokenOfOwnerByIndex(address,uint256)
-	function tokenOfOwnerByIndex(address owner, uint256 index)
-		external
-		view
-		returns (uint256);
+	function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
 
 	/// @notice Count NFTs tracked by this contract
 	/// @return A count of valid NFTs tracked by this contract, where each one of
@@ -479,21 +465,9 @@
 
 /// @dev inlined interface
 interface ERC721Events {
-	event Transfer(
-		address indexed from,
-		address indexed to,
-		uint256 indexed tokenId
-	);
-	event Approval(
-		address indexed owner,
-		address indexed approved,
-		uint256 indexed tokenId
-	);
-	event ApprovalForAll(
-		address indexed owner,
-		address indexed operator,
-		bool approved
-	);
+	event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
+	event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
+	event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
 }
 
 /// @title ERC-721 Non-Fungible Token Standard
@@ -577,10 +551,7 @@
 	/// @dev Not implemented
 	/// @dev EVM selector for this function is: 0xe985e9c5,
 	///  or in textual repr: isApprovedForAll(address,address)
-	function isApprovedForAll(address owner, address operator)
-		external
-		view
-		returns (address);
+	function isApprovedForAll(address owner, address operator) external view returns (address);
 }
 
 interface UniqueNFT is
modifiedtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -58,14 +58,11 @@
 	/// @return Property value bytes
 	/// @dev EVM selector for this function is: 0x7228c327,
 	///  or in textual repr: property(uint256,string)
-	function property(uint256 tokenId, string memory key)
-		external
-		view
-		returns (bytes memory);
+	function property(uint256 tokenId, string memory key) external view returns (bytes memory);
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x9f70d4e0
+/// @dev the ERC-165 identifier for this interface is 0x47dbc105
 interface Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -73,8 +70,7 @@
 	/// @param value Propery value.
 	/// @dev EVM selector for this function is: 0x2f073f66,
 	///  or in textual repr: setCollectionProperty(string,bytes)
-	function setCollectionProperty(string memory key, bytes memory value)
-		external;
+	function setCollectionProperty(string memory key, bytes memory value) external;
 
 	/// Delete collection property.
 	///
@@ -91,10 +87,7 @@
 	/// @return bytes The property corresponding to the key.
 	/// @dev EVM selector for this function is: 0xcf24fd6d,
 	///  or in textual repr: collectionProperty(string)
-	function collectionProperty(string memory key)
-		external
-		view
-		returns (bytes memory);
+	function collectionProperty(string memory key) external view returns (bytes memory);
 
 	/// Set the sponsor of the collection.
 	///
@@ -114,6 +107,7 @@
 	///  or in textual repr: setCollectionSponsorSubstrate(uint256)
 	function setCollectionSponsorSubstrate(uint256 sponsor) external;
 
+	/// Whether there is a pending sponsor.
 	/// @dev EVM selector for this function is: 0x058ac185,
 	///  or in textual repr: hasCollectionPendingSponsor()
 	function hasCollectionPendingSponsor() external view returns (bool);
@@ -133,9 +127,9 @@
 	/// Get current sponsor.
 	///
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
-	/// @dev EVM selector for this function is: 0xb66bbc14,
-	///  or in textual repr: getCollectionSponsor()
-	function getCollectionSponsor() external view returns (Tuple17 memory);
+	/// @dev EVM selector for this function is: 0x6ec0a9f1,
+	///  or in textual repr: collectionSponsor()
+	function collectionSponsor() external view returns (Tuple17 memory);
 
 	/// Set limits for the collection.
 	/// @dev Throws error if limit not found.
@@ -205,8 +199,7 @@
 	/// @param collections Addresses of collections that will be available for nesting.
 	/// @dev EVM selector for this function is: 0x64872396,
 	///  or in textual repr: setCollectionNesting(bool,address[])
-	function setCollectionNesting(bool enable, address[] memory collections)
-		external;
+	function setCollectionNesting(bool enable, address[] memory collections) external;
 
 	/// Set the collection access method.
 	/// @param mode Access mode
@@ -279,7 +272,7 @@
 	/// @return `Fungible` or `NFT` or `ReFungible`
 	/// @dev EVM selector for this function is: 0xd34b55b8,
 	///  or in textual repr: uniqueCollectionType()
-	function uniqueCollectionType() external returns (string memory);
+	function uniqueCollectionType() external view returns (string memory);
 
 	/// Get collection owner.
 	///
@@ -401,9 +394,7 @@
 	/// @param tokenIds IDs of the minted RFTs
 	/// @dev EVM selector for this function is: 0x44a9945e,
 	///  or in textual repr: mintBulk(address,uint256[])
-	function mintBulk(address to, uint256[] memory tokenIds)
-		external
-		returns (bool);
+	function mintBulk(address to, uint256[] memory tokenIds) external returns (bool);
 
 	/// @notice Function to mint multiple tokens with the given tokenUris.
 	/// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive
@@ -412,19 +403,14 @@
 	/// @param tokens array of pairs of token ID and token URI for minted tokens
 	/// @dev EVM selector for this function is: 0x36543006,
 	///  or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
-	function mintBulkWithTokenURI(address to, Tuple8[] memory tokens)
-		external
-		returns (bool);
+	function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) external returns (bool);
 
 	/// Returns EVM address for refungible token
 	///
 	/// @param token ID of the token
 	/// @dev EVM selector for this function is: 0xab76fac6,
 	///  or in textual repr: tokenContractAddress(uint256)
-	function tokenContractAddress(uint256 token)
-		external
-		view
-		returns (address);
+	function tokenContractAddress(uint256 token) external view returns (address);
 }
 
 /// @dev anonymous struct
@@ -448,10 +434,7 @@
 	/// Not implemented
 	/// @dev EVM selector for this function is: 0x2f745c59,
 	///  or in textual repr: tokenOfOwnerByIndex(address,uint256)
-	function tokenOfOwnerByIndex(address owner, uint256 index)
-		external
-		view
-		returns (uint256);
+	function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
 
 	/// @notice Count RFTs tracked by this contract
 	/// @return A count of valid RFTs tracked by this contract, where each one of
@@ -489,21 +472,9 @@
 
 /// @dev inlined interface
 interface ERC721Events {
-	event Transfer(
-		address indexed from,
-		address indexed to,
-		uint256 indexed tokenId
-	);
-	event Approval(
-		address indexed owner,
-		address indexed approved,
-		uint256 indexed tokenId
-	);
-	event ApprovalForAll(
-		address indexed owner,
-		address indexed operator,
-		bool approved
-	);
+	event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
+	event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
+	event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
 }
 
 /// @title ERC-721 Non-Fungible Token Standard
@@ -585,10 +556,7 @@
 	/// @dev Not implemented
 	/// @dev EVM selector for this function is: 0xe985e9c5,
 	///  or in textual repr: isApprovedForAll(address,address)
-	function isApprovedForAll(address owner, address operator)
-		external
-		view
-		returns (address);
+	function isApprovedForAll(address owner, address operator) external view returns (address);
 }
 
 interface UniqueRefungible is
modifiedtests/src/eth/api/UniqueRefungibleToken.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueRefungibleToken.sol
+++ b/tests/src/eth/api/UniqueRefungibleToken.sol
@@ -44,11 +44,7 @@
 /// @dev inlined interface
 interface ERC20Events {
 	event Transfer(address indexed from, address indexed to, uint256 value);
-	event Approval(
-		address indexed owner,
-		address indexed spender,
-		uint256 value
-	);
+	event Approval(address indexed owner, address indexed spender, uint256 value);
 }
 
 /// @title Standard ERC20 token
@@ -120,16 +116,7 @@
 	/// @return A uint256 specifying the amount of tokens still available for the spender.
 	/// @dev EVM selector for this function is: 0xdd62ed3e,
 	///  or in textual repr: allowance(address,address)
-	function allowance(address owner, address spender)
-		external
-		view
-		returns (uint256);
+	function allowance(address owner, address spender) external view returns (uint256);
 }
 
-interface UniqueRefungibleToken is
-	Dummy,
-	ERC165,
-	ERC20,
-	ERC20UniqueExtensions,
-	ERC1633
-{}
+interface UniqueRefungibleToken is Dummy, ERC165, ERC20, ERC20UniqueExtensions, ERC1633 {}
modifiedtests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionSponsoring.test.ts
+++ b/tests/src/eth/collectionSponsoring.test.ts
@@ -56,7 +56,7 @@
     await submitTransactionAsync(sponsor, confirmTx);
     expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;
     
-    const sponsorTuple = await collectionEvm.methods.getCollectionSponsor().call({from: owner});
+    const sponsorTuple = await collectionEvm.methods.collectionSponsor().call({from: owner});
     expect(bigIntToSub(api, BigInt(sponsorTuple[1]))).to.be.eq(sponsor.address);
   });
 
@@ -77,7 +77,7 @@
     
     await collectionEvm.methods.removeCollectionSponsor().send({from: owner});
     
-    const sponsorTuple = await collectionEvm.methods.getCollectionSponsor().call({from: owner});
+    const sponsorTuple = await collectionEvm.methods.collectionSponsor().call({from: owner});
     expect(sponsorTuple.field_0).to.be.eq('0x0000000000000000000000000000000000000000');
   });
 
modifiedtests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth
before · tests/src/eth/contractSponsoring.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import * as solc from 'solc';18import {expect} from 'chai';19import {expectSubstrateEventsAtBlock} from '../util/helpers';20import Web3 from 'web3';2122import {23  contractHelpers,24  createEthAccountWithBalance,25  transferBalanceToEth,26  deployFlipper,27  itWeb3,28  SponsoringMode,29  createEthAccount,30  ethBalanceViaSub,31  normalizeEvents,32  CompiledContract,33  GAS_ARGS,34  subToEth,35} from './util/helpers';36import {submitTransactionAsync} from '../substrate/substrate-api';3738describe('Sponsoring EVM contracts', () => {39  itWeb3('Self sponsored can be set by the address that deployed the contract', async ({api, web3, privateKeyWrapper}) => {40    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);41    const flipper = await deployFlipper(web3, owner);42    const helpers = contractHelpers(web3, owner);43    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;44    await expect(helpers.methods.selfSponsoredEnable(flipper.options.address).send()).to.be.not.rejected;45    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;46  });4748  itWeb3('Set self sponsored events', async ({api, web3, privateKeyWrapper}) => {49    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);50    const flipper = await deployFlipper(web3, owner);51    const helpers = contractHelpers(web3, owner);52    53    const result = await helpers.methods.selfSponsoredEnable(flipper.options.address).send();54    // console.log(result);55    const ethEvents = normalizeEvents(result.events);56    expect(ethEvents).to.be.deep.equal([57      {58        address: flipper.options.address,59        event: 'ContractSponsorSet',60        args: {61          contractAddress: flipper.options.address,62          sponsor: flipper.options.address,63        },64      },65      {66        address: flipper.options.address,67        event: 'ContractSponsorshipConfirmed',68        args: {69          contractAddress: flipper.options.address,70          sponsor: flipper.options.address,71        },72      },73    ]);7475    await expectSubstrateEventsAtBlock(76      api, 77      result.blockNumber,78      'evmContractHelpers',79      ['ContractSponsorSet','ContractSponsorshipConfirmed'],80    );81  });8283  itWeb3('Self sponsored can not be set by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {84    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);85    const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);86    const flipper = await deployFlipper(web3, owner);87    const helpers = contractHelpers(web3, owner);88    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;89    await expect(helpers.methods.selfSponsoredEnable(flipper.options.address).call({from: notOwner})).to.be.rejectedWith('NoPermission');90    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;91  });9293  itWeb3('Sponsoring can be set by the address that has deployed the contract', async ({api, web3, privateKeyWrapper}) => {94    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);95    const flipper = await deployFlipper(web3, owner);96    const helpers = contractHelpers(web3, owner);97    expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.false;98    await expect(helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner})).to.be.not.rejected;99    expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.true;100  });101102  itWeb3('Sponsoring cannot be set by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {103    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);104    const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);105    const flipper = await deployFlipper(web3, owner);106    const helpers = contractHelpers(web3, owner);107    expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.false;108    await expect(helpers.methods.setSponsoringMode(notOwner, SponsoringMode.Allowlisted).call({from: notOwner})).to.be.rejectedWith('NoPermission');109    expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.false;110  });111  112  itWeb3('Sponsor can be set by the address that deployed the contract', async ({api, web3, privateKeyWrapper}) => {113    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);114    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);115    const flipper = await deployFlipper(web3, owner);116    const helpers = contractHelpers(web3, owner);117    expect(await helpers.methods.hasPendingSponsor(flipper.options.address).call()).to.be.false;118    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).send()).to.be.not.rejected;119    expect(await helpers.methods.hasPendingSponsor(flipper.options.address).call()).to.be.true;120  });121  122  itWeb3('Set sponsor event', async ({api, web3, privateKeyWrapper}) => {123    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);124    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);125    const flipper = await deployFlipper(web3, owner);126    const helpers = contractHelpers(web3, owner);127    128    const result = await helpers.methods.setSponsor(flipper.options.address, sponsor).send();129    const events = normalizeEvents(result.events);130    expect(events).to.be.deep.equal([131      {132        address: flipper.options.address,133        event: 'ContractSponsorSet',134        args: {135          contractAddress: flipper.options.address,136          sponsor: sponsor,137        },138      },139    ]);140141    await expectSubstrateEventsAtBlock(142      api, 143      result.blockNumber,144      'evmContractHelpers',145      ['ContractSponsorSet'],146    );147  });148  149  itWeb3('Sponsor can not be set by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {150    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);151    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);152    const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);153    const flipper = await deployFlipper(web3, owner);154    const helpers = contractHelpers(web3, owner);155    expect(await helpers.methods.hasPendingSponsor(flipper.options.address).call()).to.be.false;156    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).call({from: notOwner})).to.be.rejectedWith('NoPermission');157    expect(await helpers.methods.hasPendingSponsor(flipper.options.address).call()).to.be.false;158  });159160  itWeb3('Sponsorship can be confirmed by the address that pending as sponsor', async ({api, web3, privateKeyWrapper}) => {161    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);162    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);163    const flipper = await deployFlipper(web3, owner);164    const helpers = contractHelpers(web3, owner);165    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;166    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).send()).to.be.not.rejected;167    await expect(helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor})).to.be.not.rejected;168    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;169  });170171  itWeb3('Confirm sponsorship event', async ({api, web3, privateKeyWrapper}) => {172    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);173    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);174    const flipper = await deployFlipper(web3, owner);175    const helpers = contractHelpers(web3, owner);176    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).send()).to.be.not.rejected;177    const result = await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});178    const events = normalizeEvents(result.events);179    expect(events).to.be.deep.equal([180      {181        address: flipper.options.address,182        event: 'ContractSponsorshipConfirmed',183        args: {184          contractAddress: flipper.options.address,185          sponsor: sponsor,186        },187      },188    ]);189190    await expectSubstrateEventsAtBlock(191      api, 192      result.blockNumber,193      'evmContractHelpers',194      ['ContractSponsorshipConfirmed'],195    );196  });197198  itWeb3('Sponsorship can not be confirmed by the address that not pending as sponsor', async ({api, web3, privateKeyWrapper}) => {199    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);200    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);201    const notSponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);202    const flipper = await deployFlipper(web3, owner);203    const helpers = contractHelpers(web3, owner);204    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;205    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).send()).to.be.not.rejected;206    await expect(helpers.methods.confirmSponsorship(flipper.options.address).call({from: notSponsor})).to.be.rejectedWith('NoPermission');207    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;208  });209210  itWeb3('Sponsorship can not be confirmed by the address that not set as sponsor', async ({api, web3, privateKeyWrapper}) => {211    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);212    const notSponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);213    const flipper = await deployFlipper(web3, owner);214    const helpers = contractHelpers(web3, owner);215    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;216    await expect(helpers.methods.confirmSponsorship(flipper.options.address).call({from: notSponsor})).to.be.rejectedWith('NoPendingSponsor');217    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;218  });219220  itWeb3('Get self sponsored sponsor', async ({api, web3, privateKeyWrapper}) => {221    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);222    const flipper = await deployFlipper(web3, owner);223    const helpers = contractHelpers(web3, owner);224    await helpers.methods.selfSponsoredEnable(flipper.options.address).send();225    226    const result = await helpers.methods.getSponsor(flipper.options.address).call();227228    expect(result[0]).to.be.eq(flipper.options.address);229    expect(result[1]).to.be.eq('0');230  });231232  itWeb3('Get confirmed sponsor', async ({api, web3, privateKeyWrapper}) => {233    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);234    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);235    const flipper = await deployFlipper(web3, owner);236    const helpers = contractHelpers(web3, owner);237    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();238    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});239    240    const result = await helpers.methods.getSponsor(flipper.options.address).call();241242    expect(result[0]).to.be.eq(sponsor);243    expect(result[1]).to.be.eq('0');244  });245246  itWeb3('Sponsor can be removed by the address that deployed the contract', async ({api, web3, privateKeyWrapper}) => {247    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);248    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);249    const flipper = await deployFlipper(web3, owner);250    const helpers = contractHelpers(web3, owner);251252    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;253    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();254    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});255    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;256    257    await helpers.methods.removeSponsor(flipper.options.address).send();258    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;259  });260261  itWeb3('Remove sponsor event', async ({api, web3, privateKeyWrapper}) => {262    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);263    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);264    const flipper = await deployFlipper(web3, owner);265    const helpers = contractHelpers(web3, owner);266267    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();268    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});269    270    const result = await helpers.methods.removeSponsor(flipper.options.address).send();271    const events = normalizeEvents(result.events);272    expect(events).to.be.deep.equal([273      {274        address: flipper.options.address,275        event: 'ContractSponsorRemoved',276        args: {277          contractAddress: flipper.options.address,278        },279      },280    ]);281282    await expectSubstrateEventsAtBlock(283      api, 284      result.blockNumber,285      'evmContractHelpers',286      ['ContractSponsorRemoved'],287    );288  });289290  itWeb3('Sponsor can not be removed by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {291    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);292    const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);293    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);294    const flipper = await deployFlipper(web3, owner);295    const helpers = contractHelpers(web3, owner);296297    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;298    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();299    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});300    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;301    302    await expect(helpers.methods.removeSponsor(flipper.options.address).call({from: notOwner})).to.be.rejectedWith('NoPermission');303    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;304  });305306  itWeb3('In generous mode, non-allowlisted user transaction will be sponsored', async ({api, web3, privateKeyWrapper}) => {307    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);308    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);309    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);310311    const flipper = await deployFlipper(web3, owner);312313    const helpers = contractHelpers(web3, owner);314315    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();316    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});317318    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Generous).send({from: owner});319    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});320321    const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);322    const callerBalanceBefore = await ethBalanceViaSub(api, caller);323324    await flipper.methods.flip().send({from: caller});325    expect(await flipper.methods.getValue().call()).to.be.true;326327    // Balance should be taken from sponsor instead of caller328    const sponsorBalanceAfter = await ethBalanceViaSub(api, sponsor);329    const callerBalanceAfter = await ethBalanceViaSub(api, caller);330    expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;331    expect(callerBalanceAfter).to.be.eq(callerBalanceBefore);332  });333334  itWeb3('In generous mode, non-allowlisted user transaction will be self sponsored', async ({api, web3, privateKeyWrapper}) => {335    const alice = privateKeyWrapper('//Alice');336337    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);338    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);339340    const flipper = await deployFlipper(web3, owner);341342    const helpers = contractHelpers(web3, owner);343344    await helpers.methods.selfSponsoredEnable(flipper.options.address).send();345346    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Generous).send({from: owner});347    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});348349    await transferBalanceToEth(api, alice, flipper.options.address);350351    const contractBalanceBefore = await ethBalanceViaSub(api, flipper.options.address);352    const callerBalanceBefore = await ethBalanceViaSub(api, caller);353354    await flipper.methods.flip().send({from: caller});355    expect(await flipper.methods.getValue().call()).to.be.true;356357    // Balance should be taken from sponsor instead of caller358    const contractBalanceAfter = await ethBalanceViaSub(api, flipper.options.address);359    const callerBalanceAfter = await ethBalanceViaSub(api, caller);360    expect(contractBalanceAfter < contractBalanceBefore).to.be.true;361    expect(callerBalanceAfter).to.be.eq(callerBalanceBefore);362  });363364  itWeb3('Sponsoring is set, an address that has no UNQ can send a transaction and it works. Sponsor balance should decrease (allowlisted)', async ({api, web3, privateKeyWrapper}) => {365    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);366    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);367    const caller = createEthAccount(web3);368369    const flipper = await deployFlipper(web3, owner);370371    const helpers = contractHelpers(web3, owner);372    await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});373    await helpers.methods.toggleAllowed(flipper.options.address, caller, true).send({from: owner});374375    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner});376    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});377378    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();379    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});380381    const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);382    expect(sponsorBalanceBefore).to.be.not.equal('0');383384    await flipper.methods.flip().send({from: caller});385    expect(await flipper.methods.getValue().call()).to.be.true;386387    // Balance should be taken from flipper instead of caller388    const sponsorBalanceAfter = await ethBalanceViaSub(api, sponsor);389    expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;390  });391392  itWeb3('Sponsoring is set, an address that has no UNQ can send a transaction and it works. Sponsor balance should not decrease (non-allowlisted)', async ({api, web3, privateKeyWrapper}) => {393    const alice = privateKeyWrapper('//Alice');394395    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);396    const caller = createEthAccount(web3);397398    const flipper = await deployFlipper(web3, owner);399400    const helpers = contractHelpers(web3, owner);401402    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner});403    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});404405    await transferBalanceToEth(api, alice, flipper.options.address);406407    const originalFlipperBalance = await web3.eth.getBalance(flipper.options.address);408    expect(originalFlipperBalance).to.be.not.equal('0');409410    await expect(flipper.methods.flip().send({from: caller})).to.be.rejectedWith(/InvalidTransaction::Payment/);411    expect(await flipper.methods.getValue().call()).to.be.false;412413    // Balance should be taken from flipper instead of caller414    const balanceAfter = await web3.eth.getBalance(flipper.options.address);415    expect(+balanceAfter).to.be.equals(+originalFlipperBalance);416  });417418  itWeb3('Sponsoring is set, an address that has UNQ can send a transaction and it works. User balance should not change', async ({api, web3, privateKeyWrapper}) => {419    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);420    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);421    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);422423    const flipper = await deployFlipper(web3, owner);424425    const helpers = contractHelpers(web3, owner);426    await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});427    await helpers.methods.toggleAllowed(flipper.options.address, caller, true).send({from: owner});428429    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner});430    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});431432    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();433    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});434435    const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);436    const callerBalanceBefore = await ethBalanceViaSub(api, caller);437438    await flipper.methods.flip().send({from: caller});439    expect(await flipper.methods.getValue().call()).to.be.true;440441    const sponsorBalanceAfter = await ethBalanceViaSub(api, sponsor);442    const callerBalanceAfter = await ethBalanceViaSub(api, caller);443    expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;444    expect(callerBalanceAfter).to.be.equals(callerBalanceBefore);445  });446447  itWeb3('Sponsoring is limited, with setContractRateLimit. The limitation is working if transactions are sent more often, the sender pays the commission.', async ({api, web3, privateKeyWrapper}) => {448    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);449    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);450    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);451    const originalCallerBalance = await web3.eth.getBalance(caller);452453    const flipper = await deployFlipper(web3, owner);454455    const helpers = contractHelpers(web3, owner);456    await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});457    await helpers.methods.toggleAllowed(flipper.options.address, caller, true).send({from: owner});458459    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner});460    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 10).send({from: owner});461462    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();463    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});464465    const originalFlipperBalance = await web3.eth.getBalance(sponsor);466    expect(originalFlipperBalance).to.be.not.equal('0');467468    await flipper.methods.flip().send({from: caller});469    expect(await flipper.methods.getValue().call()).to.be.true;470    expect(await web3.eth.getBalance(caller)).to.be.equals(originalCallerBalance);471472    const newFlipperBalance = await web3.eth.getBalance(sponsor);473    expect(newFlipperBalance).to.be.not.equals(originalFlipperBalance);474475    await flipper.methods.flip().send({from: caller});476    expect(await web3.eth.getBalance(sponsor)).to.be.equal(newFlipperBalance);477    expect(await web3.eth.getBalance(caller)).to.be.not.equals(originalCallerBalance);478  });479480  // TODO: Find a way to calculate default rate limit481  itWeb3('Default rate limit equals 7200', async ({api, web3, privateKeyWrapper}) => {482    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);483    const flipper = await deployFlipper(web3, owner);484    const helpers = contractHelpers(web3, owner);485    expect(await helpers.methods.getSponsoringRateLimit(flipper.options.address).call()).to.be.equals('7200');486  });487});488489describe('Sponsoring Fee Limit', () => {490491  let testContract: CompiledContract;492  493  function compileTestContract() {494    if (!testContract) {495      const input = {496        language: 'Solidity',497        sources: {498          ['TestContract.sol']: {499            content:500            `501            // SPDX-License-Identifier: MIT502            pragma solidity ^0.8.0;503            504            contract TestContract {505              event Result(bool);506507              function test(uint32 cycles) public {508                uint256 counter = 0;509                while(true) {510                  counter ++;511                  if (counter > cycles){512                    break;513                  }514                }515                emit Result(true);516              }517            }518            `,519          },520        },521        settings: {522          outputSelection: {523            '*': {524              '*': ['*'],525            },526          },527        },528      };529      const json = JSON.parse(solc.compile(JSON.stringify(input)));530      const out = json.contracts['TestContract.sol']['TestContract'];531  532      testContract = {533        abi: out.abi,534        object: '0x' + out.evm.bytecode.object,535      };536    }537    return testContract;538  }539  540  async function deployTestContract(web3: Web3, owner: string) {541    const compiled = compileTestContract();542    const testContract = new web3.eth.Contract(compiled.abi, undefined, {543      data: compiled.object,544      from: owner,545      ...GAS_ARGS,546    });547    return await testContract.deploy({data: compiled.object}).send({from: owner});548  }549550  itWeb3('Default fee limit', async ({api, web3, privateKeyWrapper}) => {551    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);552    const flipper = await deployFlipper(web3, owner);553    const helpers = contractHelpers(web3, owner);554    expect(await helpers.methods.getSponsoringFeeLimit(flipper.options.address).call()).to.be.equals('115792089237316195423570985008687907853269984665640564039457584007913129639935');555  });556557  itWeb3('Set fee limit', async ({api, web3, privateKeyWrapper}) => {558    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);559    const flipper = await deployFlipper(web3, owner);560    const helpers = contractHelpers(web3, owner);561    await helpers.methods.setSponsoringFeeLimit(flipper.options.address, 100).send();562    expect(await helpers.methods.getSponsoringFeeLimit(flipper.options.address).call()).to.be.equals('100');563  });564565  itWeb3('Negative test - set fee limit by non-owner', async ({api, web3, privateKeyWrapper}) => {566    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);567    const stranger = await createEthAccountWithBalance(api, web3, privateKeyWrapper);568    const flipper = await deployFlipper(web3, owner);569    const helpers = contractHelpers(web3, owner);570    await expect(helpers.methods.setSponsoringFeeLimit(flipper.options.address, 100).send({from: stranger})).to.be.rejected;571  });572573  itWeb3('Negative test - check that eth transactions exceeding fee limit are not executed', async ({api, web3, privateKeyWrapper}) => {574    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);575    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);576    const user = await createEthAccountWithBalance(api, web3, privateKeyWrapper);577578    const testContract = await deployTestContract(web3, owner);579    const helpers = contractHelpers(web3, owner);580    581    await helpers.methods.setSponsoringMode(testContract.options.address, SponsoringMode.Generous).send({from: owner});582    await helpers.methods.setSponsoringRateLimit(testContract.options.address, 0).send({from: owner});583    584    await helpers.methods.setSponsor(testContract.options.address, sponsor).send();585    await helpers.methods.confirmSponsorship(testContract.options.address).send({from: sponsor});586587    const gasPrice = BigInt(await web3.eth.getGasPrice());588589    await helpers.methods.setSponsoringFeeLimit(testContract.options.address, 2_000_000n * gasPrice).send();590591    const originalUserBalance = await web3.eth.getBalance(user);592    await testContract.methods.test(100).send({from: user, gas: 2_000_000});593    expect(await web3.eth.getBalance(user)).to.be.equal(originalUserBalance);594595    await testContract.methods.test(100).send({from: user, gas: 2_100_000});596    expect(await web3.eth.getBalance(user)).to.not.be.equal(originalUserBalance);597  });598599  itWeb3('Negative test - check that evm.call transactions exceeding fee limit are not executed', async ({api, web3, privateKeyWrapper}) => {600    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);601    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);602603    const testContract = await deployTestContract(web3, owner);604    const helpers = contractHelpers(web3, owner);605    606    await helpers.methods.setSponsoringMode(testContract.options.address, SponsoringMode.Generous).send({from: owner});607    await helpers.methods.setSponsoringRateLimit(testContract.options.address, 0).send({from: owner});608    609    await helpers.methods.setSponsor(testContract.options.address, sponsor).send();610    await helpers.methods.confirmSponsorship(testContract.options.address).send({from: sponsor});611612    const gasPrice = BigInt(await web3.eth.getGasPrice());613614    await helpers.methods.setSponsoringFeeLimit(testContract.options.address, 2_000_000n * gasPrice).send();615616    const alice = privateKeyWrapper('//Alice');617    const originalAliceBalance = (await api.query.system.account(alice.address)).data.free.toBigInt();618    619    await submitTransactionAsync(620      alice,621      api.tx.evm.call(622        subToEth(alice.address),623        testContract.options.address,624        testContract.methods.test(100).encodeABI(),625        Uint8Array.from([]),626        2_000_000n,627        gasPrice,628        null,629        null,630        [],631      ),632    );633    expect((await api.query.system.account(alice.address)).data.free.toBigInt()).to.be.equal(originalAliceBalance);634    635    await submitTransactionAsync(636      alice,637      api.tx.evm.call(638        subToEth(alice.address),639        testContract.options.address,640        testContract.methods.test(100).encodeABI(),641        Uint8Array.from([]),642        2_100_000n,643        gasPrice,644        null,645        null,646        [],647      ),648    );649    expect((await api.query.system.account(alice.address)).data.free.toBigInt()).to.not.be.equal(originalAliceBalance);650  });651});
after · tests/src/eth/contractSponsoring.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import * as solc from 'solc';18import {expect} from 'chai';19import {expectSubstrateEventsAtBlock} from '../util/helpers';20import Web3 from 'web3';2122import {23  contractHelpers,24  createEthAccountWithBalance,25  transferBalanceToEth,26  deployFlipper,27  itWeb3,28  SponsoringMode,29  createEthAccount,30  ethBalanceViaSub,31  normalizeEvents,32  CompiledContract,33  GAS_ARGS,34  subToEth,35} from './util/helpers';36import {submitTransactionAsync} from '../substrate/substrate-api';3738describe('Sponsoring EVM contracts', () => {39  itWeb3('Self sponsored can be set by the address that deployed the contract', async ({api, web3, privateKeyWrapper}) => {40    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);41    const flipper = await deployFlipper(web3, owner);42    const helpers = contractHelpers(web3, owner);43    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;44    await expect(helpers.methods.selfSponsoredEnable(flipper.options.address).send()).to.be.not.rejected;45    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;46  });4748  itWeb3('Set self sponsored events', async ({api, web3, privateKeyWrapper}) => {49    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);50    const flipper = await deployFlipper(web3, owner);51    const helpers = contractHelpers(web3, owner);52    53    const result = await helpers.methods.selfSponsoredEnable(flipper.options.address).send();54    // console.log(result);55    const ethEvents = normalizeEvents(result.events);56    expect(ethEvents).to.be.deep.equal([57      {58        address: flipper.options.address,59        event: 'ContractSponsorSet',60        args: {61          contractAddress: flipper.options.address,62          sponsor: flipper.options.address,63        },64      },65      {66        address: flipper.options.address,67        event: 'ContractSponsorshipConfirmed',68        args: {69          contractAddress: flipper.options.address,70          sponsor: flipper.options.address,71        },72      },73    ]);7475    await expectSubstrateEventsAtBlock(76      api, 77      result.blockNumber,78      'evmContractHelpers',79      ['ContractSponsorSet','ContractSponsorshipConfirmed'],80    );81  });8283  itWeb3('Self sponsored can not be set by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {84    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);85    const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);86    const flipper = await deployFlipper(web3, owner);87    const helpers = contractHelpers(web3, owner);88    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;89    await expect(helpers.methods.selfSponsoredEnable(flipper.options.address).call({from: notOwner})).to.be.rejectedWith('NoPermission');90    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;91  });9293  itWeb3('Sponsoring can be set by the address that has deployed the contract', async ({api, web3, privateKeyWrapper}) => {94    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);95    const flipper = await deployFlipper(web3, owner);96    const helpers = contractHelpers(web3, owner);97    expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.false;98    await expect(helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner})).to.be.not.rejected;99    expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.true;100  });101102  itWeb3('Sponsoring cannot be set by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {103    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);104    const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);105    const flipper = await deployFlipper(web3, owner);106    const helpers = contractHelpers(web3, owner);107    expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.false;108    await expect(helpers.methods.setSponsoringMode(notOwner, SponsoringMode.Allowlisted).call({from: notOwner})).to.be.rejectedWith('NoPermission');109    expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.false;110  });111  112  itWeb3('Sponsor can be set by the address that deployed the contract', async ({api, web3, privateKeyWrapper}) => {113    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);114    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);115    const flipper = await deployFlipper(web3, owner);116    const helpers = contractHelpers(web3, owner);117    expect(await helpers.methods.hasPendingSponsor(flipper.options.address).call()).to.be.false;118    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).send()).to.be.not.rejected;119    expect(await helpers.methods.hasPendingSponsor(flipper.options.address).call()).to.be.true;120  });121  122  itWeb3('Set sponsor event', async ({api, web3, privateKeyWrapper}) => {123    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);124    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);125    const flipper = await deployFlipper(web3, owner);126    const helpers = contractHelpers(web3, owner);127    128    const result = await helpers.methods.setSponsor(flipper.options.address, sponsor).send();129    const events = normalizeEvents(result.events);130    expect(events).to.be.deep.equal([131      {132        address: flipper.options.address,133        event: 'ContractSponsorSet',134        args: {135          contractAddress: flipper.options.address,136          sponsor: sponsor,137        },138      },139    ]);140141    await expectSubstrateEventsAtBlock(142      api, 143      result.blockNumber,144      'evmContractHelpers',145      ['ContractSponsorSet'],146    );147  });148  149  itWeb3('Sponsor can not be set by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {150    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);151    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);152    const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);153    const flipper = await deployFlipper(web3, owner);154    const helpers = contractHelpers(web3, owner);155    expect(await helpers.methods.hasPendingSponsor(flipper.options.address).call()).to.be.false;156    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).call({from: notOwner})).to.be.rejectedWith('NoPermission');157    expect(await helpers.methods.hasPendingSponsor(flipper.options.address).call()).to.be.false;158  });159160  itWeb3('Sponsorship can be confirmed by the address that pending as sponsor', async ({api, web3, privateKeyWrapper}) => {161    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);162    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);163    const flipper = await deployFlipper(web3, owner);164    const helpers = contractHelpers(web3, owner);165    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;166    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).send()).to.be.not.rejected;167    await expect(helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor})).to.be.not.rejected;168    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;169  });170171  itWeb3('Confirm sponsorship event', async ({api, web3, privateKeyWrapper}) => {172    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);173    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);174    const flipper = await deployFlipper(web3, owner);175    const helpers = contractHelpers(web3, owner);176    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).send()).to.be.not.rejected;177    const result = await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});178    const events = normalizeEvents(result.events);179    expect(events).to.be.deep.equal([180      {181        address: flipper.options.address,182        event: 'ContractSponsorshipConfirmed',183        args: {184          contractAddress: flipper.options.address,185          sponsor: sponsor,186        },187      },188    ]);189190    await expectSubstrateEventsAtBlock(191      api, 192      result.blockNumber,193      'evmContractHelpers',194      ['ContractSponsorshipConfirmed'],195    );196  });197198  itWeb3('Sponsorship can not be confirmed by the address that not pending as sponsor', async ({api, web3, privateKeyWrapper}) => {199    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);200    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);201    const notSponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);202    const flipper = await deployFlipper(web3, owner);203    const helpers = contractHelpers(web3, owner);204    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;205    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).send()).to.be.not.rejected;206    await expect(helpers.methods.confirmSponsorship(flipper.options.address).call({from: notSponsor})).to.be.rejectedWith('NoPermission');207    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;208  });209210  itWeb3('Sponsorship can not be confirmed by the address that not set as sponsor', async ({api, web3, privateKeyWrapper}) => {211    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);212    const notSponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);213    const flipper = await deployFlipper(web3, owner);214    const helpers = contractHelpers(web3, owner);215    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;216    await expect(helpers.methods.confirmSponsorship(flipper.options.address).call({from: notSponsor})).to.be.rejectedWith('NoPendingSponsor');217    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;218  });219220  itWeb3('Get self sponsored sponsor', async ({api, web3, privateKeyWrapper}) => {221    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);222    const flipper = await deployFlipper(web3, owner);223    const helpers = contractHelpers(web3, owner);224    await helpers.methods.selfSponsoredEnable(flipper.options.address).send();225    226    const result = await helpers.methods.sponsor(flipper.options.address).call();227228    expect(result[0]).to.be.eq(flipper.options.address);229    expect(result[1]).to.be.eq('0');230  });231232  itWeb3('Get confirmed sponsor', async ({api, web3, privateKeyWrapper}) => {233    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);234    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);235    const flipper = await deployFlipper(web3, owner);236    const helpers = contractHelpers(web3, owner);237    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();238    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});239    240    const result = await helpers.methods.sponsor(flipper.options.address).call();241242    expect(result[0]).to.be.eq(sponsor);243    expect(result[1]).to.be.eq('0');244  });245246  itWeb3('Sponsor can be removed by the address that deployed the contract', async ({api, web3, privateKeyWrapper}) => {247    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);248    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);249    const flipper = await deployFlipper(web3, owner);250    const helpers = contractHelpers(web3, owner);251252    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;253    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();254    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});255    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;256    257    await helpers.methods.removeSponsor(flipper.options.address).send();258    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;259  });260261  itWeb3('Remove sponsor event', async ({api, web3, privateKeyWrapper}) => {262    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);263    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);264    const flipper = await deployFlipper(web3, owner);265    const helpers = contractHelpers(web3, owner);266267    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();268    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});269    270    const result = await helpers.methods.removeSponsor(flipper.options.address).send();271    const events = normalizeEvents(result.events);272    expect(events).to.be.deep.equal([273      {274        address: flipper.options.address,275        event: 'ContractSponsorRemoved',276        args: {277          contractAddress: flipper.options.address,278        },279      },280    ]);281282    await expectSubstrateEventsAtBlock(283      api, 284      result.blockNumber,285      'evmContractHelpers',286      ['ContractSponsorRemoved'],287    );288  });289290  itWeb3('Sponsor can not be removed by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {291    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);292    const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);293    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);294    const flipper = await deployFlipper(web3, owner);295    const helpers = contractHelpers(web3, owner);296297    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;298    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();299    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});300    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;301    302    await expect(helpers.methods.removeSponsor(flipper.options.address).call({from: notOwner})).to.be.rejectedWith('NoPermission');303    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;304  });305306  itWeb3('In generous mode, non-allowlisted user transaction will be sponsored', async ({api, web3, privateKeyWrapper}) => {307    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);308    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);309    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);310311    const flipper = await deployFlipper(web3, owner);312313    const helpers = contractHelpers(web3, owner);314315    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();316    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});317318    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Generous).send({from: owner});319    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});320321    const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);322    const callerBalanceBefore = await ethBalanceViaSub(api, caller);323324    await flipper.methods.flip().send({from: caller});325    expect(await flipper.methods.getValue().call()).to.be.true;326327    // Balance should be taken from sponsor instead of caller328    const sponsorBalanceAfter = await ethBalanceViaSub(api, sponsor);329    const callerBalanceAfter = await ethBalanceViaSub(api, caller);330    expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;331    expect(callerBalanceAfter).to.be.eq(callerBalanceBefore);332  });333334  itWeb3('In generous mode, non-allowlisted user transaction will be self sponsored', async ({api, web3, privateKeyWrapper}) => {335    const alice = privateKeyWrapper('//Alice');336337    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);338    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);339340    const flipper = await deployFlipper(web3, owner);341342    const helpers = contractHelpers(web3, owner);343344    await helpers.methods.selfSponsoredEnable(flipper.options.address).send();345346    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Generous).send({from: owner});347    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});348349    await transferBalanceToEth(api, alice, flipper.options.address);350351    const contractBalanceBefore = await ethBalanceViaSub(api, flipper.options.address);352    const callerBalanceBefore = await ethBalanceViaSub(api, caller);353354    await flipper.methods.flip().send({from: caller});355    expect(await flipper.methods.getValue().call()).to.be.true;356357    // Balance should be taken from sponsor instead of caller358    const contractBalanceAfter = await ethBalanceViaSub(api, flipper.options.address);359    const callerBalanceAfter = await ethBalanceViaSub(api, caller);360    expect(contractBalanceAfter < contractBalanceBefore).to.be.true;361    expect(callerBalanceAfter).to.be.eq(callerBalanceBefore);362  });363364  itWeb3('Sponsoring is set, an address that has no UNQ can send a transaction and it works. Sponsor balance should decrease (allowlisted)', async ({api, web3, privateKeyWrapper}) => {365    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);366    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);367    const caller = createEthAccount(web3);368369    const flipper = await deployFlipper(web3, owner);370371    const helpers = contractHelpers(web3, owner);372    await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});373    await helpers.methods.toggleAllowed(flipper.options.address, caller, true).send({from: owner});374375    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner});376    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});377378    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();379    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});380381    const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);382    expect(sponsorBalanceBefore).to.be.not.equal('0');383384    await flipper.methods.flip().send({from: caller});385    expect(await flipper.methods.getValue().call()).to.be.true;386387    // Balance should be taken from flipper instead of caller388    const sponsorBalanceAfter = await ethBalanceViaSub(api, sponsor);389    expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;390  });391392  itWeb3('Sponsoring is set, an address that has no UNQ can send a transaction and it works. Sponsor balance should not decrease (non-allowlisted)', async ({api, web3, privateKeyWrapper}) => {393    const alice = privateKeyWrapper('//Alice');394395    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);396    const caller = createEthAccount(web3);397398    const flipper = await deployFlipper(web3, owner);399400    const helpers = contractHelpers(web3, owner);401402    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner});403    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});404405    await transferBalanceToEth(api, alice, flipper.options.address);406407    const originalFlipperBalance = await web3.eth.getBalance(flipper.options.address);408    expect(originalFlipperBalance).to.be.not.equal('0');409410    await expect(flipper.methods.flip().send({from: caller})).to.be.rejectedWith(/InvalidTransaction::Payment/);411    expect(await flipper.methods.getValue().call()).to.be.false;412413    // Balance should be taken from flipper instead of caller414    const balanceAfter = await web3.eth.getBalance(flipper.options.address);415    expect(+balanceAfter).to.be.equals(+originalFlipperBalance);416  });417418  itWeb3('Sponsoring is set, an address that has UNQ can send a transaction and it works. User balance should not change', async ({api, web3, privateKeyWrapper}) => {419    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);420    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);421    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);422423    const flipper = await deployFlipper(web3, owner);424425    const helpers = contractHelpers(web3, owner);426    await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});427    await helpers.methods.toggleAllowed(flipper.options.address, caller, true).send({from: owner});428429    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner});430    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});431432    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();433    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});434435    const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);436    const callerBalanceBefore = await ethBalanceViaSub(api, caller);437438    await flipper.methods.flip().send({from: caller});439    expect(await flipper.methods.getValue().call()).to.be.true;440441    const sponsorBalanceAfter = await ethBalanceViaSub(api, sponsor);442    const callerBalanceAfter = await ethBalanceViaSub(api, caller);443    expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;444    expect(callerBalanceAfter).to.be.equals(callerBalanceBefore);445  });446447  itWeb3('Sponsoring is limited, with setContractRateLimit. The limitation is working if transactions are sent more often, the sender pays the commission.', async ({api, web3, privateKeyWrapper}) => {448    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);449    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);450    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);451    const originalCallerBalance = await web3.eth.getBalance(caller);452453    const flipper = await deployFlipper(web3, owner);454455    const helpers = contractHelpers(web3, owner);456    await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});457    await helpers.methods.toggleAllowed(flipper.options.address, caller, true).send({from: owner});458459    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner});460    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 10).send({from: owner});461462    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();463    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});464465    const originalFlipperBalance = await web3.eth.getBalance(sponsor);466    expect(originalFlipperBalance).to.be.not.equal('0');467468    await flipper.methods.flip().send({from: caller});469    expect(await flipper.methods.getValue().call()).to.be.true;470    expect(await web3.eth.getBalance(caller)).to.be.equals(originalCallerBalance);471472    const newFlipperBalance = await web3.eth.getBalance(sponsor);473    expect(newFlipperBalance).to.be.not.equals(originalFlipperBalance);474475    await flipper.methods.flip().send({from: caller});476    expect(await web3.eth.getBalance(sponsor)).to.be.equal(newFlipperBalance);477    expect(await web3.eth.getBalance(caller)).to.be.not.equals(originalCallerBalance);478  });479480  // TODO: Find a way to calculate default rate limit481  itWeb3('Default rate limit equals 7200', async ({api, web3, privateKeyWrapper}) => {482    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);483    const flipper = await deployFlipper(web3, owner);484    const helpers = contractHelpers(web3, owner);485    expect(await helpers.methods.sponsoringRateLimit(flipper.options.address).call()).to.be.equals('7200');486  });487});488489describe('Sponsoring Fee Limit', () => {490491  let testContract: CompiledContract;492  493  function compileTestContract() {494    if (!testContract) {495      const input = {496        language: 'Solidity',497        sources: {498          ['TestContract.sol']: {499            content:500            `501            // SPDX-License-Identifier: MIT502            pragma solidity ^0.8.0;503            504            contract TestContract {505              event Result(bool);506507              function test(uint32 cycles) public {508                uint256 counter = 0;509                while(true) {510                  counter ++;511                  if (counter > cycles){512                    break;513                  }514                }515                emit Result(true);516              }517            }518            `,519          },520        },521        settings: {522          outputSelection: {523            '*': {524              '*': ['*'],525            },526          },527        },528      };529      const json = JSON.parse(solc.compile(JSON.stringify(input)));530      const out = json.contracts['TestContract.sol']['TestContract'];531  532      testContract = {533        abi: out.abi,534        object: '0x' + out.evm.bytecode.object,535      };536    }537    return testContract;538  }539  540  async function deployTestContract(web3: Web3, owner: string) {541    const compiled = compileTestContract();542    const testContract = new web3.eth.Contract(compiled.abi, undefined, {543      data: compiled.object,544      from: owner,545      ...GAS_ARGS,546    });547    return await testContract.deploy({data: compiled.object}).send({from: owner});548  }549550  itWeb3('Default fee limit', async ({api, web3, privateKeyWrapper}) => {551    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);552    const flipper = await deployFlipper(web3, owner);553    const helpers = contractHelpers(web3, owner);554    expect(await helpers.methods.sponsoringFeeLimit(flipper.options.address).call()).to.be.equals('115792089237316195423570985008687907853269984665640564039457584007913129639935');555  });556557  itWeb3('Set fee limit', async ({api, web3, privateKeyWrapper}) => {558    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);559    const flipper = await deployFlipper(web3, owner);560    const helpers = contractHelpers(web3, owner);561    await helpers.methods.setSponsoringFeeLimit(flipper.options.address, 100).send();562    expect(await helpers.methods.sponsoringFeeLimit(flipper.options.address).call()).to.be.equals('100');563  });564565  itWeb3('Negative test - set fee limit by non-owner', async ({api, web3, privateKeyWrapper}) => {566    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);567    const stranger = await createEthAccountWithBalance(api, web3, privateKeyWrapper);568    const flipper = await deployFlipper(web3, owner);569    const helpers = contractHelpers(web3, owner);570    await expect(helpers.methods.setSponsoringFeeLimit(flipper.options.address, 100).send({from: stranger})).to.be.rejected;571  });572573  itWeb3('Negative test - check that eth transactions exceeding fee limit are not executed', async ({api, web3, privateKeyWrapper}) => {574    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);575    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);576    const user = await createEthAccountWithBalance(api, web3, privateKeyWrapper);577578    const testContract = await deployTestContract(web3, owner);579    const helpers = contractHelpers(web3, owner);580    581    await helpers.methods.setSponsoringMode(testContract.options.address, SponsoringMode.Generous).send({from: owner});582    await helpers.methods.setSponsoringRateLimit(testContract.options.address, 0).send({from: owner});583    584    await helpers.methods.setSponsor(testContract.options.address, sponsor).send();585    await helpers.methods.confirmSponsorship(testContract.options.address).send({from: sponsor});586587    const gasPrice = BigInt(await web3.eth.getGasPrice());588589    await helpers.methods.setSponsoringFeeLimit(testContract.options.address, 2_000_000n * gasPrice).send();590591    const originalUserBalance = await web3.eth.getBalance(user);592    await testContract.methods.test(100).send({from: user, gas: 2_000_000});593    expect(await web3.eth.getBalance(user)).to.be.equal(originalUserBalance);594595    await testContract.methods.test(100).send({from: user, gas: 2_100_000});596    expect(await web3.eth.getBalance(user)).to.not.be.equal(originalUserBalance);597  });598599  itWeb3('Negative test - check that evm.call transactions exceeding fee limit are not executed', async ({api, web3, privateKeyWrapper}) => {600    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);601    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);602603    const testContract = await deployTestContract(web3, owner);604    const helpers = contractHelpers(web3, owner);605    606    await helpers.methods.setSponsoringMode(testContract.options.address, SponsoringMode.Generous).send({from: owner});607    await helpers.methods.setSponsoringRateLimit(testContract.options.address, 0).send({from: owner});608    609    await helpers.methods.setSponsor(testContract.options.address, sponsor).send();610    await helpers.methods.confirmSponsorship(testContract.options.address).send({from: sponsor});611612    const gasPrice = BigInt(await web3.eth.getGasPrice());613614    await helpers.methods.setSponsoringFeeLimit(testContract.options.address, 2_000_000n * gasPrice).send();615616    const alice = privateKeyWrapper('//Alice');617    const originalAliceBalance = (await api.query.system.account(alice.address)).data.free.toBigInt();618    619    await submitTransactionAsync(620      alice,621      api.tx.evm.call(622        subToEth(alice.address),623        testContract.options.address,624        testContract.methods.test(100).encodeABI(),625        Uint8Array.from([]),626        2_000_000n,627        gasPrice,628        null,629        null,630        [],631      ),632    );633    expect((await api.query.system.account(alice.address)).data.free.toBigInt()).to.be.equal(originalAliceBalance);634    635    await submitTransactionAsync(636      alice,637      api.tx.evm.call(638        subToEth(alice.address),639        testContract.options.address,640        testContract.methods.test(100).encodeABI(),641        Uint8Array.from([]),642        2_100_000n,643        gasPrice,644        null,645        null,646        [],647      ),648    );649    expect((await api.query.system.account(alice.address)).data.free.toBigInt()).to.not.be.equal(originalAliceBalance);650  });651});
modifiedtests/src/eth/fungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/fungibleAbi.json
+++ b/tests/src/eth/fungibleAbi.json
@@ -159,6 +159,23 @@
   },
   {
     "inputs": [],
+    "name": "collectionSponsor",
+    "outputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "",
+        "type": "tuple"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
     "name": "confirmCollectionSponsorship",
     "outputs": [],
     "stateMutability": "nonpayable",
@@ -183,23 +200,6 @@
     "name": "deleteCollectionProperty",
     "outputs": [],
     "stateMutability": "nonpayable",
-    "type": "function"
-  },
-  {
-    "inputs": [],
-    "name": "getCollectionSponsor",
-    "outputs": [
-      {
-        "components": [
-          { "internalType": "address", "name": "field_0", "type": "address" },
-          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
-        ],
-        "internalType": "struct Tuple6",
-        "name": "",
-        "type": "tuple"
-      }
-    ],
-    "stateMutability": "view",
     "type": "function"
   },
   {
@@ -453,7 +453,7 @@
     "inputs": [],
     "name": "uniqueCollectionType",
     "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
-    "stateMutability": "nonpayable",
+    "stateMutability": "view",
     "type": "function"
   }
 ]
modifiedtests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/nonFungibleAbi.json
+++ b/tests/src/eth/nonFungibleAbi.json
@@ -189,6 +189,23 @@
   },
   {
     "inputs": [],
+    "name": "collectionSponsor",
+    "outputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple17",
+        "name": "",
+        "type": "tuple"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
     "name": "confirmCollectionSponsorship",
     "outputs": [],
     "stateMutability": "nonpayable",
@@ -231,23 +248,6 @@
     ],
     "name": "getApproved",
     "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
-    "stateMutability": "view",
-    "type": "function"
-  },
-  {
-    "inputs": [],
-    "name": "getCollectionSponsor",
-    "outputs": [
-      {
-        "components": [
-          { "internalType": "address", "name": "field_0", "type": "address" },
-          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
-        ],
-        "internalType": "struct Tuple17",
-        "name": "",
-        "type": "tuple"
-      }
-    ],
     "stateMutability": "view",
     "type": "function"
   },
@@ -651,7 +651,7 @@
     "inputs": [],
     "name": "uniqueCollectionType",
     "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
-    "stateMutability": "nonpayable",
+    "stateMutability": "view",
     "type": "function"
   }
 ]
modifiedtests/src/eth/reFungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/reFungibleAbi.json
+++ b/tests/src/eth/reFungibleAbi.json
@@ -189,6 +189,23 @@
   },
   {
     "inputs": [],
+    "name": "collectionSponsor",
+    "outputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple17",
+        "name": "",
+        "type": "tuple"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
     "name": "confirmCollectionSponsorship",
     "outputs": [],
     "stateMutability": "nonpayable",
@@ -231,23 +248,6 @@
     ],
     "name": "getApproved",
     "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
-    "stateMutability": "view",
-    "type": "function"
-  },
-  {
-    "inputs": [],
-    "name": "getCollectionSponsor",
-    "outputs": [
-      {
-        "components": [
-          { "internalType": "address", "name": "field_0", "type": "address" },
-          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
-        ],
-        "internalType": "struct Tuple17",
-        "name": "",
-        "type": "tuple"
-      }
-    ],
     "stateMutability": "view",
     "type": "function"
   },
@@ -660,7 +660,7 @@
     "inputs": [],
     "name": "uniqueCollectionType",
     "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
-    "stateMutability": "nonpayable",
+    "stateMutability": "view",
     "type": "function"
   }
 ]
modifiedtests/src/eth/util/contractHelpersAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/util/contractHelpersAbi.json
+++ b/tests/src/eth/util/contractHelpersAbi.json
@@ -111,18 +111,8 @@
         "type": "address"
       }
     ],
-    "name": "getSponsor",
-    "outputs": [
-      {
-        "components": [
-          { "internalType": "address", "name": "field_0", "type": "address" },
-          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
-        ],
-        "internalType": "struct Tuple0",
-        "name": "",
-        "type": "tuple"
-      }
-    ],
+    "name": "hasPendingSponsor",
+    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
     "stateMutability": "view",
     "type": "function"
   },
@@ -134,8 +124,8 @@
         "type": "address"
       }
     ],
-    "name": "getSponsoringFeeLimit",
-    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+    "name": "hasSponsor",
+    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
     "stateMutability": "view",
     "type": "function"
   },
@@ -147,9 +137,9 @@
         "type": "address"
       }
     ],
-    "name": "getSponsoringRateLimit",
-    "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }],
-    "stateMutability": "view",
+    "name": "removeSponsor",
+    "outputs": [],
+    "stateMutability": "nonpayable",
     "type": "function"
   },
   {
@@ -160,9 +150,9 @@
         "type": "address"
       }
     ],
-    "name": "hasPendingSponsor",
-    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
-    "stateMutability": "view",
+    "name": "selfSponsoredEnable",
+    "outputs": [],
+    "stateMutability": "nonpayable",
     "type": "function"
   },
   {
@@ -171,11 +161,12 @@
         "internalType": "address",
         "name": "contractAddress",
         "type": "address"
-      }
+      },
+      { "internalType": "address", "name": "sponsor", "type": "address" }
     ],
-    "name": "hasSponsor",
-    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
-    "stateMutability": "view",
+    "name": "setSponsor",
+    "outputs": [],
+    "stateMutability": "nonpayable",
     "type": "function"
   },
   {
@@ -184,9 +175,10 @@
         "internalType": "address",
         "name": "contractAddress",
         "type": "address"
-      }
+      },
+      { "internalType": "uint256", "name": "feeLimit", "type": "uint256" }
     ],
-    "name": "removeSponsor",
+    "name": "setSponsoringFeeLimit",
     "outputs": [],
     "stateMutability": "nonpayable",
     "type": "function"
@@ -197,9 +189,10 @@
         "internalType": "address",
         "name": "contractAddress",
         "type": "address"
-      }
+      },
+      { "internalType": "uint8", "name": "mode", "type": "uint8" }
     ],
-    "name": "selfSponsoredEnable",
+    "name": "setSponsoringMode",
     "outputs": [],
     "stateMutability": "nonpayable",
     "type": "function"
@@ -211,9 +204,9 @@
         "name": "contractAddress",
         "type": "address"
       },
-      { "internalType": "address", "name": "sponsor", "type": "address" }
+      { "internalType": "uint32", "name": "rateLimit", "type": "uint32" }
     ],
-    "name": "setSponsor",
+    "name": "setSponsoringRateLimit",
     "outputs": [],
     "stateMutability": "nonpayable",
     "type": "function"
@@ -224,12 +217,21 @@
         "internalType": "address",
         "name": "contractAddress",
         "type": "address"
-      },
-      { "internalType": "uint256", "name": "feeLimit", "type": "uint256" }
+      }
+    ],
+    "name": "sponsor",
+    "outputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple0",
+        "name": "",
+        "type": "tuple"
+      }
     ],
-    "name": "setSponsoringFeeLimit",
-    "outputs": [],
-    "stateMutability": "nonpayable",
+    "stateMutability": "view",
     "type": "function"
   },
   {
@@ -238,12 +240,11 @@
         "internalType": "address",
         "name": "contractAddress",
         "type": "address"
-      },
-      { "internalType": "uint8", "name": "mode", "type": "uint8" }
+      }
     ],
-    "name": "setSponsoringMode",
-    "outputs": [],
-    "stateMutability": "nonpayable",
+    "name": "sponsoringEnabled",
+    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+    "stateMutability": "view",
     "type": "function"
   },
   {
@@ -252,12 +253,11 @@
         "internalType": "address",
         "name": "contractAddress",
         "type": "address"
-      },
-      { "internalType": "uint32", "name": "rateLimit", "type": "uint32" }
+      }
     ],
-    "name": "setSponsoringRateLimit",
-    "outputs": [],
-    "stateMutability": "nonpayable",
+    "name": "sponsoringFeeLimit",
+    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+    "stateMutability": "view",
     "type": "function"
   },
   {
@@ -268,8 +268,8 @@
         "type": "address"
       }
     ],
-    "name": "sponsoringEnabled",
-    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+    "name": "sponsoringRateLimit",
+    "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }],
     "stateMutability": "view",
     "type": "function"
   },