From aa9afbd8a5d072b3185b4157be4d9bfc643a7b43 Mon Sep 17 00:00:00 2001 From: Grigoriy Simonov Date: Tue, 13 Dec 2022 13:19:31 +0000 Subject: [PATCH] fix: `set_token_properties` --- --- a/pallets/nonfungible/src/erc.rs +++ b/pallets/nonfungible/src/erc.rs @@ -155,7 +155,7 @@ &caller, TokenId(token_id), properties.into_iter(), - >::token_exists(&self, TokenId(token_id)), + false, &nesting_budget, ) .map_err(dispatch_to_evm::) --- a/pallets/refungible/src/erc.rs +++ b/pallets/refungible/src/erc.rs @@ -157,7 +157,7 @@ &caller, TokenId(token_id), properties.into_iter(), - >::token_exists(&self, TokenId(token_id)), + false, &nesting_budget, ) .map_err(dispatch_to_evm::) --- 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" } ] --- 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" } ] --- 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; -- gitstuff