git.delta.rocks / unique-network / refs/commits / 2b0cd0f6b4f0

difftreelog

Limits check fix

str-mv2020-12-15parent: #6994ced.patch.diff
in: master

1 file changed

modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
14591459
1460 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()) {
1463
1464 // check token limit and account token limit1462 // check token limit and account token limit
1465 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
1468
1469 Ok(())1466 Ok(())
1470 }1467 }
14711468
1472 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 {
1473
1474 if !Self::is_owner_or_admin_permissions(collection_id, sender.clone()) {
14751470
1476 // check token limit and account token limit1471 // check token limit and account token limit
1477 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);
1476
1477 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 }
14851482
1486 Ok(())1483 Ok(())
1487 }1484 }