Price Feed
Instant price feed
To establish a most up-to-date price of assets for perpetual markets. Instead of relying completely on an on-chain oracle. We also leverage the price sources from centralized exchange. We are calculating the median price of an asset from top 5 centralized exchange: Binance, Coinbase, Kucoin, Kraken and Bybit.
We have an Outlier
filter that eliminates bad prices from any exchange that falls too far from a certain threshold.
Additionally, A deviation threshold of 0.1%
comparing to the ChainLink price oracle is configured in the PriceFeed
smart contract, if the median price fall out of this deviation threshold, the keeper bots will not be able to update the price of an asset. This is a mechanism of the smart contract to prevent price manipulation.
Keeper bots will constantly update the price to the PriceFeed
contract. In the worst scenario, if keepers couldn't update the price of an asset. Chainlink price will be used as a fallback.
Data quality
In order for an oracle to give a trustworthy price feed, it is necessary to get prices from trustworthy sources.
Price source: We use the Websocket Price Feeds from top tier and most liquid centralized exchanges: Binance, Coinbase, Bybit, Kraken.. as the sources of the price data.There is already an ecosystem of oracles, market makers and traders that rely on an accurate data feed provided by these price feeds.
Off-chain filtering: Our price feed implements a filtering mechanism that rejects data points that significantly deviate from the expected volatility of each asset.
Chainlink price as a fallback
We use these price feeds from chainlink as fallbacks. More assets are being added.
Pair | Address |
---|---|
BTC / USD | 0xAC15714c08986DACC0379193e22382736796496f |
DAI / USD | 0x440bD1535a02243d72E0fEED45B137efcC98bF7e |
ETH / USD | 0xcD2A119bD1F7DF95d706DE6F2057fDD45A0503E2 |
USDC / USD | 0xb85765935B4d9Ab6f841c9a00690Da5F34368bc0 |
Source: Base docs