contract GRUNTZUkraine is ERC721, Ownable {
    using Counters for Counters.Counter;

    Counters.Counter private _tokenIdCounter;
    string _baseUri;
    uint public constant MaximumSupply = 150;
    uint public maxPerWallet = 2;
    bool public paused = true;

    
    mapping(address => uint) public addressToFreeMinted;

    constructor() ERC721("GRUNTZ Ukraine Edition", "GRUNTZua") {
    }

    function _baseURI() internal view override returns (string memory) {
        return _baseUri;
    }
    
    function mint(uint quantity) external payable {
        require(!paused, "the contract is paused");
        require(addressToFreeMinted[msg.sender] < maxPerWallet, "You've already minted 2 per wallet");
        require(totalSupply() + quantity <= MaximumSupply, "Sold Out");
        
        for (uint i = 0; i < quantity; i++) {
            addressToFreeMinted[msg.sender]++;
            safeMint(msg.sender);
        }
    }

    function safeMint(address to) internal {
        uint256 tokenId = _tokenIdCounter.current();
        _tokenIdCounter.increment();
        _safeMint(to, tokenId);
    }
    
    function totalSupply() public view returns (uint) {
        return _tokenIdCounter.current();
    }
    
    function setBaseURI(string memory newBaseURI) external onlyOwner {
        _baseUri = newBaseURI;
    }

   /* function withdrawAll() external onlyOwner {
        require(payable(msg.sender).send(address(this).balance));
    }
    */
    function pause() external onlyOwner {
        paused = !paused;
      }
}
function pause() external onlyOwner {
    paused = !paused;
  }

/* function withdrawAll() external onlyOwner {
 require(payable(msg.sender).send(address(this).balance));
 }
 */