# Finding LP Balances

Developers may find they need to track the token reserves of Maverick LPs. A Maverick LP can hold tokens in Maverick in three ways:

1. They can hold a position in a pool
2. They can hold a balance in a Boosted Position (BP)
3. They can hold a balance in a BP and have staked it in a rewards contract

This document explains how to track LP reserves held in all three ways. A developer wishing to track all the reserves of a particular token held by LPs would need to make calls across all pools and BPs that contain that token in order to achieve full coverage.

### 1. LP positions in a Pool

In order to find the token reserves held by an LP in a pool, you can use the Maverick PositionInspector contract and call `addressBinReservesAllKindsAllTokenIds`.

This call requires the pool address and the LP’s wallet address, and will return the balances of `tokenA` and `tokenB`. The call can be made on any block, so you can look up historical as well as current data for each LP.

The PositionInspector contract is available on all chains; please see [this page](https://docs.mav.xyz/further-information/contract-addresses) for all contract addresses.

### 2. LP balances in Boosted Positions (unstaked)

LPs in BPs receive an ERC-20 LP token, which can be left unstaked or staked into the BP’s rewards contract. To find an LP’s unstaked BP balance:&#x20;

1. call `balanceOf` on the BP’s contract using the LP’s wallet address, which will output the amount of LP tokens held by the LP
2. call `totalSupply` on the BP’s contract to find the LP’s pro-rata ownership of the BP (i.e., use the amount from step 1 to calculate the LP’s percentage ownership of the total supply)
3. call `getReserves` on the BP’s contract to find the total reserves held by the BP

The LP’s percentage ownership can then be used to calculate their share of the BP’s reserves.

### 3. LP balances in Boosted Positions (staked)

Most LPs will have staked their BP LP tokens into the BP’s rewards contracts. The rewards contract basically functions as another pro-rata owner of the BP. To find the total balance held by the rewards contract:

1. call `balanceOf` on the BP’s contract using the BP’s rewards contract address, which will output the amount of LP tokens held by the BP
2. call `totalSupply` on the BP’s contract to find the rewards contract’s percentage ownership of the BP (i.e., use the amount from step 1 to calculate the rewards contract’s percentage ownership of the total supply)
3. call `getReserves` to find the total reserves held by the BP

The rewards contract’s percentage ownership can then be used to calculate the contract’s share of the BP’s reserves. Using this amount, you can then calculate the individual LP’s staked BP reserves:

1. call `balanceOf` on the BP rewards contract using the LP’s wallet address, which will output the amount of staked LP tokens owned by the LP
2. call `totalSupply` on the BP rewards contract to find the LP’s percentage share of the staked LP tokens (i.e., use the amount from step 1 to calculate the LP’s percentage ownership of the total supply)

The LP’s percentage ownership can then be used to calculate how much of the rewards contract’s reserves belong to the LP.

<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/finding-lp-balances.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.
