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
186impl Default for CollectionLimits {186impl Default for CollectionLimits {
187 fn default() -> CollectionLimits {187 fn default() -> CollectionLimits {
188 CollectionLimits { 188 CollectionLimits {
189 account_token_ownership_limit: 0, 189 account_token_ownership_limit: u32::max_value(),
190 token_limit: 0,190 token_limit: u32::max_value(),
191 sponsored_data_size: 0, 191 sponsored_data_size: u32::max_value(),
192 sponsor_transfer_timeout: 0 }192 sponsor_transfer_timeout: u32::max_value() }
193 }193 }
194}194}
195195
1417 #[weight = 0]1417 #[weight = 0]
1418 pub fn set_collection_limits(1418 pub fn set_collection_limits(
1419 origin,1419 origin,
1420 collection_id: u64,1420 collection_id: u32,
1421 limits: CollectionLimits,1421 limits: CollectionLimits,
1422 ) -> DispatchResult {1422 ) -> DispatchResult {
1423 let sender = ensure_signed(origin)?;1423 let sender = ensure_signed(origin)?;
1439 if !Self::is_owner_or_admin_permissions(collection_id, sender.clone()) {1439 if !Self::is_owner_or_admin_permissions(collection_id, sender.clone()) {
14401440
1441 // check token limit and account token limit1441 // check token limit and account token limit
1442 let total_items: u64 = ItemListIndex::get(collection_id);1442 let total_items: u32 = ItemListIndex::get(collection_id);
1443 let account_items: u32 = <AddressTokens<T>>::get(collection_id, sender.clone()).len() as u32;1443 let account_items: u32 = <AddressTokens<T>>::get(collection_id, sender.clone()).len() as u32;
1444 ensure!(collection.limits.token_limit as u64 > total_items, Error::<T>::CollectionTokenLimitExceeded);1444 ensure!(collection.limits.token_limit > total_items, Error::<T>::CollectionTokenLimitExceeded);
1445 ensure!(collection.limits.account_token_ownership_limit > account_items, Error::<T>::AccountTokenLimitExceeded);1445 ensure!(collection.limits.account_token_ownership_limit > account_items, Error::<T>::AccountTokenLimitExceeded);
1446 ensure!(collection.mint_mode == true, Error::<T>::PublicMintingNotAllowed);1446 ensure!(collection.mint_mode == true, Error::<T>::PublicMintingNotAllowed);
1447 Self::check_white_list(collection_id, owner)?;1447 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
--- 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