git.delta.rocks / unique-network / refs/commits / c36ef7824029

difftreelog

Update custom types

str-mv2020-12-11parent: #b86074c.patch.diff
in: master

3 files changed

modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -186,10 +186,10 @@
 impl Default for CollectionLimits {
     fn default() -> CollectionLimits {
         CollectionLimits { 
-            account_token_ownership_limit: 0, 
-            token_limit: 0,
-            sponsored_data_size: 0, 
-            sponsor_transfer_timeout: 0 }
+            account_token_ownership_limit: u32::max_value(), 
+            token_limit: u32::max_value(),
+            sponsored_data_size: u32::max_value(), 
+            sponsor_transfer_timeout: u32::max_value() }
     }
 }
 
@@ -1417,7 +1417,7 @@
         #[weight = 0]
         pub fn set_collection_limits(
             origin,
-            collection_id: u64,
+            collection_id: u32,
             limits: CollectionLimits,
         ) -> DispatchResult {
             let sender = ensure_signed(origin)?;
@@ -1439,9 +1439,9 @@
         if !Self::is_owner_or_admin_permissions(collection_id, sender.clone()) {
 
             // check token limit and account token limit
-            let total_items: u64 = ItemListIndex::get(collection_id);
+            let total_items: u32 = ItemListIndex::get(collection_id);
             let account_items: u32 = <AddressTokens<T>>::get(collection_id, sender.clone()).len() as u32;
-            ensure!(collection.limits.token_limit as u64 > total_items,  Error::<T>::CollectionTokenLimitExceeded);
+            ensure!(collection.limits.token_limit > total_items,  Error::<T>::CollectionTokenLimitExceeded);
             ensure!(collection.limits.account_token_ownership_limit > account_items,  Error::<T>::AccountTokenLimitExceeded);
             ensure!(collection.mint_mode == true, Error::<T>::PublicMintingNotAllowed);
             Self::check_white_list(collection_id, owner)?;
modifiedpallets/nft/src/tests.rsdiffbeforeafterboth
--- a/pallets/nft/src/tests.rs
+++ b/pallets/nft/src/tests.rs
@@ -3,7 +3,7 @@
 use crate::mock::*;
 use crate::{AccessMode, ApprovePermissions, CollectionMode,
     Ownership, ChainLimits, CreateItemData, CreateNftData, CreateFungibleData, CreateReFungibleData,
-    CollectionId, TokenId, MAX_DECIMAL_POINTS}; //Err
+    CollectionId, TokenId, MAX_DECIMAL_POINTS};
 use frame_support::{assert_noop, assert_ok};
 use frame_system::{ RawOrigin };
 
modifiedruntime_types.jsondiffbeforeafterboth
46 "Owner": "AccountId",46 "Owner": "AccountId",
47 "Value": "u128"47 "Value": "u128"
48 },48 },
49 "ReFungibleItemType": {
50 "Collection": "CollectionId",
51 "Owner": "Vec<Ownership>",
52 "Data": "Vec<u8>"
53 },
54 "NftItemType": {49 "NftItemType": {
55 "Collection": "CollectionId",50 "Collection": "CollectionId",
56 "Owner": "AccountId",51 "Owner": "AccountId",
57 "ConstData": "Vec<u8>",52 "ConstData": "Vec<u8>",
58 "VariableData": "Vec<u8>"53 "VariableData": "Vec<u8>"
59 },54 },
60 "Ownership": {
61 "owner": "AccountId",
62 "fraction": "u128"
63 },
64 "ReFungibleItemType": {55 "ReFungibleItemType": {
65 "Collection": "CollectionId",56 "Collection": "CollectionId",
66 "Owner": "Vec<Ownership<AccountId>>",57 "Owner": "Vec<Ownership<AccountId>>",
79 "OffchainSchema": "Vec<u8>",70 "OffchainSchema": "Vec<u8>",
80 "Sponsor": "AccountId",71 "Sponsor": "AccountId",
81 "UnconfirmedSponsor": "AccountId",72 "UnconfirmedSponsor": "AccountId",
73 "Limits": "CollectionLimits",
82 "VariableOnChainSchema": "Vec<u8>",74 "VariableOnChainSchema": "Vec<u8>",
83 "ConstOnChainSchema": "Vec<u8>"75 "ConstOnChainSchema": "Vec<u8>"
84 },76 },
120 "nft_sponsor_transfer_timeout": "u32",112 "nft_sponsor_transfer_timeout": "u32",
121 "fungible_sponsor_transfer_timeout": "u32",113 "fungible_sponsor_transfer_timeout": "u32",
122 "refungible_sponsor_transfer_timeout": "u32"114 "refungible_sponsor_transfer_timeout": "u32"
123 }115 },
116 "CollectionLimits": {
117 "AccountTokenOwnershipLimit": "u32",
118 "SponsoredDataSize": "u32",
119 "TokenLimit": "u32",
120 "SponsorTransferTimeout": "u32"
121 }
124 }122 }
125 123