# 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="https://2700472736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkcxvvIc3ISTwTw8FPt%2Fuploads%2FO9IRmy2tFa8fPLzRo4HC%2Fimage.png?alt=media&#x26;token=63708159-4f41-438a-b058-f225e0f5ced8" 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
