# 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: 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.mav.xyz/technical-reference/maverick-v2/v2-contracts/maverick-v2-supplemental-contracts/libraries/poolinspection.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.
