> For the complete documentation index, see [llms.txt](https://docs.turbine.exchange/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.turbine.exchange/reference/contracts/solidity-documentation/univ4-hook/interfaces/interface.iturbineliquidityrouter.md).

# ITurbineLiquidityRouter

[Git Source](https://github.com/propeller-heads/turbine/blob/90514973167f1eb25cb9eb7756354fb3de34824d/src/univ4-hook/interfaces/ITurbineLiquidityRouter.sol)

## Functions

### addLiquidity

Adds liquidity to the pair represented by the given hook.

```solidity
function addLiquidity(
    address to,
    uint256 amount0,
    uint256 amount1,
    address poolToken0,
    address poolToken1,
    uint24 poolFee,
    uint256 liquidity,
    BatchSignatureTransferParams memory batchSignatureTransferParams
) external payable returns (uint256);
```

**Parameters**

| Name                           | Type                           | Description                                                                     |
| ------------------------------ | ------------------------------ | ------------------------------------------------------------------------------- |
| `to`                           | `address`                      | The address receiving the minted liquidity.                                     |
| `amount0`                      | `uint256`                      | The amount of token0 to add as liquidity.                                       |
| `amount1`                      | `uint256`                      | The amount of token1 to add as liquidity.                                       |
| `poolToken0`                   | `address`                      | The address of the first token in the pool.                                     |
| `poolToken1`                   | `address`                      | The address of the second token in the pool.                                    |
| `poolFee`                      | `uint24`                       | The fee of the pool.                                                            |
| `liquidity`                    | `uint256`                      | The liquidity amount to mint for the caller.                                    |
| `batchSignatureTransferParams` | `BatchSignatureTransferParams` | The Permit2 batch SignatureTransfer permit and signature for token0 and token1. |

**Returns**

| Name     | Type      | Description                                           |
| -------- | --------- | ----------------------------------------------------- |
| `<none>` | `uint256` | liquidity The minted liquidity amount for the caller. |

### removeLiquidity

Burns liquidity to the pair represented by the given hook.

```solidity
function removeLiquidity(
    address to,
    uint256 liquidity,
    address poolToken0,
    address poolToken1,
    uint24 poolFee,
    SignatureTransferParams memory signatureTransferParams
) external payable returns (uint256, uint256);
```

**Parameters**

| Name                      | Type                      | Description                                                          |
| ------------------------- | ------------------------- | -------------------------------------------------------------------- |
| `to`                      | `address`                 | The address receiving the burnt liquidity.                           |
| `liquidity`               | `uint256`                 | The burnt liquidity amount from the caller.                          |
| `poolToken0`              | `address`                 | The address of the first token in the pool.                          |
| `poolToken1`              | `address`                 | The address of the second token in the pool.                         |
| `poolFee`                 | `uint24`                  | The fee of the pool.                                                 |
| `signatureTransferParams` | `SignatureTransferParams` | The Permit2 SignatureTransfer permit and signature for the LP token. |

**Returns**

| Name     | Type      | Description                                                   |
| -------- | --------- | ------------------------------------------------------------- |
| `<none>` | `uint256` | amount0 The amount of token0 received from burning liquidity. |
| `<none>` | `uint256` | amount1 The amount of token1 received from burning liquidity. |

### submitRemoveLiquidityIntent

Submits a new remove-liquidity intent for later execution.

The caller must be `intent.owner`. The provided Permit2 authorization must match the LP token and cover at least `intent.lpTokenAmount`.

The signature stored onchain can only be used by the spender address (this router) because the msg.sender is included in the PermitTransferFrom.hash() see <https://github.com/Uniswap/permit2/blob/cc56ad0f3439c502c246fc5cfcc3db92bb8b7219/src/libraries/PermitHash.sol#L62>

```solidity
function submitRemoveLiquidityIntent(
    RemoveLiquidityIntent calldata intent,
    SignatureTransferParams calldata signatureTransferParams
) external returns (RemoveLiquidityIntentHash);
```

**Parameters**

| Name                      | Type                      | Description                                                                       |
| ------------------------- | ------------------------- | --------------------------------------------------------------------------------- |
| `intent`                  | `RemoveLiquidityIntent`   | The remove-liquidity instruction containing pool and LP token amount details.     |
| `signatureTransferParams` | `SignatureTransferParams` | Permit2 SignatureTransfer parameters and signature authorizing LP token transfer. |

**Returns**

| Name     | Type                        | Description                                        |
| -------- | --------------------------- | -------------------------------------------------- |
| `<none>` | `RemoveLiquidityIntentHash` | The intent hash used to reference this submission. |

### MIN\_INTENT\_EXPIRY

Returns the minimum expiry for the TurbineLiquidityRouter

```solidity
function MIN_INTENT_EXPIRY() external view returns (uint256);
```

**Returns**

| Name     | Type      | Description                   |
| -------- | --------- | ----------------------------- |
| `<none>` | `uint256` | The minimum expiry in seconds |

### getTurbineSettler

Returns the address of the TurbineSettler

```solidity
function getTurbineSettler() external view returns (address);
```

**Returns**

| Name     | Type      | Description                       |
| -------- | --------- | --------------------------------- |
| `<none>` | `address` | The address of the TurbineSettler |

### getTurbineHook

Returns the address of the TurbineHook

Return type is address to avoid unnecessary imports

```solidity
function getTurbineHook() external view returns (address);
```

**Returns**

| Name     | Type      | Description                    |
| -------- | --------- | ------------------------------ |
| `<none>` | `address` | The address of the TurbineHook |

### executePendingIntents

Executes the provided intent hashes and deletes the executed intents.

```solidity
function executePendingIntents(RemoveLiquidityIntentHash[] calldata hashes) external;
```

**Parameters**

| Name     | Type                          | Description                        |
| -------- | ----------------------------- | ---------------------------------- |
| `hashes` | `RemoveLiquidityIntentHash[]` | Array of intent hashes to execute. |

### getRemoveLiquidityIntents

Returns remove-liquidity intent data for the given hashes. Skips deleted/unknown intents (owner == address(0)).

```solidity
function getRemoveLiquidityIntents(RemoveLiquidityIntentHash[] calldata hashes)
    external
    view
    returns (RemoveLiquidityData[] memory result);
```

**Parameters**

| Name     | Type                          | Description                      |
| -------- | ----------------------------- | -------------------------------- |
| `hashes` | `RemoveLiquidityIntentHash[]` | Array of intent hashes to query. |

**Returns**

| Name     | Type                    | Description                                          |
| -------- | ----------------------- | ---------------------------------------------------- |
| `result` | `RemoveLiquidityData[]` | Array of RemoveLiquidityData for valid intents only. |

### swapExactTokens

Swaps an exact amount of a token for an exact amount of another token.

This function is only callable by the `turbineSettler` address and the output tokens are transferred to the `turbineSettler`

* This function assumes that amountIn is already transferred to this contract.
* This function transfers tokens to the `poolManager` via `poolManager.unlock(...)`.
* The `poolManager` will perform the swap and return the output amount via the callback (`unlockCallback`).

```solidity
function swapExactTokens(
    uint256 amountIn,
    uint256 amountOut,
    address poolToken0,
    address poolToken1,
    uint24 poolFee,
    bool zeroForOne,
    uint256 deadline
) external payable;
```

**Parameters**

| Name         | Type      | Description                                                       |
| ------------ | --------- | ----------------------------------------------------------------- |
| `amountIn`   | `uint256` | The exact amount of input tokens to be sent for the swap.         |
| `amountOut`  | `uint256` | The exact amount of tokens expected to be received from the swap. |
| `poolToken0` | `address` | The address of the first token in the pool.                       |
| `poolToken1` | `address` | The address of the second token in the pool.                      |
| `poolFee`    | `uint24`  | The fee of the pool.                                              |
| `zeroForOne` | `bool`    | The direction of the swap.                                        |
| `deadline`   | `uint256` | A timestamp by which the call be finished to be valid.            |

## Events

### SettlerSet

```solidity
event SettlerSet(address indexed settler);
```

### RemoveLiquidityIntentSubmitted

```solidity
event RemoveLiquidityIntentSubmitted(
    address indexed owner,
    PoolId indexed poolId,
    RemoveLiquidityIntentHash intentHash,
    uint256 createdAt,
    uint256 deadline
);
```

### RemoveLiquidityIntentDeleted

```solidity
event RemoveLiquidityIntentDeleted(RemoveLiquidityIntentHash indexed intentHash);
```

## Errors

### InvalidOutputReceived

```solidity
error InvalidOutputReceived();
```

### OutOfGas

```solidity
error OutOfGas();
```

### ZeroLiquidity

```solidity
error ZeroLiquidity();
```

### InsufficientInitialLiquidity

```solidity
error InsufficientInitialLiquidity();
```

### InsufficientLiquidityBurnt

```solidity
error InsufficientLiquidityBurnt();
```

### SwapExpired

```solidity
error SwapExpired();
```

### NotTurbineSettler

```solidity
error NotTurbineSettler();
```

### NotPoolManager

```solidity
error NotPoolManager();
```

### NotSettlerOrPoolManager

```solidity
error NotSettlerOrPoolManager();
```

### InvalidIntentOwner

```solidity
error InvalidIntentOwner();
```

### InsufficientLpTokenBalance

```solidity
error InsufficientLpTokenBalance(address lpToken, uint256 requested, uint256 balance);
```

### DuplicateIntent

```solidity
error DuplicateIntent(RemoveLiquidityIntentHash intentHash);
```

### InvalidLpTokenAmount

```solidity
error InvalidLpTokenAmount();
```

### InvalidPermitToken

```solidity
error InvalidPermitToken(address expected, address actual);
```

### InvalidPermitAmount

```solidity
error InvalidPermitAmount(uint256 amount, uint256 required);
```

### PermitDeadlineTooShort

```solidity
error PermitDeadlineTooShort(uint256 deadline, uint256 minimumDeadline);
```

### PermitDeadlineTooLong

```solidity
error PermitDeadlineTooLong(uint256 deadline, uint256 maximumDeadline);
```

### NonceAlreadyUsed

```solidity
error NonceAlreadyUsed(address owner, uint256 nonce);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.turbine.exchange/reference/contracts/solidity-documentation/univ4-hook/interfaces/interface.iturbineliquidityrouter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
