I’m trying to figure out how tokens that contribute some proportion of each trade to liquidity don’t end up violating the
x * y = k constraint with AMMs.
Start with a liquidity pool of 100 of coin X and 100 of coin Y.
Someone swaps 10 of coin X:
100 * 100 = (100 + 10) * (100 - y) => y = 9.1
However, let’s say token Y sends 10% of every trade back to the liquidity pool.
In this case, when someone swaps 10 of coin X, they receive
9.1 * 0.9 = 8.19 of coin Y and
9.1 * 0.1 = 0.91 of coin Y gets put back into the liquidity pool. Our new pool holds 110 of coin X, and
90.9 + 0.91 = 91.8 of coin Y. However, 110 * 91.8 = 10098 > 10000, so now
x * y > k which I thought wasn’t allowed. Does anyone understand how to reconcile this? Thanks!