On-chain price feeds are a critical component for many decentralized financial applications including those similar to derivatives, lending, margin trading, prediction markets and more. Despite closely tracking the real-world price most of the time, current subdex implementation cannot be used safely as a price oracle because the price can move significantly in a short period of time.
Proposal
Introduce functionality to store cumulative price data on-chain (variable, which represents a sum of the price for every second in the entire history of the liquidity pair existence)
This variable can subsequently be used to track accurate time-weighted average prices (TWAPs) across any time interval.
Motivation
Proposal
Use https://uniswap.org/blog/uniswap-v2/#price-oracles for reference