Just as adapters interact with external "integratees," so do price feeds interact with sources that provide them with the data they need to provide rates.
Prices Aave aTokens
, which are pegged 1:1 with the value of their underlying, e.g., 1 aAAVE
is equal to 1 AAVE
. aTokens
accrue interest via a formulaic rebasing mechanism.
Docs: https://docs.aave.com/developers/the-core-protocol/atokens​
Mainnet contracts:
ProtocolDataProvider
: 0x057835Ad21a177dbdd3090bB1CAE03EaCF78Fc6d
Considerations: Always directly returns the input amount as the output amount (i.e., 1:1 pegging)
Provides a price for ibETH
.
Docs: https://github.com/AlphaFinanceLab/alphahomora/blob/master/contracts/5/Bank.sol​
Mainnet contracts:
Bank
(ibETH
): 0x67B66C99D3Eb37Fa76Aa3Ed1ff33E8e39F0b9c7A
Considerations: Uses cached rate
Each rate pair (we use those quoted in either USD or ETH) is provided by a Chainlink "aggregator," and we interact with the proxy contracts for those aggregators.
Docs: https://docs.chain.link/docs/using-chainlink-reference-contracts​
Mainnet contracts: each aggregator
Considerations:
We do not check timestamps on every price lookup, rather we provide a function to allow quickly removing an aggregator that is considered to be stale. If an aggregator is removed, the corresponding primitive will cease to produce a price from the feed and will revert, causing any function that relies on that price to fail until it is re-instituted. This is the desired behavior.
This price feed mimics how Chai
determines its rate in its codebase, by interacting with Maker DAO's DSR Pot
contract.
Docs: https://github.com/dapphub/chai​
Mainnet contracts:
Pot
- 0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7
Considerations:
We do not call Pot.drip()
before calculating price as in Chai
, in order to save gas (drip()
updates storage). The CHAI-DAI rate changes negligibly for even long periods of time.
Queries each Compound Token (cToken) directly for its rate.
Docs: https://compound.finance/docs​
Mainnet contracts: each cToken
Considerations:
We query the cached rate instead of the live rate for gas savings. Like CHAI
, cTokens rates change negligibly for long periods of time.
Queries the Synthetix Exchanger
contract to get the rate for a Synth in terms of sUSD
.
Docs: https://docs.synthetix.io/​
Mainnet contracts:
AddressResolver
- 0x61166014E3f04E40C953fe4EAb9D9E40863C83AE
Considerations: Live prices
Uses a special pool manipulation-resistant formula that takes into consideration the current underlying asset balances and pool token balance in the given Uniswap pool (UniswapV2Pair
) along with a trusted rate between the two underlying tokens.
Docs: https://uniswap.org/docs/v2/​
Mainnet contracts:
UniswapV2Factory
: 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f
instances of UniswapV2Pair
See also the sample implementation we based this on: https://github.com/Uniswap/uniswap-v2-periphery/blob/267ba44471f3357071a2fe2573fe4da42d5ad969/contracts/libraries/UniswapV2LiquidityMathLibrary.sol​
Considerations: Live prices
This price feed uses a known formula for pricing DGLD based on the current rate of XAU. It uses Chainlink aggregators directly.
Docs: https://dgld.ch/​
Mainnet Contracts:
XAU/USD Aggregator: 0x214eD9Da11D2fbe465a6fc601a91E62EbEc1a0D6
ETH/USD Aggregator 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
Considerations: Live prices