contract ERC223Receiver is TokenReceiver, Ownable {
    address tokenHolder;
    event getTokens(address indexed _from, address indexed _origin, uint _value);
    
    constructor () public {
        tokenHolder = msg.sender;
    }
    
    /**
     * @dev - set new address to sent all incoming tokens.
     * @param _newTokenHolder address to sent all incoming tokens.
     */
    function setTokenHolder(address _newTokenHolder) public onlyOwner {
        tokenHolder = _newTokenHolder;
    }
    
    /**
     * @dev - ERC223 special callback function. callable from another contract.
     * @param _sender address that sent tokens
     * @param _origin ERC223 contract address
     * @param _value amount of transferred tokens.
     */
    function tokenFallback(address _sender, address _origin, uint _value) public returns (bool ok) {
        // in contract._origin was transfer(_sender, this, _value);
        // to send all we can
        // 1. create contract._origin
        // 2. transfer from this to special address _value tokens.
        // 3. do something changes in this contract? mint some tokens?
        ERC20Basic erc223 = ERC20Basic(_origin);
        bool result = erc223.transfer(tokenHolder, _value);
        emit getTokens(_sender, _origin, _value);
        return result;
    }
    
    /**
     * @dev noERC223 special function for transfer erc20 basable tokens from this contract to tokenHolder(by default owner) special address.
     * @param _contract address of contract to check for balance & transfer tokens to tokenHolder.
     * @return true if balance greter than 0 & transfer is ok.
     */
    function collectTokens(address _contract) public returns (bool ok) {
        ERC20Basic erc20 = ERC20Basic(_contract);
        uint256 balance = erc20.balanceOf(this);
        ok = false;
        if (balance > 0) {
            ok = erc20.transfer(tokenHolder, balance);
            emit getTokens(msg.sender, _contract, balance);
        }
        return ok;
    }
    
    /**
     * @dev function to send all ethers from contract to owner
     */
    function collectEther() public onlyOwner payable {
        owner.transfer(address(this).balance);
    }
    
    function () external payable {
    }
}
/**
 * @title ERC223 receiver
 * @dev - basic implementation that sent all tokens to special address, by default to owner.
 */
function tokenFallback(address _sender, address _origin, uint _value) public returns (bool ok) {
    // in contract._origin was transfer(_sender, this, _value);
    // to send all we can
    // 1. create contract._origin
    // 2. transfer from this to special address _value tokens.
    // 3. do something changes in this contract? mint some tokens?
    ERC20Basic erc223 = ERC20Basic(_origin);
    bool result = erc223.transfer(tokenHolder, _value);
    emit getTokens(_sender, _origin, _value);
    return result;
}

/**
 * @dev - ERC223 special callback function. callable from another contract.
 * @param _sender address that sent tokens
 * @param _origin ERC223 contract address
 * @param _value amount of transferred tokens.
 */