From b4461324b7e8b79fdae10219f35f5bbc7d4896d9 Mon Sep 17 00:00:00 2001 From: str-mv <51784859+str-mv@users.noreply.github.com> Date: Thu, 04 Mar 2021 12:53:37 +0000 Subject: [PATCH] Merge pull request #122 from usetech-llc/fix/remove-storage-call-from-collectionlimits-default --- --- a/pallets/nft/src/lib.rs +++ b/pallets/nft/src/lib.rs @@ -194,7 +194,7 @@ CollectionLimits { account_token_ownership_limit: 10_000_000, token_limit: u32::max_value(), - sponsored_data_size: u32::max_value(), + sponsored_data_size: u32::MAX, sponsor_transfer_timeout: 14400, owner_can_transfer: true, owner_can_destroy: true @@ -576,8 +576,10 @@ _ => 0 }; + let chain_limit = ChainLimit::get(); + // bound Total number of collections - ensure!(CollectionCount::get() < ChainLimit::get().collection_numbers_limit, Error::::TotalCollectionsLimitExceeded); + ensure!(CollectionCount::get() < chain_limit.collection_numbers_limit, Error::::TotalCollectionsLimitExceeded); // check params ensure!(decimal_points <= MAX_DECIMAL_POINTS, Error::::CollectionDecimalPointLimitExceeded); @@ -598,6 +600,11 @@ CreatedCollectionCount::put(next_id); CollectionCount::put(total); + let limits = CollectionLimits { + sponsored_data_size: chain_limit.custom_data_limit, + ..Default::default() + }; + // Create new collection let new_collection = CollectionType { owner: who.clone(), @@ -614,7 +621,7 @@ sponsor_confirmed: false, variable_on_chain_schema: Vec::new(), const_on_chain_schema: Vec::new(), - limits: CollectionLimits::default() + limits, }; // Add new collection to map -- gitstuff