difftreelog
added `destroyCollection`method to `CollectionHelpers`
in: master
10 files changed
Cargo.lockdiffbeforeafterboth679967996800[[package]]6800[[package]]6801name = "pallet-unique"6801name = "pallet-unique"6802version = "0.2.0"6802version = "0.2.1"6803dependencies = [6803dependencies = [6804 "ethereum",6804 "ethereum",6805 "evm-coder",6805 "evm-coder",pallets/unique/CHANGELOG.mddiffbeforeafterboth445<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->667## [v0.2.1] 2022-10-1089### Changes1011- Addded **CollectionHelpers** method `destroyCollection`.127## [v0.2.0] 2022-09-1313## [v0.2.0] 2022-09-138149### Changes15### Changes1610- Change **collectionHelper** method `createRefungibleCollection` to `createRFTCollection`,17- Change **collectionHelper** method `createRefungibleCollection` to `createRFTCollection`,111812## [v0.1.4] 2022-09-0519## [v0.1.4] 2022-09-05132014### Added21### Added152216- Methods `force_set_sponsor` , `force_remove_collection_sponsor` to be able to administer sponsorships with other pallets. Added to implement `AppPromotion` pallet logic.23- Methods `force_set_sponsor` , `force_remove_collection_sponsor` to be able to administer sponsorships with other pallets. Added to implement `AppPromotion` pallet logic.172418## [v0.1.3] 2022-08-1625## [v0.1.3] 2022-08-16192620### Other changes27### Other changes212822- build: Upgrade polkadot to v0.9.27 2c498572636f2b34d53b1c51b7283a761a7dc90a29- build: Upgrade polkadot to v0.9.27 2c498572636f2b34d53b1c51b7283a761a7dc90a233024- build: Upgrade polkadot to v0.9.26 85515e54c4ca1b82a2630034e55dcc804c643bf831- build: Upgrade polkadot to v0.9.26 85515e54c4ca1b82a2630034e55dcc804c643bf8253226- refactor: Remove `#[transactional]` from extrinsics 7fd36cea2f6e00c02c67ccc1de9649ae404efd3133- refactor: Remove `#[transactional]` from extrinsics 7fd36cea2f6e00c02c67ccc1de9649ae404efd31273428Every extrinsic now runs in transaction implicitly, and35Every extrinsic now runs in transaction implicitly, and29`#[transactional]` on pallet dispatchable is now meaningless36`#[transactional]` on pallet dispatchable is now meaningless303731Upstream-Change: https://github.com/paritytech/substrate/issues/1080638Upstream-Change: https://github.com/paritytech/substrate/issues/10806323933- refactor: Switch to new prefix removal methods 26734e9567589d75cdd99e404eabf11d5a97d97540- refactor: Switch to new prefix removal methods 26734e9567589d75cdd99e404eabf11d5a97d975344135New methods allows to call `remove_prefix` with limit multiple times42New methods allows to call `remove_prefix` with limit multiple times36in the same block43in the same block394640Upstream-Change: https://github.com/paritytech/substrate/pull/1149047Upstream-Change: https://github.com/paritytech/substrate/pull/11490414842- build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b49- build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b435044## [v0.1.1] - 2022-07-2551## [v0.1.1] - 2022-07-25455246### Added53### Added475448- Method for creating `ERC721Metadata` compatible NFT collection.55- Method for creating `ERC721Metadata` compatible NFT collection.49- Method for creating `ERC721Metadata` compatible ReFungible collection.56- Method for creating `ERC721Metadata` compatible ReFungible collection.50- Method for creating ReFungible collection.57- Method for creating ReFungible collection.5158pallets/unique/Cargo.tomldiffbeforeafterboth9license = 'GPLv3'9license = 'GPLv3'10name = 'pallet-unique'10name = 'pallet-unique'11repository = 'https://github.com/UniqueNetwork/unique-chain'11repository = 'https://github.com/UniqueNetwork/unique-chain'12version = "0.2.0"12version = "0.2.1"131314[package.metadata.docs.rs]14[package.metadata.docs.rs]15targets = ['x86_64-unknown-linux-gnu']15targets = ['x86_64-unknown-linux-gnu']pallets/unique/src/eth/mod.rsdiffbeforeafterboth19use core::marker::PhantomData;19use core::marker::PhantomData;20use ethereum as _;20use ethereum as _;21use evm_coder::{execution::*, generate_stubgen, solidity_interface, solidity, weight, types::*};21use evm_coder::{execution::*, generate_stubgen, solidity_interface, solidity, weight, types::*};22use frame_support::traits::Get;22use frame_support::{traits::Get, storage::StorageNMap};2324use crate::sp_api_hidden_includes_decl_storage::hidden_include::StorageDoubleMap;23use pallet_common::{25use pallet_common::{24 CollectionById,26 CollectionById,25 dispatch::CollectionDispatch,27 dispatch::CollectionDispatch,38};40};394140use crate::{Config, SelfWeightOf, weights::WeightInfo};42use crate::{43 Config, SelfWeightOf, weights::WeightInfo, NftTransferBasket, FungibleTransferBasket,44 ReFungibleTransferBasket, NftApproveBasket, FungibleApproveBasket, RefungibleApproveBasket,45};414642use sp_std::vec::Vec;47use sp_std::vec::Vec;296 Ok(())301 Ok(())297 }302 }303304 #[weight(<SelfWeightOf<T>>::destroy_collection())]305 #[solidity(rename_selector = "destroyCollection")]306 fn destroy_collection(&mut self, caller: caller, collection_address: address) -> Result<void> {307 let caller = T::CrossAccountId::from_eth(caller);308 let collection_id = pallet_common::eth::map_eth_to_id(&collection_address)309 .ok_or("Invalid collection address format".into())310 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;311 let collection = <pallet_common::CollectionHandle<T>>::try_get(collection_id)312 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;313 collection314 .check_is_internal()315 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;316317 T::CollectionDispatch::destroy(caller, collection)318 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;319320 let _ = <NftTransferBasket<T>>::clear_prefix(collection_id, u32::MAX, None);321 let _ = <FungibleTransferBasket<T>>::clear_prefix(collection_id, u32::MAX, None);322 let _ = <ReFungibleTransferBasket<T>>::clear_prefix((collection_id,), u32::MAX, None);323324 let _ = <NftApproveBasket<T>>::clear_prefix(collection_id, u32::MAX, None);325 let _ = <FungibleApproveBasket<T>>::clear_prefix(collection_id, u32::MAX, None);326 let _ = <RefungibleApproveBasket<T>>::clear_prefix((collection_id,), u32::MAX, None);327328 Ok(())329 }298330299 /// Check if a collection exists331 /// Check if a collection exists300 /// @param collectionAddress Address of the collection in question332 /// @param collectionAddress Address of the collection in questionpallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterbothbinary blob — no preview
pallets/unique/src/eth/stubs/CollectionHelpers.soldiffbeforeafterboth23}23}242425/// @title Contract, which allows users to operate with collections25/// @title Contract, which allows users to operate with collections26/// @dev the ERC-165 identifier for this interface is 0x5891863126/// @dev the ERC-165 identifier for this interface is 0x0edfb42e27contract CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {27contract CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {28 /// Create an NFT collection28 /// Create an NFT collection29 /// @param name Name of the collection29 /// @param name Name of the collection85 dummy = 0;85 dummy = 0;86 }86 }8788 /// @dev EVM selector for this function is: 0x564e321f,89 /// or in textual repr: destroyCollection(address)90 function destroyCollection(address collectionAddress) public {91 require(false, stub_error);92 collectionAddress;93 dummy = 0;94 }879588 /// Check if a collection exists96 /// Check if a collection exists89 /// @param collectionAddress Address of the collection in question97 /// @param collectionAddress Address of the collection in questiontests/src/eth/api/CollectionHelpers.soldiffbeforeafterboth18}18}191920/// @title Contract, which allows users to operate with collections20/// @title Contract, which allows users to operate with collections21/// @dev the ERC-165 identifier for this interface is 0x5891863121/// @dev the ERC-165 identifier for this interface is 0x0edfb42e22interface CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {22interface CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {23 /// Create an NFT collection23 /// Create an NFT collection24 /// @param name Name of the collection24 /// @param name Name of the collection54 /// or in textual repr: makeCollectionERC721MetadataCompatible(address,string)54 /// or in textual repr: makeCollectionERC721MetadataCompatible(address,string)55 function makeCollectionERC721MetadataCompatible(address collection, string memory baseUri) external;55 function makeCollectionERC721MetadataCompatible(address collection, string memory baseUri) external;5657 /// @dev EVM selector for this function is: 0x564e321f,58 /// or in textual repr: destroyCollection(address)59 function destroyCollection(address collectionAddress) external;566057 /// Check if a collection exists61 /// Check if a collection exists58 /// @param collectionAddress Address of the collection in question62 /// @param collectionAddress Address of the collection in questiontests/src/eth/collectionHelpersAbi.jsondiffbeforeafterboth47 "stateMutability": "payable",47 "stateMutability": "payable",48 "type": "function"48 "type": "function"49 },49 },50 {51 "inputs": [52 {53 "internalType": "address",54 "name": "collectionAddress",55 "type": "address"56 }57 ],58 "name": "destroyCollection",59 "outputs": [],60 "stateMutability": "nonpayable",61 "type": "function"62 },50 {63 {51 "inputs": [64 "inputs": [52 {65 {tests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth264 .call()).to.be.rejectedWith('unknown boolean limit "badLimit"');264 .call()).to.be.rejectedWith('unknown boolean limit "badLimit"');265 });265 });266 267 itEth('destroyCollection test', async ({helper}) => {268 const owner = await helper.eth.createAccountWithBalance(donor);269 const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');270 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);271 272 await expect(collectionHelper.methods273 .destroyCollection(collectionAddress)274 .send({from: owner})).to.be.fulfilled;275 276 expect(await collectionHelper.methods277 .isCollectionExist(collectionAddress)278 .call()).to.be.false; 279 });266});280});267281tests/src/eth/destroyCollection.test.tsdiffbeforeafterbothno changes