git.delta.rocks / unique-network / refs/commits / aa9afbd8a5d0

difftreelog

fix `set_token_properties`

Grigoriy Simonov2022-12-13parent: #cb9214d.patch.diff
in: master

5 files changed

modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -155,7 +155,7 @@
 			&caller,
 			TokenId(token_id),
 			properties.into_iter(),
-			<Pallet<T>>::token_exists(&self, TokenId(token_id)),
+			false,
 			&nesting_budget,
 		)
 		.map_err(dispatch_to_evm::<T>)
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -157,7 +157,7 @@
 			&caller,
 			TokenId(token_id),
 			properties.into_iter(),
-			<Pallet<T>>::token_exists(&self, TokenId(token_id)),
+			false,
 			&nesting_budget,
 		)
 		.map_err(dispatch_to_evm::<T>)
modifiedtests/src/eth/abi/nonFungibleDeprecated.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/nonFungibleDeprecated.json
+++ b/tests/src/eth/abi/nonFungibleDeprecated.json
@@ -99,5 +99,15 @@
     "outputs": [],
     "stateMutability": "nonpayable",
     "type": "function"
+  },
+  {
+    "inputs": [
+      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
+      { "internalType": "string", "name": "key", "type": "string" }
+    ],
+    "name": "deleteProperty",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
   }
 ]
modifiedtests/src/eth/abi/reFungibleDeprecated.jsondiffbeforeafterboth
88 "outputs": [],88 "outputs": [],
89 "stateMutability": "nonpayable",89 "stateMutability": "nonpayable",
90 "type": "function"90 "type": "function"
91 }91 },
92 {
93 "inputs": [
94 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
95 { "internalType": "string", "name": "key", "type": "string" }
96 ],
97 "name": "deleteProperty",
98 "outputs": [],
99 "stateMutability": "nonpayable",
100 "type": "function"
101 }
92]102]
93103
modifiedtests/src/eth/tokenProperties.test.tsdiffbeforeafterboth
--- a/tests/src/eth/tokenProperties.test.ts
+++ b/tests/src/eth/tokenProperties.test.ts
@@ -273,12 +273,12 @@
     {method: 'deleteProperty', methodParams: ['testKey_2']}, // FIXME: the method is gone?
     {method: 'deleteProperties', methodParams: [['testKey_2']]},
   ].map(testCase =>  
-    itEth('Cannot delete properties of non-owned collection', async ({helper}) => {
+    itEth(`[${testCase.method}] Cannot delete properties of non-owned collection`, async ({helper}) => {
       caller = await helper.eth.createAccountWithBalance(donor);
-      collectionEvm = helper.ethNativeContract.collection(helper.ethAddress.fromCollectionId(aliceCollection.collectionId), 'nft', caller, true);
+      collectionEvm = helper.ethNativeContract.collection(helper.ethAddress.fromCollectionId(aliceCollection.collectionId), 'nft', caller, testCase.method == 'deleteProperty');
       // Caller not an owner and not an admin, so he cannot set properties:
       // FIXME: non owner and non admin can deleteProperties
-      await helper.collection.addAdmin(alice, aliceCollection.collectionId, {Ethereum: caller});
+      // await helper.collection.addAdmin(alice, aliceCollection.collectionId, {Ethereum: caller});
       await expect(collectionEvm.methods[testCase.method](token.tokenId, ...testCase.methodParams).call({from: caller})).to.be.rejectedWith('NoPermission');
       await expect(collectionEvm.methods[testCase.method](token.tokenId, ...testCase.methodParams).send({from: caller})).to.be.rejected;