difftreelog
Limits check fix
in: master
1 file changed
pallets/nft/src/lib.rsdiffbeforeafterboth145914591460 fn is_correct_transfer(collection_id: CollectionId, collection: &CollectionType<T::AccountId>, recipient: &T::AccountId) -> DispatchResult {1460 fn is_correct_transfer(collection_id: CollectionId, collection: &CollectionType<T::AccountId>, recipient: &T::AccountId) -> DispatchResult {14611461 1462 if !Self::is_owner_or_admin_permissions(collection_id, recipient.clone()) {14631464 // check token limit and account token limit1462 // check token limit and account token limit1465 let account_items: u32 = <AddressTokens<T>>::get(collection_id, recipient).len() as u32;1463 let account_items: u32 = <AddressTokens<T>>::get(collection_id, recipient).len() as u32;1466 ensure!(collection.limits.account_token_ownership_limit > account_items, Error::<T>::AccountTokenLimitExceeded);1464 ensure!(collection.limits.account_token_ownership_limit > account_items, Error::<T>::AccountTokenLimitExceeded);1467 }1465 14681469 Ok(())1466 Ok(())1470 }1467 }147114681472 fn can_create_items_in_collection(collection_id: CollectionId, collection: &CollectionType<T::AccountId>, sender: &T::AccountId, owner: &T::AccountId) -> DispatchResult {1469 fn can_create_items_in_collection(collection_id: CollectionId, collection: &CollectionType<T::AccountId>, sender: &T::AccountId, owner: &T::AccountId) -> DispatchResult {14731474 if !Self::is_owner_or_admin_permissions(collection_id, sender.clone()) {147514701476 // check token limit and account token limit1471 // check token limit and account token limit1477 let total_items: u32 = ItemListIndex::get(collection_id);1472 let total_items: u32 = ItemListIndex::get(collection_id);1478 let account_items: u32 = <AddressTokens<T>>::get(collection_id, owner).len() as u32;1473 let account_items: u32 = <AddressTokens<T>>::get(collection_id, owner).len() as u32;1479 ensure!(collection.limits.token_limit > total_items, Error::<T>::CollectionTokenLimitExceeded);1474 ensure!(collection.limits.token_limit > total_items, Error::<T>::CollectionTokenLimitExceeded);1480 ensure!(collection.limits.account_token_ownership_limit > account_items, Error::<T>::AccountTokenLimitExceeded);1475 ensure!(collection.limits.account_token_ownership_limit > account_items, Error::<T>::AccountTokenLimitExceeded);14761477 if !Self::is_owner_or_admin_permissions(collection_id, sender.clone()) {1481 ensure!(collection.mint_mode == true, Error::<T>::PublicMintingNotAllowed);1478 ensure!(collection.mint_mode == true, Error::<T>::PublicMintingNotAllowed);1482 Self::check_white_list(collection_id, owner)?;1479 Self::check_white_list(collection_id, owner)?;1483 Self::check_white_list(collection_id, sender)?;1480 Self::check_white_list(collection_id, sender)?;1484 }1481 }148514821486 Ok(())1483 Ok(())1487 }1484 }