# 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 |


---

# 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://bonsaiswap.gitbook.io/bonsaiswap-docs/developers/technical-reference/periphery/libraries/path.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.
