I implemented the logic of the uniswap protocol on my blockchain using uniswap v2 whitepaper. To check if its working, I am comparing it with real examples of creating liquidity. I come across examples of calculating the creation of a liquidity pool with different results, which are described by the sminted = √(xdeposited · ydeposited) formula. Here are some of them:

Correct calculation for example Uniswap V2: COIN 11 :

10000000e18 * 1900e18 = 19000000000e36
sqrt(19000000000e36) - 1000 = 137840487520902217678559

Incorrect calculation for the Uniswap V2: USDT 2 example:

sqrt(1.103511e18 * 0.005e18) - 1000 = 74280245364 // but in the transaction itself, the number of pool shares is 74280245364 

Also, here are some more correct and incorrect calculations: USDT-HUB incorrect, correct, incorrect, incorrect, correct, incorrect.

Could I have missed something in the calculations?

  • There is no question here! – goodvibration Nov 27 '20 at 11:01
  • could I have missed something in the calculations? – klim0v Nov 27 '20 at 11:17

Your Answer

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

Browse other questions tagged or ask your own question.