soliditynfterc721

Dedicated mint event vs transfer event in erc721


For NFT minting - Standard says to emit transfer event with value of from as zero address. But i was wondering a dedicated event let's say mint sound more better and clear.

event Mint(address to, string tokenId)

Also it gives us advantage of one more variable to be indexed in event as max three value can be indexed.

Can anyone please clear this ? What is best way?


Solution

  • Pasted from a comment below my other answer answering a question

    why not to use dedicated mint event ?

    I can't speak for the authors and reviewers of the ERC-721 standard, why they chose this specific way. But from my understanding, it was already a common practice to emit Transfer event log with zero sender address when minting ERC-20 tokens, when they were creating the 721 standard. So one of the reasons might have been reusability of code for offchain apps such as blockchain explorers, to be able to handle token minting in a more generalized way.


    To add context to your more specific question about the advantage of being able to pass more values:

    Apart from Transfer, you can also emit other event logs, including this arbitrary Mint as well, when you're minting new tokens.

    Since this Mint event is not standardized, it will not be recognized by most offchain apps (such as Etherscan) as token mint. They will only show it on the transaction detail page as "some event named Mint that we don't recognize", but their internal aggregated database of "who owns which tokens" and "these tokens were minted during this transaction" will still reflect only the values passed to the Transfer event.

    However, you'll be able to handle this arbitrary event from your own offchain apps.