# ISwapRouter

Functions for swapping tokens via DragonswapV2

### Parameter Structs[​](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#parameter-structs) <a href="#parameter-structs" id="parameter-structs"></a>

Note that `fee` is in hundredths of basis points (e.g. the `fee` for a pool at the 0.3% tier is 3000; the `fee` for a pool at the 0.01% tier is 100).

#### ExactInputSingleParams[​](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#exactinputsingleparams) <a href="#exactinputsingleparams" id="exactinputsingleparams"></a>

```solidity
    struct ExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }
```

#### ExactInputParams[​](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#exactinputparams) <a href="#exactinputparams" id="exactinputparams"></a>

```solidity
   struct ExactInputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
    }
```

#### ExactOutputSingleParams[​](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#exactoutputsingleparams) <a href="#exactoutputsingleparams" id="exactoutputsingleparams"></a>

```solidity
    struct ExactOutputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
        uint160 sqrtPriceLimitX96;
    }
```

#### ExactOutputParams[​](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#exactoutputparams) <a href="#exactoutputparams" id="exactoutputparams"></a>

```solidity
    struct ExactOutputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
    }
```

### Functions[​](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#functions) <a href="#functions" id="functions"></a>

#### exactInputSingle[​](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#exactinputsingle) <a href="#exactinputsingle" id="exactinputsingle"></a>

```solidity
  function exactInputSingle(
    struct ISwapRouter.ExactInputSingleParams params
  ) external returns (uint256 amountOut)
```

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

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#parameters)

| Name     | Type                                      | Description                                                                            |
| -------- | ----------------------------------------- | -------------------------------------------------------------------------------------- |
| `params` | struct ISwapRouter.ExactInputSingleParams | The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata |

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#return-values)

| Name        | Type                                      | Description                      |
| ----------- | ----------------------------------------- | -------------------------------- |
| `amountOut` | struct ISwapRouter.ExactInputSingleParams | The amount of the received token |

#### exactInput[​](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#exactinput) <a href="#exactinput" id="exactinput"></a>

```solidity
  function exactInput(
    struct ISwapRouter.ExactInputParams params
  ) external returns (uint256 amountOut)
```

Swaps `amountIn` of one token for as much as possible of another along the specified path

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#parameters-1)

| Name     | Type                                | Description                                                                                |
| -------- | ----------------------------------- | ------------------------------------------------------------------------------------------ |
| `params` | struct ISwapRouter.ExactInputParams | The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata |

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#return-values-1)

| Name        | Type                                | Description                      |
| ----------- | ----------------------------------- | -------------------------------- |
| `amountOut` | struct ISwapRouter.ExactInputParams | The amount of the received token |

#### exactOutputSingle[​](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#exactoutputsingle) <a href="#exactoutputsingle" id="exactoutputsingle"></a>

```solidity
  function exactOutputSingle(
    struct ISwapRouter.ExactOutputSingleParams params
  ) external returns (uint256 amountIn)
```

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

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#parameters-2)

| Name     | Type                                       | Description                                                                             |
| -------- | ------------------------------------------ | --------------------------------------------------------------------------------------- |
| `params` | struct ISwapRouter.ExactOutputSingleParams | The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata |

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#return-values-2)

| Name       | Type                                       | Description                   |
| ---------- | ------------------------------------------ | ----------------------------- |
| `amountIn` | struct ISwapRouter.ExactOutputSingleParams | The amount of the input token |

#### exactOutput[​](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#exactoutput) <a href="#exactoutput" id="exactoutput"></a>

```solidity
  function exactOutput(
    struct ISwapRouter.ExactOutputParams params
  ) external returns (uint256 amountIn)
```

Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#parameters-3)

| Name     | Type                                 | Description                                                                                 |
| -------- | ------------------------------------ | ------------------------------------------------------------------------------------------- |
| `params` | struct ISwapRouter.ExactOutputParams | The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata |

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter#return-values-3)

| Name       | Type                                 | Description                   |
| ---------- | ------------------------------------ | ----------------------------- |
| `amountIn` | struct ISwapRouter.ExactOutputParams | The amount of the input 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.dragonswap.app/dragonswap/resources/developer-resources/smart-contracts/dragonswapv2/periphery/interfaces/iswaprouter.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.
