How to calculate Deposit Amounts for Adding Liquidity within Uniswap V3

Viewed 1613

Add Liquidity To Uniswap V3

Whilst adding liquidity to a new pool within Uniswap V3, I am trying to calculate the formula for the 'Deposit Amounts' on any given pair.

For example, lets take the pair ETH/USDC

Current Price: 2172.05 Set price Rangle -20% & +20%

Min Price: 1747.7 Max Price: 2612.4

ETH: 0.394064 ($854.888) USDC: 1000 ($1000)

How is the ETH dollar amount calculated and what is the formula? (How did Uniswap get ETH to $854.888 ???)

ps: I have looked at the Uniswap V3 white paper https://uniswap.org/whitepaper-v3.pdf but need a step by step layman explanation. Cheers!

Additional

I have been reading the following article and the answer lies within the formulas below: uniswap-deep-dive-into-v3-technical-white-paper Source: uniswap-deep-dive-into-v3-technical-white-paper

2 Answers

This question might be a bit off-topic for SO, but I believe it will be useful for people anyway. Here is my answer...

Uniswap gave you the USD value of ETH amount you entered, just for convenience, using an oracle price. It's not a parameter of this deposit operation.

There are only 3 parameters here:

  • Asset A amount
  • Asset B amount
  • Price range

Asset A (ETH in your instance) ratio to Asset B (USDC in your instance) determines the equilibrium point. For example, if you deposit 1 Ether and 1000 USDC, then the equilibrium point will be ETH = 1000 USDC. Lastly, you define a price range to specify the range you want your deposit to be functional. By limiting the price range of your deposit, you increase the efficiency of the capital (deposit) in a given range. This involves quite a bit of math to explain but let me try to explain in a nutshell: Basically, automated market makers work on this equation: a * b = k. This implies when a goes to infinity b goes to zero and vice-versa. Because of this 'liquidity' is distributed over 0 to infinity, uniformly. When you put price ranges instead, you 'concentrate' liquidity inside the range, at expense of outside-range liquidity. Thus you increase the efficiency of capital.

Related