> For the complete documentation index, see [llms.txt](https://docs.dragonswap.app/dragonswap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dragonswap.app/dragonswap/resources/developer-resources/smart-contracts/dragonswapv2/periphery/libraries/path.md).

# Path

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

#### hasMultiplePools[​](https://docs.uniswap.org/contracts/v3/reference/periphery/libraries/Path#hasmultiplepools) <a href="#hasmultiplepools" id="hasmultiplepools"></a>

```solidity
  function hasMultiplePools(
    bytes path
  ) internal returns (bool)
```

Returns true iff the path contains two or more pools

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

| Name   | Type  | Description           |
| ------ | ----- | --------------------- |
| `path` | bytes | The encoded swap path |

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

| Type | Description                                         |
| ---- | --------------------------------------------------- |
| bool | if path contains two or more pools, otherwise false |

#### decodeFirstPool[​](https://docs.uniswap.org/contracts/v3/reference/periphery/libraries/Path#decodefirstpool) <a href="#decodefirstpool" id="decodefirstpool"></a>

```solidity
  function decodeFirstPool(
    bytes path
  ) internal returns (address tokenA, address tokenB, uint24 fee)
```

Decodes the first pool in path

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

| Name   | Type  | Description                 |
| ------ | ----- | --------------------------- |
| `path` | bytes | The bytes encoded swap path |

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

| Name     | Type    | Description                        |
| -------- | ------- | ---------------------------------- |
| `tokenA` | address | The first token of the given pool  |
| `tokenB` | address | The second token of the given pool |
| `fee`    | uint24  | The fee level of the pool          |

#### getFirstPool[​](https://docs.uniswap.org/contracts/v3/reference/periphery/libraries/Path#getfirstpool) <a href="#getfirstpool" id="getfirstpool"></a>

```solidity
  function getFirstPool(
    bytes path
  ) internal returns (bytes)
```

Gets the segment corresponding to the first pool in the path

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

| Name   | Type  | Description                 |
| ------ | ----- | --------------------------- |
| `path` | bytes | The bytes encoded swap path |

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

| Type  | Description                                                                |
| ----- | -------------------------------------------------------------------------- |
| bytes | segment containing all data necessary to target the first pool in the path |

#### skipToken[​](https://docs.uniswap.org/contracts/v3/reference/periphery/libraries/Path#skiptoken) <a href="#skiptoken" id="skiptoken"></a>

```solidity
  function skipToken(
    bytes path
  ) internal returns (bytes)
```

Skips a token + fee element from the buffer and returns the remainder

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

| Name   | Type  | Description   |
| ------ | ----- | ------------- |
| `path` | bytes | The swap path |

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

| Type  | Description                                |
| ----- | ------------------------------------------ |
| bytes | remaining token + fee elements in the path |

<br>


---

# 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.dragonswap.app/dragonswap/resources/developer-resources/smart-contracts/dragonswapv2/periphery/libraries/path.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.
