git.delta.rocks / unique-network / refs/commits / 7ed3eb8cb302

difftreelog

CORE-337 Rewrite set limits

Trubnikov Sergey2022-05-24parent: #686ae35.patch.diff
in: master

9 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
before · pallets/common/src/erc.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use evm_coder::{solidity_interface, types::*, execution::{Result, Error}};18pub use pallet_evm::{PrecompileOutput, PrecompileResult, account::CrossAccountId};19use pallet_evm_coder_substrate::{dispatch_to_evm, SubstrateRecorder};20use sp_core::{H160, U256};21use sp_std::vec::Vec;22use up_data_structs::Property;2324use crate::{Pallet, CollectionHandle, Config, CollectionProperties};2526/// Does not always represent a full collection, for RFT it is either27/// collection (Implementing ERC721), or specific collection token (Implementing ERC20)28pub trait CommonEvmHandler {29	const CODE: &'static [u8];3031	fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileResult>;32}3334#[solidity_interface(name = "Collection")]35impl<T: Config> CollectionHandle<T> {36	fn set_collection_property(&mut self, caller: caller, key: string, value: bytes) -> Result<()> {37		let caller = T::CrossAccountId::from_eth(caller);38		let key = <Vec<u8>>::from(key)39			.try_into()40			.map_err(|_| "key too large")?;41		let value = value.try_into().map_err(|_| "value too large")?;4243		<Pallet<T>>::set_collection_property(self, &caller, Property { key, value })44			.map_err(dispatch_to_evm::<T>)45	}4647	fn delete_collection_property(&mut self, caller: caller, key: string) -> Result<()> {48		let caller = T::CrossAccountId::from_eth(caller);49		let key = <Vec<u8>>::from(key)50			.try_into()51			.map_err(|_| "key too large")?;5253		<Pallet<T>>::delete_collection_property(self, &caller, key).map_err(dispatch_to_evm::<T>)54	}5556	/// Throws error if key not found57	fn collection_property(&self, key: string) -> Result<bytes> {58		let key = <Vec<u8>>::from(key)59			.try_into()60			.map_err(|_| "key too large")?;6162		let props = <CollectionProperties<T>>::get(self.id);63		let prop = props.get(&key).ok_or("key not found")?;6465		Ok(prop.to_vec())66	}6768	fn eth_set_sponsor(69		&mut self,70		caller: caller,71		sponsor: address,72	) -> Result<void> {73		check_is_owner(caller, self)?;7475		let sponsor = T::CrossAccountId::from_eth(sponsor);76		self.set_sponsor(sponsor.as_sub().clone());77		save(self);78		Ok(())79	}8081	fn eth_confirm_sponsorship(&mut self, caller: caller) -> Result<void> {82		let caller = T::CrossAccountId::from_eth(caller);83		if !self.confirm_sponsorship(caller.as_sub()) {84			return Err(Error::Revert("Caller is not set as sponsor".into()));85		}86		save(self);87		Ok(())88	}8990	fn set_limits(91		&self,92		caller: caller,93		limits_json: string,94	) -> Result<void> {95		// let mut collection = collection_from_address::<T>(self.contract_address(caller).unwrap(), self.1.gas_left())?;96		// check_is_owner(caller, &collection)?;9798		// let limits = serde_json_core::from_str(limits_json.as_ref())99		// 	.map_err(|e| Error::Revert(format!("Parse JSON error: {}", e)))?;100		// collection.limits = limits.0;101		// collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;102		Ok(())103	}104105	fn contract_address(&self, _caller: caller) -> Result<address> {106		Ok(crate::eth::collection_id_to_address(self.id))107	}108}109110fn collection_from_address<T: Config>(111	collection_address: address,112	gas_limit: u64113) -> Result<CollectionHandle<T>> {114	let collection_id = crate::eth::map_eth_to_id(&collection_address)115	.ok_or(Error::Revert("Contract is not an unique collection".into()))?;116	let recorder = <SubstrateRecorder<T>>::new(gas_limit);117	let collection =118		CollectionHandle::new_with_recorder(collection_id, recorder)119			.ok_or(Error::Revert("Create collection handle error".into()))?;120	Ok(collection)121}122123fn check_is_owner<T: Config>(caller: caller, collection: &CollectionHandle<T>) -> Result<()> {124	let caller = T::CrossAccountId::from_eth(caller);125	collection126		.check_is_owner(&caller)127		.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;128	Ok(())129}130131fn save<T: Config>(collection: &CollectionHandle<T>) {132	<crate::CollectionById<T>>::insert(collection.id, collection.collection.clone());133}
after · pallets/common/src/erc.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use evm_coder::{solidity_interface, types::*, execution::{Result, Error}};18pub use pallet_evm::{PrecompileOutput, PrecompileResult, account::CrossAccountId};19use pallet_evm_coder_substrate::dispatch_to_evm;20use sp_core::{H160, U256};21use sp_std::vec::Vec;22use up_data_structs::{Property, SponsoringRateLimit};23use alloc::format;2425use crate::{Pallet, CollectionHandle, Config, CollectionProperties};2627/// Does not always represent a full collection, for RFT it is either28/// collection (Implementing ERC721), or specific collection token (Implementing ERC20)29pub trait CommonEvmHandler {30	const CODE: &'static [u8];3132	fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileResult>;33}3435#[solidity_interface(name = "Collection")]36impl<T: Config> CollectionHandle<T> {37	fn set_collection_property(&mut self, caller: caller, key: string, value: bytes) -> Result<()> {38		let caller = T::CrossAccountId::from_eth(caller);39		let key = <Vec<u8>>::from(key)40			.try_into()41			.map_err(|_| "key too large")?;42		let value = value.try_into().map_err(|_| "value too large")?;4344		<Pallet<T>>::set_collection_property(self, &caller, Property { key, value })45			.map_err(dispatch_to_evm::<T>)46	}4748	fn delete_collection_property(&mut self, caller: caller, key: string) -> Result<()> {49		let caller = T::CrossAccountId::from_eth(caller);50		let key = <Vec<u8>>::from(key)51			.try_into()52			.map_err(|_| "key too large")?;5354		<Pallet<T>>::delete_collection_property(self, &caller, key).map_err(dispatch_to_evm::<T>)55	}5657	/// Throws error if key not found58	fn collection_property(&self, key: string) -> Result<bytes> {59		let key = <Vec<u8>>::from(key)60			.try_into()61			.map_err(|_| "key too large")?;6263		let props = <CollectionProperties<T>>::get(self.id);64		let prop = props.get(&key).ok_or("key not found")?;6566		Ok(prop.to_vec())67	}6869	fn eth_set_sponsor(70		&mut self,71		caller: caller,72		sponsor: address,73	) -> Result<void> {74		check_is_owner(caller, self)?;7576		let sponsor = T::CrossAccountId::from_eth(sponsor);77		self.set_sponsor(sponsor.as_sub().clone());78		save(self);79		Ok(())80	}8182	fn eth_confirm_sponsorship(&mut self, caller: caller) -> Result<void> {83		let caller = T::CrossAccountId::from_eth(caller);84		if !self.confirm_sponsorship(caller.as_sub()) {85			return Err(Error::Revert("Caller is not set as sponsor".into()));86		}87		save(self);88		Ok(())89	}9091	fn set_limit(92		&mut self,93		caller: caller,94		limit: string,95		value: string,96	) -> Result<void> {97		check_is_owner(caller, self)?;98		let mut limits = self.limits.clone();99100		match limit.as_str() {101			"accountTokenOwnershipLimit" => {102				limits.account_token_ownership_limit = parse_int(value)?;103			},104			"sponsoredDataSize" => {105				limits.sponsored_data_size = parse_int(value)?;106			},107			"sponsoredDataRateLimit" => {108				limits.sponsored_data_rate_limit = Some(SponsoringRateLimit::Blocks(parse_int(value)?.unwrap()));109			},110			"tokenLimit" => {111				limits.token_limit = parse_int(value)?;112			},113			"sponsorTransferTimeout" => {114				limits.sponsor_transfer_timeout = parse_int(value)?;115			},116			"sponsorApproveTimeout" => {117				limits.sponsor_approve_timeout = parse_int(value)?;118			},119			"ownerCanTransfer" => {120				limits.owner_can_transfer = parse_bool(value)?;121			},122			"ownerCanDestroy" => {123				limits.owner_can_destroy = parse_bool(value)?;124			},125			"transfersEnabled" => {126				limits.transfers_enabled = parse_bool(value)?;127			},128			_ => return Err(Error::Revert(format!("Unknown limit \"{}\"", limit)))129		}130		self.limits = limits;131		save(self);132		Ok(())133	}134135	fn contract_address(&self, _caller: caller) -> Result<address> {136		Ok(crate::eth::collection_id_to_address(self.id))137	}138}139140fn check_is_owner<T: Config>(caller: caller, collection: &CollectionHandle<T>) -> Result<()> {141	let caller = T::CrossAccountId::from_eth(caller);142	collection143		.check_is_owner(&caller)144		.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;145	Ok(())146}147148fn save<T: Config>(collection: &CollectionHandle<T>) {149	<crate::CollectionById<T>>::insert(collection.id, collection.collection.clone());150}151152fn parse_int(value: string) -> Result<Option<u32>> {153	value.parse::<u32>()154		.map_err(|e| Error::Revert(format!("Int value \"{}\" parse error: {}", value, e)))155		.map(|value| Some(value))156}157158fn parse_bool(value: string) -> Result<Option<bool>> {159	value.parse::<bool>()160		.map_err(|e| Error::Revert(format!("Bool value \"{}\" parse error: {}", value, e)))161		.map(|value| Some(value))162}
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
@@ -51,67 +51,6 @@
 	event MintingFinished();
 }
 
