contract ForwarderContract {
    
    address payable public parentAddress;
 
    event ForwarderDeposited(address from, uint value, bytes data);
    event TokensFlushed(address forwarderAddress, uint value, address tokenContractAddress);

    /**
    * @dev Modifier that will execute internal code block only if the sender is the parent address
    */
    modifier onlyParent {
        require(msg.sender == parentAddress);
        _;
    }
    
    /**
    * @dev Create the contract, and sets the destination address to that of the creator
    */
    constructor() public{
        parentAddress = msg.sender;
    }

    /**
    * @dev Default function; Gets called when Ether is deposited, and forwards it to the parent address.
    *      Credit eth to contract creator.
    */
    function() external payable {
        parentAddress.transfer(msg.value);
        emit ForwarderDeposited(msg.sender, msg.value, msg.data);
    }

    /**
    * @dev Execute a token transfer of the full balance from the forwarder contract to the parent address
    * @param _tokenContractAddress the address of the erc20 token contract
    */
    function flushDeposit(address _tokenContractAddress) public onlyParent {
        IERC223Token instance = IERC223Token(_tokenContractAddress);
        uint forwarderBalance = instance.balanceOf(address(this));
        require(forwarderBalance > 0);
        require(instance.transfer(parentAddress, forwarderBalance));
        emit TokensFlushed(address(this), forwarderBalance, _tokenContractAddress);
    }
  
    /**
    * @dev Execute a specified token transfer from the forwarder contract to the parent address.
    * @param _from the address of the erc20 token contract.
    * @param _value the amount of token.
    */
    function flushAmountToken(address _from, uint _value) external{
        require(IERC223Token(_from).transfer(parentAddress, _value), "instance error");
    }

    /**
    * @dev It is possible that funds were sent to this address before the contract was deployed.
    *      We can flush those funds to the parent address.
    */
    function flush() public {
        parentAddress.transfer(address(this).balance);
    }
}
/**
 * @title ForwarderContract
 * @dev Contract that will forward any incoming Ether & token to wallet
 */
function flushDeposit(address _tokenContractAddress) public onlyParent {
    IERC223Token instance = IERC223Token(_tokenContractAddress);
    uint forwarderBalance = instance.balanceOf(address(this));
    require(forwarderBalance > 0);
    require(instance.transfer(parentAddress, forwarderBalance));
    emit TokensFlushed(address(this), forwarderBalance, _tokenContractAddress);
}

/**
 * @dev Execute a token transfer of the full balance from the forwarder contract to the parent address
 * @param _tokenContractAddress the address of the erc20 token contract
 */