Liquidity Operations (L)
Last updated
Last updated
When users provide liquidity on TermMax, they will deposit Underlying Token (UT) into the pool and mint the Liquidity Provider (LP) tokens (lpFT and lpXT). There are three internal steps: (1) deposit UT, (2) mint FT and XT to the pool, and (3) mint lpFT and lpXT to users' wallet. The number of FT/XT and lpFT/lpXT can be derived based on the amount of UT and LTV ratio of the pool.
If a user provides UT as liquidity and the LTV ratio of the pool is , the amount of FT (), XT (), lpFT (), and lpXT () can be derived as
Withdraw lpFT and lpXt to UT
According to , FT and XT can be combined into UT.
When the withdrawal amount of FT and XT equals to , there will be no price impact to the pool. Therefore, to minimize the impermanent loss when withdrawing the liquidity, we first combine FT and XT with ratio and withdraw the remaining FT or XT from the pool for UT.
The liquidity impact of withdrawing FT from the pool () is equivalent to the liquidity impact of the following two operations ().
Sell FT to the pool and get XT
Combine FT and XT into UT and withdraw
The new price impact of withdrawing FT from the pool will be equivalent to the price impact of the two operations. By definition, the price of the pool remains the same when UT is provided or withdrawn from the pool. Therefore, the price impact of withdrawing FT from the pool will be equivalent to the price impact of Sell FT to the pool and get XT.