-// Selector: 38e33c60
-contract Collection is Dummy, ERC165 {
-	// Selector: setCollectionProperty(string,bytes) 2f073f66
-	function setCollectionProperty(string memory key, bytes memory value)
-		public
-	{
-		require(false, stub_error);
-		key;
-		value;
-		dummy = 0;
-	}
-
-	// Selector: deleteCollectionProperty(string) 7b7debce
-	function deleteCollectionProperty(string memory key) public {
-		require(false, stub_error);
-		key;
-		dummy = 0;
-	}
-
-	// Throws error if key not found
-	//
-	// Selector: collectionProperty(string) cf24fd6d
-	function collectionProperty(string memory key)
-		public
-		view
-		returns (bytes memory)
-	{
-		require(false, stub_error);
-		key;
-		dummy;
-		return hex"";
-	}
-
-	// Selector: ethSetSponsor(address) 8f9af356
-	function ethSetSponsor(address sponsor) public {
-		require(false, stub_error);
-		sponsor;
-		dummy = 0;
-	}
-
-	// Selector: ethConfirmSponsorship() a8580d1a
-	function ethConfirmSponsorship() public {
-		require(false, stub_error);
-		dummy = 0;
-	}
-
-	// Selector: setLimits(string) 72cb345d
-	function setLimits(string memory limitsJson) public view {
-		require(false, stub_error);
-		limitsJson;
-		dummy;
-	}
-
-	// Selector: contractAddress() f6b4dfb4
-	function contractAddress() public view returns (address) {
-		require(false, stub_error);
-		dummy;
-		return 0x0000000000000000000000000000000000000000;
-	}
-}
-
 // Selector: 41369377
 contract TokenProperties is Dummy, ERC165 {
 	// Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa
@@ -441,6 +380,68 @@
 	}
 }
 
