Virtual and Real Reserves in Uniswap v3

Solidity Programming Language
2 min readAug 13, 2021

This is great question. what are the real reserves and virtual reserves ?

The liquidity in Uniswap v3 is allocated within a custom price range.

x: The amount of x token

y:The amount of y token

L²: Liqudity

P= y/x ( This is price of x)

x*y=L²

Some boring math:

x*x*P=L²

x=L / sqrt(P) [ This is x]

y/P * y=L²

y= L * sqrt(P) [ This is y]

The liquidity was distributed uniformly along the price curve between 0 and infinity in Uniswap v1 and v2.

Virtual Reserves

We understand that liquidity is allocated within a custom price range. We called it “real reserves” . Real reserves is only some part of the virtual reserves because reasl reserves is limited by maximum x minimum price(y maximum price) and y minimum price(x maximum price).

real reserves

x-x(pb)=real reserves of x

y-y(pa)=real reserves of y

x(pb)= L / sqrt(pb)

x(pb) is the x amount in Pb price.

y(pa)= L * sqrt(pa)

y(pa) is the y amount in Pa price.

x virtual reserves=x real reserves + x(pb)

y virtual reserves= y real reserves + y(pa)

Dr. Engin YILMAZ

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Solidity Programming Language
Solidity Programming Language

Written by Solidity Programming Language

Solidity basics for beginners: Learn the fundamentals of smart contract development and build your first DApp! #Solidity #Foundry #Ethereum #Opcodes #DApps

No responses yet

Write a response