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
--- 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
--- 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
273 {method: 'deleteProperty', methodParams: ['testKey_2']}, // FIXME: the method is gone?273 {method: 'deleteProperty', methodParams: ['testKey_2']}, // FIXME: the method is gone?
274 {method: 'deleteProperties', methodParams: [['testKey_2']]},274 {method: 'deleteProperties', methodParams: [['testKey_2']]},
275 ].map(testCase => 275 ].map(testCase =>
276 itEth('Cannot delete properties of non-owned collection', async ({helper}) => {276 itEth(`[${testCase.method}] Cannot delete properties of non-owned collection`, async ({helper}) => {
277 caller = await helper.eth.createAccountWithBalance(donor);277 caller = await helper.eth.createAccountWithBalance(donor);
278 collectionEvm = helper.ethNativeContract.collection(helper.ethAddress.fromCollectionId(aliceCollection.collectionId), 'nft', caller, true);278 collectionEvm = helper.ethNativeContract.collection(helper.ethAddress.fromCollectionId(aliceCollection.collectionId), 'nft', caller, testCase.method == 'deleteProperty');
279 // Caller not an owner and not an admin, so he cannot set properties:279 // Caller not an owner and not an admin, so he cannot set properties:
280 // FIXME: non owner and non admin can deleteProperties280 // FIXME: non owner and non admin can deleteProperties
281 await helper.collection.addAdmin(alice, aliceCollection.collectionId, {Ethereum: caller});281 // await helper.collection.addAdmin(alice, aliceCollection.collectionId, {Ethereum: caller});
282 await expect(collectionEvm.methods[testCase.method](token.tokenId, ...testCase.methodParams).call({from: caller})).to.be.rejectedWith('NoPermission');282 await expect(collectionEvm.methods[testCase.method](token.tokenId, ...testCase.methodParams).call({from: caller})).to.be.rejectedWith('NoPermission');
283 await expect(collectionEvm.methods[testCase.method](token.tokenId, ...testCase.methodParams).send({from: caller})).to.be.rejected;283 await expect(collectionEvm.methods[testCase.method](token.tokenId, ...testCase.methodParams).send({from: caller})).to.be.rejected;
284284