From 28159d0dd7c6eaaeac8125259765f56ece6537e5 Mon Sep 17 00:00:00 2001 From: chungquantin <56880684+chungquantin@users.noreply.github.com> Date: Thu, 26 Dec 2024 11:43:21 +0700 Subject: [PATCH] chore: comments --- pallets/nfts/src/features/create_delete_item.rs | 4 ++-- pallets/nfts/src/tests.rs | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pallets/nfts/src/features/create_delete_item.rs b/pallets/nfts/src/features/create_delete_item.rs index cc26b15e..830cfe4e 100644 --- a/pallets/nfts/src/features/create_delete_item.rs +++ b/pallets/nfts/src/features/create_delete_item.rs @@ -74,12 +74,12 @@ impl, I: 'static> Pallet { let deposit_account = maybe_depositor.unwrap_or_else(|| collection_details.owner.clone()); - let balance_depoist = + let balance_deposit = deposit_required.then_some(T::BalanceDeposit::get()).unwrap_or_default(); Self::increment_account_balance( collection, &mint_to, - (&deposit_account, balance_depoist), + (&deposit_account, balance_deposit), )?; let item_owner = mint_to.clone(); diff --git a/pallets/nfts/src/tests.rs b/pallets/nfts/src/tests.rs index fa1bf825..71d11891 100644 --- a/pallets/nfts/src/tests.rs +++ b/pallets/nfts/src/tests.rs @@ -233,8 +233,9 @@ fn basic_minting_should_work() { default_collection_config() )); assert_eq!(collections(), vec![(account(1), 0)]); + // Minting doesn't require a reserve because the collection's DepositRequired setting is + // disabled. assert_ok!(Nfts::mint(RuntimeOrigin::signed(account(1)), 0, 42, account(1), None)); - // Minting skips deposit as `DepositRequired` is disabled. assert_eq!(AccountBalance::get(0, &account(1)), Some((1, (account(1), 0)))); assert_eq!(items(), vec![(account(1), 0, 42)]); @@ -245,7 +246,6 @@ fn basic_minting_should_work() { )); assert_eq!(collections(), vec![(account(1), 0), (account(2), 1)]); assert_ok!(Nfts::mint(RuntimeOrigin::signed(account(2)), 1, 69, account(1), None)); - // Minting skips deposit as `DepositRequired` is disabled. assert_eq!(AccountBalance::get(1, &account(1)), Some((1, (account(2), 0)))); assert_eq!(items(), vec![(account(1), 0, 42), (account(1), 1, 69)]); }); @@ -438,7 +438,8 @@ fn mint_should_work() { account(1), default_collection_config() )); - // Minting skips deposit as `DepositRequired` is disabled. + // Minting doesn't require a reserve because the collection's DepositRequired setting is + // disabled. assert_ok!(Nfts::mint(RuntimeOrigin::signed(account(1)), 0, 42, account(1), None)); assert_eq!(AccountBalance::get(0, account(1)), Some((1, (account(1), 0)))); assert_eq!(Nfts::owner(0, 42).unwrap(), account(1));