5/5
Let's take a look at an example to understand how to calculate the amount of shares to mint when a deposit is made into a liquidity pool. We'll say the value of the pool before the deposit is made is 1,100 USDC. We are measuring the value of the pool by the amount of USDC inside the pool contract. We'll call this state L0. L0 = 1,100 USDC. A deposit of 110 USDC is then made. We'll call this state L1. L1 = 1,210 USDC. Let's visualize this with a pie chart. The purple portion of the pie represents the amount of USDC in the pool before the deposit, L0. The green portion represents the deposit that was made, L1 - L0. The total value of the pool in state L1 is 1,210 USDC. We're going to mint shares to reflect this change. To do this, we'll use the following equation: $S=\frac{L_1 - L_0}{L_0}T$ Where: * S is the amount of shares that will be minted * L0 is the total value of the pool before the deposit * L1 is the total value of the pool after the deposit * T is the total number of shares before the deposit We'll say that we have 1,000 total shares before the deposit. Using our equation, we can plug in the values for L1, L0, and T. $S=\frac{1210 - 1100}{1100}*1000$ This simplifies to: 1. $S=\frac{110}{1100}*1000$ 2. $S = 100$ We must mint 100 shares to reflect the 10% increase in the pool's value. Now, the total shares in the pool are 1,100.
Let's take a look at an example to understand how to calculate the amount of shares to mint when a deposit is made into a liquidity pool.
We'll say the value of the pool before the deposit is made is 1,100 USDC. We are measuring the value of the pool by the amount of USDC inside the pool contract. We'll call this state L0.
L0 = 1,100 USDC.
A deposit of 110 USDC is then made. We'll call this state L1.
L1 = 1,210 USDC.
Let's visualize this with a pie chart. The purple portion of the pie represents the amount of USDC in the pool before the deposit, L0. The green portion represents the deposit that was made, L1 - L0. The total value of the pool in state L1 is 1,210 USDC.
We're going to mint shares to reflect this change. To do this, we'll use the following equation:
Where:
S is the amount of shares that will be minted
L0 is the total value of the pool before the deposit
L1 is the total value of the pool after the deposit
T is the total number of shares before the deposit
We'll say that we have 1,000 total shares before the deposit. Using our equation, we can plug in the values for L1, L0, and T.
This simplifies to:
We must mint 100 shares to reflect the 10% increase in the pool's value. Now, the total shares in the pool are 1,100.
A practical guide to understanding share minting in liquidity pools - This lesson walks through how to calculate the number of shares to mint after a deposit has been made into a liquidity pool, showing the relationship between shares and the overall value of the pool.
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 June 6, 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 June 6, 2025