3

Let's use this transaction as an example.

Here 1 BUSD was transferred to Zombie / BUSD LP in exchange for 172054109197 Zombie tokens. (3511308350 (2%) Zombie tokens were burned as part of the transaction.)

Here is the Swap event:

amount0In: 0
amount1In: 1000000000000000000
amount0Out: 175565417547
amount1Out: 0

Prior to the Swap, the reserve values were:

reserve0: 1203765031
reserve1: 6402195517789394391

after Swap, reserve values were updated to:

reserve0: 173257874228
reserve1: 44614233592769925

Everywhere that I've read, it is stated that constant product formula (x*y=k) requires that the k remains constant. However, this isn't the case here.

1203765031*6402195517789394391=7,706,739,085,939,811,390,553,341,121
173257874228*44614233592769925=7,729,767,272,594,744,235,790,992,900

Am I misunderstanding the function of the formula or is something else going on here?

1

The product k would actually be constant, if the swap fee was 0%. Since AMMs usually have a fee, the product of the reserves is not really a constant in practice.

The name ‘constant product market’ comes from the fact that, when the fee is zero (i.e., γ = 1), any trade ∆β to ∆α must change the reserves in such a way that the product RαRβ remains equal to the constant k.

Source: An analysis of Uniswap markets

1
  • That makes sense. in this case, the difference is 0.2%, which aligns with what the PancakeSwap fees are. – Gajus Jun 1 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.