I am asking this question regarding to the dev note above Transfer event in the ERC721 spesification / code.
/// @dev This emits when ownership of any NFT changes by any mechanism. /// This event emits when NFTs are created (
from== 0) and destroyed /// (
to== 0). Exception: during contract creation, any number of NFTs /// may be created and assigned without emitting Transfer. At the time of /// any transfer, the approved address for that NFT (if any) is reset to none. event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);
I am scratching my head for days because of this. How is this possible? Technically, I couldn't think of any solution to create "n" tokens and assign to a wallet address, without mapping token ids in a for loop in the mint function. Probably to achieve this, enumeration functions in the official implementations should be bypassed. But then how do the tokens exist in contract? Is there an example implementation regarding this? I searched everywhere but couldn't find anything. Being able to create "n" number of NFTs on contract creation (without emitting an event) would benefit me a lot; I am working on some experiments, so I am disregarding the events for now.