5/5
## Pool Shares We've been talking about pool shares and liquidity, so let's summarise what we've learned about this. We learned that the number of shares we need to mint is described by the equation below. ``` S = (L1 - L0) / L0 * T ``` This equation uses the following variables: * **S** = shares to mint * **T** = total shares * **L1** = liquidity after * **L0** = liquidity before We also saw that the expression (L1 - L0) / L0 can be simplified in a few ways. This expression is equal to both dx / x0 and dy / y0, where: * **dx** represents the change in the amount of token X we hold * **x0** is the initial amount of token X * **dy** represents the change in the amount of token Y we hold * **y0** is the initial amount of token Y. We can express all of this in the equation below: ``` (L1 - L0) / L0 = dx / x0 = dy / y0 ``` We saw that this equation holds true in all three ways of defining the pool value function. If we substitute (L1 - L0) / L0 in the first equation, we get: ``` S = dx / x0 * T = dy / y0 * T ``` This equation tells us that the number of shares to mint is equal to dx / x0 times the total shares, and it's also equal to dy / y0 times the total shares.
A detailed explanation of how to calculate pool shares in a liquidity pool - This lesson covers calculating the number of shares to be minted in a liquidity pool based on the liquidity before and after adding liquidity. The lesson also examines how to relate the changes in liquidity in a pool to the changes in the token amounts.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
How to use Uniswap v2 dex and contracts
Interacting with the Uniswap v2 router and factory
How to create Uniswap v2 liquidity pools
How to add liquidity to Uniswap v2 pools
Swaps, flash swaps, flash swap arbitrage, and time-weighted average price (TWAP)
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on May 15, 2025
Duration: 14min
Duration: 1h 20min
Duration: 10min
Duration: 54min
Duration: 25min
Duration: 26min
Duration: 1h 03min
Duration: 59min
Course Overview
About the course
How to use Uniswap v2 dex and contracts
Interacting with the Uniswap v2 router and factory
How to create Uniswap v2 liquidity pools
How to add liquidity to Uniswap v2 pools
Swaps, flash swaps, flash swap arbitrage, and time-weighted average price (TWAP)
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on May 15, 2025