mint Free & paid
Free mint <=3 & pay x value if mint >3
function mint(uint256 quantity) external payable {
require(totalSupply()<=maxSupply , "Minting Ends");
require(quantity <= maxMinting , "Minting need to be less then 3");
uint userMinted = _numberMinted(msg.sender);
if(userMinted >=3 ){
//pay if user has 3 free mints
require(mintPrice * quantity >= msg.value, "Ether value sent is not correct");
_mint(msg.sender, quantity);
}
else{
//free if user has not minted yet
_mint(msg.sender, quantity);
}
}
msg.sender
_mint(msg.sender, quantity);
wallet address of contract invoker
msg.value
require(mintPrice * quantity >= msg.value, "Ether value sent is not correct");
wallet address who tries to mint with bigger or equal to the value being signed.
Last updated
Was this helpful?