Add Liquidity
Understanding the add liquidity event step-by-step.
Last updated
Understanding the add liquidity event step-by-step.
Last updated
The event of adding liquidity requires the following information from the user: 1. Amount of token A to be added 2. Amount of token B to be added 3. Owner
After the information was supplied, the add liquidity
function will perform the following activities:
This happens if . If , it is not required to calculate the option price in the very first liquidity provision in a pool.
For simplicity, let's acknowledge that the option price is a function that required a and an internal vector () as input.
For more details about the pricing formula or its contract implementation for pricing the options, check this section.
If ,
If ,
Since this is the first liquidity provision of the pool, this is and therefore, .
By the time the pool is created () , the and will be equal to the and since:
Updating this factor is essential, especially when there is a re-add liquidity
event.
The works as if it was a snapshot of the pool's factor at the moment of this user's deposit. This factor will be updated in the case of re-add liquidity
by the user.
At the contract level, an ERC20 transfer is happening. Total balance (TB) is just a mathematical representation. The Total balance is checked by consulting the balanceOf()
of the pool contract of the respective token (tokenA or tokenB)
Add liquidity ✅