Uniswap V3 LP Token Analyzer
Last updated
Last updated
Uniswap V3 LP token is an NFT token that represents the liquidity provision position. Check Uniswap V3 Whitepaper for detail.
Specifically, the variable represents the liquidity given the relative price () of asset in the denomination of asset at the time the position is created/last changed, the lower bound () and upper bound () of price in which the user chooses to provide liquidity.
Define input parameters. On the page of adding liquidity in Uniswap V3, three factors have to be defined, , , and either one of and , where and denote the number of and tokens that will be injected into the liquidity provision position.
Calculate and or . Depending on which one of and is defined in step 1), the other one will be calculated. The detailed calculation follows formula 2.2 on Uniswap V3 Whitepaper. For example, if is defined, we will first solve based on (1) and then calculate based on (2) below:
Note here in Uniswap V3.
Then given price fluctuating to any , and that represent the number of and tokens redeemable from the liquidity provision position can be derived following eq. 6.29 and 6.30 in Uniswap V3 Whitepaper, which are copied and pasted below:
To get and in a given position as well as other information, function positions()
can be called. See details here.