How to limit the number of minted NFTs? I'm using OpenZeppelin, and I see the totalSupply query function, but no way to actually limit the number of minted NFTs
1 Answer
On your mint function you can check the totalSupply is less than the amount you want minted.
Eg.
uint256 public maxMint = 1000;
function mint(uint256 _amnt) public {
...
require(totalSupply() + _amnt <= maxMint, "This many cannot be minted at this moment");
...
}