> For the complete documentation index, see [llms.txt](https://docs.frax.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.frax.finance/frax-oracle/how-it-works.md).

# How It Works

## Prior Work

See <https://docs.chain.link/data-feeds/api-reference#aggregatorv3interface> for documentation on the Chainlink Oracle interface.

## Supported Frax Assets

Currently frxEth/ETH and sfrxEth/ETH are supported.

## Frax Dual Oracle Price Logic

### frxEth

The frxEth price is determined from two onchain price sources. The first price source is the frxEth / ETH Curve pool EMA Oracle - [0xa1f8a6807c402e4a15ef4eba36528a3fed24e577](https://etherscan.io/address/0xa1f8a6807c402e4a15ef4eba36528a3fed24e577). This price is bounded to be 0.7 at the lowest (0.7 frxEth = 1 ETH) and 1 at the highest (1 frxEth = 1 ETH).

The second price source comes from the Uniswap frxEth / FRAX pool TWAP oracle - [0x36C060Cc4b088c830a561E959A679A58205D3F56](https://etherscan.io/address/0x36C060Cc4b088c830a561E959A679A58205D3F56). We then retrieve the price of ETH in USD from this chainlink oracle ([0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419](https://etherscan.io/address/0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419)) and the price of FRAX in USD from this chainlink oracle ([0xB9E1E3A9feFf48998E45Fa90847ed4D467E8BcfD](https://etherscan.io/address/0xB9E1E3A9feFf48998E45Fa90847ed4D467E8BcfD)). These chainlink prices are used to convert the frxEth / FRAX pool price into a frxEth / ETH price using the following equation:

```
ethPerFrxEth = (fraxPerFrxEthUniswapTwap * usdPerFraxChainlink) / usdPerEthChainlink;
```

This price from Uniswap is similarly bounded between 0.7 and 1, mirroring the Curve price.\
\
The lower of these prices is returned as priceLow and the higher is returned as priceHigh. These prices are then written to the frxEth / ETH Frax Oracle.

### sfrxEth

Simply retrieves the pricePerShare() from the sfrxEth contract, retrieves the priceHigh and priceLow in the same manner as the frxEth Dual Oracle outlined above, and returns the following equation:

<pre><code><strong>priceLow =  (SFRXETH_ERC4626.pricePerShare() * frxEthEthPriceLow) / 1e18;
</strong>priceHigh = (SFRXETH_ERC4626.pricePerShare() * frxEthEthPriceHigh) / 1e18;
</code></pre>

This works because pricePerShare() returns how many frxEth a single sfrxEth is worth. pricePerShare() goes up over time.

These prices are then written to the sfrxEth / ETH Frax Oracle.

## How to use with Chainlink Interface - AggregatorV3Interface

Simply call <https://docs.chain.link/data-feeds/api-reference#getrounddata> or <https://docs.chain.link/data-feeds/api-reference#latestrounddata> on the Frax Oracle contract for the asset you want the price of.

## Frax Oracle on L2

Coming soon<br>


---

# 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.frax.finance/frax-oracle/how-it-works.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.
