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

# PoolInspection

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

#### poolSqrtPrice <a href="#poolsqrtprice" id="poolsqrtprice"></a>

Calculates the square root price of a given Maverick V2 pool.

```solidity
function poolSqrtPrice(IMaverickV2Pool pool) internal view returns (uint256 sqrtPrice);
```

**Parameters**

| Name   | Type              | Description                      |
| ------ | ----------------- | -------------------------------- |
| `pool` | `IMaverickV2Pool` | The Maverick V2 pool to inspect. |

**Returns**

| Name        | Type      | Description                        |
| ----------- | --------- | ---------------------------------- |
| `sqrtPrice` | `uint256` | The square root price of the pool. |

#### userSubaccountBinReserves <a href="#usersubaccountbinreserves" id="usersubaccountbinreserves"></a>

Retrieves the reserves of a user's subaccount for a specific bin.

```solidity
function userSubaccountBinReserves(IMaverickV2Pool pool, address user, uint256 subaccount, uint32 binId)
    internal
    view
    returns (uint256 amountA, uint256 amountB, int32 tick, uint256 liquidity);
```

#### subaccountPositionInformation <a href="#subaccountpositioninformation" id="subaccountpositioninformation"></a>

Retrieves the reserves of a token for all bins associated with it.

```solidity
function subaccountPositionInformation(IMaverickV2Pool pool, address user, uint256 subaccount, uint32[] memory binIds)
    internal
    view
    returns (
        uint256 amountA,
        uint256 amountB,
        uint256[] memory binAAmounts,
        uint256[] memory binBAmounts,
        int32[] memory ticks,
        uint256[] memory liquidities
    );
```

#### binLpBalances <a href="#binlpbalances" id="binlpbalances"></a>

```solidity
function binLpBalances(IMaverickV2Pool pool, uint32[] memory binIds, uint256 subaccount)
    internal
    view
    returns (uint128[] memory amounts);
```

#### lpBalanceForTargetReserveAmounts <a href="#lpbalancefortargetreserveamounts" id="lpbalancefortargetreserveamounts"></a>

```solidity
function lpBalanceForTargetReserveAmounts(
    IMaverickV2Pool pool,
    uint32 binId,
    uint256 amountA,
    uint256 amountB,
    uint256 scaleA,
    uint256 scaleB
) internal view returns (IMaverickV2Pool.AddLiquidityParams memory addParams);
```

#### maxRemoveParams <a href="#maxremoveparams" id="maxremoveparams"></a>

```solidity
function maxRemoveParams(IMaverickV2Pool pool, uint32 binId, address user, uint256 subaccount)
    internal
    view
    returns (IMaverickV2Pool.RemoveLiquidityParams memory params);
```

<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/poolinspection.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.
