# ICallbackOperations

**Inherits:** [IExactOutputSlim](https://docs.mav.xyz/technical-reference/maverick-v2/v2-contracts/maverick-v2-supplemental-contracts/routerbase/iexactoutputslim)

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

#### exactOutputSingle <a href="#exactoutputsingle" id="exactoutputsingle"></a>

Perform an exact output single swap.

```solidity
function exactOutputSingle(
    address recipient,
    IMaverickV2Pool pool,
    bool tokenAIn,
    uint256 amountOut,
    uint256 amountInMaximum
) external payable returns (uint256 amountIn, uint256 amountOut_);
```

**Parameters**

| Name              | Type              | Description                                   |
| ----------------- | ----------------- | --------------------------------------------- |
| `recipient`       | `address`         | The address of the recipient.                 |
| `pool`            | `IMaverickV2Pool` | The Maverick V2 pool to swap with.            |
| `tokenAIn`        | `bool`            | A boolean indicating if token A is the input. |
| `amountOut`       | `uint256`         | The amount of output tokens desired.          |
| `amountInMaximum` | `uint256`         | The maximum amount of input tokens allowed.   |

**Returns**

| Name         | Type      | Description                                   |
| ------------ | --------- | --------------------------------------------- |
| `amountIn`   | `uint256` | The amount of input tokens used for the swap. |
| `amountOut_` | `uint256` | The actual amount of output tokens received.  |

#### outputSingleWithTickLimit <a href="#outputsinglewithticklimit" id="outputsinglewithticklimit"></a>

Perform an output-specified single swap with tick limit check.

```solidity
function outputSingleWithTickLimit(
    address recipient,
    IMaverickV2Pool pool,
    bool tokenAIn,
    uint256 amountOut,
    int32 tickLimit,
    uint256 amountInMaximum,
    uint256 amountOutMinimum
) external payable returns (uint256 amountIn_, uint256 amountOut_);
```

**Parameters**

| Name               | Type              | Description                                   |
| ------------------ | ----------------- | --------------------------------------------- |
| `recipient`        | `address`         | The address of the recipient.                 |
| `pool`             | `IMaverickV2Pool` | The Maverick V2 pool to swap with.            |
| `tokenAIn`         | `bool`            | A boolean indicating if token A is the input. |
| `amountOut`        | `uint256`         | The amount of output tokens desired.          |
| `tickLimit`        | `int32`           | The tick limit for the swap.                  |
| `amountInMaximum`  | `uint256`         | The maximum amount of input tokens allowed.   |
| `amountOutMinimum` | `uint256`         | The minimum amount of output tokens expected. |

**Returns**

| Name         | Type      | Description                                                                                                                                                                                                                                                  |
| ------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `amountIn_`  | `uint256` | The actual amount of input tokens used for the swap.                                                                                                                                                                                                         |
| `amountOut_` | `uint256` | The actual amount of output tokens received. This amount can vary from the requested amountOut due to the tick limit. If the pool swaps to the tick limit, it will stop filling the order and return the amount out swapped up to the ticklimit to the user. |

#### exactOutputMultiHop <a href="#exactoutputmultihop" id="exactoutputmultihop"></a>

Perform an exact output multihop swap.

```solidity
function exactOutputMultiHop(address recipient, bytes memory path, uint256 amountOut, uint256 amountInMaximum)
    external
    payable
    returns (uint256 amountIn);
```

**Parameters**

| Name              | Type      | Description                       |
| ----------------- | --------- | --------------------------------- |
| `recipient`       | `address` | The recipient address.            |
| `path`            | `bytes`   | The swap path as encoded bytes.   |
| `amountOut`       | `uint256` | The exact output amount.          |
| `amountInMaximum` | `uint256` | The maximum input amount allowed. |

**Returns**

| Name       | Type      | Description                    |
| ---------- | --------- | ------------------------------ |
| `amountIn` | `uint256` | The input amount for the swap. |

#### inputSingleWithTickLimit <a href="#inputsinglewithticklimit" id="inputsinglewithticklimit"></a>

Perform an input-specified single swap with tick limit check.

```solidity
function inputSingleWithTickLimit(
    address recipient,
    IMaverickV2Pool pool,
    bool tokenAIn,
    uint256 amountIn,
    int32 tickLimit,
    uint256 amountOutMinimum
) external payable returns (uint256 amountIn_, uint256 amountOut);
```

**Parameters**

| Name               | Type              | Description                                   |
| ------------------ | ----------------- | --------------------------------------------- |
| `recipient`        | `address`         | The address of the recipient.                 |
| `pool`             | `IMaverickV2Pool` | The Maverick V2 pool to swap with.            |
| `tokenAIn`         | `bool`            | A boolean indicating if token A is the input. |
| `amountIn`         | `uint256`         | The amount of input tokens.                   |
| `tickLimit`        | `int32`           | The tick limit for the swap.                  |
| `amountOutMinimum` | `uint256`         | The minimum amount of output tokens expected. |

**Returns**

| Name        | Type      | Description                                                                                                                                                                                                                                                            |
| ----------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `amountIn_` | `uint256` | The actual input amount used for the swap. This may differ from the amount the caller specified if the pool reaches the tick limit. In that case, the pool will consume the input swap amount up to the tick limit and return the resulting output amount to the user. |
| `amountOut` | `uint256` | The amount of output tokens received.                                                                                                                                                                                                                                  |

<br>
