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

difftreelog

fix `set_token_properties`

Grigoriy Simonov2022-12-13parent: #b525e57.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
157 &caller,157 &caller,
158 TokenId(token_id),158 TokenId(token_id),
159 properties.into_iter(),159 properties.into_iter(),
160 <Pallet<T>>::token_exists(&self, TokenId(token_id)),160 false,
161 &nesting_budget,161 &nesting_budget,
162 )162 )
163 .map_err(dispatch_to_evm::<T>)163 .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
--- a/tests/src/eth/abi/reFungibleDeprecated.json
+++ b/tests/src/eth/abi/reFungibleDeprecated.json
@@ -88,5 +88,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/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;