> 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/stakewise-v3.md). Agents can also search and read this documentation through its [MCP server](https://docs.kpk.io/~gitbook/mcp).

# StakeWise V3

One immutable meta-adapter that reports an account's StakeWise V3 vault positions across any vault on a chain.

One immutable meta-adapter that reports an account's StakeWise V3 vault positions across any vault on a chain. Per vault it emits two gross legs: `Staking` (vault shares) and `Borrowed` (minted osToken debt), both converted to the underlying.

* **Type:** Meta-adapter
* **protocolSubId:** `keccak256("stakewise-v3-vaults")`
* **Instance key:** the StakeWise V3 vault address, widened to `bytes32`.
* **Source:** `StakeWiseV3VaultsMetaBalanceAdapter.sol`

## Positions returned

Up to two legs per vault, both in the underlying staking asset:

| Leg          | PositionKind | isDebt  | Description                                                       |
| ------------ | ------------ | ------- | ----------------------------------------------------------------- |
| Staking      | `Staking`    | `false` | Vault shares converted to the underlying staking asset            |
| osToken debt | `Borrowed`   | `true`  | Minted osToken position converted to the underlying staking asset |

Zero-amount legs are dropped. The instance returns empty if the underlying is unregistered in NAVCalculator or filtered by `assetFilter`.

## Balance calculation

<figure><picture><source srcset="https://1699303810-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUsQM4bzcmOPSgkWddkeN%2Fuploads%2FIfMGvO5ZR2n9irpg7Jrc%2Fmeta-stakewise-v3_D.png?alt=media&amp;token=565a126c-5a00-49b2-9a80-e9e17d39985e" media="(prefers-color-scheme: dark)"><img src="https://1699303810-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUsQM4bzcmOPSgkWddkeN%2Fuploads%2FSvNHj24HRZ4yynjZeu7U%2Fmeta-stakewise-v3.png?alt=media&amp;token=98ecf31e-fa38-42d6-ac6b-d076200f87b7" alt="Flowchart of the StakeWise V3 balance adapter: read calls derive position legs into PositionBalance entries."></picture><figcaption><p>StakeWise V3 adapter: how the underlying balances reported to the NAV Calculator are derived.</p></figcaption></figure>

Both legs are denominated in `UNDERLYING_TOKEN` (the chain's staking asset: the ETH sentinel on mainnet, GNO on Gnosis):

```
vaultAssets = vault.convertToAssets(vault.getShares(account))                            // Staking
mintedOs    = OS_TOKEN_VAULT_CONTROLLER.convertToAssets(vault.osTokenPositions(account))  // Borrowed
```

osToken debt is held in osToken **shares**, whose rate is governed by the `OsTokenVaultController`, not the vault's own rate. The `Borrowed` leg therefore converts through the controller, the same rate the osToken price feed uses; the vault's rate would mis-scale the debt. The legs are gross, not netted.

## Identity

* **positionId:** `abi.encode(address vault)`
* **positionKind:** `Staking` (vault shares), `Borrowed` (osToken debt)
* **Labels:** `positionLabels(positionId)` returns a two-tier leaf, read live and fail-open, shown only on the verbose reads:

  1. the vault's ERC20 `name()`, for example `["Vault", "Stakers Union GNO"]`. Only StakeWise's `…Erc20Vault` variants answer it;
  2. otherwise `"<underlying symbol> <vault address>"`, for example `["Vault", "GNO 0x4b4406ed…"]`, where every configured instance lands today. The symbol comes from the NAV asset registry, because the mainnet underlying is the codeless ETH sentinel `0xEeee…EEeE`; an unregistered underlying degrades to the bare address.

  Tier 2 is a coordinate rendering, not a name: non-ERC20 vaults expose no readable identity onchain, and StakeWise's UI names come from offchain IPFS metadata. Treat the leaf as descriptive, never as an identifier; three Gnosis vaults are all named `"SEED"`. Key on `positionId`.

The reconciliation key is `keccak256(abi.encode(chainId, protocolSubId, positionId, balanceAsset.asset, positionKind))`, so the `Staking` and `Borrowed` legs reconcile independently.

## Constructor

```solidity
constructor(address underlyingToken_, address osTokenVaultController_, address navCalculator_)
```

| Parameter                 | Description                                                                                                                  |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `underlyingToken_`        | Staking asset all configured vaults use (ETH sentinel on mainnet, GNO on Gnosis). Must be non-zero                           |
| `osTokenVaultController_` | StakeWise `OsTokenVaultController` for this chain, converting osToken-debt shares for the `Borrowed` leg. Must be a contract |
| `navCalculator_`          | NAVCalculator, used for the registered-asset registry. Must be a contract                                                    |

## Registration

Register with `addMetaBalanceAdapter(adapter, instances)`, then add or remove vaults with `addMetaInstances(adapter, instances)` / `removeMetaInstances(adapter, instances)`.


---

# 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/stakewise-v3.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.
