# Oracles

In decentralized finance (DeFi), accurate and reliable price data is crucial for the seamless operation of decentralized exchanges (DEXs). Price oracles serve as the bridge between off-chain data sources and on-chain smart contracts, providing real-time asset pricing to ensure fair and transparent trading.

### **Role of Price Oracles in Our DEX**

Our platform integrates advanced price oracle solutions to deliver precise and up-to-date market information. This integration supports various functionalities, including:

* **Accurate Pricing:** Ensures that token swaps and trades reflect current market values, protecting users from price discrepancies.
* **Risk Management:** Provides essential data for features like margin trading and liquidation processes, maintaining platform stability.
* **Enhanced Security:** Reduces vulnerabilities to price manipulation by sourcing data from multiple reputable providers.

### **Integrated Oracle Solutions**

To achieve optimal performance and reliability, our DEX utilizes the following oracle services:

1. **Stork**
   * **Ultra-Low Latency:** Delivers sub-millisecond updates, making it ideal for high-frequency trading and volatile markets.
   * **Data Aggregation:** Collects price data off-chain from major exchanges, validating it through digital signatures and WebSocket connections before transmitting to the blockchain.
   * **Applications:** Supports real-time trading, futures, and derivatives markets.
2. **Pyth Network**
   * **Broad Data Sources:** Aggregates information from over 65 sources, including crypto exchanges, stock markets, and forex, ensuring extensive coverage.
   * **High-Frequency Updates:** Capable of processing over 700 price updates per second, utilizing Solana’s fast blockchain infrastructure for sub-second updates.
   * **Cross-Chain Compatibility:** Utilizes the Wormhole protocol for secure data transmission across blockchains, enabling seamless integration with the TON blockchain.

**How Prices Are Formed on Our Platform**

We calculate an index price by aggregating data from both Stork and Pyth Network. This index considers trading volumes from multiple exchanges to create a weighted average price, filtering out anomalies to maintain data integrity. Additionally, the market price is adjusted dynamically based on real-time open interest, reflecting aggregated trading positions. This dual pricing approach ensures accurate representation of both long-term trends and short-term market shifts, providing fair and consistent trading conditions.

By integrating these advanced oracle solutions, our DEX offers reliable, real-time pricing, optimizing the trading experience on the TON blockchain.
