contract pxMAYCpastel is ERC721, Ownable {
  bool public paused = true;
  bool public isFlipState = true;
  string private _baseTokenURI;
  uint256 public totalSupply = 0;
  uint256 public price = 0.01 ether;
  uint256 public maxSupply = 6666;
  uint256 public maxFreeMints = 1000;
  mapping(address => uint256) private freeWallets;

  constructor(string memory baseURI)
    ERC721("pxMAYCpastel", "pxMAYCpastel")
  {
    setBaseURI(baseURI);
  }

  function Mint(uint256 num) public payable {
    uint256 supply = totalSupply;

    require(!paused, "MINTING PAUSED");
    require(totalSupply + num <= maxSupply, "EXCEEDS MAX SUPPLY");

    if (totalSupply + num > maxFreeMints && isFlipState) {
      require(num < 31, "MAX PER TRANSACTION IS 30");
      require(msg.value >= price * num, "NOT ENOUGH ETH");
    } else {
      require(
        freeWallets[msg.sender] + num < 11,
        "MAX FREE MINTS PER WALLET IS 10"
      );

      freeWallets[msg.sender] += num;
    }

    totalSupply += num;

    for (uint256 i; i < num; i++) {
      _mint(msg.sender, supply + i);
    }
  }

  function _baseURI() internal view virtual override returns (string memory) {
    return _baseTokenURI;
  }

  function setBaseURI(string memory baseUri) public onlyOwner {
    _baseTokenURI = baseUri;
  }
//price should be set ie 10000000000000000
  function setPrice(uint256 newPrice) public onlyOwner {
    price = newPrice;
  }

  function setMaxSupply(uint256 newMaxSupply) public onlyOwner {
    maxSupply = newMaxSupply;
  }

  function setMaxFreeMints(uint256 newMaxFreeMints) public onlyOwner {
    maxFreeMints = newMaxFreeMints;
  }

  function pause(bool state) public onlyOwner {
    paused = state;
  }

  function FlipState(bool state) public onlyOwner {
    isFlipState = state;
  }

  function withdrawAll() public onlyOwner {
    require(
      payable(owner()).send(address(this).balance),
      "WITHDRAW UNSUCCESSFUL"
    );
  }
}
function setPrice(uint256 newPrice) public onlyOwner {
  price = newPrice;
}

//price should be set ie 10000000000000000