git.delta.rocks / unique-network / refs/commits / 1f47f964a0fc

difftreelog

Merge pull request #121 from usetech-llc/fix/remove-storage-call-from-collectionlimits-default

str-mv2021-03-04parents: #ff4b334 #2b06b09.patch.diff
in: master
Remove storage call from CollectionLimits Default impl

1 file changed

modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
194 CollectionLimits { 194 CollectionLimits {
195 account_token_ownership_limit: 10_000_000, 195 account_token_ownership_limit: 10_000_000,
196 token_limit: u32::max_value(),196 token_limit: u32::max_value(),
197 sponsored_data_size: ChainLimit::get().custom_data_limit, 197 sponsored_data_size: u32::MAX,
198 sponsor_transfer_timeout: 14400,198 sponsor_transfer_timeout: 14400,
199 owner_can_transfer: true,199 owner_can_transfer: true,
200 owner_can_destroy: true200 owner_can_destroy: true
576 _ => 0576 _ => 0
577 };577 };
578
579 let chain_limit = ChainLimit::get();
578580
579 // bound Total number of collections581 // bound Total number of collections
580 ensure!(CollectionCount::get() < ChainLimit::get().collection_numbers_limit, Error::<T>::TotalCollectionsLimitExceeded);582 ensure!(CollectionCount::get() < chain_limit.collection_numbers_limit, Error::<T>::TotalCollectionsLimitExceeded);
581583
582 // check params584 // check params
583 ensure!(decimal_points <= MAX_DECIMAL_POINTS, Error::<T>::CollectionDecimalPointLimitExceeded);585 ensure!(decimal_points <= MAX_DECIMAL_POINTS, Error::<T>::CollectionDecimalPointLimitExceeded);
598 CreatedCollectionCount::put(next_id);600 CreatedCollectionCount::put(next_id);
599 CollectionCount::put(total);601 CollectionCount::put(total);
602
603 let limits = CollectionLimits {
604 sponsored_data_size: chain_limit.custom_data_limit,
605 ..Default::default()
606 };
600607
601 // Create new collection608 // Create new collection
602 let new_collection = CollectionType {609 let new_collection = CollectionType {
614 sponsor_confirmed: false,621 sponsor_confirmed: false,
615 variable_on_chain_schema: Vec::new(),622 variable_on_chain_schema: Vec::new(),
616 const_on_chain_schema: Vec::new(),623 const_on_chain_schema: Vec::new(),
617 limits: CollectionLimits::default()624 limits,
618 };625 };
619626
620 // Add new collection to map627 // Add new collection to map