Price Protection
Last updated
Was this helpful?
Last updated
Was this helpful?
Several price protection mechanisms have been implemented in the off-chain and on-chain infrastructure to ensure robust, tamperproof, fair and transparent pricing for all the end-users. Some of them have been mentioned below:
There have been cases where a few market participants have manipulated the price and generated profits. On the other hand, there have been several oracle attacks across DeFi each year resulting in loss of millions of dollars of users' assets.
To address such issues, B3X will use a black box function to ensure tamper-proof pseudo-deterministic price for fair trade execution. This function takes a real world source as seed which is consistently changing and generates a random number using Mersenne Twister, a pseudo-random number generator.
The prices of all the real-world and decentralized sources are checked for deviations as defined in the asset manager for the asset, and such factor is called Deviation Factor, which can be unique for each asset.
Let be the number of the real-world sources with prices, and be the price from a decentralized source such as Chainlink or Pyth, then if
then price source is valid and acceptable and will be considered for final price computation.
Binance: 45125.89, OKX: 45100.45, Coinbase: 45156.34, MEXC: 45900.90, Kucoin: 45146.22, Bybit: 45116.78, Chainlink: 45110.45, Pyth: 45111.23
In this sample, MEXC's BTC price is out of acceptable deviation (>1.5%) as compared to decentralized sources, hence will be rejected.
Once all the real-world sources pass the deviation check, the off-chain infrastructure checks all the prices from these sources for outliers to ensure fair pricing for all.
In order to process this, we can define deviations of price feed against other sources, as
Hence, the deviation of price feed against others can be written as and similarly for price feed, we can define and so on.
Then we compute variance of this dataset to fine-tune the sources, as
The maximum acceptable value of is defined in the Asset Manager for an asset. If the is not under acceptable value, the dataset is sorted in ascending order and the first and last element is removed. This process is continued until V is under acceptable value. One must note that with each elimination, the underlying price feed is also eliminated and not considered from final computation.
In the previous example, if MEXC's price feed by any chance passes the deviation check, it will fail in the outlier check since the deviations of MEXC's price feed will be highest amongst other feeds.
B3X deploys an additional check of the price feed sources to monitor their uptime. Let a price feed report price, at time then the off-chain infrastructure computes, , relative price difference as
If , the price feed is considered faulty, invalid or dead, and hence will not be included to compute final off-chain price. But this check depends upon the asset, some asset may skip the fault check for example: RWA assets on off-market hours.
Since FTX Saga and several API incidents , it is important to implement fault checks for the price feed sources.