Disecting Constant Product formula

The constant product is used in decentralized finance. It is used to calculate how much someone gets for currency $Y$ when giving funds of currency $X$. $X$ and $Y$ indicate the size of funds in the corresponding currencies, $z$ stands for the amount of funds of currency $X$ given into the pool, $a$ stands for the amount of funds received in currency $Y$.

$k = X * Y$
$a = Y - k / (X + z)$

I want to split $Y$ into $Y_1$ and $Y_2$:

$k = X * (Y_1 + Y_2)$
$a = (Y_1 + Y_2) - k / (X + z)$

Now my question is: How much does someone have to give to exactly receive $Y_1$? What the size of $z$ so that $a = Y_1$?

Example:
$X = 100, Y_1 = 50, Y_2 = 50, z = 10$
$k = 100 *(50+50)$
$a = (50+50) - 10000 / (100+10) = 9.09...$

So here the question is how to calculate $z$ so that $a=Y_1=50$

  • Aman R Aman R
    0

    Not complete question, define z

  • Maxbry Maxbry
    0

    Thanks for your comment. I edited the question and hope to have added more clearity.

  • Erdos Erdos
    0

    Your question is unclear. Does "z stands for the amount of funds of currency X" mean z=X?

    • Erdos Erdos
      0

      If not, what does X stand for her?

    • Maxbry Maxbry
      0

      No, z stands the amount of funds which are of the same currency as X

Answer

Answers can be viewed only if
  1. The questioner was satisfied and accepted the answer, or
  2. The answer was disputed, but the judge evaluated it as 100% correct.
View the answer
Erdos Erdos
4.6K
  • Erdos Erdos
    0

    Leave a comment if you need any clarifications.

The answer is accepted.
Join Matchmaticians Affiliate Marketing Program to earn up to 50% commission on every question your affiliated users ask or answer.