Pricing Mechanism

A rational pricing mechanism is the foundation of fairness in contract trading and also the underlying infrastructure of any decentralized exchange (DEX). Having a good pricing mechanism not only enhances the user's trading experience but also provides better scalability, accommodating more price introduction scenarios in the future.

Pricing Principles

Decentralized pricing typically employs the following three methods:

  • On-chain oracle feeds

  • Centralized exchange API prices

  • Automated Market Maker (AMM) pricing from liquidity pools

Borabora's pricing mechanism incorporates the strengths of various approaches. It not only connects with APIs from mainstream centralized exchanges and DEX's Time-Weighted Average Price (TWAP) but also introduces a price weighting strategy and deviation verification by Chainlink. This addresses issues such as delays in on-chain oracle prices, instability in centralized exchange APIs, and poor accuracy in liquidity pool pricing.

Market Data

Centralized Market Data

The data from centralized exchanges are sourced from multiple high-quality APIs that have undergone identity verification. These APIs are aggregated into verified answers, eliminating any single point of failure. Currently, the data sources include:

  • Binance

  • Okex

  • Kucoin

  • LBank

  • Bigget

  • Gate.io

  • Mexc

In theory, any asset that has a price within the integrated data sources can support contract trading on Borabora. More data sources will be supported in the future, along with different request weights allocated based on the stability of different data sources.

Decentralized Market Data

Borabora's existing price infrastructure can fully interface with data sources from decentralized exchanges (DEXs), such as Uniswap, Pancake Swap, Orca, DODO, etc. However, due to the permissionless nature of market-making activities in DEXs, the resulting prices may be unstable and inaccurate. This could directly expose Borabora's contract users, whether traders or liquidity providers (LPs), to risk. Therefore, we adopt a cautious attitude towards integrating decentralized market data and will selectively open access at an appropriate time.

Price Aggregation Strategy

Due to price discrepancies, data delays, and occasional failures in different data sources, the price data obtained from market data sources need to be processed through a strategy before use. The strategy includes the following parts:

  • Maintaining consistent data source push frequencies

The price push frequency varies among different data sources, with some pushing every 0.1 seconds and others every 0.5 seconds. Aggregating price data from different time points may affect the accuracy of the prices.

  • Prioritizing high-stability data sources

In the acquisition of centralized market data, due to the performance and concurrency advantages of APIs, data from sources like Binance and Okex are prioritized to ensure the stability of price data.

  • Aggregating multiple data sources by weight

When the same asset is pushed by different data sources, Borabora allocates weights according to the market recognition of different data sources to ensure the final price is reasonable.

Price Keeper Verification

We anchor the final price verification on Chainlink Price Feeds, as they are designed to offer the highest level of security, reliability, and accuracy. If the difference from the Chainlink Price Feed exceeds 2%, we consider the aggregator's price answer as unreasonable and reject the price answer, waiting for the next price. Only when the aggregator submits a price again and it passes verification is the final result sent to the trading contract for order execution.

Example: If the first price of Token A, after being processed by the aggregator, is $10.00, and the price of Token A on Chainlink Price Feeds at that time is $10.03, then the deviation = |$10.00 - $10.03| / $10.00 = 3%, and the price verification does not pass. If the second time the price of Token A is $10.02, and the price of Token A on Chainlink Price Feeds at that time is $10.03, then the deviation = |$10.02 - $10.03| / $10.00 = 1%, and the price verification passes, allowing normal use.

Price Validity

The validity period for prices is set at 20 seconds; prices exceeding this 20-second time limit are considered invalid. This measure is implemented to prevent the selection of favorable execution prices within a short timeframe, thereby mitigating potential arbitrage risks.

Last updated