1/5
## Burn pool shares This lesson will go over how to derive the equation to calculate how many USDC the user will receive for burning pool shares. We will define the variables as follows: * **T** = total shares * **S** = shares to burn * **L0** = value of pool before the token is sent back to the user * **L1** = value of pool after the token is sent to the user We can think about the value of the pool as being the amount of tokens inside the pool contract. The decrease in the value of the pool from L0 to L1 is proportional to the decrease of the shares: ``` Decrease L0 to L1 proportional to decrease of shares ``` For example, if we burn S shares and this decreases the total shares by 10%, then the value of the pool from L0 to L1 will also decrease by 10%. The decrease in shares is represented by the following equation: ``` T - S ---- T ``` Therefore, the ratio of total shares after burning and before burning is represented as follows: ``` T - S ---- T ``` We want this ratio to be equal to the ratio of the value of the pool after the tokens are withdrawn and the value of the pool before the tokens are withdrawn. ``` T - S L1 ---- = ---- T L0 ``` To solve for L0 - L1, we can rewrite this equation as follows: ``` L0 - L1 = L0 * S ---- T ``` We can then rewrite this equation as follows: ``` L0 - L1 = S * L0 ---- T ``` This equation tells us that L0 - L1 is equal to the percentage of shares that we're burning times the value of the pool before the tokens are withdrawn. We can use this equation to calculate how many USDC the user will receive for burning S shares.
A mathematical breakdown of how to burn pool shares - This lesson goes through the mathematical formula for burning shares in a liquidity pool. The equation is broken down in detail to understand how the values L0 and L1 change when shares are burnt.
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 October 9, 2024
Solidity Developer
Uniswap V2Duration: 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 October 9, 2024
Testimonials
Read what our students have to say about this course.
Chainlink
Chainlink
Gustavo Gonzalez
Solutions Engineer at OpenZeppelin
Francesco Andreoli
Lead Devrel at Metamask
Albert Hu
DeForm Founding Engineer
Radek
Senior Developer Advocate at Ceramic
Boidushya
WalletConnect
Idris
Developer Relations Engineer at Axelar