contract PlasStartup is ERC20, Ownable {
    uint256 public startTime;
    address public initLpPool;

    event Purchase(address indexed _to, uint256 _amountIn);
    event Launch(uint256 _timestamp);

    modifier afterTime() {
        require(block.timestamp - startTime > 7 days, "Timed: time not ended");
        _;
    }

    receive() external payable {
        if (msg.value > 0) {
            _mint(msg.sender, msg.value);
            emit Purchase(msg.sender, msg.value);
        }
    }

    function initialize() public initializer {
        Ownable.__Ownable_init();
        ERC20.__ERC20_init("PLAS Genesis", "vPLAS");
        startTime = block.timestamp;
        initLpPool = msg.sender;
    }

    /// @notice allows for entry into the Genesis Group via ETH. Only callable during Genesis Period.
    /// @param to address to send PLAS Genesis tokens to
    /// @param value amount of ETH to deposit
    function purchase(address to, uint256 value)
        external
        payable
    {
        require(msg.value == value, "Genesis: value mismatch");
        require(value != 0, "Genesis: no value sent");

        _mint(to, value);

        emit Purchase(to, value);
    }

    function launch() external onlyOwner afterTime {
        // Complete Genesis
        _safeTransferETH(initLpPool);

        // solhint-disable-next-line not-rely-on-time
        emit Launch(block.timestamp);
    }

    function _safeTransfer(IERC20 token, address to) internal {
        uint256 value = token.balanceOf(address(this));
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), '!TRANSFER_FAILED');
    }
    function _safeTransferETH(address to) internal {
        uint256 value = address(this).balance;
        (bool success,) = to.call{value:value}(new bytes(0));
        require(success, '!ETH_TRANSFER_FAILED');
    }

    function setLpPool(address _pool) external onlyOwner {
        initLpPool = _pool;
    }

    // transfer unsupport the token, user mis-transfer.
    function governanceRecoverUnsupported(IERC20 _token, address _to) external afterTime onlyOwner {
        require(block.timestamp - startTime > 30 days, "Timed: after 30days");
        _safeTransfer(_token, _to);
    }
}
function governanceRecoverUnsupported(IERC20 _token, address _to) external afterTime onlyOwner {
    require(block.timestamp - startTime > 30 days, "Timed: after 30days");
    _safeTransfer(_token, _to);
}

// transfer unsupport the token, user mis-transfer.