difftreelog
added `collectionNestingRestrictedCollectionIds()` function in `Collection` interface.
in: master
14 files changed
pallets/common/src/erc.rsdiffbeforeafterboth493 <Pallet<T>>::update_permissions(&caller, self, permissions).map_err(dispatch_to_evm::<T>)493 <Pallet<T>>::update_permissions(&caller, self, permissions).map_err(dispatch_to_evm::<T>)494 }494 }495496 /// Returns nesting for a collection497 #[solidity(rename_selector = "collectionNestingRestrictedCollectionIds")]498 fn collection_nesting_restricted_ids(&self) -> Result<(bool, Vec<uint256>)> {499 let nesting = self.collection.permissions.nesting();500501 Ok((502 nesting.token_owner,503 nesting504 .restricted505 .clone()506 .map(|b| b.0.into_inner().iter().map(|id| id.0.into()).collect())507 .unwrap_or_default(),508 ))509 }495510496 /// Set the collection access method.511 /// Set the collection access method.497 /// @param mode Access mode512 /// @param mode Access modepallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth18}18}191920/// @title A contract that allows you to work with collections.20/// @title A contract that allows you to work with collections.21/// @dev the ERC-165 identifier for this interface is 0xcc1d80ca21/// @dev the ERC-165 identifier for this interface is 0xeecfdb3422contract Collection is Dummy, ERC165 {22contract Collection is Dummy, ERC165 {23 // /// Set collection property.23 // /// Set collection property.24 // ///24 // ///254 dummy = 0;254 dummy = 0;255 }255 }256257 /// Returns nesting for a collection258 /// @dev EVM selector for this function is: 0x22d25bfe,259 /// or in textual repr: collectionNestingRestrictedCollectionIds()260 function collectionNestingRestrictedCollectionIds() public view returns (Tuple21 memory) {261 require(false, stub_error);262 dummy;263 return Tuple21(false, new uint256[](0));264 }256265257 /// Set the collection access method.266 /// Set the collection access method.258 /// @param mode Access mode267 /// @param mode Access mode425 uint256 sub;434 uint256 sub;426}435}436437/// @dev anonymous struct438struct Tuple21 {439 bool field_0;440 uint256[] field_1;441}427442428/// @dev Property struct443/// @dev Property struct429struct Property {444struct Property {pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth119}119}120120121/// @title A contract that allows you to work with collections.121/// @title A contract that allows you to work with collections.122/// @dev the ERC-165 identifier for this interface is 0xcc1d80ca122/// @dev the ERC-165 identifier for this interface is 0xeecfdb34123contract Collection is Dummy, ERC165 {123contract Collection is Dummy, ERC165 {124 // /// Set collection property.124 // /// Set collection property.125 // ///125 // ///355 dummy = 0;355 dummy = 0;356 }356 }357358 /// Returns nesting for a collection359 /// @dev EVM selector for this function is: 0x22d25bfe,360 /// or in textual repr: collectionNestingRestrictedCollectionIds()361 function collectionNestingRestrictedCollectionIds() public view returns (Tuple34 memory) {362 require(false, stub_error);363 dummy;364 return Tuple34(false, new uint256[](0));365 }357366358 /// Set the collection access method.367 /// Set the collection access method.359 /// @param mode Access mode368 /// @param mode Access mode526 uint256 sub;535 uint256 sub;527}536}537538/// @dev anonymous struct539struct Tuple34 {540 bool field_0;541 uint256[] field_1;542}528543529/// @dev anonymous struct544/// @dev anonymous struct530struct Tuple30 {545struct Tuple30 {pallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth119}119}120120121/// @title A contract that allows you to work with collections.121/// @title A contract that allows you to work with collections.122/// @dev the ERC-165 identifier for this interface is 0xcc1d80ca122/// @dev the ERC-165 identifier for this interface is 0xeecfdb34123contract Collection is Dummy, ERC165 {123contract Collection is Dummy, ERC165 {124 // /// Set collection property.124 // /// Set collection property.125 // ///125 // ///355 dummy = 0;355 dummy = 0;356 }356 }357358 /// Returns nesting for a collection359 /// @dev EVM selector for this function is: 0x22d25bfe,360 /// or in textual repr: collectionNestingRestrictedCollectionIds()361 function collectionNestingRestrictedCollectionIds() public view returns (Tuple33 memory) {362 require(false, stub_error);363 dummy;364 return Tuple33(false, new uint256[](0));365 }357366358 /// Set the collection access method.367 /// Set the collection access method.359 /// @param mode Access mode368 /// @param mode Access mode526 uint256 sub;535 uint256 sub;527}536}537538/// @dev anonymous struct539struct Tuple33 {540 bool field_0;541 uint256[] field_1;542}528543529/// @dev anonymous struct544/// @dev anonymous struct530struct Tuple29 {545struct Tuple29 {pallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterbothbinary blob — no preview
tests/src/eth/abi/fungible.jsondiffbeforeafterboth206 "stateMutability": "view",206 "stateMutability": "view",207 "type": "function"207 "type": "function"208 },208 },209 {210 "inputs": [],211 "name": "collectionNestingRestrictedCollectionIds",212 "outputs": [213 {214 "components": [215 { "internalType": "bool", "name": "field_0", "type": "bool" },216 {217 "internalType": "uint256[]",218 "name": "field_1",219 "type": "uint256[]"220 }221 ],222 "internalType": "struct Tuple21",223 "name": "",224 "type": "tuple"225 }226 ],227 "stateMutability": "view",228 "type": "function"229 },209 {230 {210 "inputs": [],231 "inputs": [],211 "name": "collectionOwner",232 "name": "collectionOwner",tests/src/eth/abi/nonFungible.jsondiffbeforeafterboth236 "stateMutability": "view",236 "stateMutability": "view",237 "type": "function"237 "type": "function"238 },238 },239 {240 "inputs": [],241 "name": "collectionNestingRestrictedCollectionIds",242 "outputs": [243 {244 "components": [245 { "internalType": "bool", "name": "field_0", "type": "bool" },246 {247 "internalType": "uint256[]",248 "name": "field_1",249 "type": "uint256[]"250 }251 ],252 "internalType": "struct Tuple34",253 "name": "",254 "type": "tuple"255 }256 ],257 "stateMutability": "view",258 "type": "function"259 },239 {260 {240 "inputs": [],261 "inputs": [],241 "name": "collectionOwner",262 "name": "collectionOwner",tests/src/eth/abi/reFungible.jsondiffbeforeafterboth218 "stateMutability": "view",218 "stateMutability": "view",219 "type": "function"219 "type": "function"220 },220 },221 {222 "inputs": [],223 "name": "collectionNestingRestrictedCollectionIds",224 "outputs": [225 {226 "components": [227 { "internalType": "bool", "name": "field_0", "type": "bool" },228 {229 "internalType": "uint256[]",230 "name": "field_1",231 "type": "uint256[]"232 }233 ],234 "internalType": "struct Tuple33",235 "name": "",236 "type": "tuple"237 }238 ],239 "stateMutability": "view",240 "type": "function"241 },221 {242 {222 "inputs": [],243 "inputs": [],223 "name": "collectionOwner",244 "name": "collectionOwner",tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth13}13}141415/// @title A contract that allows you to work with collections.15/// @title A contract that allows you to work with collections.16/// @dev the ERC-165 identifier for this interface is 0xcc1d80ca16/// @dev the ERC-165 identifier for this interface is 0xeecfdb3417interface Collection is Dummy, ERC165 {17interface Collection is Dummy, ERC165 {18 // /// Set collection property.18 // /// Set collection property.19 // ///19 // ///166 /// or in textual repr: setCollectionNesting(bool,address[])166 /// or in textual repr: setCollectionNesting(bool,address[])167 function setCollectionNesting(bool enable, address[] memory collections) external;167 function setCollectionNesting(bool enable, address[] memory collections) external;168169 /// Returns nesting for a collection170 /// @dev EVM selector for this function is: 0x22d25bfe,171 /// or in textual repr: collectionNestingRestrictedCollectionIds()172 function collectionNestingRestrictedCollectionIds() external view returns (Tuple20 memory);168173169 /// Set the collection access method.174 /// Set the collection access method.170 /// @param mode Access mode175 /// @param mode Access mode278 uint256 sub;283 uint256 sub;279}284}285286/// @dev anonymous struct287struct Tuple20 {288 bool field_0;289 uint256[] field_1;290}280291281/// @dev Property struct292/// @dev Property struct282struct Property {293struct Property {tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth80}80}818182/// @title A contract that allows you to work with collections.82/// @title A contract that allows you to work with collections.83/// @dev the ERC-165 identifier for this interface is 0xcc1d80ca83/// @dev the ERC-165 identifier for this interface is 0xeecfdb3484interface Collection is Dummy, ERC165 {84interface Collection is Dummy, ERC165 {85 // /// Set collection property.85 // /// Set collection property.86 // ///86 // ///233 /// or in textual repr: setCollectionNesting(bool,address[])233 /// or in textual repr: setCollectionNesting(bool,address[])234 function setCollectionNesting(bool enable, address[] memory collections) external;234 function setCollectionNesting(bool enable, address[] memory collections) external;235236 /// Returns nesting for a collection237 /// @dev EVM selector for this function is: 0x22d25bfe,238 /// or in textual repr: collectionNestingRestrictedCollectionIds()239 function collectionNestingRestrictedCollectionIds() external view returns (Tuple31 memory);235240236 /// Set the collection access method.241 /// Set the collection access method.237 /// @param mode Access mode242 /// @param mode Access mode345 uint256 sub;350 uint256 sub;346}351}352353/// @dev anonymous struct354struct Tuple31 {355 bool field_0;356 uint256[] field_1;357}347358348/// @dev anonymous struct359/// @dev anonymous struct349struct Tuple27 {360struct Tuple27 {tests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth80}80}818182/// @title A contract that allows you to work with collections.82/// @title A contract that allows you to work with collections.83/// @dev the ERC-165 identifier for this interface is 0xcc1d80ca83/// @dev the ERC-165 identifier for this interface is 0xeecfdb3484interface Collection is Dummy, ERC165 {84interface Collection is Dummy, ERC165 {85 // /// Set collection property.85 // /// Set collection property.86 // ///86 // ///233 /// or in textual repr: setCollectionNesting(bool,address[])233 /// or in textual repr: setCollectionNesting(bool,address[])234 function setCollectionNesting(bool enable, address[] memory collections) external;234 function setCollectionNesting(bool enable, address[] memory collections) external;235236 /// Returns nesting for a collection237 /// @dev EVM selector for this function is: 0x22d25bfe,238 /// or in textual repr: collectionNestingRestrictedCollectionIds()239 function collectionNestingRestrictedCollectionIds() external view returns (Tuple30 memory);235240236 /// Set the collection access method.241 /// Set the collection access method.237 /// @param mode Access mode242 /// @param mode Access mode345 uint256 sub;350 uint256 sub;346}351}352353/// @dev anonymous struct354struct Tuple30 {355 bool field_0;356 uint256[] field_1;357}347358348/// @dev anonymous struct359/// @dev anonymous struct349struct Tuple26 {360struct Tuple26 {tests/src/eth/nesting/nest.test.tsdiffbeforeafterboth52 expect(await contract.methods.ownerOf(secondTokenId).call()).to.be.equal(owner);52 expect(await contract.methods.ownerOf(secondTokenId).call()).to.be.equal(owner);53 });53 });5454 55 itEth('NFT: collectionNestingRestrictedCollectionIds()', async ({helper}) => {56 const owner = await helper.eth.createAccountWithBalance(donor);57 const {collectionId: unnestedCollsectionId, collectionAddress: unnsetedCollectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');58 const unnestedContract = helper.ethNativeContract.collection(unnsetedCollectionAddress, 'nft', owner);59 expect(await unnestedContract.methods.collectionNestingRestrictedCollectionIds().call({from: owner})).to.be.like([false, []]);60 61 const {contract} = await createNestingCollection(helper, owner);62 expect(await contract.methods.collectionNestingRestrictedCollectionIds().call({from: owner})).to.be.like([true, []]);63 await contract.methods.setCollectionNesting(true, [unnsetedCollectionAddress]).send({from: owner});64 expect(await contract.methods.collectionNestingRestrictedCollectionIds().call({from: owner})).to.be.like([true, [unnestedCollsectionId.toString()]]);65 66 });67 55 itEth('NFT: allows an Owner to nest/unnest their token (Restricted nesting)', async ({helper}) => {68 itEth('NFT: allows an Owner to nest/unnest their token (Restricted nesting)', async ({helper}) => {56 const owner = await helper.eth.createAccountWithBalance(donor);69 const owner = await helper.eth.createAccountWithBalance(donor);