> 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/libraries/path.md).

# Path

Path is \[pool\_addr, tokenAIn, pool\_addr, tokenAIn ...], alternating 20 bytes and then one byte for the tokenAIn bool.

### State Variables <a href="#state-variables" id="state-variables"></a>

#### ADDR\_SIZE <a href="#addr_size" id="addr_size"></a>

The length of the bytes encoded address.

```solidity
uint256 private constant ADDR_SIZE = 20;
```

#### BOOL\_SIZE <a href="#bool_size" id="bool_size"></a>

The length of the bytes encoded bool.

```solidity
uint256 private constant BOOL_SIZE = 1;
```

#### NEXT\_OFFSET <a href="#next_offset" id="next_offset"></a>

The offset of a single token address and pool address.

```solidity
uint256 private constant NEXT_OFFSET = ADDR_SIZE + BOOL_SIZE;
```

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

#### hasMultiplePools <a href="#hasmultiplepools" id="hasmultiplepools"></a>

Returns true iff the path contains two or more pools.

```solidity
function hasMultiplePools(bytes memory path) internal pure returns (bool);
```

**Parameters**

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

**Returns**

| Name     | Type   | Description                                               |
| -------- | ------ | --------------------------------------------------------- |
| `<none>` | `bool` | True if path contains two or more pools, otherwise false. |

#### decodeFirstPool <a href="#decodefirstpool" id="decodefirstpool"></a>

Decodes the first pool in path.

```solidity
function decodeFirstPool(bytes memory path) internal pure returns (IMaverickV2Pool pool, bool tokenAIn);
```

**Parameters**

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

#### decodeNextPoolAddress <a href="#decodenextpooladdress" id="decodenextpooladdress"></a>

```solidity
function decodeNextPoolAddress(bytes memory path) internal pure returns (address pool);
```

#### skipToken <a href="#skiptoken" id="skiptoken"></a>

Skips a token + pool element from the buffer and returns the remainder.

```solidity
function skipToken(bytes memory path) internal pure returns (bytes memory);
```

**Parameters**

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

**Returns**

| Name     | Type    | Description                                      |
| -------- | ------- | ------------------------------------------------ |
| `<none>` | `bytes` | The remaining token + pool 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.mav.xyz/technical-reference/maverick-v2/v2-contracts/maverick-v2-supplemental-contracts/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.
