contract Assteroids is Ownable, ERC721Enumerable, ReentrancyGuard {
    using SafeMath for uint256;

    string public Assteroids_PROVENANCE = "";
    string public BASE_URI = "";
    uint256 public constant PRICE = 0.0069 ether;
    uint256 public constant MAX_Assteroids = 6969;
    uint256 public constant PURCHASE_LIMIT = 20;
    uint256 public totalPublicSupply;
    address public chairtyAddress = 0xE855Bf4efc4C607E1740c3b772F9Fd01609Dd916;
    bool public saleIsActive = true;

    constructor() ERC721("Assteroids", "ASS") {}

    function withdraw() public onlyOwner {
        uint256 value = address(this).balance;
        sendValueTo(chairtyAddress, value);
    }

    /**
    * @dev Send value to address
    */
    function sendValueTo(address to_, uint256 value) internal {
        address payable to = payable(to_);
        (bool success, ) = to.call{value: value}("");
        require(success, "Transfer failed.");
    }

    function setWitdrawAddress(address _add) public onlyOwner {
        chairtyAddress = _add;
    }

    /**
    * @dev Return base URI
    */
    function _baseURI() internal view override returns (string memory) {
        return BASE_URI;
    }

    /**
    * @dev Set data
    */
    function setBaseURI(string memory baseURI_) public onlyOwner {
        BASE_URI = baseURI_;
    }

    function setProvenanceHash(string memory provenanceHash) public onlyOwner {
        Assteroids_PROVENANCE = provenanceHash;
    }

    /**
    * @dev Minting functions
    * Mint used by the public
    * Reserve used by team for giveaways etc
    */
    function mint(uint256 numberOfTokens) public payable nonReentrant {
        require(saleIsActive, 'Contract is not active');
        require(totalSupply().add(numberOfTokens) <= MAX_Assteroids,"All tokens have been minted");
        require(numberOfTokens > 0 && numberOfTokens <= PURCHASE_LIMIT,"Would exceed PURCHASE_LIMIT");
        require(msg.value / numberOfTokens == PRICE, "Eth value is not good");

        for (uint256 i = 0; i < numberOfTokens; i++) {
            if (totalPublicSupply < MAX_Assteroids) {
                uint256 tokenId = totalPublicSupply;
                totalPublicSupply += 1;
                _safeMint(msg.sender, tokenId);
            }
        }
    }
}
function _baseURI() internal view override returns (string memory) {
    return BASE_URI;
}

/**
 * @dev Return base URI
 */