difftreelog
fix `set_token_properties`
in: master
5 files changed
pallets/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>)
pallets/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>)
tests/src/eth/abi/nonFungibleDeprecated.jsondiffbeforeafterboth1[2 {3 "inputs": [4 { "internalType": "address", "name": "newAdmin", "type": "address" }5 ],6 "name": "addCollectionAdmin",7 "outputs": [],8 "stateMutability": "nonpayable",9 "type": "function"10 },11 {12 "inputs": [13 { "internalType": "address", "name": "user", "type": "address" }14 ],15 "name": "addToCollectionAllowList",16 "outputs": [],17 "stateMutability": "nonpayable",18 "type": "function"19 },20 {21 "inputs": [22 { "internalType": "address", "name": "from", "type": "address" },23 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }24 ],25 "name": "burnFrom",26 "outputs": [],27 "stateMutability": "nonpayable",28 "type": "function"29 },30 {31 "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],32 "name": "deleteCollectionProperty",33 "outputs": [],34 "stateMutability": "nonpayable",35 "type": "function"36 },37 {38 "inputs": [39 { "internalType": "address", "name": "user", "type": "address" }40 ],41 "name": "isOwnerOrAdmin",42 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],43 "stateMutability": "view",44 "type": "function"45 },46 {47 "inputs": [48 { "internalType": "address", "name": "admin", "type": "address" }49 ],50 "name": "removeCollectionAdmin",51 "outputs": [],52 "stateMutability": "nonpayable",53 "type": "function"54 },55 {56 "inputs": [57 { "internalType": "address", "name": "user", "type": "address" }58 ],59 "name": "removeFromCollectionAllowList",60 "outputs": [],61 "stateMutability": "nonpayable",62 "type": "function"63 },64 {65 "inputs": [66 { "internalType": "string", "name": "key", "type": "string" },67 { "internalType": "bytes", "name": "value", "type": "bytes" }68 ],69 "name": "setCollectionProperty",70 "outputs": [],71 "stateMutability": "nonpayable",72 "type": "function"73 },74 {75 "inputs": [76 { "internalType": "address", "name": "sponsor", "type": "address" }77 ],78 "name": "setCollectionSponsor",79 "outputs": [],80 "stateMutability": "nonpayable",81 "type": "function"82 },83 {84 "inputs": [85 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },86 { "internalType": "string", "name": "key", "type": "string" },87 { "internalType": "bytes", "name": "value", "type": "bytes" }88 ],89 "name": "setProperty",90 "outputs": [],91 "stateMutability": "nonpayable",92 "type": "function"93 },94 {95 "inputs": [96 { "internalType": "address", "name": "newOwner", "type": "address" }97 ],98 "name": "changeCollectionOwner",99 "outputs": [],100 "stateMutability": "nonpayable",101 "type": "function"102 }103]tests/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"
}
]
tests/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;