+// Selector: f5652829
+contract Collection is Dummy, ERC165 {
+	// Selector: setCollectionProperty(string,bytes) 2f073f66
+	function setCollectionProperty(string memory key, bytes memory value)
+		public
+	{
+		require(false, stub_error);
+		key;
+		value;
+		dummy = 0;
+	}
+
+	// Selector: deleteCollectionProperty(string) 7b7debce
+	function deleteCollectionProperty(string memory key) public {
+		require(false, stub_error);
+		key;
+		dummy = 0;
+	}
+
+	// Throws error if key not found
+	//
+	// Selector: collectionProperty(string) cf24fd6d
+	function collectionProperty(string memory key)
+		public
+		view
+		returns (bytes memory)
+	{
+		require(false, stub_error);
+		key;
+		dummy;
+		return hex"";
+	}
+
+	// Selector: ethSetSponsor(address) 8f9af356
+	function ethSetSponsor(address sponsor) public {
+		require(false, stub_error);
+		sponsor;
+		dummy = 0;
+	}
+
+	// Selector: ethConfirmSponsorship() a8580d1a
+	function ethConfirmSponsorship() public {
+		require(false, stub_error);
+		dummy = 0;
+	}
+
+	// Selector: setLimit(string,string) bf4d2014
+	function setLimit(string memory limit, string memory value) public {
+		require(false, stub_error);
+		limit;
+		value;
+		dummy = 0;
+	}
+
+	// Selector: contractAddress() f6b4dfb4
+	function contractAddress() public view returns (address) {
+		require(false, stub_error);
+		dummy;
+		return 0x0000000000000000000000000000000000000000;
+	}
+}
+
 contract UniqueNFT is
 	Dummy,
 	ERC165,
