My Crypto Investments #1 — Uniswap v3

Yoda Defi
6 min readMay 7, 2021

Recently (5th of May, 2021) Uniswap has released 3rd version of its well known Ethereum protocol.

Disclaimer

This article should not be used as an investment advice. Use this text and data at your own risk. Please validate all math and data by yourself.

What Uniswap is?

Uniswap is an open source “crypto exchange protocol” (code, whitepaper, etc is open) and infrastructure (website, license etc are restricted) that can be used:

  1. by Crypto users — to swap different tokens.
    Say ETH <-> Dai or even
    ETH <-> SOME_VERY_RARE_TOKEN_NOBODY_KNOWS_OF
  2. by Crypto projects — to provide liquidity to their tokens, i.e. “make a market”
  3. by Crypto hodlers — to earn fees on each swap (be a Liquidity Provider).

We are currently interested in UseCase#3.

This type of decentralized crypto exchange is called either “automated market maker” or “liquidity mining” as long as it doesn’t use order books for trades.

p.s. Check Bancor to see previous “leader” of the Atomated Market Making world.

How to earn money using Uniswap v3?

Anyone can create a new token pool or add liquidity to existing one. By putting your money into the pool you generate rewards proportional to your stake in that particular pool.

Let’s check some stats

As an example, i am going to show you Dai <-> ETH pool stats here https://www.liquidityfolio.com/app/3ed2dd6f0c95400e840c0990d0ad1d0e/pools

So 1278 ETH per month is the current reward rate for ALL liquidity providers in that particular Dai <-> ETH pool. If you provide 10% of that liquidity, then you will get 127.8 ETH rewards per month. Pretty simple.

How Uniswap market making works?

Example1

  • Let’s assume there are 10 ETH in the pool
  • Current cost of ETH is $3500
  • So we create new pool and put 35000 Dais in the pool to keep ratio

Uniswap uses super-simple formula to keep ratio constant:
35000 of tokens A * 10 tokens B = 350000

When someone wants to swap his 1 ETH into Dai using that pool he sends his ether to the pool, and now we have this formula:
31818,18 of tokens A * 11 tokens B = 350000

So user got 35000–31818,18=3181,82 Dai for one Ether. Not including fees!

Example2

  • Let’s assume there are 10000 ETH in the pool
  • Current cost of ETH is $3500
  • So we crete new pool and put 35000000 Dais in the pool to keep 1:1 ratio

Uniswap uses super-simple formula to keep ratio constant:
35000000 of tokens A * 10000 tokens B = 350000000000

When someone wants to swap his 1 ETH into Dai using that pool he sends his ether to the pool, and now we have this formula:
34996500,35 of tokens A * 10001 tokens B = 350000000000

So user got 35000000–34996500,35=3499,65 Dai for one Ether. Not including fees! Pretty close to the current “market” price.

Now let’s put money into the Dai <-> ETH pool

Let’s imagine i have 1488 Dai token and 0.40 ETH.
At time of writing it is $1488 + $3436 * 0.4 = $1488 + $1374 = $2862 worth of crypto.

Go to Uniswap app, then click on “New position” and select appropriate token pair:

As you can see here, you should also select min and max prices.
This is new feature in v3 version.

By specifying the price range, you provide liquidity and earn fees only when current price is within that range.

If the range is narrow -> you get more money when price is in that range.

If the range is wide -> you get less money, but chances are much higher that you generate fees at all.

How to select correct price range?

I am going to hold my liquidity locked for 30 days, and the final ETH price is going to be $4000.

Now let’s go to https://defi-lab.xyz/ and test 2 strategies:

  • min is 3313, max is 3691 (i assume time in range would be 15%)
  • min is 1000, max is 5000 (i assume time in range would be 100%)

As you can see here, i will generate $94.83 fees using first strategy and $51.34 using second. But the caveat here is “V2 fee” (APR) value that is set to 20%. And “time in range” parameter is very hard to predict too.

Ok, what’s my ROI after 1 day?

I selected first strategy (3313… 3691) and sent my 1488 Dai and 0.454 ETH into the pool.

As long as ETH price is within that price range i will generate some fees.

Opening position required me to spend 0,002091 ETH ($7,3USD) plus 0,02015582 ETH ($70,36) on Ethereum gas fees.

As ETH/Dai price goes up or down liquidity proportion is changed. As you can see on the pricture.

After 24 hours

Eventually ETH price went down and in 24 hours my results are as follows:

You can see here that proportion of Dai/ETH changed drastically and i was always in the price range.

Here $36.30 can’t even fix my gas.

Still, $36.30 per day means “V2 fee %” is even higher in my case than 20% that was set in the calculator above.

Effective “V2 fee” should be about 35%.

ROI after 1 day

Please see final calculations here — https://docs.google.com/spreadsheets/d/1qwA58_87Gq-gAkuRRUxhUYyPTmGQFyU2_U2KB12ZUeg/edit?usp=sharing

ROI after 5 days

I will keep you updated

ROI after 10 days

I will keep you updated

Three Uniswap Downsides

As you can see, there are some downsides in using Uniswap today:

  1. The problem that is called “Impermanent loss”.
  2. Difficult to calculate reward/risk ratio
  3. Difficult to calculate proper price ranges and predict rewards. This can be fixed by specifying really large range. And also you can always close your position and open new one with different price range (at gas costs!)

“Add liquidity UI now requires a master’s degree to figure out how to price your liquidity position. It’s a huge step backward from the simplicity we had in v2.”

Impermanent Loss

If i withdraw 1387 Dais + 0,4318 ETH then the value would be $2894,01. But i invested $2927,11. I lost $33,1 just because of “impermanent loss”. This can’t be fixed and should be taken into account.

If price of ETH goes 2x then i loose ~5.7%.
If price of ETH goes 1/2x then i loose ~5.7% too.

THAT’S WHY UNISWAP is a PREDICTION MARKET.
MORE CLOSELY YOU PREDICT -> MORE YOU EARN.
IF YOUR RANGE IS NARROW AND ASSET PRICE IS IN THE RANGE -> YOU GET a lot.

I wonder how Uniswap can be used to forecast ETH price movements.

Last Uniswap problem to mention

And last problem worth noting.

If market goes up or down you will be left with ~100% of the token that has LOST its price, and is probably LOOSING its price even more. So in my case, if ETH will cost $1000, then my position would contain only ETH and no Dai.

It means that by providing liquidity i effectively swapped all my Dai into ETHer just like being on exchange. And as long as ETH market goes further down i have chosen wrong token ;-)

--

--