LP tokens in a pool is SQR(Token A * Token B), correct?
If I recalculate one of my pools in this way, I should have about 3000 more LP tokens than are shown. So a difference of about 3%.
What am I missing here? Or is this the current state of the IL in the pool?
there are differences in the datatypes, i think you have calculated with a very high amount of decimals, the code has not so many decimals, that could cause this issue
the sqrt only applies for the initial tokens. after that, the tokens are calculated in relation to the existing liquidity. due to slipage (you provide a different relation than the current one in the pool) the real liquidity will diverge from the sqrt formula. thats why the chain saves the current reserve for A and B and the total amount of liquidity tokens. this way you can calculate your share of the reserve.
Thank you very much! Is there a separate formula to calculate this reserve? Or is it simply the difference? Sorry for the maybe stupid question. I'm trying to understand the whole thing in a language that is not my mother tongue 😉 (maybe I'll be allowed to join the German DeFiChain group again sometime).
the current reserve you get from the chain reserveA, reserveB and the totalLPTokens is in totalLiquidity. your share of assetA is <yourTokens>/totalLiquidity * reserveA
Thank you! But it wasn't the decimal places, I left them out. But I think Kuegi has given me a clue to the explanation.
Oh, thank you, I was on the wrong track! That's right, that's the calculation approach. Embarrassing for me, sorry.
Обсуждают сегодня