Skip to content

Commit

Permalink
revert event emission functions
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuahannan committed Jan 24, 2024
1 parent 0a43997 commit d896d25
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
30 changes: 16 additions & 14 deletions contracts/NonFungibleToken.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ access(all) contract interface NonFungibleToken: ViewResolver {
/// If the collection is not in an account's storage, `from` will be `nil`.
///
access(all) event Withdrawn(type: String, id: UInt64, uuid: UInt64, from: Address?, providerUUID: UInt64)
access(self) view fun emitWithdrawnEvent(type: String, id: UInt64, uuid: UInt64, from: Address?, providerUUID: UInt64): Bool {
if from != nil {
emit Withdrawn(type: type, id: id, uuid: uuid, from: from, providerUUID: providerUUID)
}
return true
}
// access(contract) view fun emitWithdrawnEvent(type: String, id: UInt64, uuid: UInt64, from: Address?, providerUUID: UInt64): Bool {
// if from != nil {
// emit Withdrawn(type: type, id: id, uuid: uuid, from: from, providerUUID: providerUUID)
// }
// return true
// }
/// Event that emitted when a token is deposited to a collection.
/// Indicates the type, id, uuid, the owner of the collection that it was deposited to,
Expand All @@ -90,12 +90,12 @@ access(all) contract interface NonFungibleToken: ViewResolver {
/// If the collection is not in an account's storage, `from`, will be `nil`.
///
access(all) event Deposited(type: String, id: UInt64, uuid: UInt64, to: Address?, collectionUUID: UInt64)
access(self) view fun emitDepositedEvent(type: String, id: UInt64, uuid: UInt64, to: Address?, collectionUUID: UInt64): Bool {
if to != nil {
emit Deposited(type: type, id: id, uuid: uuid, to: to, collectionUUID: collectionUUID)
}
return true
}
// access(contract) view fun emitDepositedEvent(type: String, id: UInt64, uuid: UInt64, to: Address?, collectionUUID: UInt64): Bool {
// if to != nil {
// emit Deposited(type: type, id: id, uuid: uuid, to: to, collectionUUID: collectionUUID)
// }
// return true
// }
/// Included for backwards-compatibility
access(all) resource interface INFT: NFT {}
Expand Down Expand Up @@ -156,7 +156,8 @@ access(all) contract interface NonFungibleToken: ViewResolver {
access(Withdraw | Owner) fun withdraw(withdrawID: UInt64): @{NFT} {
post {
result.id == withdrawID: "The ID of the withdrawn token must be the same as the requested ID"
emitWithdrawnEvent(type: result.getType().identifier, id: result.id, uuid: result.uuid, from: self.owner?.address, providerUUID: self.uuid)
//emitWithdrawnEvent(type: result.getType().identifier, id: result.id, uuid: result.uuid, from: self.owner?.address, providerUUID: self.uuid)
emit Withdrawn(type: result.getType().identifier, id: result.id, uuid: result.uuid, from: self.owner?.address, providerUUID: self.uuid)
}
}
}
Expand Down Expand Up @@ -194,7 +195,8 @@ access(all) contract interface NonFungibleToken: ViewResolver {
// because the `Collection` interface is almost always the final destination
// of tokens and deposit emissions from custom receivers could be confusing
// and hard to reconcile to event listeners
emitDepositedEvent(type: token.getType().identifier, id: token.id, uuid: token.uuid, to: self.owner?.address, collectionUUID: self.uuid)
//emitDepositedEvent(type: token.getType().identifier, id: token.id, uuid: token.uuid, to: self.owner?.address, collectionUUID: self.uuid)
emit Deposited(type: token.getType().identifier, id: token.id, uuid: token.uuid, to: self.owner?.address, collectionUUID: self.uuid)
}
}

Expand Down
Loading

0 comments on commit d896d25

Please sign in to comment.