Skip to content

Update destroyMoments() to call withdraw() #295

Description

@joshuahannan

Issue To Be Solved

When destroyMoments() is called, it removes the NFTs directly instead of withdrawing them, which skips emitting the NonFungibleToken.Withdraw event. Third parties that monitor these events get very confused because they can't update their records if a withdraw event is not emitted.

https://www.flowscan.io/tx/0a869a6e007b43830887afb662923670d6a254ea6ba8358f3769dce938d23a51?tab=events

The data quality becomes very poor when they do this:
there are msising nft_transfers of topshot
status of nfts are wrong or tricky to calculate systemmatically
there are uuid conflicts in < 200 UUID so using the standard NFT.ResourceDestroyed event alone is not possible. (that is what we currently do so there is a bug in our system)

Suggest A Solution

Update destroyMoments() to withdraw the NFT, which will also emit the regular withdraw event, so the additional withdraw event is not needed.

// does nothing if the moment is not locked
topShotLockingAdmin.unlockByID(id: id)

// Remove the nft from the Collection
let token <- self.withdraw(withdrawID: id)
        ?? panic("Cannot destroy: Moment does not exist in collection: ".concat(id.toString()))

Burner.burn(<-token)

Context

Third party sites like find and flowscan are suffering from this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions