Basic LP calculation question

Suppose we have a ETH-USDC pool when rate of ETH is 1,000.

Suppose total pool size is 20,000: 10,000 ETH and 10,000 USDC.

So quantities supplied at start will be 10 ETH and 10,000 USDC.

Suppose the 1st trade happens: someone wants to swap their 1 ETH using this pool.

What is the formula to determine how much USDC they will get?

(My confusion is in where does k = xy kick in)

Thanks!

View Source

1 thought on “Basic LP calculation question”

  1. Highly recommended [this video](https://youtu.be/1PbZMudPP5E)

    Initially, x*y=k, with x=10 (ETH), y=10,000 (USDC), so k=100,000

    Now, you swap 1ETH, which make x=11 (ETH), k must stay constant, so y=k/x=100,000/11=9090.9

    So, the USDC you receive = y(initial)- y(after you swapped)=10,000-9090.9=909.1

    Hope my answer could help you.

    Reply

Leave a Comment