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
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
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