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

# Gearbox Markets

One immutable meta-adapter that reports an account's passive-liquidity supply in any Gearbox V3 ERC-4626 farming pool.

One immutable meta-adapter that reports an account's passive-liquidity supply in *any* Gearbox V3 ERC-4626 farming pool. Which pools it queries is a governed instance set on the NAV Calculator; the adapter holds no per-pool state. The borrow side is covered by the sibling [Gearbox Credit Accounts](/funds/infrastructure/architecture/onchain-accounting/meta-balance-adapters/gearbox-credit-accounts.md) adapter.

* **Type:** Meta-adapter
* **protocolSubId:** `keccak256("gearbox-v3-markets")`
* **Instance key:** the market (pool) address, widened to `bytes32`
* **Source:** `GearboxV3MarketsMetaBalanceAdapter.sol`

## Positions returned

One position per pool the account has shares in.

| Leg         | PositionKind | isDebt  | Description                             |
| ----------- | ------------ | ------- | --------------------------------------- |
| Pool supply | `Supplied`   | `false` | Pool shares converted to the underlying |

A pool returns an empty result when its asset is unregistered, excluded by `assetFilter`, or the converted balance is zero. Merkl rewards are not included.

## Balance calculation

<figure><picture><source srcset="/files/n75cZOF9iECEOB7EkQr0" media="(prefers-color-scheme: dark)"><img src="https://1699303810-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUsQM4bzcmOPSgkWddkeN%2Fuploads%2FjpHt08v6EYYRHhhWeHif%2Fmeta-gearbox.png?alt=media&amp;token=b8897494-c17f-40bd-8828-79b66c916813" alt="Flowchart of the Gearbox Markets balance adapter: read calls derive position legs into PositionBalance entries."></picture><figcaption><p>Gearbox Markets adapter: how the underlying balances reported to the NAV Calculator are derived.</p></figcaption></figure>

```
amount = market.convertToAssets(market.balanceOf(account))
```

`convertToAssets` uses the pool's current share price (reflecting interest accrued from Gearbox credit accounts borrowing the pool's liquidity). The result is denominated in `market.asset()`.

## Identity

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

There is no `labels` field on the position. The adapter implements `positionLabels(positionId)`, which returns `["Market", "<market ERC20 name()>"]` from the market's onchain name; surfaced only by the verbose reads (`getAccountPositionsVerbose` / `getAccountNavVerbose`); the full breadcrumb is `[protocolName, ...labels]`.

## Constructor

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

| Parameter        | Description                                             |
| ---------------- | ------------------------------------------------------- |
| `navCalculator_` | NAV Calculator contract (asset registry + instance set) |

## Registration

Meta-adapter. Register once and seed its pools with `addMetaBalanceAdapter(adapter, instances)`, then adjust with `addMetaInstances(adapter, instances)` / `removeMetaInstances(adapter, instances)` (MANAGER-gated). Each instance coordinate is a **pool address widened to `bytes32`** (decoded via `_toAddress`). Adding a new pool is a config call, no new deploy.


---

# 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/gearbox.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.
