Integral Docs

Oracle and Prices

This page explains the working mechanism of Integral's oracle, and summarizes how the protocol make sure that the time-weighted average price we use is fair, reliable, and hard to manipulate.

What's the role of oracle in Integral?

Oracle in the Integral is a smart contract that holds the reference to the external price oracle and contains the math that swaps involve (given tokenIn calculate tokenOut etc).
Currently Integral supports Uniswap and Sushiswap pools as oracle.

What is unique about Integral and its oracle?

DEXs like Uniswap relies on curves to deduce price between two assets based on their amounts in the pool. A large swap will both increase and decrease the amount of assets, thus changing the ratio/price substantially and resulting price impact.
This does not apply to Integral, whose execution prices is solely determined by the oracle. If there is enough capital in the liquidity pool, your order will be completely filled with 1 SINGLE TWAP, without experiencing any price impact.

How Integral interacts with Uniswap to calculate TWAP?

Once the order is submitted, it has to wait in the smart contract contract for 30 minutes before interacting with the pool. During this time, the protocol will query Uniswap v2 twice: once when the delay starts, and once when the delay ends.
After the delay time elapses, Integral will calculate the TWAP by doing the calculations above. If the actual amount of tokens you'll receive from TWAP is larger than or equal to the Minimum Received, your order will be executed at TWAP, and you will receive any positive slippage incurred. Otherwise it will be reverted to protect your funds from excessive slippage.
Minimum Received = Estimated Amount * (1 - Slippage Tolerance)