git.delta.rocks / unique-network / refs/commits / 9d5e6bdc297d

difftreelog

fix forward collection flags

Yaroslav Bolyukin2022-10-13parent: #f27580f.patch.diff
in: master

10 files changed

modifiedpallets/common/src/dispatch.rsdiffbeforeafterboth
9 traits::Get,9 traits::Get,
10};10};
11use sp_runtime::DispatchError;11use sp_runtime::DispatchError;
12use up_data_structs::{CollectionId, CreateCollectionData};12use up_data_structs::{CollectionId, CreateCollectionData, CollectionFlags};
1313
14use crate::{pallet::Config, CommonCollectionOperations, CollectionHandle};14use crate::{pallet::Config, CommonCollectionOperations, CollectionHandle};
1515
80 sender: T::CrossAccountId,80 sender: T::CrossAccountId,
81 payer: T::CrossAccountId,81 payer: T::CrossAccountId,
82 data: CreateCollectionData<T::AccountId>,82 data: CreateCollectionData<T::AccountId>,
83 flags: CollectionFlags,
83 ) -> Result<CollectionId, DispatchError>;84 ) -> Result<CollectionId, DispatchError>;
8485
85 /// Delete the collection.86 /// Delete the collection.
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
212 owner: T::CrossAccountId,212 owner: T::CrossAccountId,
213 payer: T::CrossAccountId,213 payer: T::CrossAccountId,
214 data: CreateCollectionData<T::AccountId>,214 data: CreateCollectionData<T::AccountId>,
215 flags: CollectionFlags,
215 ) -> Result<CollectionId, DispatchError> {216 ) -> Result<CollectionId, DispatchError> {
216 <PalletCommon<T>>::init_collection(owner, payer, data, CollectionFlags::default())217 <PalletCommon<T>>::init_collection(owner, payer, data, flags)
217 }218 }
218219
219 /// Initializes the collection with ForeignCollection flag. Returns [CollectionId] on success, [DispatchError] otherwise.220 /// Initializes the collection with ForeignCollection flag. Returns [CollectionId] on success, [DispatchError] otherwise.
modifiedpallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth
55 owner,55 owner,
56 CollectionMode::NFT,56 CollectionMode::NFT,
57 |owner: T::CrossAccountId, data| {57 |owner: T::CrossAccountId, data| {
58 <Pallet<T>>::init_collection(owner.clone(), owner, data, true)58 <Pallet<T>>::init_collection(owner.clone(), owner, data, Default::default())
59 },59 },
60 NonfungibleHandle::cast,60 NonfungibleHandle::cast,
61 )61 )
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
408 owner: T::CrossAccountId,408 owner: T::CrossAccountId,
409 payer: T::CrossAccountId,409 payer: T::CrossAccountId,
410 data: CreateCollectionData<T::AccountId>,410 data: CreateCollectionData<T::AccountId>,
411 is_external: bool,411 flags: CollectionFlags,
412 ) -> Result<CollectionId, DispatchError> {412 ) -> Result<CollectionId, DispatchError> {
413 <PalletCommon<T>>::init_collection(413 <PalletCommon<T>>::init_collection(owner, payer, data, flags)
414 owner,
415 payer,
416 data,
417 CollectionFlags {
418 external: is_external,
419 ..Default::default()
420 },
421 )
422 }414 }
423415
modifiedpallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth
1452 sender.clone(),
1453 sender,
1454 data,
1455 up_data_structs::CollectionFlags {
1456 external: true,
1457 ..Default::default()
1458 },
1459 );
14521460
1453 if let Err(DispatchError::Arithmetic(_)) = &collection_id {1461 if let Err(DispatchError::Arithmetic(_)) = &collection_id {
modifiedpallets/proxy-rmrk-equip/src/lib.rsdiffbeforeafterboth
254 cross_sender.clone(),254 cross_sender.clone(),
255 cross_sender.clone(),255 cross_sender.clone(),
256 data,256 data,
257 up_data_structs::CollectionFlags {
257 true,258 external: true,
259 ..Default::default()
260 },
258 );261 );
259262
260 if let Err(DispatchError::Arithmetic(_)) = &collection_id_res {263 if let Err(DispatchError::Arithmetic(_)) = &collection_id_res {
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
371 owner: T::CrossAccountId,371 owner: T::CrossAccountId,
372 payer: T::CrossAccountId,372 payer: T::CrossAccountId,
373 data: CreateCollectionData<T::AccountId>,373 data: CreateCollectionData<T::AccountId>,
374 flags: CollectionFlags,
374 ) -> Result<CollectionId, DispatchError> {375 ) -> Result<CollectionId, DispatchError> {
375 <PalletCommon<T>>::init_collection(owner, payer, data, CollectionFlags::default())376 <PalletCommon<T>>::init_collection(owner, payer, data, flags)
376 }377 }
377378
378 /// Destroy RFT collection379 /// Destroy RFT collection
modifiedpallets/unique/src/eth/mod.rsdiffbeforeafterboth
34use sp_std::vec;34use sp_std::vec;
35use up_data_structs::{35use up_data_structs::{
36 CollectionName, CollectionDescription, CollectionTokenPrefix, CreateCollectionData,36 CollectionName, CollectionDescription, CollectionTokenPrefix, CreateCollectionData,
37 CollectionMode, PropertyValue,37 CollectionMode, PropertyValue, CollectionFlags,
38};38};
3939
40use crate::{Config, SelfWeightOf, weights::WeightInfo};40use crate::{Config, SelfWeightOf, weights::WeightInfo};
189 let collection_id =189 let collection_id = T::CollectionDispatch::create(
190 T::CollectionDispatch::create(caller.clone(), collection_helpers_address, data)190 caller.clone(),
191 collection_helpers_address,
192 data,
193 CollectionFlags {
194 erc721metadata: add_properties,
195 ..Default::default()
196 },
197 )
191 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;198 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
192 let address = pallet_common::eth::collection_id_to_address(collection_id);199 let address = pallet_common::eth::collection_id_to_address(collection_id);
246 let collection_id = T::CollectionDispatch::create(caller, collection_helpers_address, data)253 let collection_id = T::CollectionDispatch::create(
254 caller,
255 collection_helpers_address,
256 data,
257 Default::default(),
258 )
247 .map_err(dispatch_to_evm::<T>)?;259 .map_err(dispatch_to_evm::<T>)?;
248260
294 let collection_id = T::CollectionDispatch::create(caller, collection_helpers_address, data)306 let collection_id = T::CollectionDispatch::create(
307 caller,
308 collection_helpers_address,
309 data,
310 CollectionFlags {
311 erc721metadata: true,
312 ..Default::default()
313 },
314 )
295 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;315 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
296316
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
345345
346 // =========346 // =========
347 let sender = T::CrossAccountId::from_sub(sender);347 let sender = T::CrossAccountId::from_sub(sender);
348 let _id = T::CollectionDispatch::create(sender.clone(), sender, data)?;348 let _id = T::CollectionDispatch::create(sender.clone(), sender, data, Default::default())?;
349349
350 Ok(())350 Ok(())
351 }351 }
modifiedruntime/common/dispatch.rsdiffbeforeafterboth
31};31};
32use up_data_structs::{32use up_data_structs::{
33 CollectionMode, CreateCollectionData, MAX_DECIMAL_POINTS, mapping::TokenAddressMapping,33 CollectionMode, CreateCollectionData, MAX_DECIMAL_POINTS, mapping::TokenAddressMapping,
34 CollectionId,34 CollectionId, CollectionFlags,
35};35};
3636
37#[cfg(not(feature = "refungible"))]37#[cfg(not(feature = "refungible"))]
57 sender: T::CrossAccountId,57 sender: T::CrossAccountId,
58 payer: T::CrossAccountId,58 payer: T::CrossAccountId,
59 data: CreateCollectionData<T::AccountId>,59 data: CreateCollectionData<T::AccountId>,
60 flags: CollectionFlags,
60 ) -> Result<CollectionId, DispatchError> {61 ) -> Result<CollectionId, DispatchError> {
61 let id = match data.mode {62 let id = match data.mode {
62 CollectionMode::NFT => {63 CollectionMode::NFT => {
63 <PalletNonfungible<T>>::init_collection(sender, payer, data, false)?64 <PalletNonfungible<T>>::init_collection(sender, payer, data, flags)?
64 }65 }
65 CollectionMode::Fungible(decimal_points) => {66 CollectionMode::Fungible(decimal_points) => {
66 // check params67 // check params
67 ensure!(68 ensure!(
68 decimal_points <= MAX_DECIMAL_POINTS,69 decimal_points <= MAX_DECIMAL_POINTS,
69 pallet_unique::Error::<T>::CollectionDecimalPointLimitExceeded70 pallet_unique::Error::<T>::CollectionDecimalPointLimitExceeded
70 );71 );
71 <PalletFungible<T>>::init_collection(sender, payer, data)?72 <PalletFungible<T>>::init_collection(sender, payer, data, flags)?
72 }73 }
7374
74 #[cfg(feature = "refungible")]75 #[cfg(feature = "refungible")]
75 CollectionMode::ReFungible => <PalletRefungible<T>>::init_collection(sender, payer, data)?,76 CollectionMode::ReFungible => {
77 <PalletRefungible<T>>::init_collection(sender, payer, data, flags)?
78 }
7679
77 #[cfg(not(feature = "refungible"))]80 #[cfg(not(feature = "refungible"))]
78 CollectionMode::ReFungible => return unsupported!(T),81 CollectionMode::ReFungible => return unsupported!(T),