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
--- 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
before · tests/src/eth/nonFungibleAbi.json
1[2  {3    "anonymous": false,4    "inputs": [5      {6        "indexed": true,7        "internalType": "address",8        "name": "owner",9        "type": "address"10      },11      {12        "indexed": true,13        "internalType": "address",14        "name": "approved",15        "type": "address"16      },17      {18        "indexed": true,19        "internalType": "uint256",20        "name": "tokenId",21        "type": "uint256"22      }23    ],24    "name": "Approval",25    "type": "event"26  },27  {28    "anonymous": false,29    "inputs": [30      {31        "indexed": true,32        "internalType": "address",33        "name": "owner",34        "type": "address"35      },36      {37        "indexed": true,38        "internalType": "address",39        "name": "operator",40        "type": "address"41      },42      {43        "indexed": false,44        "internalType": "bool",45        "name": "approved",46        "type": "bool"47      }48    ],49    "name": "ApprovalForAll",50    "type": "event"51  },52  {53    "anonymous": false,54    "inputs": [],55    "name": "MintingFinished",56    "type": "event"57  },58  {59    "anonymous": false,60    "inputs": [61      {62        "indexed": true,63        "internalType": "address",64        "name": "from",65        "type": "address"66      },67      {68        "indexed": true,69        "internalType": "address",70        "name": "to",71        "type": "address"72      },73      {74        "indexed": true,75        "internalType": "uint256",76        "name": "tokenId",77        "type": "uint256"78      }79    ],80    "name": "Transfer",81    "type": "event"82  },83  {84    "inputs": [85      { "internalType": "address", "name": "approved", "type": "address" },86      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }87    ],88    "name": "approve",89    "outputs": [],90    "stateMutability": "nonpayable",91    "type": "function"92  },93  {94    "inputs": [95      { "internalType": "address", "name": "owner", "type": "address" }96    ],97    "name": "balanceOf",98    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],99    "stateMutability": "view",100    "type": "function"101  },102  {103    "inputs": [104      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }105    ],106    "name": "burn",107    "outputs": [],108    "stateMutability": "nonpayable",109    "type": "function"110  },111  {112    "inputs": [113      { "internalType": "address", "name": "from", "type": "address" },114      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }115    ],116    "name": "burnFrom",117    "outputs": [],118    "stateMutability": "nonpayable",119    "type": "function"120  },121  {122    "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],123    "name": "collectionProperty",124    "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],125    "stateMutability": "view",126    "type": "function"127  },128  {129    "inputs": [],130    "name": "contractAddress",131    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],132    "stateMutability": "view",133    "type": "function"134  },135  {136    "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],137    "name": "deleteCollectionProperty",138    "outputs": [],139    "stateMutability": "nonpayable",140    "type": "function"141  },142  {143    "inputs": [144      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },145      { "internalType": "string", "name": "key", "type": "string" }146    ],147    "name": "deleteProperty",148    "outputs": [],149    "stateMutability": "nonpayable",150    "type": "function"151  },152  {153    "inputs": [],154    "name": "ethConfirmSponsorship",155    "outputs": [],156    "stateMutability": "nonpayable",157    "type": "function"158  },159  {160    "inputs": [161      { "internalType": "address", "name": "sponsor", "type": "address" }162    ],163    "name": "ethSetSponsor",164    "outputs": [],165    "stateMutability": "nonpayable",166    "type": "function"167  },168  {169    "inputs": [],170    "name": "finishMinting",171    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],172    "stateMutability": "nonpayable",173    "type": "function"174  },175  {176    "inputs": [177      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }178    ],179    "name": "getApproved",180    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],181    "stateMutability": "view",182    "type": "function"183  },184  {185    "inputs": [186      { "internalType": "address", "name": "owner", "type": "address" },187      { "internalType": "address", "name": "operator", "type": "address" }188    ],189    "name": "isApprovedForAll",190    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],191    "stateMutability": "view",192    "type": "function"193  },194  {195    "inputs": [196      { "internalType": "address", "name": "to", "type": "address" },197      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }198    ],199    "name": "mint",200    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],201    "stateMutability": "nonpayable",202    "type": "function"203  },204  {205    "inputs": [206      { "internalType": "address", "name": "to", "type": "address" },207      { "internalType": "uint256[]", "name": "tokenIds", "type": "uint256[]" }208    ],209    "name": "mintBulk",210    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],211    "stateMutability": "nonpayable",212    "type": "function"213  },214  {215    "inputs": [216      { "internalType": "address", "name": "to", "type": "address" },217      {218        "components": [219          { "internalType": "uint256", "name": "field_0", "type": "uint256" },220          { "internalType": "string", "name": "field_1", "type": "string" }221        ],222        "internalType": "struct Tuple0[]",223        "name": "tokens",224        "type": "tuple[]"225      }226    ],227    "name": "mintBulkWithTokenURI",228    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],229    "stateMutability": "nonpayable",230    "type": "function"231  },232  {233    "inputs": [234      { "internalType": "address", "name": "to", "type": "address" },235      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },236      { "internalType": "string", "name": "tokenUri", "type": "string" }237    ],238    "name": "mintWithTokenURI",239    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],240    "stateMutability": "nonpayable",241    "type": "function"242  },243  {244    "inputs": [],245    "name": "mintingFinished",246    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],247    "stateMutability": "view",248    "type": "function"249  },250  {251    "inputs": [],252    "name": "name",253    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],254    "stateMutability": "view",255    "type": "function"256  },257  {258    "inputs": [],259    "name": "nextTokenId",260    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],261    "stateMutability": "view",262    "type": "function"263  },264  {265    "inputs": [266      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }267    ],268    "name": "ownerOf",269    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],270    "stateMutability": "view",271    "type": "function"272  },273  {274    "inputs": [275      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },276      { "internalType": "string", "name": "key", "type": "string" }277    ],278    "name": "property",279    "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],280    "stateMutability": "view",281    "type": "function"282  },283  {284    "inputs": [285      { "internalType": "address", "name": "from", "type": "address" },286      { "internalType": "address", "name": "to", "type": "address" },287      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }288    ],289    "name": "safeTransferFrom",290    "outputs": [],291    "stateMutability": "nonpayable",292    "type": "function"293  },294  {295    "inputs": [296      { "internalType": "address", "name": "from", "type": "address" },297      { "internalType": "address", "name": "to", "type": "address" },298      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },299      { "internalType": "bytes", "name": "data", "type": "bytes" }300    ],301    "name": "safeTransferFromWithData",302    "outputs": [],303    "stateMutability": "nonpayable",304    "type": "function"305  },306  {307    "inputs": [308      { "internalType": "address", "name": "operator", "type": "address" },309      { "internalType": "bool", "name": "approved", "type": "bool" }310    ],311    "name": "setApprovalForAll",312    "outputs": [],313    "stateMutability": "nonpayable",314    "type": "function"315  },316  {317    "inputs": [318      { "internalType": "string", "name": "key", "type": "string" },319      { "internalType": "bytes", "name": "value", "type": "bytes" }320    ],321    "name": "setCollectionProperty",322    "outputs": [],323    "stateMutability": "nonpayable",324    "type": "function"325  },326  {327    "inputs": [328      { "internalType": "string", "name": "limitsJson", "type": "string" }329    ],330    "name": "setLimits",331    "outputs": [],332    "stateMutability": "view",333    "type": "function"334  },335  {336    "inputs": [337      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },338      { "internalType": "string", "name": "key", "type": "string" },339      { "internalType": "bytes", "name": "value", "type": "bytes" }340    ],341    "name": "setProperty",342    "outputs": [],343    "stateMutability": "nonpayable",344    "type": "function"345  },346  {347    "inputs": [348      { "internalType": "string", "name": "key", "type": "string" },349      { "internalType": "bool", "name": "isMutable", "type": "bool" },350      { "internalType": "bool", "name": "collectionAdmin", "type": "bool" },351      { "internalType": "bool", "name": "tokenOwner", "type": "bool" }352    ],353    "name": "setTokenPropertyPermission",354    "outputs": [],355    "stateMutability": "nonpayable",356    "type": "function"357  },358  {359    "inputs": [360      { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }361    ],362    "name": "supportsInterface",363    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],364    "stateMutability": "view",365    "type": "function"366  },367  {368    "inputs": [],369    "name": "symbol",370    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],371    "stateMutability": "view",372    "type": "function"373  },374  {375    "inputs": [376      { "internalType": "uint256", "name": "index", "type": "uint256" }377    ],378    "name": "tokenByIndex",379    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],380    "stateMutability": "view",381    "type": "function"382  },383  {384    "inputs": [385      { "internalType": "address", "name": "owner", "type": "address" },386      { "internalType": "uint256", "name": "index", "type": "uint256" }387    ],388    "name": "tokenOfOwnerByIndex",389    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],390    "stateMutability": "view",391    "type": "function"392  },393  {394    "inputs": [395      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }396    ],397    "name": "tokenURI",398    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],399    "stateMutability": "view",400    "type": "function"401  },402  {403    "inputs": [],404    "name": "totalSupply",405    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],406    "stateMutability": "view",407    "type": "function"408  },409  {410    "inputs": [411      { "internalType": "address", "name": "to", "type": "address" },412      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }413    ],414    "name": "transfer",415    "outputs": [],416    "stateMutability": "nonpayable",417    "type": "function"418  },419  {420    "inputs": [421      { "internalType": "address", "name": "from", "type": "address" },422      { "internalType": "address", "name": "to", "type": "address" },423      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }424    ],425    "name": "transferFrom",426    "outputs": [],427    "stateMutability": "nonpayable",428    "type": "function"429  }430]
after · tests/src/eth/nonFungibleAbi.json
1[2  {3    "anonymous": false,4    "inputs": [5      {6        "indexed": true,7        "internalType": "address",8        "name": "owner",9        "type": "address"10      },11      {12        "indexed": true,13        "internalType": "address",14        "name": "approved",15        "type": "address"16      },17      {18        "indexed": true,19        "internalType": "uint256",20        "name": "tokenId",21        "type": "uint256"22      }23    ],24    "name": "Approval",25    "type": "event"26  },27  {28    "anonymous": false,29    "inputs": [30      {31        "indexed": true,32        "internalType": "address",33        "name": "owner",34        "type": "address"35      },36      {37        "indexed": true,38        "internalType": "address",39        "name": "operator",40        "type": "address"41      },42      {43        "indexed": false,44        "internalType": "bool",45        "name": "approved",46        "type": "bool"47      }48    ],49    "name": "ApprovalForAll",50    "type": "event"51  },52  {53    "anonymous": false,54    "inputs": [],55    "name": "MintingFinished",56    "type": "event"57  },58  {59    "anonymous": false,60    "inputs": [61      {62        "indexed": true,63        "internalType": "address",64        "name": "from",65        "type": "address"66      },67      {68        "indexed": true,69        "internalType": "address",70        "name": "to",71        "type": "address"72      },73      {74        "indexed": true,75        "internalType": "uint256",76        "name": "tokenId",77        "type": "uint256"78      }79    ],80    "name": "Transfer",81    "type": "event"82  },83  {84    "inputs": [85      { "internalType": "address", "name": "approved", "type": "address" },86      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }87    ],88    "name": "approve",89    "outputs": [],90    "stateMutability": "nonpayable",91    "type": "function"92  },93  {94    "inputs": [95      { "internalType": "address", "name": "owner", "type": "address" }96    ],97    "name": "balanceOf",98    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],99    "stateMutability": "view",100    "type": "function"101  },102  {103    "inputs": [104      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }105    ],106    "name": "burn",107    "outputs": [],108    "stateMutability": "nonpayable",109    "type": "function"110  },111  {112    "inputs": [113      { "internalType": "address", "name": "from", "type": "address" },114      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }115    ],116    "name": "burnFrom",117    "outputs": [],118    "stateMutability": "nonpayable",119    "type": "function"120  },121  {122    "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],123    "name": "collectionProperty",124    "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],125    "stateMutability": "view",126    "type": "function"127  },128  {129    "inputs": [],130    "name": "contractAddress",131    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],132    "stateMutability": "view",133    "type": "function"134  },135  {136    "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],137    "name": "deleteCollectionProperty",138    "outputs": [],139    "stateMutability": "nonpayable",140    "type": "function"141  },142  {143    "inputs": [144      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },145      { "internalType": "string", "name": "key", "type": "string" }146    ],147    "name": "deleteProperty",148    "outputs": [],149    "stateMutability": "nonpayable",150    "type": "function"151  },152  {153    "inputs": [],154    "name": "ethConfirmSponsorship",155    "outputs": [],156    "stateMutability": "nonpayable",157    "type": "function"158  },159  {160    "inputs": [161      { "internalType": "address", "name": "sponsor", "type": "address" }162    ],163    "name": "ethSetSponsor",164    "outputs": [],165    "stateMutability": "nonpayable",166    "type": "function"167  },168  {169    "inputs": [],170    "name": "finishMinting",171    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],172    "stateMutability": "nonpayable",173    "type": "function"174  },175  {176    "inputs": [177      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }178    ],179    "name": "getApproved",180    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],181    "stateMutability": "view",182    "type": "function"183  },184  {185    "inputs": [186      { "internalType": "address", "name": "owner", "type": "address" },187      { "internalType": "address", "name": "operator", "type": "address" }188    ],189    "name": "isApprovedForAll",190    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],191    "stateMutability": "view",192    "type": "function"193  },194  {195    "inputs": [196      { "internalType": "address", "name": "to", "type": "address" },197      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }198    ],199    "name": "mint",200    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],201    "stateMutability": "nonpayable",202    "type": "function"203  },204  {205    "inputs": [206      { "internalType": "address", "name": "to", "type": "address" },207      { "internalType": "uint256[]", "name": "tokenIds", "type": "uint256[]" }208    ],209    "name": "mintBulk",210    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],211    "stateMutability": "nonpayable",212    "type": "function"213  },214  {215    "inputs": [216      { "internalType": "address", "name": "to", "type": "address" },217      {218        "components": [219          { "internalType": "uint256", "name": "field_0", "type": "uint256" },220          { "internalType": "string", "name": "field_1", "type": "string" }221        ],222        "internalType": "struct Tuple0[]",223        "name": "tokens",224        "type": "tuple[]"225      }226    ],227    "name": "mintBulkWithTokenURI",228    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],229    "stateMutability": "nonpayable",230    "type": "function"231  },232  {233    "inputs": [234      { "internalType": "address", "name": "to", "type": "address" },235      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },236      { "internalType": "string", "name": "tokenUri", "type": "string" }237    ],238    "name": "mintWithTokenURI",239    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],240    "stateMutability": "nonpayable",241    "type": "function"242  },243  {244    "inputs": [],245    "name": "mintingFinished",246    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],247    "stateMutability": "view",248    "type": "function"249  },250  {251    "inputs": [],252    "name": "name",253    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],254    "stateMutability": "view",255    "type": "function"256  },257  {258    "inputs": [],259    "name": "nextTokenId",260    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],261    "stateMutability": "view",262    "type": "function"263  },264  {265    "inputs": [266      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }267    ],268    "name": "ownerOf",269    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],270    "stateMutability": "view",271    "type": "function"272  },273  {274    "inputs": [275      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },276      { "internalType": "string", "name": "key", "type": "string" }277    ],278    "name": "property",279    "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],280    "stateMutability": "view",281    "type": "function"282  },283  {284    "inputs": [285      { "internalType": "address", "name": "from", "type": "address" },286      { "internalType": "address", "name": "to", "type": "address" },287      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }288    ],289    "name": "safeTransferFrom",290    "outputs": [],291    "stateMutability": "nonpayable",292    "type": "function"293  },294  {295    "inputs": [296      { "internalType": "address", "name": "from", "type": "address" },297      { "internalType": "address", "name": "to", "type": "address" },298      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },299      { "internalType": "bytes", "name": "data", "type": "bytes" }300    ],301    "name": "safeTransferFromWithData",302    "outputs": [],303    "stateMutability": "nonpayable",304    "type": "function"305  },306  {307    "inputs": [308      { "internalType": "address", "name": "operator", "type": "address" },309      { "internalType": "bool", "name": "approved", "type": "bool" }310    ],311    "name": "setApprovalForAll",312    "outputs": [],313    "stateMutability": "nonpayable",314    "type": "function"315  },316  {317    "inputs": [318      { "internalType": "string", "name": "key", "type": "string" },319      { "internalType": "bytes", "name": "value", "type": "bytes" }320    ],321    "name": "setCollectionProperty",322    "outputs": [],323    "stateMutability": "nonpayable",324    "type": "function"325  },326  {327    "inputs": [328      { "internalType": "string", "name": "limit", "type": "string" },329      { "internalType": "string", "name": "value", "type": "string" }330    ],331    "name": "setLimit",332    "outputs": [],333    "stateMutability": "nonpayable",334    "type": "function"335  },336  {337    "inputs": [338      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },339      { "internalType": "string", "name": "key", "type": "string" },340      { "internalType": "bytes", "name": "value", "type": "bytes" }341    ],342    "name": "setProperty",343    "outputs": [],344    "stateMutability": "nonpayable",345    "type": "function"346  },347  {348    "inputs": [349      { "internalType": "string", "name": "key", "type": "string" },350      { "internalType": "bool", "name": "isMutable", "type": "bool" },351      { "internalType": "bool", "name": "collectionAdmin", "type": "bool" },352      { "internalType": "bool", "name": "tokenOwner", "type": "bool" }353    ],354    "name": "setTokenPropertyPermission",355    "outputs": [],356    "stateMutability": "nonpayable",357    "type": "function"358  },359  {360    "inputs": [361      { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }362    ],363    "name": "supportsInterface",364    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],365    "stateMutability": "view",366    "type": "function"367  },368  {369    "inputs": [],370    "name": "symbol",371    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],372    "stateMutability": "view",373    "type": "function"374  },375  {376    "inputs": [377      { "internalType": "uint256", "name": "index", "type": "uint256" }378    ],379    "name": "tokenByIndex",380    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],381    "stateMutability": "view",382    "type": "function"383  },384  {385    "inputs": [386      { "internalType": "address", "name": "owner", "type": "address" },387      { "internalType": "uint256", "name": "index", "type": "uint256" }388    ],389    "name": "tokenOfOwnerByIndex",390    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],391    "stateMutability": "view",392    "type": "function"393  },394  {395    "inputs": [396      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }397    ],398    "name": "tokenURI",399    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],400    "stateMutability": "view",401    "type": "function"402  },403  {404    "inputs": [],405    "name": "totalSupply",406    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],407    "stateMutability": "view",408    "type": "function"409  },410  {411    "inputs": [412      { "internalType": "address", "name": "to", "type": "address" },413      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }414    ],415    "name": "transfer",416    "outputs": [],417    "stateMutability": "nonpayable",418    "type": "function"419  },420  {421    "inputs": [422      { "internalType": "address", "name": "from", "type": "address" },423      { "internalType": "address", "name": "to", "type": "address" },424      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }425    ],426    "name": "transferFrom",427    "outputs": [],428    "stateMutability": "nonpayable",429    "type": "function"430  }431]