contract YFIDappLock_Team_Advisor_Marketing is Ownable {
    using SafeMath for uint;
    
    address public constant tokenAddress = 0x61266424B904d65cEb2945a1413Ac322185187D5;
    
    
    // Team and Advisor = 10,116 YFIDapp     ;       Every Month Unlocking =   843 YFIDapp 
    //     Marketing    =  9,528 YFIDapp     ;       Every Month Unlocking =   794 YFIDapp 
    //     Total        = 19,644 YFIDapp     ;       Every Month Unlocking = 1,637 YFIDapp 
    
    
    uint public constant tokensLocked = 19644e18;      // 19644 YFIDapp 
    uint public constant unlockRate =   1637;          // 1637 YFIDapp unlocking every month
                                                       // 19644 ÷ 1637 = 12 
                                                       
    uint public constant lockDuration = 30 days;       // 1637 YFIDapp unlock in every 30 days
    uint public lastClaimedTime;
    uint public deployTime;

    
    constructor() public {
        deployTime = now;
        lastClaimedTime = now;
    }
    
    function claim() public onlyOwner {
        uint pendingUnlocked = getPendingUnlocked();
        uint contractBalance = YfDFI(tokenAddress).balanceOf(address(this));
        uint amountToSend = pendingUnlocked;
        if (contractBalance < pendingUnlocked) {
            amountToSend = contractBalance;
        }
        require(YfDFI(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* ERC20 tokens sent to this contract (by mistake)
    function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
        require(_tokenAddr != tokenAddress, "Cannot transfer out reward tokens");
        YfDFI(_tokenAddr).transfer(_to, _amount);
    }

}
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
        require(_tokenAddr != tokenAddress, "Cannot transfer out reward tokens");
        YfDFI(_tokenAddr).transfer(_to, _amount);
    }
// function to allow admin to claim *other* ERC20 tokens sent to this contract (by mistake)