> 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-v2-gauges.md).

# Balancer V2 Gauges

Reports an account's gauge-staked Balancer V2 LP plus claimable rewards across any gauge.

Reports an account's **gauge-staked** Balancer V2 LP plus claimable rewards across any gauge. Staked LP is decomposed pro-rata into the pool's underlying tokens via the Vault's pool balances; BAL and extra reward tokens are reported as rewards. Wallet-held LP is the separate [Balancer V2 Pools](https://docs.kpk.io/funds/infrastructure/architecture/onchain-accounting/meta-balance-adapters/balancer-v2-pools.md) adapter.

* **Type:** Meta-adapter
* **protocolSubId:** `keccak256("balancer-v2-gauges")`
* **Instance key:** the gauge address, widened to bytes32.
* **Source:** `BalancerV2GaugesMetaBalanceAdapter.sol`

## Positions returned

| Leg             | PositionKind | isDebt  | Description                                                                     |
| --------------- | ------------ | ------- | ------------------------------------------------------------------------------- |
| Staking         | `Staking`    | `false` | Pro-rata share of one underlying pool token, from the account's gauge-staked LP |
| Rewards (BAL)   | `Rewards`    | `false` | Claimable BAL, minted via the Balancer Minter                                   |
| Rewards (extra) | `Rewards`    | `false` | Claimable amount of each extra gauge reward token                               |

Unregistered, zero-amount, and asset-filtered tokens are skipped.

## Balance calculation

<figure><picture><source srcset="https://1699303810-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUsQM4bzcmOPSgkWddkeN%2Fuploads%2FWjaYEoVztdx1JQ23rbxe%2Fmeta-balancer-v2-gauges_D.png?alt=media&amp;token=1c3acca8-a34e-482f-b2a1-a9873a8c5307" media="(prefers-color-scheme: dark)"><img src="https://1699303810-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUsQM4bzcmOPSgkWddkeN%2Fuploads%2FPPGPLGaMiiBYLoBY5c4P%2Fmeta-balancer-v2-gauges.png?alt=media&amp;token=85fc5d4d-7371-4040-bafd-3568d5f06df9" alt="Flowchart of the Balancer V2 Gauges balance adapter: read calls derive position legs into PositionBalance entries."></picture><figcaption><p>Balancer V2 Gauges adapter: how the underlying balances reported to the NAV Calculator are derived.</p></figcaption></figure>

**Staking legs** use `staked = gauge.balanceOf(account)`. The gauge's `lp_token` BPT resolves its `getPoolId()`, and `BalancerV2PoolLib.shares` reads the Vault balances to compute each token's pro-rata amount:

```
amount[i] = balances[i] * staked / effectiveSupply
```

where `effectiveSupply` is `getActualSupply()` (composable-stable) or `totalSupply()` (legacy). The poolId read is skipped when stake is zero.

**BAL and extra rewards** use the same logic as the [Balancer V3 Gauges](https://docs.kpk.io/funds/infrastructure/architecture/onchain-accounting/meta-balance-adapters/balancer-v3-gauges.md) adapter:

```
claimableBAL = max(integrateFraction(account) - minter.minted(account, gauge), 0)
```

`integrateFraction` is recomputed by walking weekly boundaries (`WEEK = 7 * 86400`), trying the mainnet model (up to 500 weeks, future-epoch rate switch via the token admin) and falling back to the L2 per-week-rate model (up to 256 weeks); a killed gauge zeroes the rate. Extra rewards come from `claimable_reward(account, token)` per `reward_tokens(i)` (BAL excluded).

## Identity

* **positionId:** `abi.encode(address gauge)`
* **positionKind:** `Staking` · `Rewards`

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

## Constructor

```solidity
constructor(address vault_, address balancerMinter_, address navCalculator_)
```

| Parameter         | Description                                                                                            |
| ----------------- | ------------------------------------------------------------------------------------------------------ |
| `vault_`          | Balancer V2 Vault address (must be a contract); the chain-level singleton holding pool balances        |
| `balancerMinter_` | Balancer Minter contract (must be a contract); resolves the BAL token, token admin, and minted amounts |
| `navCalculator_`  | NAVCalculator address (must be a contract); source of the asset registry and the instance set          |

## Registration

Register with `addMetaBalanceAdapter(adapter)`, then add gauges with `addMetaInstances`. Each coordinate is the gauge 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-v2-gauges.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.
