Chainsight platform demo to integrate with Uniswap V3
- Stores Uniswap V3 prices as time series data
- Calculates a financial index (Realized Volatility)
- Synchronizes the calculated index with other blockchains
The exchange_rate
is calculated by using the value obtained from the following view function of UniswapPoolV3.
- sqrtPriceX96 from UniswapPoolV3#slot0
- blockTimestamp from UniswapPoolV3#observations
- Used for mapping price to the relevant date and time
ex: USDC/WETH
exchange_rate = {(sqrtPriceX96)^2 / 2^192}
* 10^6 // USDC decimals
/ 10^18 // WETH decimals
ref: A primer on Uniswap v3 math: As easy as 1, 2, v3
RVOL is derived by using the exchange_rate Pt
corresponding to a certain time range t
calculated by the above formula, using N
number of data for the period under consideration, and applying the following formula.
ex: Calculate daily RVOL
- t: 1day
- N: 24
- Pt,i: The
i
th exchange rate belonging to periodt
Pt,0
exchange_rate corresponds to YYYYMMDDT00:00:00ZPt,1
exchange_rate corresponds to YYYYMMDDT01:00:00Z
- About Chainsight
- About Integration
- In case of Uniswap: Decentralized Asset Rating Oracles powered by Uniswap v3 and Chainsight