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 1


On your mint function you can check the totalSupply is less than the amount you want minted.


uint256 public maxMint = 1000;
function mint(uint256 _amnt) public {
    require(totalSupply() + _amnt <= maxMint, "This many cannot be minted at this moment");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.