> For the complete documentation index, see [llms.txt](https://docs.notional.finance/exponent/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.notional.finance/exponent/smart-contracts/oracle-design-morpho.md).

# Oracle Design (Morpho)

All Notional Exponent Morpho markets list the Notional Exponent vault as its own price oracle.&#x20;

The vault returns the vaultShare price to Morpho by combining the yieldToken/USD and asset/USD exchange rates that come from the oracles listed on the [Trading Module](https://etherscan.io/address/0x594734c7e06C3D483466ADBCe401C6Bd269746C8).

### Step by step method

On [price()](https://github.com/notional-finance/notional-exponent/blob/37154068c19c971c0e72168285aec7922773fc55/src/AbstractYieldStrategy.sol#L135):<br>

1. Vault gets **vaultShare/yieldToken exchange rate**. This slowly decreases over time as Notional accrues fees. <br>
2. Vault gets **yieldToken/asset exchange rate** by calling [getOraclePrice(yieldToken, asset)](https://github.com/notional-finance/leveraged-vaults/blob/7e0abc3e118db0abb20c7521c6f53f1762fdf562/contracts/trading/TradingModule.sol#L262) on the [Trading Module](https://etherscan.io/address/0x594734c7e06C3D483466ADBCe401C6Bd269746C8).<br>
3. Trading Module gets yieldToken/USD exchange rate and asset/USD exchange rate from listed price oracles. <br>
4. Trading Module calculates and returns **yieldToken/asset price**.<br>
5. Vault calculates and returns **vaultShare/asset price**.

<figure><img src="/files/nHjSZj21VYcppNYTvXoz" alt=""><figcaption></figcaption></figure>

### Example calculation

**Set up**

* vaultShare = n-sUSDe
* yieldToken = sUSDe
* asset = USDC

**Step by step**

1. n-sUSDe/sUSDe exchange rate = 0.9999
2. sUSDe/USD exchange rate = 1.2105
3. USDC/USD exchange rate = 0.9978
4. sUSDe/USDC exchange rate = 1.2137
5. n-sUSDe/USDC exchange rate = 1.2136

### Auditing

```solidity
To get the yieldToken/USD and asset/USD oracle contracts:

TradingModule.priceOracles(address yieldToken)
TradingModule.priceOracles(address asset) 
```

**Validation**

Morpho’s oracle validation tool will not successfully validate Notional Exponent oracles because they do not follow Morpho’s standard format.

To validate Notional Exponent oracles, make the following checks:<br>

1. Validate the price
   1. Call price() on the oracle
   2. Compare the result to the price you expect. NOTE - Notional’s vault share price will be slightly lower than the yield token price due to protocol fee accrual<br>
2. Validate the decimals
   1. The oracle decimals is equal to (36 + loan token decimals - collateral token decimals)
   2. Divide the price() return value by the decimals and check that it is correct


---

# 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.notional.finance/exponent/smart-contracts/oracle-design-morpho.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.
