Hey guys, how to emit events for specific token id in batch minting in ERC721A?

Oct 7, 2022, 3:12 PM
Hi
In the mintNFT() function, You can emit an event with tokenId as the parameter.
event MintComplete(uint tokenId, address owner);
function mintNFT() public payable
{
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(msg.sender, newItemId);
emit MintComplete(newItemId, msg.sender);
}
function setURI(uint256 id, string memory ipfsURI)
public onlyOwner // called from a script when above event emitted
{
_setTokenURI(id, ipfsURI);
}
Oct 7, 2022, 3:18 PM
yes this is not the case for ERC721A which includes batch minting. Suppose when i batch mint like 10. ERC721a handles this simple operation like this»» _mint(msg.sender, quantity); In this process, how do i emit for specific tokens
Oct 7, 2022, 3:22 PM

© 2024 Draquery.com All rights reserved.