# IMaverickV2Quoter

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

#### calculateSwap <a href="#calculateswap" id="calculateswap"></a>

Calculates a swap on a MaverickV2Pool and returns the resulting amount and estimated gas. The gas estimate is only a rough estimate and may not match a swap's gas.

```solidity
function calculateSwap(IMaverickV2Pool pool, uint128 amount, bool tokenAIn, bool exactOutput, int32 tickLimit)
    external
    returns (uint256 amountIn, uint256 amountOut, uint256 gasEstimate);
```

**Parameters**

| Name          | Type              | Description                                                                                                                                                                                                                           |
| ------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `pool`        | `IMaverickV2Pool` | The MaverickV2Pool to swap on.                                                                                                                                                                                                        |
| `amount`      | `uint128`         | The input amount.                                                                                                                                                                                                                     |
| `tokenAIn`    | `bool`            | Indicates if token A is the input token.                                                                                                                                                                                              |
| `exactOutput` | `bool`            | Indicates if the amount is the output amount (true) or input amount (false). If the tickLimit is reached, the full value of the exactOutput may not be returned because the pool will stop swapping before the whole order is filled. |
| `tickLimit`   | `int32`           | The tick limit for the swap. Once the swap lands in this tick, it will stop and return the output amount swapped up to that tick.                                                                                                     |

#### calculateMultiHopSwap <a href="#calculatemultihopswap" id="calculatemultihopswap"></a>

Calculates a multihop swap and returns the resulting amount and estimated gas. The gas estimate is only a rough estimate and may not match a swap's gas.

```solidity
function calculateMultiHopSwap(bytes memory path, uint256 amount, bool exactOutput)
    external
    returns (uint256 returnAmount, uint256 gasEstimate);
```

**Parameters**

| Name          | Type      | Description                                                                                                                                                                                                      |
| ------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `path`        | `bytes`   | The path of pools to swap through. Path is given by an packed array of (pool, tokenAIn) tuples. So each step in the path is 160 + 8 = 168 bits of data. e.g. path = abi.encodePacked(pool1, true, pool2, false); |
| `amount`      | `uint256` | The input amount.                                                                                                                                                                                                |
| `exactOutput` | `bool`    | A boolean indicating if exact output is required.                                                                                                                                                                |

#### calculateAddLiquidity <a href="#calculateaddliquidity" id="calculateaddliquidity"></a>

Computes the token amounts required for a given set of addLiquidity parameters. The gas estimate is only a rough estimate and may not match a add's gas.

```solidity
function calculateAddLiquidity(IMaverickV2Pool pool, IMaverickV2Pool.AddLiquidityParams calldata params)
    external
    returns (uint256 amountA, uint256 amountB, uint256 gasEstimate);
```

#### poolSqrtPrice <a href="#poolsqrtprice" id="poolsqrtprice"></a>

Pool's sqrt price.

```solidity
function poolSqrtPrice(IMaverickV2Pool pool) external view returns (uint256 sqrtPrice);
```

### Errors <a href="#errors" id="errors"></a>

#### QuoterInvalidSwap <a href="#quoterinvalidswap" id="quoterinvalidswap"></a>

```solidity
error QuoterInvalidSwap();
```

#### QuoterInvalidAddLiquidity <a href="#quoterinvalidaddliquidity" id="quoterinvalidaddliquidity"></a>

```solidity
error QuoterInvalidAddLiquidity();
```

<br>
