payableand requiring the user to pay a particular amount of ETH before triggering the transfer of the NFT to the buyer.
function mintToken(address to, uint256 tokenId, string uri) public virtual payable
publicfunctions can be called internally or via messages to allow anyone to interact with the function. (We don't want this function to be only callable by the contract's owner since this would lock out prospective buyers!)
require(msg.value >= 10, "Not enough ETH sent; check price!");
requirestatement requires that the payable function receive at least 10 wei, else the function will fail and revert. The
msg.valueparameter is the ETH value of amount sent in alongside the mint function.
mintfunction included in OpenZepplin's ERC721 contract file and instantiates/transfers the selected NFT to the buyer.
_setTokenURIfunction included in OpenZepplin's ERC721 contract file and sets the NFT URI to a particular endpoint.