rmrk-team/rmrk-substrate

Accept NFT allows for NFT owner to accept NFT to another NFT that is not current owner

Closed this issue · 2 comments

Currently the accept_nft function has a parameter named new_owner this new_owner can be defined by the user that owns a pending NFT. So this opens up for the following example described in this excalidraw:

image

Since the lookup_root_owner already proves that the accept_nft sender owns the NFT & we do not require the need to define the new_owner since the new_owner will already possess the NFT in Storage. All that is needed is to mutate the pending field from true to false & we also do not require another call to uniques pallet's do_transfer function. Also, calling the do_transfer would cause the Storage between uniques and rmrk to be inconsistent.

I have also found that the Nfts field owner is never updated when sending an NFT to another NFT in the nft_send function. This causes the NftInfo owner field to be inconsistent with the Uniques owner() function for an NFT. This is not caught due to the current ownership checks only using the Uniques pallet functions & does not check if the Nfts owner field matches the value of Uniques owner(col_id, nft_id). The cause of this is due to this change here where updating the owner field was commented out.

// Nfts::<T>::insert(collection_id, nft_id, sending_nft);

When un-comment the code for updating Nfts storage, tests start to fail.