> 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/price-feeds/wsteth-l2.md).

# wstETH (L2)

Custom price feed for **Lido Wrapped Staked ETH** on L2 chains. No direct wstETH/USD feed exists, so the price is composed from a Chainlink wstETH/ETH feed and a Chainlink ETH/USD feed.

**Source:** [`wstETH_L2_CustomPriceFeed.sol`](https://github.com/karpatkey/onchain-accounting/blob/main/src/prices/protocols/wstETH_L2_CustomPriceFeed.sol)

{% hint style="info" %}
**L2 feed.** For the Ethereum mainnet feed, see [wstETH](/funds/infrastructure/onchain-accounting/price-feeds/wsteth.md).
{% endhint %}

***

## Approach

Chainlink wstETH/ETH × ETH/USD — the ETH/USD term is read from the NAV's own primary feed via `getPriceData(WETH)`, not a hardcoded oracle.

<figure><img src="/files/e0dnmrjcNm77ZyH3gWYU" alt="Left-to-right flowchart of the wstETH (L2) price feed: rate and Chainlink inputs combine into a USD price, with a staleness gate."><figcaption><p>wstETH (L2) price feed — how its oracle inputs compose into a USD price, with the staleness gate.</p></figcaption></figure>

{% hint style="info" %}
The ETH/USD term is sourced from the NAV's own selector — see [Base/USD from the NAV's own selector](/funds/infrastructure/onchain-accounting/price-feeds.md#base-usd-from-the-navs-own-selector).
{% endhint %}

***

## Price calculation

```
price = (wstETH/ETH) × (ETH/USD, NAV-selected) / 10^(wstETH/ETH decimals)
```

| Input        | Source                                                  | Description                      |
| ------------ | ------------------------------------------------------- | -------------------------------- |
| `wstETH/ETH` | Chainlink wstETH/ETH feed (`latestRoundData`)           | wstETH price in ETH (18 dec)     |
| `ETH/USD`    | **NAV base** — `getPriceDataNoDivergence(WETH)` (8 dec) | the NAV's primary WETH/USD price |

The wstETH/ETH feed already embeds the Lido exchange rate, so no on-chain rate call is made. The divisor is `10 ** RATE_FEED.decimals()`, captured once at construction as `_rateUnit`. Output is **8 decimals** (inherited from the ETH/USD term via `_decimals`).

***

## Constructor

```solidity
constructor(
    address wstEth_,
    address wstEthToEthChainlink_,
    uint256 wstEthToEthHeartbeat_,
    address nav_,
    address baseAsset_
)
```

| Parameter               | Description                                                                                |
| ----------------------- | ------------------------------------------------------------------------------------------ |
| `wstEth_`               | wstETH token address (the supported underlying asset)                                      |
| `wstEthToEthChainlink_` | Chainlink wstETH/ETH aggregator                                                            |
| `wstEthToEthHeartbeat_` | Staleness window (seconds) for the wstETH/ETH feed                                         |
| `nav_`                  | NAVCalculator (proxy) — supplies the base asset's USD price via `getPriceDataNoDivergence` |
| `baseAsset_`            | the registered base asset whose USD price is read (WETH)                                   |

***

## Staleness

`getLatestPrice()` returns `stale = true` if the wstETH/ETH feed satisfies `block.timestamp − updatedAt ≥ heartbeat`, if its answer is `≤ 0`, if its `updatedAt` is in the future (clamped to `block.timestamp` before the check), or if the NAV reports the base asset (WETH) stale — all its feeds stale. The base leg's `updatedAt` now comes from the NAV's selected WETH feed. The reported `updatedAt` is the **older** (smaller) of the two legs.

***

## Chains

Deployed on **Arbitrum, Base, and Gnosis**. The Ethereum mainnet counterpart is [wstETH (Mainnet)](/funds/infrastructure/onchain-accounting/price-feeds/wsteth.md), which derives the rate from `stEthPerToken()` instead of a wstETH/ETH feed.


---

# 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/price-feeds/wsteth-l2.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.
