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
155 &caller,155 &caller,
156 TokenId(token_id),156 TokenId(token_id),
157 properties.into_iter(),157 properties.into_iter(),
158 <Pallet<T>>::token_exists(&self, TokenId(token_id)),158 false,
159 &nesting_budget,159 &nesting_budget,
160 )160 )
161 .map_err(dispatch_to_evm::<T>)161 .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
99 "outputs": [],99 "outputs": [],
100 "stateMutability": "nonpayable",100 "stateMutability": "nonpayable",
101 "type": "function"101 "type": "function"
102 }102 },
103 {
104 "inputs": [
105 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
106 { "internalType": "string", "name": "key", "type": "string" }
107 ],
108 "name": "deleteProperty",
109 "outputs": [],
110 "stateMutability": "nonpayable",
111 "type": "function"
112 }
103]113]
104114
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
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