Alcor
  • Alcor.exchange
  • What is Alcor Exchange?
  • Home Page Overview
    • Swap
      • Swap Charts
      • Add Liquidity
      • Manage Liquidity
    • Markets
      • Market Exchange
        • Order Books
        • Graph
        • Open Orders
        • Placing Trades
    • OTC
    • NFT
    • Wallet
  • Developers API
    • Amm Swap Contract API
      • Formulas
      • Contracts
      • Examples
    • Market creation
      • Open new market
    • Contract actions
    • Contract Tables
    • API
      • Markets API
      • Account
      • WebSocket
      • Node API
    • Public Alcor Data Access
  • Alcor Swap
    • Referral / Custom Market Fee
    • Introduction
    • Swap Page
    • Locking Liquidity
    • Providing liquidity
      • How to Add Liquidity on Alcor Exchange
    • Ranges: Everything you need to know
      • How to set a Range for your Liquidity position
    • Pool Page
    • Liquidity Provider FAQ
    • Concentrated liquidity FAQ
    • AlcorSwap v2 Price Oracles
      • Alcor Price Oracle vs DelphiOracle
      • Expanding Price Availability with RAM Purchase
      • How to Use Alcor Price Oracle
  • Alcor Farms: Unlocking DeFi Opportunities
    • Creating Farm Incentives - Quick Tutorial
    • Project Farms Unique Link
    • Technical details
  • LSW- Liquid Staked WAX
    • How it works
    • Exchange rate
    • Withdrawal process
  • Adding Token Information
    • Token logo
    • USD Price
  • Swap Widget
    • Swap Chart Widget
  • Networks Features
    • WAX
      • Alcor USDT
  • Additional Docs
  • Definitions
  • FAQ
    • Does Alcor Exchange Have Fees?
    • Whats the difference between using Swap, Market Trade, and OTC?
    • What is a liquidity Pool?
  • Social Media/Contact
Powered by GitBook
On this page

Was this helpful?

  1. Alcor Swap

AlcorSwap v2 Price Oracles

Time-weighted average price (TWAP) overview

PreviousConcentrated liquidity FAQNextAlcor Price Oracle vs DelphiOracle

Last updated 1 year ago

Was this helpful?

By drawing inspiration from , Alcor introduces a decentralized solution to provide accurate asset prices on the blockchain.

Alcor Price Oracle is a mechanism that provides asset prices on the blockchain. Since blockchains are isolated ecosystems, there is no direct way of querying external data, and there are difficulties in ensuring data validity and authenticity.

DelphiOracle is presented as one of the first working solutions to these problems on EOSIO(Antelope). It runs a decentralized network of oracles that fetch asset prices from centralized exchanges via APIs, average them, and provide them on-chain.

DelphiOracle is essentially a smart contract with one state variable, asset price, that can be read by anyone but can only be written to by oracles (top block producers). However, DelphiOracle only provides the last price while the Defi Dapp needs the price by timestamp for various purposes. Furthermore, DelphiOracle exclusively supports a limited number of well-known tokens: BTC/USD, ETH/USD, WAX/USD, EOS/USD, whereas there is a multitude of tokens available on WAX/EOS that require price data for integration with the Defi Dapp.

Manipulation on most AlcorSwap v2 TWAP oracles isn’t currently feasible, bad actors both need to source incredibly high levels of capital and then need to make enough money back to make up for money lost to fees. Make sure that your Dapps use a rolling time window for TWAP to calculate the price because spot prices are easy and relatively cheap to manipulate.

In Alcor, historical price data is stored as an array of observations. Initially, each pool tracks only one observation, overwriting it as new blocks are added. As a result, the data can only be accessed for a limited period. However, any party can expand the period of data availability by paying RAM to increase the number of tracked observations and the maximum of observations is unlimited.

AlcorSwap v2 facilitated the creation of on-chain price oracles known as time-weighted average price () oracles. These oracles are highly decentralized and provide a solution for many of the challenges involved in creating robust blockchain protocols.

TWAP
Uniswap V3 Price Oracle