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

# NXM / wNXM

Custom price feed for **Nexus Mutual's NXM** token and its 1:1 transferable wrapper **wNXM** on Ethereum. NXM has no external market oracle by design; its value is set internally by Nexus Mutual's Ratcheting AMM (RAMM), combined here with an ETH/USD price read from the NAV's own primary feed.

{% 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 %}

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

***

## Approach

`RAMM.getInternalPrice()` (ETH per NXM, TWAP) × NAV-selected ETH/USD.

Deploy **one instance per priced token**: one for NXM and one for wNXM. Both use the same RAMM book value per NXM-unit, since a member can unwrap wNXM 1:1 to NXM.

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

***

## Price calculation

```
price = getInternalPrice × ETH_USD / 1e18
```

| Input                | Source                                              | Description                                         |
| -------------------- | --------------------------------------------------- | --------------------------------------------------- |
| `getInternalPrice()` | `IRamm(RAMM)`                                       | Manipulation-resistant TWAP of ETH per NXM (18 dec) |
| `ETH_USD`            | NAV base — `getPriceDataNoDivergence(WETH)` (8 dec) | the NAV's primary WETH/USD price                    |

`getInternalPrice()` is the RAMM's internal ETH-per-NXM price (18 dec); multiplying by the 8-dec ETH/USD and dividing by `1e18` yields an **8-decimal** USD price. If the internal price is zero, the feed returns stale.

***

## Constructor

```solidity
constructor(
    address token_,
    address ramm_,
    address nav_,
    address baseAsset_
)
```

| Parameter    | Description                                                                                |
| ------------ | ------------------------------------------------------------------------------------------ |
| `token_`     | The priced token: NXM or its 1:1 wrapper wNXM                                              |
| `ramm_`      | Nexus Mutual RAMM contract providing the internal ETH-per-NXM price                        |
| `nav_`       | NAVCalculator (proxy) — supplies the base asset's USD price via `getPriceDataNoDivergence` |
| `baseAsset_` | The registered base asset whose USD price is read (WETH)                                   |

The constructor reverts if `RAMM.getInternalPrice()` returns 0 at deploy, failing fast on a wrong or non-contract RAMM address.

***

## Staleness

The price is stale if `getInternalPrice()` returns 0, or if the NAV reports the base asset (WETH) stale — all its feeds stale. The base leg's `updatedAt` comes from the NAV's selected WETH feed. The RAMM internal price itself has no heartbeat — it is a view function read live on each call.

***

## Chains

Deployed on **Ethereum mainnet**. One instance is deployed per priced token (NXM and wNXM).


---

# 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/nxm.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.
