I am learning about how nft smart contracts work. I could not understand why emitting an event receives address(0)
.
This is the _mint function from Openzeppeling ERC721
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
// i am stuck at here
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(address(0), to, tokenId);
}
When we emit the Transfer event, why do we use address(0)
. address(0)
stands for empty address. Here is the Transfer event:
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId);