--- a/pallets/common/src/dispatch.rs +++ b/pallets/common/src/dispatch.rs @@ -9,7 +9,7 @@ traits::Get, }; use sp_runtime::DispatchError; -use up_data_structs::{CollectionId, CreateCollectionData}; +use up_data_structs::{CollectionId, CreateCollectionData, CollectionFlags}; use crate::{pallet::Config, CommonCollectionOperations, CollectionHandle}; @@ -80,6 +80,7 @@ sender: T::CrossAccountId, payer: T::CrossAccountId, data: CreateCollectionData, + flags: CollectionFlags, ) -> Result; /// Delete the collection. --- a/pallets/fungible/src/lib.rs +++ b/pallets/fungible/src/lib.rs @@ -212,8 +212,9 @@ owner: T::CrossAccountId, payer: T::CrossAccountId, data: CreateCollectionData, + flags: CollectionFlags, ) -> Result { - >::init_collection(owner, payer, data, CollectionFlags::default()) + >::init_collection(owner, payer, data, flags) } /// Initializes the collection with ForeignCollection flag. Returns [CollectionId] on success, [DispatchError] otherwise. --- a/pallets/nonfungible/src/benchmarking.rs +++ b/pallets/nonfungible/src/benchmarking.rs @@ -55,7 +55,7 @@ owner, CollectionMode::NFT, |owner: T::CrossAccountId, data| { - >::init_collection(owner.clone(), owner, data, true) + >::init_collection(owner.clone(), owner, data, Default::default()) }, NonfungibleHandle::cast, ) --- a/pallets/nonfungible/src/lib.rs +++ b/pallets/nonfungible/src/lib.rs @@ -408,17 +408,9 @@ owner: T::CrossAccountId, payer: T::CrossAccountId, data: CreateCollectionData, - is_external: bool, + flags: CollectionFlags, ) -> Result { - >::init_collection( - owner, - payer, - data, - CollectionFlags { - external: is_external, - ..Default::default() - }, - ) + >::init_collection(owner, payer, data, flags) } /// Destroy NFT collection --- a/pallets/proxy-rmrk-core/src/lib.rs +++ b/pallets/proxy-rmrk-core/src/lib.rs @@ -1448,7 +1448,15 @@ data: CreateCollectionData, properties: impl Iterator, ) -> Result { - let collection_id = >::init_collection(sender.clone(), sender, data, true); + let collection_id = >::init_collection( + sender.clone(), + sender, + data, + up_data_structs::CollectionFlags { + external: true, + ..Default::default() + }, + ); if let Err(DispatchError::Arithmetic(_)) = &collection_id { return Err(>::NoAvailableCollectionId.into()); --- a/pallets/proxy-rmrk-equip/src/lib.rs +++ b/pallets/proxy-rmrk-equip/src/lib.rs @@ -254,7 +254,10 @@ cross_sender.clone(), cross_sender.clone(), data, - true, + up_data_structs::CollectionFlags { + external: true, + ..Default::default() + }, ); if let Err(DispatchError::Arithmetic(_)) = &collection_id_res { --- a/pallets/refungible/src/lib.rs +++ b/pallets/refungible/src/lib.rs @@ -371,8 +371,9 @@ owner: T::CrossAccountId, payer: T::CrossAccountId, data: CreateCollectionData, + flags: CollectionFlags, ) -> Result { - >::init_collection(owner, payer, data, CollectionFlags::default()) + >::init_collection(owner, payer, data, flags) } /// Destroy RFT collection --- a/pallets/unique/src/eth/mod.rs +++ b/pallets/unique/src/eth/mod.rs @@ -34,7 +34,7 @@ use sp_std::vec; use up_data_structs::{ CollectionName, CollectionDescription, CollectionTokenPrefix, CreateCollectionData, - CollectionMode, PropertyValue, + CollectionMode, PropertyValue, CollectionFlags, }; use crate::{Config, SelfWeightOf, weights::WeightInfo}; @@ -186,9 +186,16 @@ let collection_helpers_address = T::CrossAccountId::from_eth(::ContractAddress::get()); - let collection_id = - T::CollectionDispatch::create(caller.clone(), collection_helpers_address, data) - .map_err(pallet_evm_coder_substrate::dispatch_to_evm::)?; + let collection_id = T::CollectionDispatch::create( + caller.clone(), + collection_helpers_address, + data, + CollectionFlags { + erc721metadata: add_properties, + ..Default::default() + }, + ) + .map_err(pallet_evm_coder_substrate::dispatch_to_evm::)?; let address = pallet_common::eth::collection_id_to_address(collection_id); Ok(address) } @@ -243,8 +250,13 @@ check_sent_amount_equals_collection_creation_price::(value)?; let collection_helpers_address = T::CrossAccountId::from_eth(::ContractAddress::get()); - let collection_id = T::CollectionDispatch::create(caller, collection_helpers_address, data) - .map_err(dispatch_to_evm::)?; + let collection_id = T::CollectionDispatch::create( + caller, + collection_helpers_address, + data, + Default::default(), + ) + .map_err(dispatch_to_evm::)?; let address = pallet_common::eth::collection_id_to_address(collection_id); Ok(address) @@ -291,8 +303,16 @@ check_sent_amount_equals_collection_creation_price::(value)?; let collection_helpers_address = T::CrossAccountId::from_eth(::ContractAddress::get()); - let collection_id = T::CollectionDispatch::create(caller, collection_helpers_address, data) - .map_err(pallet_evm_coder_substrate::dispatch_to_evm::)?; + let collection_id = T::CollectionDispatch::create( + caller, + collection_helpers_address, + data, + CollectionFlags { + erc721metadata: true, + ..Default::default() + }, + ) + .map_err(pallet_evm_coder_substrate::dispatch_to_evm::)?; let address = pallet_common::eth::collection_id_to_address(collection_id); Ok(address) --- a/pallets/unique/src/lib.rs +++ b/pallets/unique/src/lib.rs @@ -345,7 +345,7 @@ // ========= let sender = T::CrossAccountId::from_sub(sender); - let _id = T::CollectionDispatch::create(sender.clone(), sender, data)?; + let _id = T::CollectionDispatch::create(sender.clone(), sender, data, Default::default())?; Ok(()) } --- a/runtime/common/dispatch.rs +++ b/runtime/common/dispatch.rs @@ -31,7 +31,7 @@ }; use up_data_structs::{ CollectionMode, CreateCollectionData, MAX_DECIMAL_POINTS, mapping::TokenAddressMapping, - CollectionId, + CollectionId, CollectionFlags, }; #[cfg(not(feature = "refungible"))] @@ -57,10 +57,11 @@ sender: T::CrossAccountId, payer: T::CrossAccountId, data: CreateCollectionData, + flags: CollectionFlags, ) -> Result { let id = match data.mode { CollectionMode::NFT => { - >::init_collection(sender, payer, data, false)? + >::init_collection(sender, payer, data, flags)? } CollectionMode::Fungible(decimal_points) => { // check params @@ -68,11 +69,13 @@ decimal_points <= MAX_DECIMAL_POINTS, pallet_unique::Error::::CollectionDecimalPointLimitExceeded ); - >::init_collection(sender, payer, data)? + >::init_collection(sender, payer, data, flags)? } #[cfg(feature = "refungible")] - CollectionMode::ReFungible => >::init_collection(sender, payer, data)?, + CollectionMode::ReFungible => { + >::init_collection(sender, payer, data, flags)? + } #[cfg(not(feature = "refungible"))] CollectionMode::ReFungible => return unsupported!(T),