contract Presale {
    address payable owner;
    address me = address(this);
    
    // *** Config ***
    uint startPresale = 1609459200; // unix timestamp for presale to go live - 01-01-2021 00:00:00 UTC
    uint percentSell = 50;          // 2,500 token presale
    uint256 pricePresale = 12;       // 0.12 ETH
    uint256 maxPerWallet = 10 ether; // Max 10 ETH per Wallet
    // --- Config ---

    ERC20 token = new ERC20();
    
    constructor() public {
        owner = msg.sender;
        token.transfer(owner, token.totalSupply() / 100 * (100 - percentSell));
    }

    function() external payable {
        require(startPresale <= now, "Presale has not yet started");
        uint amount = msg.value / pricePresale * 100;
        require(amount <= token.balanceOf(address(this)), "Insufficient token balance in ICO");
        require((amount + token.balanceOf(address(msg.sender)) <= (maxPerWallet / pricePresale * 100) ), "Over Max Per Wallet");
        token.transfer(msg.sender, amount);
    }
    
    function manualGetETH() public payable {
        require(msg.sender == owner, "You are not the owner!");
        owner.transfer(address(this).balance);
    }
    
    function getLeftTokens() public {
        require(msg.sender == owner, "You are not the owner!");
        token.transfer(owner, token.balanceOf(address(this)));
    }
    
    
    // Utils
    function getStartICO() public view returns (uint) {
        return startPresale - now;
    }
    function tokenAddress() public view returns (address){
        return address(token);
    }
    function ICO_deposit() public view returns(uint){
        return token.balanceOf(address(this));
    }
    function myBalance() public view returns(uint){
        return token.balanceOf(msg.sender);
    }
}
function getStartICO() public view returns (uint) {
    return startPresale - now;
}

// Utils