Skip to content

Commit

Permalink
chore: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
chungquantin committed Dec 26, 2024
1 parent f316e2f commit 28159d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pallets/nfts/src/features/create_delete_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
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();
Expand Down
7 changes: 4 additions & 3 deletions pallets/nfts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]);

Expand All @@ -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)]);
});
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 28159d0

Please sign in to comment.