MIP10c3-SP#: 28 Author(s): Niklas Kunkel (@NiklasKunkel) Contributors: Type: Process Component Oracle Team Name: Green Status: RFC Date Proposed: 2020-02-20 Date Ratified: <yyyy-mm-dd>
This Oracle would provide the UNI-V2-DAI-USDT/USD price as part of the collateral onboarding process for the UNI-V2-DAI-USDT LP token.
Oracle Data Model
A smart contract utilizing Uniswap primitives and liquidity reserves to calculate the price of a Uniswap Liquidity Provider (LP) token.
The reserves of the Uniswap pool, and the supply of the Uniswap LP token are used as inputs to the model. This model utilizes MakerDAO Oracles to price the underlying assets.
This model utilizes the following base assumptions:
Invariant k = reserve_x * reserve_y
reserve_x * price_x = reserve_y * price_y (only holds true at steady-state)
Combining (1) and (2) allows us to derive the formulas for calculating the “normalized” reserve balances of the underlying assets given the invariant k and prices of the underlying assets.
reserve_x = sqrt(k * price_y / price_x)
reserve_y = sqrt*(k * price_x / price_y)
Alternatively given one calculated normalized reserve, one can calculate the other using a mutation of (1).
This is useful for optimizing gas since calculating the square root is an expensive operation.
reserve_x = k / reserve_y
reserve_y = k / reserve_x
Once the normalized reserve balances have been calculated the price of the LP token can be derived:
price_lp = ( (reserve_x * price_x) + (reserve_y * price_y) ) / supply_lp
Substitute of (3), (4) and (7) gives us the following model for calculating the price of a Uniswap V2 LP token:
price_lp = ( (sqrt(k * price_y / price_x) * price_x) + (sqrt(k * price_x / price_y) * price_y) ) / supply_lp
This can be simplified to:
price_lo = 2 * sqrt(k * price_x * price_y) / supply_lp
Oracle Supporting Data Model(s)
| Source | Asset Pair | Feed Model | | :------------ | :------------ | :----------: | | 1 | DAI/USD | constant |
| Source | Asset Pair | Feed Model | | :------------ | :------------ | :----------: | | Binance | BTC/USDT | Median | | FTX | ETH/USDT | | | Huobi | ETH/USDT | | | Kraken | USDT/USD | | | OKEx | BTC/USDT | |
- Mainnet - UniV2LpOracle - TBD
- Deploy Oracle from Factory Contract
This proposal would create an Oracle for UNIV2-DAI-USDT/USD as part of the collateral onboarding process. It uses the existing USDT/USD Oracle the Maker Protocol utilizes and a static value of 1 DAI/USD to price the pair component tokens.
While current liquidity of the DAI-USDT Uniswap pool is limited, incentivizing Dai liquidity is a strategic initiave for the Domain Teams. This onboarding can be considered experimental in nature to determine if the Maker Protocol can boostrap liquidity.
The Oracle Domain Team is recommending to limit the debt ceiling of 3M at this time to limit Oracle risk. Audits for the LP Oracle contract are currently underway with ABDK. Upon successful audits, the community can start to consider raising debt ceilings.