> 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/onchain-accounting/meta-balance-adapters/morpho-vault.md).

# Morpho Vaults

One immutable meta-adapter that reports an account's underlying-asset balance in *any* Morpho ERC-4626 vault (MetaMorpho V1 and V2). Which vaults it queries is a governed instance set on the NAV Calculator; the adapter holds no per-vault state.

* **Type:** Meta-adapter
* **protocolSubId:** `keccak256("morpho-vaults")`
* **Instance key:** the vault address, widened to `bytes32`
* **Source:** [`MorphoVaultsMetaBalanceAdapter.sol`](https://github.com/karpatkey/onchain-accounting/blob/main/src/balances/MetaBalanceAdapters/MorphoVaultsMetaBalanceAdapter.sol)

***

## Positions returned

One position per vault the account holds shares in.

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

A vault returns an empty result (rather than reverting) when its asset is unregistered, excluded by `assetFilter`, or the converted balance is zero — so one bad vault never zeroes out the rest of the set. Rewards (Merkl / Universal Rewards Distributor) are not included.

***

## Balance calculation

<figure><img src="/files/GRJAVmRSbxw8PYjp2lGY" alt="Flowchart of the Morpho Vaults balance adapter: read calls derive position legs into PositionBalance entries."><figcaption><p>Morpho Vaults adapter — how the underlying balances reported to the NAV Calculator are derived.</p></figcaption></figure>

```
amount = vault.previewRedeem(vault.balanceOf(account))   // 0 if unreadable; no convertToAssets fallback
```

The shares are valued with `previewRedeem`, which nets out any ERC-4626 vault **exit fee** (per EIP-4626 §4.3) that `convertToAssets` ignores. It reflects the vault's current `totalAssets / totalSupply` (interest accrued across its underlying Morpho markets), denominated in `vault.asset()`. The two agree for fee-less vaults (none currently charge an exit fee).

If `previewRedeem` cannot be read the leg reports **`0`**; there is **no `convertToAssets` fallback**. Because §4.3 requires `convertToAssets` to ignore the redemption fee that `previewRedeem` must include, `convertToAssets ≥ previewRedeem` by construction — so falling back could only ever report *more* than a redemption would pay. Reporting nothing under-reports, which is the permitted direction. If instead `previewRedeem` runs out of the gas its frame was given, the read **fails closed** with `RedeemValueGasExhausted(vault, stipend, consumed)` rather than reporting `0`, since a starved read is not evidence of an empty position — see [a starved read is not an empty read](/funds/infrastructure/onchain-accounting/balance-adapters.md#how-an-adapter-is-built).

***

## Identity

* **positionId:** `abi.encode(address vault)` — the vault address
* **positionKind:** `Supplied`

There is no `labels` field on the position. The adapter implements `positionLabels(positionId)`, which returns `["Vault", "<ERC4626 name()>"]` from the vault's on-chain 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 vaults with `addMetaBalanceAdapter(adapter, instances)`, then adjust with `addMetaInstances(adapter, instances)` / `removeMetaInstances(adapter, instances)` (MANAGER-gated). Each instance coordinate is a **vault address widened to `bytes32`** (decoded via `_toAddress`, which reverts on a non-address coordinate). Adding a new vault 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.kpk.io/funds/infrastructure/onchain-accounting/meta-balance-adapters/morpho-vault.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
