pragma solidity ^0.7.6;

//SPDX-License-Identifier: MIT

interface IERC20 {
    function balanceOf(address account) external view returns (uint256);
    function transfer(address recipient, uint256 amount) external returns (bool);
    function approve(address spender, uint256 amount) external returns (bool);
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}

interface ISafeERC20 {
    function safeTransfer(IERC20 token, address to, uint256 value) external;
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) external;
    function safeApprove(IERC20 token, address spender, uint256 value) external;
}


contract OTK{
    address public owner;

    constructor(){
        owner = msg.sender;
    }

    //withdraw ETH
    function withdrawEther() external onlyOwner {
        uint balance = address(this).balance;
        require(balance > 0, "No ether to withdraw.");
        payable(msg.sender).transfer(balance);
    }

    //withdraw TOKEN
    function withdrawToken( address tokenContract, address _to, uint256 amount) external onlyOwner{
        IERC20 token = IERC20(tokenContract);
        ISafeERC20 safeToken = ISafeERC20(tokenContract);
        safeToken.safeTransfer(token, _to, amount);
    }


    modifier onlyOwner{
        require(msg.sender == owner , "Not authorized to call this function");
        _;
    }
}