Frankencoin-ZCHF / FrankenCoin

Frankencoin Smart Contracts
MIT License
12 stars 4 forks source link

Uniswap Pool Filler #10

Open luziusmeisser opened 1 year ago

luziusmeisser commented 1 year ago

How about creating a special minter contract with the goal of providing Uniswap liquidity against another stablecoin (let's say DAI) and the following properties:

Details to be figured out. :) But it would help us a lot to get highly liquid pools on DEXes.

luziusmeisser commented 1 month ago

Example

We start at dollar-franc parity, i.e. 1 USD = 1 CHF. A user provides 100'000'000 USDC to the pool filler and borrows 100'000'000 ZCHF on top of that to create a pool with a symmetric range around 1 CHF from 0.95 CHF to 1.05 CHF. The users starts with a net wealth of 100'000'000 USD = 100'000'000 CHF = Pool Value - ZCHF debt.

Over the course of time, the dollar falls to 0.95 CHF and the pool now contains about 202'500'000 USDC. The user's new net wealth is roughly 202'500'000 USDC - 100'000'000 ZCHF = 97'500'000 USDC. So they lost some money in dollar terms and even more in ZCHF terms as 97'500'000 USDC = 92'500'000 ZCHF at this point.

If, somewhat later, the dollar climbs to 1.05 CHF, the pool will contain 202'500'000 ZCHF. In that case, wealth in ZCHF has increased to 202'500'000 CHF - 100'000'000 CHF = 102'500'000 CHF. But wealth in dollar terms has declined to about 92'500'000 USD.

So at average, they would lose about 5% of their wealth, regardless of whether it is measured in dollar of zchf terms. This is in line with the basic logic that the impermanent loss of the pure position is 2.5%, but it is leveraged 2x, so the total loss is about 5%.

Disclaimer: all calculations have been made with "linear" calculations and are therefore only an approximation to the actual values. But overall, the liquidity amplifier allows users to fill a uniswap pool with a leverage. Doing so will be profitable when the fees outweigh the impermanent loss, i.e. when the exchange rate goes back and forth often enough.

Analysis

The advantage of the liquidity amplifier is that it contains an interest-free loan, such that providing liquidity on uniswap becomes less expensive. In a competitive system, this should lead to more liquidity and lower fees for the end users.

luziusmeisser commented 4 weeks ago

Proof of concept can be found here: https://github.com/Frankencoin-ZCHF/FrankenCoin/blob/amplifier/contracts/Amplifier.sol