Comment on page

VWAP Oracles

Integrate the Mute Switch LP Oracles into your dApp
All LP pair contracts update and record their VWAP based on the cumulative trade volume over the last 30 minutes. You can use this information to access onchain oracle price fees by calling the specific pair with the function calls below.


The functions are available using the pair abi, and specifying the proper LP pair you are trying to fetch prices from, e.g. MUTE/ETH.
// returns the current VWAP over the last 30 minute window
function current(address tokenIn, uint amountIn) external view returns (uint amountOut)
// returns the VWAP over the granularity amount, 30 min increments
// e.g. granularity = 2 returns VWAP of the last 60 min window (2 sample points)
function quote(address tokenIn, uint amountIn, uint granularity) external view returns (uint amountOut)