This is the contract.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
contract SimpleMintContract is ERC721, Ownable {
uint256 public mintPrice = 0.01 ether;
uint256 public totalSupply;
uint256 public maxSupply;
bool public isMintEnabled;
mapping(address => uint256) public mintedWallets;
constructor() payable ERC721('Simple Mint', 'SIMPLEMINT'){
maxSupply = 20;
}
function toggleIsMintedEnabled() external onlyOwner {
isMintEnabled = !isMintEnabled;
}
function setMaxSupply(uint256 maxSupply_) external onlyOwner {
maxSupply = maxSupply_;
}
function mint() external payable {
require(isMintEnabled, 'minting not enabled');
require(mintedWallets[msg.sender] < 5, 'exceeds max per wallet');
require(msg.value == mintPrice, 'wrong value');
require(maxSupply > totalSupply, 'sold out');
mintedWallets[msg.sender]++;
totalSupply++;
uint256 tokenId = totalSupply;
_safeMint(msg.sender, tokenId);
}
}