Price Oracle
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.
Last updated