Skip to content

Oracle โ€‹

What Is a Crypto Oracle? โ€‹

A crypto oracle is a service that provides external price data to smart contracts on the blockchain. Oracles are essential for decentralized exchanges (DEXs) to ensure that on-chain trading and settlement reflect real-world asset prices.

How Our Oracle System Works โ€‹

  • USDC Price:
    The price of USDC is hardcoded to always be 1 USD. This means all calculations and settlements involving USDC assume a fixed value, ensuring stability for USD-pegged trades.

  • NVT (Neony Vault) Price:
    The price is dynamically calculated based on current balance and position of Vault

  • Other Tokens:
    All other token prices are provided by a heartbeat oracle. This oracle pushes the latest price data to the blockchain at 1-second intervals.

    INFO

    • The heartbeat oracle is a trusted off-chain service that fetches prices from reliable sources and submits them to the blockchain.
    • This ensures that the DEX always has up-to-date and accurate price information for all supported tokens.

Why Use a Heartbeat Oracle? โ€‹

  • High Frequency:
    By updating every second, the oracle minimizes price lag and reduces the risk of manipulation or stale data.
  • Reliability:
    The oracle aggregates prices from multiple sources, providing robust and tamper-resistant data.
  • Transparency:
    All price updates are recorded on-chain, allowing anyone to verify the current and historical prices used by the DEX.

Example: Price Feeds โ€‹

TokenPrice SourceUpdate Frequency
USDCHardcoded (1 USD)N/A
BTCHeartbeat Oracle1 second
ETHHeartbeat Oracle1 second
...Heartbeat Oracle1 second

How Prices Are Used โ€‹

  • Spot and Perpetual Trading:
    The DEX uses the latest on-chain price for each token to calculate trade execution, margin requirements, liquidations, and funding rates.
  • Stability for USDC:
    By hardcoding USDC to 1 USD, the system ensures a stable base for all USD-denominated trades and settlements.

Security and Trust โ€‹

TIP

  • The heartbeat oracle is operated by a trusted party and is monitored for uptime and accuracy.
  • All price updates are transparent and auditable on-chain.
  • In the event of an oracle failure, trading may be paused to protect users.

Summary โ€‹

  • USDC is always valued at 1 USD.
  • All other tokens use a high-frequency heartbeat oracle for price data.
  • This design ensures accurate, up-to-date, and reliable pricing for all DEX operations.