hey guys can anyone help me? I have a question, it may seem very silly to you but I don't really understand how a contract for an nft collection works in the part where the nft is acquired.
I know that mint function will verify some conditions and call _safeMint
`function mint(uint256 _mintAmount) public payable {`
`uint256 supply = totalSupply();`
`require(!paused);`
`require(_mintAmount > 0);`
`require(_mintAmount <= maxMintAmount);`
`require(supply + _mintAmount <= maxSupply);`
`if (msg.sender != owner()) {`
`require(msg.value >= cost * _mintAmount);`
`}`
`for(uint256 i = 1; i <= _mintAmount; i++) {`
`_safeMint(msg.sender, supply + i);`
`}`
`}`
safe mint will call _mint
f
unction _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); }
mint will update the balance of the address that called mint function
`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; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); }`
I know that now in the contract my address will be pointing to the token id, but I don't understand how for example open Sea can know that I have this token. because the function that I called only changed the state of the contract, it didn't give me anything back.
For example if a mint a nft and go to open sea I can see my nft on my wallet, but how it works???