[UNI-V2-DAI-USDC] Collateral Onboarding Oracle Assessment (MIP10c3-SP22)

Preamble

MIP10c3-SP#: 23
Author(s): Niklas Kunkel (@NiklasKunkel)
Contributors:
Type: Process Component
Oracle Team Name: Green
Status: RFC
Date Proposed: 2020-01-31
Date Ratified: <yyyy-mm-dd>

Specification

Introduction

This Oracle would provide the UNI-V2-DAI-USDC/USD price as part of the collateral onboarding process for the UNI-V2-DAI-USDC 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:

(1) Invariant k = reserve_x * reserve_y

(2) 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.

(3) reserve_x = sqrt(k * price_y / price_x)

(4) 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.

(5) reserve_x = k / reserve_y

(6) reserve_y = k / reserve_x

Once the normalized reserve balances have been calculated the price of the LP token can be derived:

(7) 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:

(8) 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:

(9) price_lo = 2 * sqrt(k * price_x * price_y) / supply_lp

Oracle Supporting Data Model(s)

DAI/USD (canonical)

|    Source     |  Asset Pair   |  Feed Model  |
| :------------ | :------------ | :----------: | 
|      1        |    DAI/USD    |   constant   |

USDC/USD (canonical)

|    Source     |  Asset Pair   |  Feed Model  |
| :------------ | :------------ | :----------: | 
|      1        |   USDC/USD    |   constant   |

Oracle Address

  • Mainnet - UniV2LpOracle - TBD

Supported Tools

UniV2LpOracle - Source Code
UniV2LpOracle - Tests

Remaining Work

  • Deploy Oracle from Factory Contract
  • Update MegaPoker to poke UniV2LpOracle

Summary

This proposal seeks to facilitate the onboarding of UNI-V2-DAI-USDC as a collateral in the Maker Protocol. This benefits the Maker Protocol in a variety of ways. It boost Dai liquidity, which will help strengthen the peg. From a risk perspective, being half Dai is also highly desirable in terms of liquidations due to the value-balancing properties of the pool.

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.

4 Likes

The Curve Stableswap Whitepaper identifies issues with stable price constant-product exchanges. Funds would have better returns on Curve, and we should look into supporting their liquidity tokens as well.

2 Likes

I believe while it is a problem for them, It is probably a solution for us.

a dai is 1:1 with usd what ever the market decide and arbitrage in this way is all welcome.
The issue is probably more with the usdc 1:1, but we have decided to peg the dai against the usdc so …

Also, here we don’t arbitrage the uniswap pool/ curve we find a value to allow liquidation with probably a 10% margin which is a level up.

Regarding the curve liquidity token, as far as I am aware of the only plus value is to lock your liquidity token. If it is unlocked you can’t get the CRV reward so it is point-less.

You are mistaken. The problem with the pool is that it only gets 6% APY, and that only fools trade on it. As aggregators improve we can expect fewer fools and the APY would further decrease. Whereas on Curve we see a steady 11-20% APY and much higher volumes.

1 Like

The DAI-USDC Uniswap APY is especially pathetic considering that the Compound supply rates are currently higher. Its liquidity is systemically under-utilized, as discussed in the stableswap whitepaper, linked above.

1 Like

There is not 11% return. it is ~1% plus some share distribution which currently make up the 10% left, that won’t last forever it is a market gap. Same for Compound you can’t pay more than what you get forever. At the opposite Uniswap is not expecting to lose monies.

The uniswap pool will be arbitrated forever as lot of contract uses it without the ability to change the router cause of security/bad coding that is without counting on the uniswap website direct stream. This white-paper is clearly oriented and here for a marketing reason.

I am not too sure if that is your concern.

I agree. I support the collateral proposal. Long ago I proposed we support Uniswap liquidity tokens as collateral for all assets we support.

The reason was that faster-appreciating collateral can support a higher DSR. All of our collateral should be earning the highest possible interest. But I know that Curve support is distant because in order to support any Curve we’d need to support their underlying tokens.

I share your concerns with how APY is measured. Most of the YieldFarming mechanics are ponzi schemes. However, the regular Compound supply interest currently exceeds 6% on both DAI and USDC.

2 Likes

I have 3 MIPs for that 32/35/36.
There is also cropjoin. You can push for them to be voted but it is up to the governance now and share holder.

1 Like

I think this is the biggest limiting factor with Curve. We either need to accept exposure to USDT (3pool, y pool, etc), or we need to first review Compound cDAI/cUSDC to onboard the Compound pool (which includes the risk of something going wrong at Compound).

UNI-V2-DAI-USDC is relatively safe, a positive tradeoff of the less efficient AMM formula is lower potential losses if USDC loses its peg.

1 Like