# SlimRouter

## **Table of Contents**

* [**Contract Details**](#contract-details)
* [**Structs**](#structs)
  * [ExactInputSingleParams](#struct-exactinputsingleparams)
  * [ExactOutputSingleParams](#struct-exactoutputsingleparams)
* [**Functions**](#functions)
  * [WETH9()](#fn-weth9)
  * [exactInputSingle()](#fn-exactinputsingle)
  * [exactOutputSingle()](#fn-exactoutputsingle)
  * [unwrapWETH9()](#fn-unwrapweth9)
  * [refundETH()](#fn-refundeth)
  * [sweepToken()](#fn-sweeptoken)

## **Contract Details** <a href="#contract-details" id="contract-details"></a>

* **Name :** *ISlimRouter*
* **Solidity Version :** *^0.8.0*
* *SPDX License-Identifier : GPL-2.0-or-later*
* Code: [Github](https://github.com/maverickprotocol/router-v1/blob/main/contracts/interfaces/ISlimRouter.sol)

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

### ExactInputSingleParams <a href="#struct-exactinputsingleparams" id="struct-exactinputsingleparams"></a>

```solidity
struct ExactInputSingleParams {
    address tokenIn;
    address tokenOut;
    IPool pool;
    address recipient;
    uint256 deadline;
    uint256 amountIn;
    uint256 amountOutMinimum;
    uint256 sqrtPriceLimitD18;
}
```

* `tokenIn` : The address of the token to be swapped.
* `tokenOut` : The address of the desired token to receive in the swap.
* `pool` : An instance of the IPool interface representing the pool to perform the swap in.
* `recipient` : The address where the swapped tokens will be sent.
* `deadline` : The deadline timestamp for the swap to be executed before it expires.
* `amountIn` : The amount of tokenIn token to be swapped.
* `amountOutMinimum` : The minimum amount of tokenOut tokens expected to be received from the swap.
* `sqrtPriceLimitD18` : The square root of the price limit for the swap, represented with 18 decimal places.

### ExactOutputSingleParams <a href="#struct-exactoutputsingleparams" id="struct-exactoutputsingleparams"></a>

```solidity
struct ExactOutputSingleParams {
    address tokenIn;
    address tokenOut;
    IPool pool;
    address recipient;
    uint256 deadline;
    uint256 amountOut;
    uint256 amountInMaximum;
}
```

* `tokenIn` : The address of the token to be used as input in the swap.
* `tokenOut` : The address of the token to be received as output in the swap.
* `pool` : An instance of the IPool interface representing the pool to perform the swap in.
* `recipient` : The address where the swapped tokens will be sent.
* `deadline` : The deadline timestamp for the swap to be executed before it expires.
* `amountOut` : The desired amount of tokenOut tokens to be received from the swap.
* `amountInMaximum` : The maximum amount of tokenIn tokens to be used for the swap.

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

### WETH9() <a href="#fn-weth9" id="fn-weth9"></a>

Retrieves the address of the WETH9 token.

```solidity
function WETH9() external view returns (IWETH9);
```

* Returns :
  * `IWETH9` : An instance of the `IWETH9` interface representing the WETH9 token.

### exactInputSingle() <a href="#fn-exactinputsingle" id="fn-exactinputsingle"></a>

Swaps `amountIn` of one token for as much as possible of another token.

```solidity
function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);
```

* Parameters :
  * `params` : The parameters necessary for the swap, encoded as `ExactInputSingleParams` structure in calldata.
* Returns :
  * `amountOut` : The amount of the received token `uint256`.

### exactOutputSingle() <a href="#fn-exactoutputsingle" id="fn-exactoutputsingle"></a>

Swaps as little as possible of one token for `amountOut` of another token.

```solidity
function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);
```

* Parameters :
  * `params` : The parameters necessary for the swap, encoded as `ExactOutputSingleParams` structure in calldata.
* Returns:
  * `amountIn` : The amount of the input token `uint256`.

### unwrapWETH9() <a href="#fn-unwrapweth9" id="fn-unwrapweth9"></a>

Unwraps the contract's `WETH9` balance and sends it to the specified recipient as `ETH`.

```solidity
function unwrapWETH9(uint256 amountMinimum, address recipient) external payable;
```

* Parameters:
  * `amountMinimum` : The `minimum amount` of `WETH9` to unwrap.
  * `recipient` : The `address` receiving ETH.

### refundETH() <a href="#fn-refundeth" id="fn-refundeth"></a>

Refunds any `ETH` balance held by this contract to the `msg.sender`.

```solidity
function refundETH() external payable;
```

### sweepToken() <a href="#fn-sweeptoken" id="fn-sweeptoken"></a>

Transfers the full amount of a specified token held by this contract to the recipient.

```solidity
function sweepToken(IERC20 token, uint256 amountMinimum, address recipient) external payable;
```

* Parameters:
  * `token` : The contract `address` of the token to be transferred.
  * `amountMinimum` : The `minimum amount` of token `uint256` required for the transfer.
  * `recipient` : The destination `address` of the token.


---

# 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-v1/v1-contracts/slimrouter.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.
