Pangea Swap
English
English
  • Introduction
  • Protocol Overview
  • Disclaimer
    • Risk & Security
    • Terms of Use
  • Updates
  • Audit
  • concentrated liquidity
    • Weakness of V2 DEXs: Low Liquidity utilization rate
    • Solution by V3 DEXs: Concentrated Liquidity
    • Concentrated Liquidity FAQ
  • Connectivity
    • Customizable Pool
  • Governance
    • STONE
      • STONE Distribution Plan
      • Tokenomics (Before)
      • Tokenomics (After)
      • Growth Fund History
    • Contribution Point NFT
  • Guide
    • SWAP
    • Add Liquidity
      • Add liquidity (Preset)
      • Add liquidity (Custom)
    • STONE Staking
    • Revenue Sharing
    • FAQ
  • Growth Partnership
    • Swapscanner
    • ISKRA
  • event
    • Promotion
  • Developers
    • Concept Overview
      • Problem : Lazy Liquidity
      • Liquidity Concentration
      • Position & Risk
      • Price Tick
      • Position NFT
      • Fees
      • Flash Loan
    • Contracts
      • Core Contracts
        • MasterDeployer
        • ConcentratedLiquidityPoolFactory
        • ConcentratedLiquidityPool
        • ConcentratedLiquidityPoolManager
        • PoolRouter
        • PoolLogger
        • AirdropDistributor
      • Contribution Point NFT
      • Price Oracle
    • Interacting with the Protocol
      • Setting up Local Test Environment
        • Test env. commands
      • Getting Pangea Pool Info
      • Creating Pangea Pool
      • Mint Position (add liquidity)
      • Burn Position (remove liquidity)
      • Claim Fee
      • Swap
  • Community
    • Website
    • Discord
    • Telegram
    • Medium
    • Twitter
    • Opensea - Position NFT
    • Opensea - CP NFT
    • GitHub
    • Testnet
    • E-mail
Powered by GitBook
On this page
  1. Developers
  2. Contracts

Price Oracle

PreviousContribution Point NFTNextInteracting with the Protocol

Last updated 2 years ago

The valuation of the token price and the asset value of the liquidity position are important factors in LP's portfolio management. After creating a liquidity position, the LP should be able to make decisions such as additional deposit/holding/withdrawal by continuously monitoring the change in the value of the position. To this end, Pangea Swap utilizes Price Oracle to provide users with information about the price of tokens and the value of liquidity positions.

In Pangea Swap, tokens are classified into Base Token and Derived Token and price is calculated in different ways. Tokens whose prices can be directly received from Witnet, an external oracle, are classified as Base Tokens, and KLAY and USDT are these. Other tokens are classified as Derived Tokens, and their prices are calculated through the exchange rates of liquidity pools in the Klaytn ecosystem. More specifically, the price of Derived Token is calculated based on the ratio of reserve of the liquidity pools of 8 DEXs such as Klayswap, Claimswap, and Pala.

Since the price of the token changes in real time whenever a swap occurs, volatility may become excessively high if the price is calculated every spot moments. To alleviate this part, the price of the tokens shown in the Pangea Swap is calculated using the SMA (Simple Moving Average) method, and the average price for 10 minutes is used. More specifically, the Klaytn network provides past data in units of 128 blocks, so the price is calculated as the average of 5 observations between 640 (128*5) blocks.

These processes are published in the repository below. It will be further advanced as various external oracles such as Chainlink are added in the future.

GitHub - pangea-protocol/pangea-onchain-price-oracle: Estimating Dollar price of tokens using liquidity pool on klaytnGitHub
Logo