> For the complete documentation index, see [llms.txt](https://docs.kpk.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kpk.io/funds/infrastructure/architecture/onchain-accounting/meta-balance-adapters/balancer-v3-pools.md). Agents can also search and read this documentation through its [MCP server](https://docs.kpk.io/~gitbook/mcp).

# Balancer V3 Pools

Reports an account's wallet-held (unstaked) Balancer V3 pool liquidity across any pool.

Reports an account's **wallet-held (unstaked)** Balancer V3 pool liquidity across any pool, decomposing the BPT balance pro-rata into the pool's underlying tokens. Gauge-staked LP and rewards are the separate [Balancer V3 Gauges](https://docs.kpk.io/funds/infrastructure/architecture/onchain-accounting/meta-balance-adapters/balancer-v3-gauges.md) adapter.

* **Type:** Meta-adapter
* **protocolSubId:** `keccak256("balancer-v3-pools")`
* **Instance key:** the pool (BPT) address, widened to bytes32.
* **Source:** `BalancerV3PoolsMetaBalanceAdapter.sol`

## Positions returned

One leg per registered underlying pool token with a non-zero share:

| Leg    | PositionKind | isDebt  | Description                                                                |
| ------ | ------------ | ------- | -------------------------------------------------------------------------- |
| Supply | `Supplied`   | `false` | Pro-rata share of one underlying pool token, from the account's wallet BPT |

Tokens not registered in NAVCalculator are skipped, as are zero-amount and asset-filtered tokens. ERC4626 pool tokens are unwrapped to their `asset()` so the underlying is reported.

## Balance calculation

<figure><picture><source srcset="https://1699303810-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUsQM4bzcmOPSgkWddkeN%2Fuploads%2FJyk6trBIaDWDyDqDatxl%2Fmeta-balancer-v3-pools_D.png?alt=media&amp;token=3c97f8e8-bccf-4ef5-9968-e2667c013955" media="(prefers-color-scheme: dark)"><img src="https://1699303810-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUsQM4bzcmOPSgkWddkeN%2Fuploads%2Fsgv4TZKf5eTGQv33ODrW%2Fmeta-balancer-v3-pools.png?alt=media&amp;token=8f64147b-5d90-4843-941f-93e6034df7f0" alt="Flowchart of the Balancer V3 Pools balance adapter: read calls derive position legs into PositionBalance entries."></picture><figcaption><p>Balancer V3 Pools adapter: how the underlying balances reported to the NAV Calculator are derived.</p></figcaption></figure>

For BPT balance `walletBpt = pool.balanceOf(account)` (returns nothing if zero), the adapter iterates the pool tokens in index order and computes each one's amount with `BalancerV3PoolLib.poolBalanceOfIndexed(pool, walletBpt, i)`. Keying on the pool-token **index**, not the underlying address, gives every index exactly one leg, so a pool holding the same underlying at two indices (e.g. two ERC4626 wrappers of one asset) is decomposed correctly:

```
tokenBalance = balancesLiveScaled18[i] * walletBpt / pool.totalSupply()
```

The 18-decimal live-scaled share is then converted back to raw token units:

```
raw = tokenBalance * 1e18 / (decimalScalingFactors[i] * tokenRates[i])
```

A transiently-zero scaling factor or token rate yields a `0` leg, not a revert of the whole instance. For an ERC4626 pool token, `raw` is wrapped-token shares, unwrapped via `previewRedeem(shares)`.

## Identity

* **positionId:** `abi.encode(address pool)`
* **positionKind:** `Supplied`

`positionLabels(positionId)` returns `["AMM Liquidity Pool", "<sym0>/<sym1>/…"]` from the pool's token symbols; verbose reads only (`getAccountPositionsVerbose` / `getAccountNavVerbose`).

## Constructor

```solidity
constructor(address navCalculator_)
```

| Parameter        | Description                                                                                   |
| ---------------- | --------------------------------------------------------------------------------------------- |
| `navCalculator_` | NAVCalculator address (must be a contract); source of the asset registry and the instance set |

## Registration

Register with `addMetaBalanceAdapter(adapter)`, then add pools with `addMetaInstances`. Each coordinate is the pool (BPT) address widened to bytes32.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.kpk.io/funds/infrastructure/architecture/onchain-accounting/meta-balance-adapters/balancer-v3-pools.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
