What is the curve equation difference between the 80/20 pools on Balancer and xyk on Uniswap?
Balancer proposes a general version of AMM on the basis of uniswap, which can change the ratio of the two tokens, such as 80/20 pools. The value of tokenA and tokenB remains 80% and 20% for the 80/20 pools. And what curve relationship will the reserves of the two tokens satisfy?
Assuming that the value of tokenA in the pool is 80% and the value of tokenB is 20% in total value of pool, the reserve amount of tokenA is x, and the reserve amount of tokenB is y, then the two token values satisfy:
y=-(20%/80%)*px — — — — — — — — — — — — -— — — — — -(1)
The exchange price is p, then p=-dy/dx — — — — — — — — — — (2)
(2) Substitute into (1), there are:
dy/dx=-4y/x
dy/y=-4dx/x
After integrating both sides, we get:
lny=-4lnx+C
lny+4lnx=C
ln(x⁴*y)=C
x⁴y=e^C
That is, the general solution is
x⁴y=k
If the percentage of the whole pool for tokenA is r and the percentage of tokenB is 1-r, then the reserve equation is:
80/20 pools when r=0.8.
50/50 pools when r=0.5.