Frax Finance ¤
English 🇰🇾
English 🇰🇾
  • Frax Ecosystem Overview
  • FXS & veFXS
    • Frax Shares (FXS)
    • veFXS
    • Gauges
    • FXS Distribution
    • FXS Smart Contract & Addresses
  • GOVERNANCE
    • Frax Governance Overview
    • How It Works
    • Advanced Concepts
    • Fraxtal Snapshot Voting
  • FRAX V1 - ORIGINAL
    • Original Design
    • Staking Contracts
    • FRAX ABI & Token Addresses
    • Frax V1 Pool ABI & Addresses
    • Core Frax Multisigs
  • FRAX V2 - Algorithmic Market Operations (AMO)
    • AMO Overview
    • AMO Minter
    • Collateral Investor
    • Curve
    • Uniswap v3
    • FRAX Lending
    • Decentralization Ratio (DR)
  • FRAX V3 - 100% CR AND MORE
    • Overview
    • Fraxtal
    • AMOs
    • RWAs
    • sFRAX
    • FXBs
    • sFRAX Token Addresses
    • sFRAX & FXB Multisigs
  • Bridging
    • Fraxferry
    • LayerZero x Stargate
    • Fraxtal Bridge
  • Frax Price Index
    • Overview (CPI Peg & Mechanics)
    • Frax Price Index Share (FPIS)
    • FPIS Distribution
    • CPI Tracker Oracle
    • FPI Controller Pool
    • veFPIS
    • FPIS Conversion / FPIS Locker
    • FPI and FPIS Token Addresses
    • FPI Multisigs
  • Fraxswap
    • Overview
    • Technical Specifications
    • Fraxswap Contract Addresses
  • Fraxlend
    • Fraxlend Overview
    • Key Concepts
    • Lending
    • Borrowing
    • Advanced Concepts
      • Position Health & Liquidations
      • Interest Rates
      • Vault Account
    • ABI & Code
    • Fraxlend Multisigs
  • Frax Ether
    • Overview
    • frxETH and sfrxETH
    • Technical Specifications
    • Redemption
    • frxETH V2
    • frxETH V2 Technical Details
    • frxETH Code & V2 Addresses
    • frxETH and sfrxETH Token Addresses
    • frxETH Multisigs
  • BAMM
    • Overview
  • Frax Oracle
    • Frax Oracle Overview
    • How It Works
    • Advanced Concepts
    • Fraxtal Merkle Proof Oracles
  • Guides & FAQ
    • FAQ
    • Staking
    • Uniswap Migration / Uniswap V3
    • Fraxswap / FPI
  • Miscellany
    • All Contract Addresses
    • Bug Bounty
    • Miscellaneous & Bot Addresses
    • API
  • Other
    • Audits
    • Media Kit / Logos
Powered by GitBook
On this page
  • Prior Work
  • Supported Frax Assets
  • Frax Dual Oracle Price Logic
  • frxEth
  • sfrxEth
  • How to use with Chainlink Interface - AggregatorV3Interface
  • Frax Oracle on L2

Was this helpful?

Export as PDF
  1. Frax Oracle

How It Works

PreviousFrax Oracle OverviewNextAdvanced Concepts

Last updated 7 months ago

Was this helpful?

Prior Work

See 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 - . 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 - . We then retrieve the price of ETH in USD from this chainlink oracle () and the price of FRAX in USD from this chainlink oracle (). 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:

priceLow =  (SFRXETH_ERC4626.pricePerShare() * frxEthEthPriceLow) / 1e18;
priceHigh = (SFRXETH_ERC4626.pricePerShare() * frxEthEthPriceHigh) / 1e18;

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

Frax Oracle on L2

Coming soon

Simply call or on the Frax Oracle contract for the asset you want the price of.

https://docs.chain.link/data-feeds/api-reference#aggregatorv3interface
0xa1f8a6807c402e4a15ef4eba36528a3fed24e577
0x36C060Cc4b088c830a561E959A679A58205D3F56
0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
0xB9E1E3A9feFf48998E45Fa90847ed4D467E8BcfD
https://docs.chain.link/data-feeds/api-reference#getrounddata
https://docs.chain.link/data-feeds/api-reference#latestrounddata