Error Handling
Require Statements
function :mint, { amount: :uint256 }, :public do
# Ensure the mint amount is positive
require(amount > 0, 'Amount must be positive')
# Ensure the mint amount does not exceed a pre-defined per mint limit
require(amount <= s.perMintLimit, 'Exceeded mint limit')
# Ensure the total supply won't exceed the max supply
require(s.totalSupply + amount <= s.maxSupply, 'Exceeded max supply')
# Proceed to mint
_mint(to: msg.sender, amount: amount)
endType Checking
Last updated