MCDEX uses Oracle in the following two aspects:
- Determine the Mark Price of the contract (Mark Price)
- As a reference factor for AMM pricing
Decentralized Oracle services(for example, Chainlink, Band etc.) have high security and consensus. However, due to cost considerations, the data services provided by Oracle services typically have a large deviation (0.1%~0.5%).
It is reasonable to use the price provided by the decentralized Oracle service directly as the mark price. The mark price of the perpetual contract is only used to calculate the position value of the contract, thereby determining the liquidation price. At present, the maintenance margin recommended by MCDEX is 6.7%. The deviation of 0.5% will not have much impact on the liquidation of perpetual contracts.
By greatly increasing the credibility of perpetual contracts, the use of decentralized Oracle services can significantly eliminate the “ price manipulation problem caused by the short-term wealth fluctuations of centralized exchanges. However, when a decentralized Oracle is directly used for the AMM pricing, a large Oracle deviation will cause the AMM quotation to have a larger arbitrage space.
We have two types of methods to eliminate the influence of Oracle bias on AMM pricing :
- 1.Set a larger transaction cost within the spread or transaction fee. For example, if the deviation of Oracle is 0.5%, the transaction fee is set to 0.5%, or the market spread is set to 0.5%;
- 2.Set a more accurate price for AMM quotation within the Oracle deviation range. For example, if Oracle’s data is 1000 and the deviation is 0.5%, the Operator is allowed to set more accurate price data for AMM reference quotation in [995, 1005].
The second method mentioned above will not magnify the power of the Operator. Due to the existence of deviations, the data provided by the decentralized Oracle is a range of values, not a certain value. When we trust the data given by the decentralized Oracle, what we essentially trust is the correct price within a certain range. Operator quotes a certain value within the credible price range as a reference quotation, which not only loses fairness but also reduces AMM's arbitrage space and protects the rights and interests of AMM's LP.
MCDEX encapsulates third-party decentralized Oracle services. MCDEX DAO has established a whitelist of trusted third-party Oracle services and maintains a record of these Oracle deviations.
When the Operator creates a perpetual contract, the Operator can select these decentralized Oracle services and create an adapter to these Oracles. The operator can set a fine tuner. The fine tuner is usually a bot. The fine tuner can read the external data source and set a price within the Oracle deviation range for AMM quotation. The price data set by the fine tuner is only used for AMM pricing, not for the mark price.
- 1.If the price set by the fine tuner exceeds the deviation range of the decentralized Oracle, the adapter will cut the price set by the fine-tuner to the boundary of the allowed range of deviation. For example, Oracle's price is 1000, the deviation is 0.5%, and the valid range is [995, 1005]. If the fine tuner sets the price to 990, the effective AMM reference price is 995. If the fine tuner sets the price to 1006, the effective AMM reference price is 1005.
- 2.If the fine tuner does not update the price for more than a period of time, the data set by the fine tuner will be ignored, and the decentralized Oracle will be used directly. MCDEX DAO sets the fine-tuning timeout time according to the fluctuation of the Oracle data source.
Since tuning the price requires the cost of Gas, the Operator can choose to fine-tune the frequency and accuracy according to the specific situation and control the cost of contract operation.