Uniswap / v2-core

🦄 🦄 Core smart contracts of Uniswap V2
https://uniswap.org/docs
GNU General Public License v3.0
2.93k stars 3.15k forks source link

How Pool Tokens Calculated? #94

Closed mustafatalha closed 4 years ago

mustafatalha commented 4 years ago

Hello,

I wonder, how are the pool tokens that given when we add liquidity in uniswap is calculating? I read the docs and I know that these tokens represent our position in pool, but how they are calculating in uniswap-v2-core?

I read https://uniswap.org/docs/v2/core-concepts/pools/ and didn't find any answer.

Thank you.

mustafatalha commented 4 years ago

I found the anwser in the code. I am putting here if somebody wonder: https://github.com/Uniswap/uniswap-v2-core/blob/4dd59067c76dea4a0e8e4bfdda41877a6b16dedc/contracts/UniswapV2Pair.sol#L110