Re-add Liquidity
Re-adding liquidity is very similar to add liquidity function, except for how the UB is updated.
Last updated
Re-adding liquidity is very similar to add liquidity function, except for how the UB is updated.
Last updated
This event can only happen for users that provided liquidity before. The event of re-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 re-add liquidity
function will perform the following activities:
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, check this section. .
Since the re-add liquidity happens in a given moment, may not be equal to 1, so there should be a calculation. The following formula will trigger the calculation:
In this step, the AMM saves how much it owes the user at the current Pool Value Factor "expense."
Updating this factor represents combining both deposits considering the time each entered the pool.
The works as if it was a picture of the pool's factor at the moment of this user's deposit. This factor will be updated again whenever there is a re-add liquidity
event by the same 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 thebalanceOf()
of the pool contract of the respective token (tokenA or tokenB)
Re-add liquidity ✅