Skip to content

Commit 1aa79f3

Browse files
committed
chore: resolve feedback comments
1 parent 986a5b6 commit 1aa79f3

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

pallets/nfts/src/features/atomic_swap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,19 +210,19 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
210210

211211
// This also removes the swap.
212212
Self::do_transfer(
213-
Some(&receive_item.owner),
214213
send_collection_id,
215214
send_item_id,
216215
receive_item.owner.clone(),
216+
Some(&receive_item.owner),
217217
|_, _| Ok(()),
218218
)?;
219219
// Owner of `send_item` is responsible for the deposit if the collection balance
220220
// went to zero due to the previous transfer.
221221
Self::do_transfer(
222-
Some(&send_item.owner),
223222
receive_collection_id,
224223
receive_item_id,
225224
send_item.owner.clone(),
225+
Some(&send_item.owner),
226226
|_, _| Ok(()),
227227
)?;
228228

pallets/nfts/src/features/buy_sell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
158158

159159
let old_owner = details.owner.clone();
160160

161-
Self::do_transfer(Some(&buyer), collection, item, buyer.clone(), |_, _| Ok(()))?;
161+
Self::do_transfer(collection, item, buyer.clone(), Some(&buyer), |_, _| Ok(()))?;
162162

163163
Self::deposit_event(Event::ItemBought {
164164
collection,

pallets/nfts/src/features/transfer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ use crate::*;
2525
impl<T: Config<I>, I: 'static> Pallet<T, I> {
2626
/// Transfer an NFT to the specified destination account.
2727
///
28-
/// - `depositor`: The account reserving the `CollectionBalanceDeposit` from if `dest` holds no
29-
/// items in the collection.
3028
/// - `collection`: The ID of the collection to which the NFT belongs.
3129
/// - `item`: The ID of the NFT to transfer.
3230
/// - `dest`: The destination account to which the NFT will be transferred.
31+
/// - `depositor`: The account reserving the `CollectionBalanceDeposit` from if `dest` holds no
32+
/// items in the collection.
3333
/// - `with_details`: A closure that provides access to the collection and item details,
3434
/// allowing customization of the transfer process.
3535
///
@@ -47,10 +47,10 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
4747
/// - If the collection or item is non-transferable
4848
/// ([`ItemsNonTransferable`](crate::Error::ItemsNonTransferable)).
4949
pub fn do_transfer(
50-
depositor: Option<&T::AccountId>,
5150
collection: T::CollectionId,
5251
item: T::ItemId,
5352
dest: T::AccountId,
53+
depositor: Option<&T::AccountId>,
5454
with_details: impl FnOnce(
5555
&CollectionDetailsFor<T, I>,
5656
&mut ItemDetailsFor<T, I>,

pallets/nfts/src/impl_nonfungibles.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,10 +412,10 @@ impl<T: Config<I>, I: 'static> Transfer<T::AccountId> for Pallet<T, I> {
412412
destination: &T::AccountId,
413413
) -> DispatchResult {
414414
// The item's owner pays for the deposit of `AccountBalance` if the `dest` holds no items
415-
// in `collection`. A malicious actor could have a deposit reserved from `dest` without
416-
// them knowing about the transfer. The deposit amount can be accounted for in the off chain
417-
// price of the NFT.
418-
Self::do_transfer(None, *collection, *item, destination.clone(), |_, _| Ok(()))
415+
// in `collection`. If `dest` paid the deposit, a malicious actor could transfer NFTs to
416+
// reserve involuntary deposits for `dest` . The deposit amount can be accounted for in the
417+
// off chain price of the NFT.
418+
Self::do_transfer(*collection, *item, destination.clone(), None, |_, _| Ok(()))
419419
}
420420

421421
fn disable_transfer(collection: &Self::CollectionId, item: &Self::ItemId) -> DispatchResult {

pallets/nfts/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ pub mod pallet {
10961096
// items in `collection`. A malicious actor could have a deposit reserved from `dest`
10971097
// without them knowing about the transfer. The deposit amount can be accounted for
10981098
// in the off chain price of the NFT.
1099-
Self::do_transfer(None, collection, item, dest, |_, details| {
1099+
Self::do_transfer(collection, item, dest, None, |_, details| {
11001100
if details.owner != origin {
11011101
Self::check_approval(&collection, &Some(item), &details.owner, &origin)?;
11021102
}

0 commit comments

Comments
 (0)