From 44bf7a851a55363d742d9a143d177e8655a3bd1d Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Wed, 17 Feb 2021 11:06:00 +0000 Subject: [PATCH] feat: add Transfer event --- --- a/pallets/nft/src/lib.rs +++ b/pallets/nft/src/lib.rs @@ -505,6 +505,19 @@ /// /// item_id: Identifier of burned NFT. ItemDestroyed(CollectionId, TokenId), + + /// Item was transferred + /// + /// * collection_id: Id of collection to which item is belong + /// + /// * item_id: Id of an item + /// + /// * sender: Original owner of item + /// + /// * recipient: New owner of item + /// + /// * amount: Always 1 for NFT + Transfer(CollectionId, TokenId, AccountId, AccountId, u128), } ); @@ -1556,12 +1569,14 @@ match target_collection.mode { - CollectionMode::NFT => Self::transfer_nft(collection_id, item_id, sender.clone(), recipient)?, + CollectionMode::NFT => Self::transfer_nft(collection_id, item_id, sender.clone(), recipient.clone())?, CollectionMode::Fungible(_) => Self::transfer_fungible(collection_id, value, &sender, &recipient)?, - CollectionMode::ReFungible => Self::transfer_refungible(collection_id, item_id, value, sender.clone(), recipient)?, + CollectionMode::ReFungible => Self::transfer_refungible(collection_id, item_id, value, sender.clone(), recipient.clone())?, _ => () }; + Self::deposit_event(RawEvent::Transfer(collection_id, item_id, sender, recipient, value)); + Ok(()) } -- gitstuff