> For the complete documentation index, see [llms.txt](https://docs.mav.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mav.xyz/technical-reference/maverick-v2/v2-contracts/maverick-v2-supplemental-contracts/routerbase/exactoutputslim.md).

# ExactOutputSlim

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

### 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
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, and the optional `goal` query parameter:

```
GET https://docs.mav.xyz/technical-reference/maverick-v2/v2-contracts/maverick-v2-supplemental-contracts/routerbase/exactoutputslim.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
