> 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/balance-adapters/aave-umbrella.md).

# Aave Umbrella

Reports an account's stake in Aave Umbrella across every stake token registered with a single RewardsController.

Reports an account's stake in Aave Umbrella across every stake token registered with a single `RewardsController`. Per stake token it reports locked and unlocked staking legs plus a rewards leg, all in the bare reserve token (for example USDC, USDT, WETH, GHO). Stake tokens are discovered at runtime; only the `RewardsController` is pinned.

* **Type:** Plain adapter
* **protocolSubId:** `keccak256("aave-v3-umbrella")` (brand `aave`, ecosystem `aave-v3`)
* **Source:** `AaveUmbrellaBalanceAdapter.sol`

{% hint style="info" %}
Stake tokens added by Aave governance, and changes to their reward tokens, are picked up automatically, provided the bare reserve is registered on NAVCalculator. Unregistered reserves are silently skipped.
{% endhint %}

## Positions returned

Up to three legs per discovered stake token whose bare reserve is registered on NAVCalculator:

| Leg              | PositionKind | isDebt  | isLocked | Description                                                                                           |
| ---------------- | ------------ | ------- | -------- | ----------------------------------------------------------------------------------------------------- |
| Locked staking   | `Staking`    | `false` | `true`   | Not withdrawable now: active stake, plus any cooldown still cooling or past its withdrawal window     |
| Unlocked staking | `Staking`    | `false` | `false`  | Withdrawable now. Present only when a cooldown has elapsed and is still inside its `withdrawalWindow` |
| Rewards          | `Rewards`    | `false` | `false`  | Claimable, unclaimed rewards                                                                          |

Zero-amount legs are skipped. All amounts are in bare-reserve units.

## Balance calculation

<figure><picture><source srcset="https://1699303810-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUsQM4bzcmOPSgkWddkeN%2Fuploads%2FclWrVPgOCAFkbBUezKcy%2Fadapter-aave-umbrella_D.png?alt=media&amp;token=baa1af83-7a60-4ff9-a797-0f0c846a5a0d" media="(prefers-color-scheme: dark)"><img src="https://1699303810-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUsQM4bzcmOPSgkWddkeN%2Fuploads%2FzVRD9PiICSClJlASTP2G%2Fadapter-aave-umbrella.png?alt=media&amp;token=59d5f828-fbd1-4735-82ae-4d75c946c898" alt="Flowchart of the Aave Umbrella balance adapter: read calls derive position legs into PositionBalance entries."></picture><figcaption><p>Aave Umbrella adapter: how the underlying balances reported to the NAV Calculator are derived.</p></figcaption></figure>

Stake tokens come from `RewardsController.getAllAssets()`. Each bare reserve is resolved through at most one ERC-4626 hop on the `asset()` chain (`stk → waToken → bare reserve`, or `stk → bare reserve`).

**Staking principal**: convert shares through the wrapper chain, then split by withdrawability:

```
amount = stakeToken.convertToAssets(stakeToken.balanceOf(account))
firstLevel = stakeToken.asset()
if firstLevel is an ERC-4626 wrapper (waToken):
    amount = firstLevel.previewRedeem(amount)   // one extra hop to the bare reserve; 0 if unreadable, no fallback
```

The waToken hop uses `previewRedeem`, so a wrapper redemption fee (possible via Aave governance) is not over-reported. There is no `convertToAssets` fallback: EIP-4626 §4.3 makes `convertToAssets ≥ previewRedeem`, so falling back could only over-report; an unreadable `previewRedeem` reports **`0`**. A read that runs out of gas fails closed with `RedeemValueGasExhausted(vault, stipend, consumed)`; see [a starved read is not an empty read](https://docs.kpk.io/funds/infrastructure/architecture/onchain-accounting.md#how-an-adapter-is-built). Umbrella slashing lowers `totalAssets` but not `totalSupply`, so the conversion is already post-slash.

The resulting principal is split into a locked and an (optionally present) unlocked leg by reading the account's cooldown:

```
(amount, endOfCooldown, withdrawalWindow) = stakeToken.getStakerCooldown(account)
                                            // withdrawalWindow is snapshotted per cooldown

inWindow = now >= endOfCooldown
        && now <= endOfCooldown + withdrawalWindow   // cooldown elapsed, still claimable

unlocked = inWindow ? <bare-reserve amount the cooldown covers> : 0   // isLocked = false
locked   = principal - unlocked                                       // isLocked = true
```

If the cooldown reads fail or there is no active cooldown, the whole principal is locked and no unlocked leg is emitted.

**Rewards** come from `calculateCurrentUserRewards(stakeToken, user)`. Each reward token is resolved to its bare reserve via `IAToken.UNDERLYING_ASSET_ADDRESS()` (or treated as already bare), and amounts matching the stake's bare reserve are summed. Reward aTokens are 1:1 unit-equivalent with their underlying reserve, which is what makes that sum valid.

External probes (`asset()`, `convertToAssets`, `getStakerCooldown`, `UNDERLYING_ASSET_ADDRESS()`) use low-level staticcalls with a gas budget of at most 30k.

## Identity

* **positionId:** `abi.encode(address stakeToken)`, the same for all three legs of a stake token
* **positionKind:** `Staking` · `Rewards`

The two staking legs share `positionId` and `positionKind`, and `isLocked` is not part of the reconciliation key, so they reconcile into one coordinate and sum to the total staked; read `isLocked` per leg for the breakdown. The rewards leg is told apart by `positionKind` (`Rewards`). `positionLabels(positionId)` returns `["Umbrella Module"]`, shown only on the verbose reads. `protocolName()` returns **`"Aave V3"`**, not `"Aave Umbrella"`; the [display name is the protocol, never the product](https://docs.kpk.io/funds/infrastructure/architecture/onchain-accounting.md#how-an-adapter-is-built). The breadcrumb is `["Aave V3", "Umbrella Module"]`, grouping Umbrella with its Aave V3 siblings.

## Constructor

```solidity
constructor(address rewardsController, address navCalculator)
```

| Parameter           | Description                                                                                           |
| ------------------- | ----------------------------------------------------------------------------------------------------- |
| `rewardsController` | Umbrella RewardsController (non-zero, must be a contract); the trust anchor for stake-token discovery |
| `navCalculator`     | NAVCalculator address (non-zero, must be a contract); used to resolve registered-asset metadata       |

## Registration

Registered as a plain adapter with `addBalanceAdapters([adapter])` (MANAGER-gated); removed with `removeBalanceAdapters`.


---

# 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/balance-adapters/aave-umbrella.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.
