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

# Euler Vaults

One immutable meta-adapter that reports an account's position in *any* Euler V2 ERC-4626 vault — both the EulerEarn aggregator vaults and the core eVaults (EVK, the lend/borrow product). 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("euler-vaults")`
* **Instance key:** the vault address, widened to `bytes32`
* **Source:** [`EulerVaultsMetaBalanceAdapter.sol`](https://github.com/karpatkey/onchain-accounting/blob/main/src/balances/MetaBalanceAdapters/EulerVaultsMetaBalanceAdapter.sol)

***

## Positions returned

Up to two legs per vault, both denominated in the vault's underlying asset:

| Leg    | PositionKind                 | isDebt  | Description                                                                              |
| ------ | ---------------------------- | ------- | ---------------------------------------------------------------------------------------- |
| Supply | `Supplied` *or* `Collateral` | `false` | `convertToAssets(balanceOf)`; `Collateral` if enabled as EVC collateral, else `Supplied` |
| Borrow | `Borrowed`                   | `true`  | `debtOf(account)` — core eVaults only                                                    |

A vault returns an empty result when its asset is unregistered, excluded by `assetFilter`, or the account has neither supply nor debt. Because an Euler vault's debt is denominated in the **same** asset as its supply, an unregistered asset already suppresses both legs together — so this adapter is structurally exempt from the [collateral-without-debt](/funds/infrastructure/onchain-accounting/balance-adapters.md#how-an-adapter-is-built) suppression the mixed-asset adapters need.

`debtOf` and the EVC lookups are read through **bounded, ABI-validated staticcalls** rather than `try/catch`, so EulerEarn aggregators (which lack them) and non-Euler ERC-4626 tokens degrade gracefully — no debt leg, supply classified as `Supplied`. The distinction matters: `try/catch` does not intercept a call to a code-less address (Solidity's `extcodesize` precheck reverts in the calling frame) nor a return-data decode failure (the decode also runs in the calling frame, after the call returned), and either would otherwise drop the whole instance — supply **and** debt legs — silently suppressing a real debt and over-reporting NAV.

A `debtOf` that **reverts** and one that **runs out of gas** are treated differently, and the difference is load-bearing. A revert is an answer: an EulerEarn aggregator has no `debtOf` at all, and reading `0` for it is correct. Starvation is not an answer, so the read **fails closed** rather than recording zero debt. In Euler's core topology that matters beyond the one vault: an account borrows from a **controller** vault while its collateral sits in others, so on the controller `balanceOf` is `0` — suppressing its debt leg leaves that instance with no legs at all, while sibling vaults still report their collateral in full. The result is unoffset collateral and an over-reported NAV that nothing inside the instance can correct; only refusing to answer can. See [a starved read is not an empty read](/funds/infrastructure/onchain-accounting/balance-adapters.md#how-an-adapter-is-built).

***

## Balance calculation

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

```
supplied = vault.convertToAssets(vault.balanceOf(account))   // isDebt = false
debt     = IEulerEVault(vault).debtOf(account)               // guarded read; isDebt = true, core eVaults only
```

Supply classification: `Collateral` if `vault` appears in `IEVC(vault.EVC()).getCollaterals(account)`, otherwise `Supplied`.

***

## Identity

* **positionId:** `abi.encode(address vault)` — the vault address (both legs share it)
* **positionKind:** `Supplied` · `Collateral` · `Borrowed`

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`). 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/euler-vaults.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.
