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
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -16,10 +16,11 @@
 
 use evm_coder::{solidity_interface, types::*, execution::{Result, Error}};
 pub use pallet_evm::{PrecompileOutput, PrecompileResult, account::CrossAccountId};
-use pallet_evm_coder_substrate::{dispatch_to_evm, SubstrateRecorder};
+use pallet_evm_coder_substrate::dispatch_to_evm;
 use sp_core::{H160, U256};
 use sp_std::vec::Vec;
-use up_data_structs::Property;
+use up_data_structs::{Property, SponsoringRateLimit};
+use alloc::format;
 
 use crate::{Pallet, CollectionHandle, Config, CollectionProperties};
 
@@ -87,37 +88,53 @@
 		Ok(())
 	}
 
-	fn set_limits(
-		&self,
+	fn set_limit(
+		&mut self,
 		caller: caller,
-		limits_json: string,
+		limit: string,
+		value: string,
 	) -> Result<void> {
-		// let mut collection = collection_from_address::<T>(self.contract_address(caller).unwrap(), self.1.gas_left())?;
-		// check_is_owner(caller, &collection)?;
+		check_is_owner(caller, self)?;
+		let mut limits = self.limits.clone();
 
-		// let limits = serde_json_core::from_str(limits_json.as_ref())
-		// 	.map_err(|e| Error::Revert(format!("Parse JSON error: {}", e)))?;
-		// collection.limits = limits.0;
-		// collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
+		match limit.as_str() {
+			"accountTokenOwnershipLimit" => {
+				limits.account_token_ownership_limit = parse_int(value)?;
+			},
+			"sponsoredDataSize" => {
+				limits.sponsored_data_size = parse_int(value)?;
+			},
+			"sponsoredDataRateLimit" => {
+				limits.sponsored_data_rate_limit = Some(SponsoringRateLimit::Blocks(parse_int(value)?.unwrap()));
+			},
+			"tokenLimit" => {
+				limits.token_limit = parse_int(value)?;
+			},
+			"sponsorTransferTimeout" => {
+				limits.sponsor_transfer_timeout = parse_int(value)?;
+			},
+			"sponsorApproveTimeout" => {
+				limits.sponsor_approve_timeout = parse_int(value)?;
+			},
+			"ownerCanTransfer" => {
+				limits.owner_can_transfer = parse_bool(value)?;
+			},
+			"ownerCanDestroy" => {
+				limits.owner_can_destroy = parse_bool(value)?;
+			},
+			"transfersEnabled" => {
+				limits.transfers_enabled = parse_bool(value)?;
+			},
+			_ => return Err(Error::Revert(format!("Unknown limit \"{}\"", limit)))
+		}
+		self.limits = limits;
+		save(self);
 		Ok(())
 	}
 
 	fn contract_address(&self, _caller: caller) -> Result<address> {
 		Ok(crate::eth::collection_id_to_address(self.id))
 	}
-}
-
-fn collection_from_address<T: Config>(
-	collection_address: address,
-	gas_limit: u64
-) -> Result<CollectionHandle<T>> {
-	let collection_id = crate::eth::map_eth_to_id(&collection_address)
-	.ok_or(Error::Revert("Contract is not an unique collection".into()))?;
-	let recorder = <SubstrateRecorder<T>>::new(gas_limit);
-	let collection =
-		CollectionHandle::new_with_recorder(collection_id, recorder)
-			.ok_or(Error::Revert("Create collection handle error".into()))?;
-	Ok(collection)
 }
 
 fn check_is_owner<T: Config>(caller: caller, collection: &CollectionHandle<T>) -> Result<()> {
@@ -130,4 +147,16 @@
 
 fn save<T: Config>(collection: &CollectionHandle<T>) {
 	<crate::CollectionById<T>>::insert(collection.id, collection.collection.clone());
+}
+
+fn parse_int(value: string) -> Result<Option<u32>> {
+	value.parse::<u32>()
+		.map_err(|e| Error::Revert(format!("Int value \"{}\" parse error: {}", value, e)))
+		.map(|value| Some(value))
+}
+
+fn parse_bool(value: string) -> Result<Option<bool>> {
+	value.parse::<bool>()
+		.map_err(|e| Error::Revert(format!("Bool value \"{}\" parse error: {}", value, e)))
+		.map(|value| Some(value))
 }
\ No newline at end of file
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
before · pallets/nonfungible/src/stubs/UniqueNFT.sol
1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56// Anonymous struct7struct Tuple0 {8	uint256 field_0;9	string field_1;10}1112// Common stubs holder13contract Dummy {14	uint8 dummy;15	string stub_error = "this contract is implemented in native";16}1718contract ERC165 is Dummy {19	function supportsInterface(bytes4 interfaceID)20		external21		view22		returns (bool)23	{24		require(false, stub_error);25		interfaceID;26		return true;27	}28}2930// Inline31contract ERC721Events {32	event Transfer(33		address indexed from,34		address indexed to,35		uint256 indexed tokenId36	);37	event Approval(38		address indexed owner,39		address indexed approved,40		uint256 indexed tokenId41	);42	event ApprovalForAll(43		address indexed owner,44		address indexed operator,45		bool approved46	);47}4849// Inline50contract ERC721MintableEvents {51	event MintingFinished();52}5354// Selector: 38e33c6055contract Collection is Dummy, ERC165 {56	// Selector: setCollectionProperty(string,bytes) 2f073f6657	function setCollectionProperty(string memory key, bytes memory value)58		public59	{60		require(false, stub_error);61		key;62		value;63		dummy = 0;64	}6566	// Selector: deleteCollectionProperty(string) 7b7debce67	function deleteCollectionProperty(string memory key) public {68		require(false, stub_error);69		key;70		dummy = 0;71	}7273	// Throws error if key not found74	//75	// Selector: collectionProperty(string) cf24fd6d76	function collectionProperty(string memory key)77		public78		view79		returns (bytes memory)80	{81		require(false, stub_error);82		key;83		dummy;84		return hex"";85	}8687	// Selector: ethSetSponsor(address) 8f9af35688	function ethSetSponsor(address sponsor) public {89		require(false, stub_error);90		sponsor;91		dummy = 0;92	}9394	// Selector: ethConfirmSponsorship() a8580d1a95	function ethConfirmSponsorship() public {96		require(false, stub_error);97		dummy = 0;98	}99100	// Selector: setLimits(string) 72cb345d101	function setLimits(string memory limitsJson) public view {102		require(false, stub_error);103		limitsJson;104		dummy;105	}106107	// Selector: contractAddress() f6b4dfb4108	function contractAddress() public view returns (address) {109		require(false, stub_error);110		dummy;111		return 0x0000000000000000000000000000000000000000;112	}113}114115// Selector: 41369377116contract TokenProperties is Dummy, ERC165 {117	// Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa118	function setTokenPropertyPermission(119		string memory key,120		bool isMutable,121		bool collectionAdmin,122		bool tokenOwner123	) public {124		require(false, stub_error);125		key;126		isMutable;127		collectionAdmin;128		tokenOwner;129		dummy = 0;130	}131132	// Selector: setProperty(uint256,string,bytes) 1752d67b133	function setProperty(134		uint256 tokenId,135		string memory key,136		bytes memory value137	) public {138		require(false, stub_error);139		tokenId;140		key;141		value;142		dummy = 0;143	}144145	// Selector: deleteProperty(uint256,string) 066111d1146	function deleteProperty(uint256 tokenId, string memory key) public {147		require(false, stub_error);148		tokenId;149		key;150		dummy = 0;151	}152153	// Throws error if key not found154	//155	// Selector: property(uint256,string) 7228c327156	function property(uint256 tokenId, string memory key)157		public158		view159		returns (bytes memory)160	{161		require(false, stub_error);162		tokenId;163		key;164		dummy;165		return hex"";166	}167}168169// Selector: 42966c68170contract ERC721Burnable is Dummy, ERC165 {171	// Selector: burn(uint256) 42966c68172	function burn(uint256 tokenId) public {173		require(false, stub_error);174		tokenId;175		dummy = 0;176	}177}178179// Selector: 58800161180contract ERC721 is Dummy, ERC165, ERC721Events {181	// Selector: balanceOf(address) 70a08231182	function balanceOf(address owner) public view returns (uint256) {183		require(false, stub_error);184		owner;185		dummy;186		return 0;187	}188189	// Selector: ownerOf(uint256) 6352211e190	function ownerOf(uint256 tokenId) public view returns (address) {191		require(false, stub_error);192		tokenId;193		dummy;194		return 0x0000000000000000000000000000000000000000;195	}196197	// Not implemented198	//199	// Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a11672200	function safeTransferFromWithData(201		address from,202		address to,203		uint256 tokenId,204		bytes memory data205	) public {206		require(false, stub_error);207		from;208		to;209		tokenId;210		data;211		dummy = 0;212	}213214	// Not implemented215	//216	// Selector: safeTransferFrom(address,address,uint256) 42842e0e217	function safeTransferFrom(218		address from,219		address to,220		uint256 tokenId221	) public {222		require(false, stub_error);223		from;224		to;225		tokenId;226		dummy = 0;227	}228229	// Selector: transferFrom(address,address,uint256) 23b872dd230	function transferFrom(231		address from,232		address to,233		uint256 tokenId234	) public {235		require(false, stub_error);236		from;237		to;238		tokenId;239		dummy = 0;240	}241242	// Selector: approve(address,uint256) 095ea7b3243	function approve(address approved, uint256 tokenId) public {244		require(false, stub_error);245		approved;246		tokenId;247		dummy = 0;248	}249250	// Not implemented251	//252	// Selector: setApprovalForAll(address,bool) a22cb465253	function setApprovalForAll(address operator, bool approved) public {254		require(false, stub_error);255		operator;256		approved;257		dummy = 0;258	}259260	// Not implemented261	//262	// Selector: getApproved(uint256) 081812fc263	function getApproved(uint256 tokenId) public view returns (address) {264		require(false, stub_error);265		tokenId;266		dummy;267		return 0x0000000000000000000000000000000000000000;268	}269270	// Not implemented271	//272	// Selector: isApprovedForAll(address,address) e985e9c5273	function isApprovedForAll(address owner, address operator)274		public275		view276		returns (address)277	{278		require(false, stub_error);279		owner;280		operator;281		dummy;282		return 0x0000000000000000000000000000000000000000;283	}284}285286// Selector: 5b5e139f287contract ERC721Metadata is Dummy, ERC165 {288	// Selector: name() 06fdde03289	function name() public view returns (string memory) {290		require(false, stub_error);291		dummy;292		return "";293	}294295	// Selector: symbol() 95d89b41296	function symbol() public view returns (string memory) {297		require(false, stub_error);298		dummy;299		return "";300	}301302	// Returns token's const_metadata303	//304	// Selector: tokenURI(uint256) c87b56dd305	function tokenURI(uint256 tokenId) public view returns (string memory) {306		require(false, stub_error);307		tokenId;308		dummy;309		return "";310	}311}312313// Selector: 68ccfe89314contract ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {315	// Selector: mintingFinished() 05d2035b316	function mintingFinished() public view returns (bool) {317		require(false, stub_error);318		dummy;319		return false;320	}321322	// `token_id` should be obtained with `next_token_id` method,323	// unlike standard, you can't specify it manually324	//325	// Selector: mint(address,uint256) 40c10f19326	function mint(address to, uint256 tokenId) public returns (bool) {327		require(false, stub_error);328		to;329		tokenId;330		dummy = 0;331		return false;332	}333334	// `token_id` should be obtained with `next_token_id` method,335	// unlike standard, you can't specify it manually336	//337	// Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f338	function mintWithTokenURI(339		address to,340		uint256 tokenId,341		string memory tokenUri342	) public returns (bool) {343		require(false, stub_error);344		to;345		tokenId;346		tokenUri;347		dummy = 0;348		return false;349	}350351	// Not implemented352	//353	// Selector: finishMinting() 7d64bcb4354	function finishMinting() public returns (bool) {355		require(false, stub_error);356		dummy = 0;357		return false;358	}359}360361// Selector: 780e9d63362contract ERC721Enumerable is Dummy, ERC165 {363	// Selector: tokenByIndex(uint256) 4f6ccce7364	function tokenByIndex(uint256 index) public view returns (uint256) {365		require(false, stub_error);366		index;367		dummy;368		return 0;369	}370371	// Not implemented372	//373	// Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59374	function tokenOfOwnerByIndex(address owner, uint256 index)375		public376		view377		returns (uint256)378	{379		require(false, stub_error);380		owner;381		index;382		dummy;383		return 0;384	}385386	// Selector: totalSupply() 18160ddd387	function totalSupply() public view returns (uint256) {388		require(false, stub_error);389		dummy;390		return 0;391	}392}393394// Selector: d74d154f395contract ERC721UniqueExtensions is Dummy, ERC165 {396	// Selector: transfer(address,uint256) a9059cbb397	function transfer(address to, uint256 tokenId) public {398		require(false, stub_error);399		to;400		tokenId;401		dummy = 0;402	}403404	// Selector: burnFrom(address,uint256) 79cc6790405	function burnFrom(address from, uint256 tokenId) public {406		require(false, stub_error);407		from;408		tokenId;409		dummy = 0;410	}411412	// Selector: nextTokenId() 75794a3c413	function nextTokenId() public view returns (uint256) {414		require(false, stub_error);415		dummy;416		return 0;417	}418419	// Selector: mintBulk(address,uint256[]) 44a9945e420	function mintBulk(address to, uint256[] memory tokenIds)421		public422		returns (bool)423	{424		require(false, stub_error);425		to;426		tokenIds;427		dummy = 0;428		return false;429	}430431	// Selector: mintBulkWithTokenURI(address,(uint256,string)[]) 36543006432	function mintBulkWithTokenURI(address to, Tuple0[] memory tokens)433		public434		returns (bool)435	{436		require(false, stub_error);437		to;438		tokens;439		dummy = 0;440		return false;441	}442}443444contract UniqueNFT is445	Dummy,446	ERC165,447	ERC721,448	ERC721Metadata,449	ERC721Enumerable,450	ERC721UniqueExtensions,451	ERC721Mintable,452	ERC721Burnable,453	Collection,454	TokenProperties455{}
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"
   },
   {