 # Uniswap liquidity shares（流动性代币份额）

Uniswap v2 initially mints shares equal to the geometric mean of the amounts deposited:

s_minted =sqrt(x_deposited · y_deposited)

This formula ensures that the value of a liquidity pool share at any time is essentially independent of the ratio at which liquidity was initially deposited. For example, suppose that the price of 1 ABC is currently 100 XYZ. If the initial deposit had been 2 ABC and 200 XYZ (a ratio of 1:100), the depositor would have received √(2 · 200) = 20 shares. Those shares should now still be worth 2 ABC and 200 XYZ, plus accumulated fees. If the initial deposit had been 2 ABC and 800 XYZ (a ratio of 1:400), the depositor would have received √(2 · 800) = 40 pool shares.

The above formula ensures that a liquidity pool share will never be worth less than the geometric mean of the reserves in that pool. However, it is possible for the value of a liquidity pool share to grow over time, either by accumulating trading fees or through “donations” to the liquidity pool. In theory, this could result in a situation where the value of the minimum quantity of liquidity pool shares (1e-18 pool shares) is worth so much that it becomes infeasible for small liquidity providers to provide any liquidity.

To mitigate this, Uniswap v2 burns the first 1e-15 (0.000000000000001) pool shares that are minted (1000 times the minimum quantity of pool shares), sending them to the zero address instead of to the minter. This should be a negligible cost for almost any token pair.11 But it dramatically increases the cost of the above attack. In order to raise the value of a liquidity pool share to \$100, the attacker would need to donate \$100,000 to the pool, which would be permanently locked up as liquidity.

3.162/34.785100%=9.09%, 而 10/110100%=9.09%。也就是流动性提供者充入的资金在整个pool中所占的份额，和他能获得的pool token数在整个pool tokens中的比例是相同的。

sqrt[(TokenA_reserve-amount + TokenA_deposit-amount) * (TokenB_reserve-amount + TokenB_ deposit-amount)] - sqrt(TokenA_reserve-amount * TokenB_reserve-amount)