Comment on page
Used to get FRAX-collateral and FXS-collateral price data.
The Chainlink price consumer contract is deployed at:
The FRAX-ETH Uniswap pair oracle is deployed at:
The FRAX-USDC Uniswap pair oracle is deployed at:
The FRAX-USDT Uniswap pair oracle is deployed at:
The FRAX-FXS Uniswap pair oracle is deployed at:
The FXS-ETH Uniswap pair oracle is deployed at:
The FXS-USDC Uniswap pair oracle is deployed at:
The FXS-USDT Uniswap pair oracle is deployed at:
The Frax system takes price feeds from two external systems: Chainlink and Uniswap. The system records the ETH-USD price from Chainlink and applies it to the FRAX-wETH and FXS-wETH pool balances from Uniswap in order to get an accurate FRAX-USD and FXS-USD price. This allows FRAX to follow the true price of USD and not a basket of onchain stablecoins (which could deviate significantly). The Chainlink oracle is a time weighted average of the ETH-USD price updated every hour.
ChainlinkETHUSDPriceConsumercontract is responsible for getting the price of ETH in terms of USD. To get the price of ETH in USD from this contract, call
getLatestPrice()and divide by
The Uniswap V2 system includes price oracles that use a time-weighted average price in order to robustly calculate an accurate price for tokens within the Uniswap pools. Frax uses these oracles over a
1 hourtime-weighted average price on its Uniswap pools to get price information for FRAX, FXS, and the collateral tokens in the system. The period of the time-weighted average price is changeable as a system parameter through a governance proposal.
UniswapPairOraclecontract allows one to get the price of a token within the system from its pool balance. To get the price of a token from a pair, call
consult(address token, uint amountIn)on the pair's UniswapPairOracle instance with the token's address and requested quantity.