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
before · runtime_types.json
1{2    "Schedule": {3      "version": "u32",4      "put_code_per_byte_cost": "Gas",5      "grow_mem_cost": "Gas",6      "regular_op_cost": "Gas",7      "return_data_per_byte_cost": "Gas",8      "event_data_per_byte_cost": "Gas",9      "event_per_topic_cost": "Gas",10      "event_base_cost": "Gas",11      "call_base_cost": "Gas",12      "instantiate_base_cost": "Gas",13      "dispatch_base_cost": "Gas",14      "sandbox_data_read_cost": "Gas",15      "sandbox_data_write_cost": "Gas",16      "transfer_cost": "Gas",17      "instantiate_cost": "Gas",18      "max_event_topics": "u32",19      "max_stack_height": "u32",20      "max_memory_pages": "u32",21      "max_table_size": "u32",22      "enable_println": "bool",23      "max_subject_len": "u32"24    },25    "AccessMode": {26      "_enum": [27        "Normal",28        "WhiteList"29      ]30    },31    "DecimalPoints": "u8",32    "CollectionMode": {33      "_enum": {34        "Invalid": null,35        "NFT": null,36        "Fungible": "DecimalPoints",37        "ReFungible": "DecimalPoints"38      }39    },40    "Ownership": {41      "Owner": "AccountId",42      "Fraction": "u128"43    },44    "FungibleItemType": {45      "Collection": "CollectionId",46      "Owner": "AccountId",47      "Value": "u128"48    },49    "ReFungibleItemType": {50      "Collection": "CollectionId",51      "Owner": "Vec<Ownership>",52      "Data": "Vec<u8>"53    },54    "NftItemType": {55      "Collection": "CollectionId",56      "Owner": "AccountId",57      "ConstData": "Vec<u8>",58      "VariableData": "Vec<u8>"59    },60    "Ownership": {61      "owner": "AccountId",62      "fraction": "u128"63    },64    "ReFungibleItemType": {65      "Collection": "CollectionId",66      "Owner": "Vec<Ownership<AccountId>>",67      "ConstData": "Vec<u8>",68      "VariableData": "Vec<u8>"69    },70    "CollectionType": {71      "Owner": "AccountId",72      "Mode": "CollectionMode",73      "Access": "AccessMode",74      "DecimalPoints": "DecimalPoints",75      "Name": "Vec<u16>",76      "Description": "Vec<u16>",77      "TokenPrefix": "Vec<u8>",78      "MintMode": "bool",79      "OffchainSchema": "Vec<u8>",80      "Sponsor": "AccountId",81      "UnconfirmedSponsor": "AccountId",82      "VariableOnChainSchema": "Vec<u8>",83      "ConstOnChainSchema": "Vec<u8>"84    },85    "ApprovePermissions": {86      "Approved": "AccountId",87      "Amount": "u128"88    },89    "RawData": "Vec<u8>",90    "Address": "AccountId",91    "LookupSource": "AccountId",92    "Weight": "u64",93    "CreateNftData": {94      "const_data": "Vec<u8>",95      "variable_data": "Vec<u8>" 96    },97    "CreateFungibleData": {},98    "CreateReFungibleData": {99      "const_data": "Vec<u8>",100      "variable_data": "Vec<u8>" 101    },102    "CreateItemData": {103      "_enum": {104        "NFT": "CreateNftData",105        "Fungible": "CreateFungibleData",106        "ReFungible": "CreateReFungibleData"107      }108    },109    "CollectionId": "u32",110    "TokenId": "u32",111    "BasketItem": {112      "Address": "AccountId",113      "start_block": "BlockNumber"114    },115    "ChainLimits": {116      "collection_numbers_limit": "u32",117      "account_token_ownership_limit": "u32",118      "collections_admins_limit": "u64",119      "custom_data_limit": "u32",120      "nft_sponsor_transfer_timeout": "u32",121      "fungible_sponsor_transfer_timeout": "u32",122      "refungible_sponsor_transfer_timeout": "u32"123    }124  }125  
after · runtime_types.json
1{2    "Schedule": {3      "version": "u32",4      "put_code_per_byte_cost": "Gas",5      "grow_mem_cost": "Gas",6      "regular_op_cost": "Gas",7      "return_data_per_byte_cost": "Gas",8      "event_data_per_byte_cost": "Gas",9      "event_per_topic_cost": "Gas",10      "event_base_cost": "Gas",11      "call_base_cost": "Gas",12      "instantiate_base_cost": "Gas",13      "dispatch_base_cost": "Gas",14      "sandbox_data_read_cost": "Gas",15      "sandbox_data_write_cost": "Gas",16      "transfer_cost": "Gas",17      "instantiate_cost": "Gas",18      "max_event_topics": "u32",19      "max_stack_height": "u32",20      "max_memory_pages": "u32",21      "max_table_size": "u32",22      "enable_println": "bool",23      "max_subject_len": "u32"24    },25    "AccessMode": {26      "_enum": [27        "Normal",28        "WhiteList"29      ]30    },31    "DecimalPoints": "u8",32    "CollectionMode": {33      "_enum": {34        "Invalid": null,35        "NFT": null,36        "Fungible": "DecimalPoints",37        "ReFungible": "DecimalPoints"38      }39    },40    "Ownership": {41      "Owner": "AccountId",42      "Fraction": "u128"43    },44    "FungibleItemType": {45      "Collection": "CollectionId",46      "Owner": "AccountId",47      "Value": "u128"48    },49    "NftItemType": {50      "Collection": "CollectionId",51      "Owner": "AccountId",52      "ConstData": "Vec<u8>",53      "VariableData": "Vec<u8>"54    },55    "ReFungibleItemType": {56      "Collection": "CollectionId",57      "Owner": "Vec<Ownership<AccountId>>",58      "ConstData": "Vec<u8>",59      "VariableData": "Vec<u8>"60    },61    "CollectionType": {62      "Owner": "AccountId",63      "Mode": "CollectionMode",64      "Access": "AccessMode",65      "DecimalPoints": "DecimalPoints",66      "Name": "Vec<u16>",67      "Description": "Vec<u16>",68      "TokenPrefix": "Vec<u8>",69      "MintMode": "bool",70      "OffchainSchema": "Vec<u8>",71      "Sponsor": "AccountId",72      "UnconfirmedSponsor": "AccountId",73      "Limits": "CollectionLimits",74      "VariableOnChainSchema": "Vec<u8>",75      "ConstOnChainSchema": "Vec<u8>"76    },77    "ApprovePermissions": {78      "Approved": "AccountId",79      "Amount": "u128"80    },81    "RawData": "Vec<u8>",82    "Address": "AccountId",83    "LookupSource": "AccountId",84    "Weight": "u64",85    "CreateNftData": {86      "const_data": "Vec<u8>",87      "variable_data": "Vec<u8>" 88    },89    "CreateFungibleData": {},90    "CreateReFungibleData": {91      "const_data": "Vec<u8>",92      "variable_data": "Vec<u8>" 93    },94    "CreateItemData": {95      "_enum": {96        "NFT": "CreateNftData",97        "Fungible": "CreateFungibleData",98        "ReFungible": "CreateReFungibleData"99      }100    },101    "CollectionId": "u32",102    "TokenId": "u32",103    "BasketItem": {104      "Address": "AccountId",105      "start_block": "BlockNumber"106    },107    "ChainLimits": {108      "collection_numbers_limit": "u32",109      "account_token_ownership_limit": "u32",110      "collections_admins_limit": "u64",111      "custom_data_limit": "u32",112      "nft_sponsor_transfer_timeout": "u32",113      "fungible_sponsor_transfer_timeout": "u32",114      "refungible_sponsor_transfer_timeout": "u32"115    },116    "CollectionLimits": {117      "AccountTokenOwnershipLimit": "u32",118      "SponsoredDataSize": "u32",119      "TokenLimit": "u32",120      "SponsorTransferTimeout": "u32"121    }122  }123