how to allow only 5 per user to mint nft in this function?

Viewed 18

contract Owntoken is ERC721, ERC721Enumerable, ERC721URIStorage { using Counters for Counters.Counter;

Counters.Counter private _tokenIdCounter;
 uint256 MAX_SUPPLY = 5;

constructor() ERC721("owltoken", "OWL") {}

function safeMint(address to, string memory uri) public  {
    require(_tokenIdCounter.current() <= MAX_SUPPLY, " ");

    uint256 tokenId = _tokenIdCounter.current();
    _tokenIdCounter.increment();
    _safeMint(to, tokenId);
    _setTokenURI(tokenId, uri);
}
0 Answers
Related