modifiedpallets/unique/src/eth/mod.rsdiffbeforeafterboth
--- a/pallets/unique/src/eth/mod.rs
+++ b/pallets/unique/src/eth/mod.rs
@@ -26,7 +26,7 @@
 	};
 	use frame_support::traits::Get;
 	use sp_core::H160;
-	use pallet_common::{CollectionHandle, CollectionById};
+	use pallet_common::CollectionById;
 	
 	use sp_std::vec::Vec;
 	use alloc::format;
modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -368,30 +368,21 @@
 #[derive(Encode, Decode, Debug, Default, Clone, PartialEq, TypeInfo, MaxEncodedLen)]
 #[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
 pub struct CollectionLimits {
-	#[serde(alias = "accountTokenOwnershipLimit")]
 	pub account_token_ownership_limit: Option<u32>,
-	#[serde(alias = "sponsoredDataSize")]
 	pub sponsored_data_size: Option<u32>,
 
 	/// FIXME should we delete this or repurpose it?
 	/// None - setVariableMetadata is not sponsored
 	/// Some(v) - setVariableMetadata is sponsored
 	///           if there is v block between txs
-	#[serde(alias = "sponsoredDataRateLimit")]
 	pub sponsored_data_rate_limit: Option<SponsoringRateLimit>,
-	#[serde(alias = "tokenLimit")]
 	pub token_limit: Option<u32>,
 
 	// Timeouts for item types in passed blocks
-	#[serde(alias = "sponsorTransferTimeout")]
 	pub sponsor_transfer_timeout: Option<u32>,
-	#[serde(alias = "sponsorApproveTimeout")]
 	pub sponsor_approve_timeout: Option<u32>,
-	#[serde(alias = "ownerCanTransfer")]
 	pub owner_can_transfer: Option<bool>,
-	#[serde(alias = "ownerCanDestroy")]
 	pub owner_can_destroy: Option<bool>,
-	#[serde(alias = "transfersEnabled")]
 	pub transfers_enabled: Option<bool>,
 }
 
deletedtests/src/eth/api/Collection.soldiffbeforeafterboth
--- a/tests/src/eth/api/Collection.sol
+++ /dev/null
@@ -1,28 +0,0 @@
-// SPDX-License-Identifier: OTHER
-// This code is automatically generated
-
-pragma solidity >=0.8.0 <0.9.0;
-
-// Common stubs holder
-interface Dummy {
-
-}
-
-interface ERC165 is Dummy {
-	function supportsInterface(bytes4 interfaceID) external view returns (bool);
-}
-
-// Selector: 15cc740e
-interface Collection is Dummy, ERC165 {
-	// Selector: setSponsor(address) 59753fb1
-	function setSponsor(address sponsor) external view;
-
-	// Selector: confirmSponsorship() c8c6a056
-	function confirmSponsorship() external view;
-
-	// Selector: setLimits(string) 72cb345d
-	function setLimits(string memory limitsJson) external view;
-
-	// Selector: contractAddress() f6b4dfb4
-	function contractAddress() external view returns (address);
-}
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -42,36 +42,6 @@
 	event MintingFinished();
 }
 
-// Selector: 38e33c60
-interface Collection is Dummy, ERC165 {
-	// Selector: setCollectionProperty(string,bytes) 2f073f66
-	function setCollectionProperty(string memory key, bytes memory value)
-		external;
-
-	// Selector: deleteCollectionProperty(string) 7b7debce
-	function deleteCollectionProperty(string memory key) external;
-
-	// Throws error if key not found
-	//
-	// Selector: collectionProperty(string) cf24fd6d
-	function collectionProperty(string memory key)
-		external
-		view
-		returns (bytes memory);
-
-	// Selector: ethSetSponsor(address) 8f9af356
-	function ethSetSponsor(address sponsor) external;
-
-	// Selector: ethConfirmSponsorship() a8580d1a
-	function ethConfirmSponsorship() external;
-
-	// Selector: setLimits(string) 72cb345d
-	function setLimits(string memory limitsJson) external view;
-
-	// Selector: contractAddress() f6b4dfb4
-	function contractAddress() external view returns (address);
-}
-
 // Selector: 41369377
 interface TokenProperties is Dummy, ERC165 {
 	// Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa
@@ -243,6 +213,36 @@
 		returns (bool);
 }
 
