Comment on page
😁
How AMM works
UniswapV2's AMM is "Constant Product Market Maker" that calculates price based on a formula
x * y = k
. where x
and y
are amount of each token reserved in a pool. When trader want to swap dx
for dy
, y_out
is calculated according to below function.
(Note that dx = - x_in
, dy = y_in
because trader adds dx
and removes dy
to the pool)When a pool stakes pooled ETH and if
x_0
represents actual reserve of ETH, the bonding curve collapses because k
decreases pro rata amount of staked ETH. To prevent this, we allow x_0
to count amount of staked ETH so that the bonding curve doesn't change at all. This approach does not lose any amount of ETH under the assumption that LSD does not collapse.Last modified 8mo ago