# ExactOutputSlim

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

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

#### maverickV2SwapCallback <a href="#maverickv2swapcallback" id="maverickv2swapcallback"></a>

Callback function called by Maverick V2 pools when swapping tokens.

```solidity
function maverickV2SwapCallback(IERC20 tokenIn, uint256 amountToPay, uint256, bytes calldata data) external virtual;
```

**Parameters**

| Name          | Type      | Description        |
| ------------- | --------- | ------------------ |
| `tokenIn`     | `IERC20`  | The input token.   |
| `amountToPay` | `uint256` | The amount to pay. |
| `<none>`      | `uint256` |                    |
| `data`        | `bytes`   | Additional data.   |

#### exactOutputSingleMinimal <a href="#exactoutputsingleminimal" id="exactoutputsingleminimal"></a>

Perform a swap with an exact output amount.

```solidity
function exactOutputSingleMinimal(
    address recipient,
    IMaverickV2Pool pool,
    bool tokenAIn,
    uint256 amountOut,
    int32 tickLimit
) public payable returns (uint256 amountIn, uint256 amountOut_);
```

**Parameters**

| Name        | Type              | Description                              |
| ----------- | ----------------- | ---------------------------------------- |
| `recipient` | `address`         | The recipient of the swapped tokens.     |
| `pool`      | `IMaverickV2Pool` | The MaverickV2 pool to use for the swap. |
| `tokenAIn`  | `bool`            | Whether token A is the input token.      |
| `amountOut` | `uint256`         | The exact output amount.                 |
| `tickLimit` | `int32`           | The tick limit for the swap.             |

**Returns**

| Name         | Type      | Description                                            |
| ------------ | --------- | ------------------------------------------------------ |
| `amountIn`   | `uint256` | The input amount required to achieve the exact output. |
| `amountOut_` | `uint256` | The actual output amount received from the swap.       |

#### \_exactOutputSingleWithTickCheck <a href="#exactoutputsinglewithtickcheck" id="exactoutputsinglewithtickcheck"></a>

Perform an exact output single swap with tick limit validation.

```solidity
function _exactOutputSingleWithTickCheck(
    IMaverickV2Pool pool,
    address recipient,
    uint256 amountOut,
    bool tokenAIn,
    int32 tickLimit
) internal returns (uint256 amountIn, uint256 _amountOut);
```

**Parameters**

| Name        | Type              | Description                              |
| ----------- | ----------------- | ---------------------------------------- |
| `pool`      | `IMaverickV2Pool` | The MaverickV2 pool to use for the swap. |
| `recipient` | `address`         | The recipient of the swapped tokens.     |
| `amountOut` | `uint256`         | The exact output amount.                 |
| `tokenAIn`  | `bool`            | Whether token A is the input token.      |
| `tickLimit` | `int32`           | The tick limit for the swap.             |

**Returns**

| Name         | Type      | Description                                            |
| ------------ | --------- | ------------------------------------------------------ |
| `amountIn`   | `uint256` | The input amount required to achieve the exact output. |
| `_amountOut` | `uint256` | The actual output amount received from the swap.       |


---

# 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.mav.xyz/technical-reference/maverick-v2/v2-contracts/maverick-v2-supplemental-contracts/routerbase/exactoutputslim.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.