+// Selector: f5652829
+interface Collection is Dummy, ERC165 {
+	// Selector: setCollectionProperty(string,bytes) 2f073f66
+	function setCollectionProperty(string memory key, bytes memory value)
+		external;
+
+	// Selector: deleteCollectionProperty(string) 7b7debce
+	function deleteCollectionProperty(string memory key) external;
+
+	// Throws error if key not found
+	//
+	// Selector: collectionProperty(string) cf24fd6d
+	function collectionProperty(string memory key)
+		external
+		view
+		returns (bytes memory);
+
+	// Selector: ethSetSponsor(address) 8f9af356
+	function ethSetSponsor(address sponsor) external;
+
+	// Selector: ethConfirmSponsorship() a8580d1a
+	function ethConfirmSponsorship() external;
+
+	// Selector: setLimit(string,string) bf4d2014
+	function setLimit(string memory limit, string memory value) external;
+
+	// Selector: contractAddress() f6b4dfb4
+	function contractAddress() external view returns (address);
+}
+
 interface UniqueNFT is
 	Dummy,
 	ERC165,
modifiedtests/src/eth/createCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createCollection.test.ts
+++ b/tests/src/eth/createCollection.test.ts
@@ -108,7 +108,7 @@
     const limits = {
       accountTokenOwnershipLimit: 1000,
       sponsoredDataSize: 1024,
-      sponsoredDataRateLimit: {Blocks: 30},
+      sponsoredDataRateLimit: 30,
       tokenLimit: 1000000,
       sponsorTransferTimeout: 6,
       sponsorApproveTimeout: 6,
@@ -117,14 +117,21 @@
       transfersEnabled: false,
     };
 
-    const limitsJson = JSON.stringify(limits, null, 1);
     const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
-    await collectionEvm.methods.setLimits(limitsJson).send();
+    await collectionEvm.methods.setLimit('accountTokenOwnershipLimit', limits.accountTokenOwnershipLimit.toString()).send();
+    await collectionEvm.methods.setLimit('sponsoredDataSize', limits.sponsoredDataSize.toString()).send();
+    await collectionEvm.methods.setLimit('sponsoredDataRateLimit', limits.sponsoredDataRateLimit.toString()).send();
+    await collectionEvm.methods.setLimit('tokenLimit', limits.tokenLimit.toString()).send();
+    await collectionEvm.methods.setLimit('sponsorTransferTimeout', limits.sponsorTransferTimeout.toString()).send();
+    await collectionEvm.methods.setLimit('sponsorApproveTimeout', limits.sponsorApproveTimeout.toString()).send();
+    await collectionEvm.methods.setLimit('ownerCanTransfer', limits.ownerCanTransfer.toString()).send();
+    await collectionEvm.methods.setLimit('ownerCanDestroy', limits.ownerCanDestroy.toString()).send();
+    await collectionEvm.methods.setLimit('transfersEnabled', limits.transfersEnabled.toString()).send();
     
     const collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;
     expect(collectionSub.limits.accountTokenOwnershipLimit.unwrap().toNumber()).to.be.eq(limits.accountTokenOwnershipLimit);
     expect(collectionSub.limits.sponsoredDataSize.unwrap().toNumber()).to.be.eq(limits.sponsoredDataSize);
-    expect(collectionSub.limits.sponsoredDataRateLimit.unwrap().asBlocks.toNumber()).to.be.eq(limits.sponsoredDataRateLimit.Blocks);
+    expect(collectionSub.limits.sponsoredDataRateLimit.unwrap().asBlocks.toNumber()).to.be.eq(limits.sponsoredDataRateLimit);
     expect(collectionSub.limits.tokenLimit.unwrap().toNumber()).to.be.eq(limits.tokenLimit);
     expect(collectionSub.limits.sponsorTransferTimeout.unwrap().toNumber()).to.be.eq(limits.sponsorTransferTimeout);
     expect(collectionSub.limits.sponsorApproveTimeout.unwrap().toNumber()).to.be.eq(limits.sponsorApproveTimeout);
@@ -171,6 +178,21 @@
     // const tokenUri = await contract.methods.tokenURI(nextTokenId).call();
     // expect(tokenUri).to.be.equal(`https://offchain-service.local/token-info/${nextTokenId}`);
   });
