contract UNOS_Lock_Jan is Ownable {
    using SafeMath for uint;
    
    address public constant tokenAddress = 0xd18A8abED9274eDBEace4B12D86A8633283435Da;
    
    uint public constant tokensLocked = 13860e18;         // 13860 UNOS
    uint public constant unlockRate =   13860;            // Unlock Date: 20 January 2021
    uint public constant lockDuration = 90 days;          // Before 90 Days, Its impossible to unlock...
    uint public lastClaimedTime;
    uint public deployTime;

    
    constructor() public {
        deployTime = now;
        lastClaimedTime = now;
    }
    
    function claim() public onlyOwner {
        uint pendingUnlocked = getPendingUnlocked();
        uint contractBalance = UNOS(tokenAddress).balanceOf(address(this));
        uint amountToSend = pendingUnlocked;
        if (contractBalance < pendingUnlocked) {
            amountToSend = contractBalance;
        }
        require(UNOS(tokenAddress).transfer(owner, amountToSend), "Could not transfer Tokens.");
        lastClaimedTime = now;
    }
    
    function getPendingUnlocked() public view returns (uint) {
        uint timeDiff = now.sub(lastClaimedTime);
        uint pendingUnlocked = tokensLocked
                                    .mul(unlockRate)
                                    .mul(timeDiff)
                                    .div(lockDuration)
                                    .div(1e4);
        return pendingUnlocked;
    }
    
    // function to allow admin to claim *other than UNOS* ERC20 tokens sent to this contract (by mistake) like USDT
    // UNOS can't be unlocked untill 20 Jan 2021
    function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
        require(_tokenAddr != tokenAddress, "Cannot transfer out reward tokens");
        UNOS(_tokenAddr).transfer(_to, _amount);
    }

}
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
        require(_tokenAddr != tokenAddress, "Cannot transfer out reward tokens");
        UNOS(_tokenAddr).transfer(_to, _amount);
    }
// function to allow admin to claim *other than UNOS* ERC20 tokens sent to this contract (by mistake) like USDT
// UNOS can't be unlocked untill 20 Jan 2021