Uniquote, Unihedge, and UniswapV2Oracle
We recently wrote about MetaWallet, a gasless wallet for Ethereum apps. Which is made possible thanks to the Keep3r Network, a coordination and incentivization layer for third party execution.
The second system made possible by Keep3r Network is Unihedge, an impermanent loss mitigation system, however this post is not to introduce Unihedge, instead it is to introduce two building blocks required for Unihedge to function; UniswapV2Oracle, and Uniquote.
Uniquote, is a simple liquidity provider (LP) pricing system, it denominates your liquidity into one of the two pairs. So you can quote ETH-WBTC LP tokens as ETH denominated or WBTC denominated. This is an important building block to pricing LP tokens, as we believe LP tokens will be used as collateral in many more subsystems (Unihedge and Uniloan, just to name two).
UniswapV2Oracle is an on-chain oracle for UniswapV2 pairs. It allows any pair to be added in a permissionless fashion.
UniswapV2Oracles are sliding window oracles that uses observations collected over a window to provide moving price averages in the past
windowSize with a precision of
windowSize / granularity.
windowSize was set to
4 hours. Funding rates on major perpetual platforms are updated roughly every
8 hours, for this reason
4 hours was selected. The granularity is set to
4, translating to roughly
1 reading every
UniswapV2Oracle is an oracle of last resort and should be used for pairs not normally supported by other oracles. The cost to attack these readings is to manipulate the 4 readings in a given window, while this is costly and not guaranteed, it is possible, and as such we recommend this as a fallback mechanism or to be used for pairs not well supported by core oracle providers.