Lesson 16 - Changes in Liquidity

px=yx=ynewxnew=y+Δyx+Δx
px⋅(x+Δx)=y+Δy
yx⋅(x+Δx)=y+Δy
y+yΔxx=y+Δy
Δy=yΔxx

Liquidity changes the invariant:

xnew⋅ynew=knew
(x+Δx)⋅(y+Δy)=knew
xy+xΔy+yΔx+Δx⋅Δy=knew
k+xΔy+yΔx+Δx⋅Δy=knew

Minting or burning of pool shares:

For Uniswap 2, this is the formula for the initial pool shares:

initialpoolshares=initialTokenY⋅initialTokenY
Sp=x0⋅y0

Once the pool exists, the change in share pools as liquidity is added:

ΔSpSp=Δxx

Snew=Sp+ΔSp=Sp+Sp⋅Δxx

Agent shares then are the additional shares the agent receives of the total Shares, proportional to the amount contributed.

This is the same the amount of additional Pool Shares minted to accomodate the increased liquidity:

newAP=AP+Sp⋅Δxx