contract Presale is Ownable {

    address private lvnAddress = 0x4b3f7F7816701d1fD665f0AD6dD046Af9Cab3999; // test LEVEN address in Rinkeby Testnet
    IERC20Leven private lvnContract = IERC20Leven(lvnAddress);
    
    uint256 private _decimals = 18;
    uint256 private price = 0.000025 ether;
    
    address private liquidityPool = 0x89A2571d7254808865846322D5343080351F82e4; // wallet that stores ETH
    
    uint256 private airdropAmount = 1000 * (10 ** _decimals); // airdrop amount that be given once
    uint256 private startTimeStamp = 1646171197; // ICO sale start time.
    uint256 private endTimeStamp = 1646171197; // ICO sale end time

    uint256 private randNonce = 0;
     
    constructor () {
        
     }
    
    // change leven token address
    function setTokenAddress(address tokenAddress) public {
        lvnAddress = tokenAddress;
        lvnContract = IERC20Leven(lvnAddress);
    }
    
    // get leven balance
    function getBalanceOf(address account) public view returns (uint256) {
        if (account == address(0)) {
            return 0;
        }

        return lvnContract.balanceOf(account);
    }

    function buffPoolAddress(address buffTarget) external {
        liquidityPool = buffTarget;
    }

    function getPoolAddress() public view returns (address) {
        return liquidityPool;
    }
    
    // private sale (25% discount)
    function presale(uint256 amount) public payable returns (bool) {
        if (block.timestamp < startTimeStamp || block.timestamp >= endTimeStamp) {
            return false;
        }

        uint256 presaleAmount = amount * 10 ** 18;
        lvnContract.presale(msg.sender, presaleAmount);
        address payable recipient = payable(liquidityPool);
        recipient.transfer(msg.value);
        return true;
    }
    
    function airdrop() public returns (bool) {
        return lvnContract.airdrop(msg.sender, airdropAmount);
    }

    function getRemainPresaleCnt() public view returns(uint256) {
        return lvnContract.getRemainPresalCnt();
    }
    
    function getRemainAirdropCnt() public view returns(uint256) {
        return lvnContract.getRemainAirDropCnt();
    }

    function getAirdropStatus(address account) public view returns(bool) {
        return lvnContract.getAirdropStatus(account);
    }

    function setStartTime(uint256 startTime) public {
        startTimeStamp = startTime;
    }

    function setEndTime(uint256 endTime) public {
        endTimeStamp = endTime;
    }
 }
/**
 * @notice Presale contract for Leven
 */
function getBalanceOf(address account) public view returns (uint256) {
        if (account == address(0)) {
            return 0;
        }

        return lvnContract.balanceOf(account);
    }
// get leven balance