# IMixedRouteQuoterV1

Supports quoting the calculated amounts for exact input swaps. Is specialized for routes containing a mix of V1 and V2 liquidity.

For each pool also tells you the number of initialized ticks crossed and the sqrt price of the pool after the swap.

*These functions are not marked view because they rely on calling non-view functions and reverting to compute the result. They are also not gas efficient and should not be called on-chain.*

### Functions <a href="#functions" id="functions"></a>

#### quoteExactInput <a href="#quoteexactinput" id="quoteexactinput"></a>

Returns the amount out received for a given exact input swap without executing the swap

```solidity
function quoteExactInput(bytes memory path, uint256 amountIn)
    external
    returns (
        uint256 amountOut,
        uint160[] memory v2SqrtPriceX96AfterList,
        uint32[] memory v2InitializedTicksCrossedList,
        uint256 v2SwapGasEstimate
    );
```

**Parameters**

| Name       | Type      | Description                                                 |
| ---------- | --------- | ----------------------------------------------------------- |
| `path`     | `bytes`   | The path of the swap, i.e. each token pair and the pool fee |
| `amountIn` | `uint256` | The amount of the first token to swap                       |

**Returns**

| Name                            | Type        | Description                                                                                      |
| ------------------------------- | ----------- | ------------------------------------------------------------------------------------------------ |
| `amountOut`                     | `uint256`   | The amount of the last token that would be received                                              |
| `v2SqrtPriceX96AfterList`       | `uint160[]` | List of the sqrt price after the swap for each v2 pool in the path, 0 for v1 pools               |
| `v2InitializedTicksCrossedList` | `uint32[]`  | List of the initialized ticks that the swap crossed for each v2 pool in the path, 0 for v1 pools |
| `v2SwapGasEstimate`             | `uint256`   | The estimate of the gas that the v2 swaps in the path consume                                    |

#### quoteExactInputSingleV2 <a href="#quoteexactinputsinglev2" id="quoteexactinputsinglev2"></a>

Returns the amount out received for a given exact input but for a swap of a single pool

```solidity
function quoteExactInputSingleV2(QuoteExactInputSingleV2Params memory params)
    external
    returns (uint256 amountOut, uint160 sqrtPriceX96After, uint32 initializedTicksCrossed, uint256 gasEstimate);
```

**Parameters**

| Name     | Type                            | Description                                                                                                                                                                                                                                                                                                           |
| -------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `params` | `QuoteExactInputSingleV2Params` | The params for the quote, encoded as `QuoteExactInputSingleParams` tokenIn The token being swapped in tokenOut The token being swapped out fee The fee of the token pool to consider for the pair amountIn The desired input amount sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap |

**Returns**

| Name                      | Type      | Description                                           |
| ------------------------- | --------- | ----------------------------------------------------- |
| `amountOut`               | `uint256` | The amount of `tokenOut` that would be received       |
| `sqrtPriceX96After`       | `uint160` | The sqrt price of the pool after the swap             |
| `initializedTicksCrossed` | `uint32`  | The number of initialized ticks that the swap crossed |
| `gasEstimate`             | `uint256` | The estimate of the gas that the swap consumes        |

#### quoteExactInputSingleV1 <a href="#quoteexactinputsinglev1" id="quoteexactinputsinglev1"></a>

Returns the amount out received for a given exact input but for a swap of a single V1 pool

```solidity
function quoteExactInputSingleV1(QuoteExactInputSingleV1Params memory params) external returns (uint256 amountOut);
```

**Parameters**

| Name     | Type                            | Description                                                                                                                                                                    |
| -------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `params` | `QuoteExactInputSingleV1Params` | The params for the quote, encoded as `QuoteExactInputSingleV1Params` tokenIn The token being swapped in tokenOut The token being swapped out amountIn The desired input amount |

**Returns**

| Name        | Type      | Description                                     |
| ----------- | --------- | ----------------------------------------------- |
| `amountOut` | `uint256` | The amount of `tokenOut` that would be received |

### Structs <a href="#structs" id="structs"></a>

#### QuoteExactInputSingleV2Params <a href="#quoteexactinputsinglev2params" id="quoteexactinputsinglev2params"></a>

```solidity
struct QuoteExactInputSingleV2Params {
    address tokenIn;
    address tokenOut;
    uint256 amountIn;
    uint24 fee;
    uint160 sqrtPriceLimitX96;
}
```

#### QuoteExactInputSingleV1Params <a href="#quoteexactinputsinglev1params" id="quoteexactinputsinglev1params"></a>

```solidity
struct QuoteExactInputSingleV1Params {
    address tokenIn;
    address tokenOut;
    uint256 amountIn;
}
```


---

# Agent Instructions: 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.dragonswap.app/dragonswap/resources/developer-resources/smart-contracts/dragonswapv2/smart-router/interfaces/imixedroutequoterv1.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.
