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
3use crate::mock::*;3use crate::mock::*;
4use crate::{AccessMode, ApprovePermissions, CollectionMode,4use crate::{AccessMode, ApprovePermissions, CollectionMode,
5 Ownership, ChainLimits, CreateItemData, CreateNftData, CreateFungibleData, CreateReFungibleData,5 Ownership, ChainLimits, CreateItemData, CreateNftData, CreateFungibleData, CreateReFungibleData,
6 CollectionId, TokenId, MAX_DECIMAL_POINTS}; //Err6 CollectionId, TokenId, MAX_DECIMAL_POINTS};
7use frame_support::{assert_noop, assert_ok};7use frame_support::{assert_noop, assert_ok};
8use frame_system::{ RawOrigin };8use frame_system::{ RawOrigin };
99
modifiedruntime_types.jsondiffbeforeafterboth
--- a/runtime_types.json
+++ b/runtime_types.json
@@ -46,20 +46,11 @@
       "Owner": "AccountId",
       "Value": "u128"
     },
-    "ReFungibleItemType": {
-      "Collection": "CollectionId",
-      "Owner": "Vec<Ownership>",
-      "Data": "Vec<u8>"
-    },
     "NftItemType": {
       "Collection": "CollectionId",
       "Owner": "AccountId",
       "ConstData": "Vec<u8>",
       "VariableData": "Vec<u8>"
-    },
-    "Ownership": {
-      "owner": "AccountId",
-      "fraction": "u128"
     },
     "ReFungibleItemType": {
       "Collection": "CollectionId",
@@ -79,6 +70,7 @@
       "OffchainSchema": "Vec<u8>",
       "Sponsor": "AccountId",
       "UnconfirmedSponsor": "AccountId",
+      "Limits": "CollectionLimits",
       "VariableOnChainSchema": "Vec<u8>",
       "ConstOnChainSchema": "Vec<u8>"
     },
@@ -120,6 +112,12 @@
       "nft_sponsor_transfer_timeout": "u32",
       "fungible_sponsor_transfer_timeout": "u32",
       "refungible_sponsor_transfer_timeout": "u32"
+    },
+    "CollectionLimits": {
+      "AccountTokenOwnershipLimit": "u32",
+      "SponsoredDataSize": "u32",
+      "TokenLimit": "u32",
+      "SponsorTransferTimeout": "u32"
     }
   }
   
\ No newline at end of file