+
+  itWeb3('Collection address exist', async ({api, web3}) => {
+    const owner = await createEthAccountWithBalance(api, web3);
+    const collectionAddressForNonexistentCollection = '0x17C4E6453CC49AAAAEACA894E6D9683E00112233';
+    const collectionHelper = evmCollectionHelper(web3, owner);
+    expect(await collectionHelper.methods
+      .isCollectionExist(collectionAddressForNonexistentCollection).call())
+      .to.be.false;
+    
+    const result = await collectionHelper.methods.create721Collection('Const collection', '5', '5').send();
+    const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
+    expect(await collectionHelper.methods
+      .isCollectionExist(collectionIdAddress).call())
+      .to.be.true;
+  });
 });
 
 describe('(!negative tests!) Create collection from EVM', () => {
@@ -218,30 +240,6 @@
     await expect(helper.methods
       .create721Collection(collectionName, description, tokenPrefix)
       .call()).to.be.rejectedWith('NotSufficientFounds');
-  });
-
-  itWeb3('(!negative test!) Collection address (Create collection handle error)', async ({api, web3}) => {
-    const owner = await createEthAccountWithBalance(api, web3);
-    const collectionAddressForNonexistentCollection = '0x17C4E6453CC49AAAAEACA894E6D9683E00112233';
-    const collectionEvm = evmCollection(web3, owner, collectionAddressForNonexistentCollection);
-    const EXPECTED_ERROR = 'Create collection handle error';
-    {
-      const sponsor = await createEthAccountWithBalance(api, web3);
-      await expect(collectionEvm.methods
-        .setSponsor(sponsor)
-        .call()).to.be.rejectedWith(EXPECTED_ERROR);
-      
-      const sponsorCollection = evmCollection(web3, sponsor, collectionAddressForNonexistentCollection);
-      await expect(sponsorCollection.methods
-        .confirmSponsorship()
-        .call()).to.be.rejectedWith(EXPECTED_ERROR);
-    }
-    {
-      const limits = '{"account_token_ownership_limit":1000}';
-      await expect(collectionEvm.methods
-        .setLimits(limits)
-        .call()).to.be.rejectedWith(EXPECTED_ERROR);
-    }
   });
 
   itWeb3('(!negative test!) Check owner', async ({api, web3}) => {
@@ -255,18 +253,17 @@
     {
       const sponsor = await createEthAccountWithBalance(api, web3);
       await expect(contractEvmFromNotOwner.methods
-        .setSponsor(sponsor)
+        .ethSetSponsor(sponsor)
         .call()).to.be.rejectedWith(EXPECTED_ERROR);
       
       const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);
       await expect(sponsorCollection.methods
-        .confirmSponsorship()
+        .ethConfirmSponsorship()
         .call()).to.be.rejectedWith('Caller is not set as sponsor');
     }
     {
-      const limits = '{"account_token_ownership_limit":1000}';
       await expect(contractEvmFromNotOwner.methods
-        .setLimits(limits)
+        .setLimit('account_token_ownership_limit', '1000')
         .call()).to.be.rejectedWith(EXPECTED_ERROR);
     }
   });
@@ -277,9 +274,14 @@
     const result = await collectionHelper.methods.create721Collection('Schema collection', 'A', 'A').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
-    const badJson = '{accountTokenOwnershipLimit: 1000}';
     await expect(collectionEvm.methods
-      .setLimits(badJson)
-      .call()).to.be.rejectedWith('Parse JSON error:');
+      .setLimit('badLimit', 'true')
+      .call()).to.be.rejectedWith('Unknown limit "badLimit"');
+    await expect(collectionEvm.methods
+      .setLimit('sponsoredDataSize', 'badValue')
+      .call()).to.be.rejectedWith('Int value "badValue" parse error:');
+    await expect(collectionEvm.methods
+      .setLimit('ownerCanTransfer', 'badValue')
+      .call()).to.be.rejectedWith('Bool value "badValue" parse error:');
   });
 });
\ No newline at end of file
modifiedtests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/nonFungibleAbi.json
+++ b/tests/src/eth/nonFungibleAbi.json
@@ -325,11 +325,12 @@
   },
   {
     "inputs": [
-      { "internalType": "string", "name": "limitsJson", "type": "string" }
+      { "internalType": "string", "name": "limit", "type": "string" },
+      { "internalType": "string", "name": "value", "type": "string" }
     ],
-    "name": "setLimits",
+    "name": "setLimit",
     "outputs": [],
-    "stateMutability": "view",
+    "stateMutability": "nonpayable",
     "type": "function"
   },
   {