Add Liquidity
Understanding the add liquidity event step-by-step.
Add Liquidity
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:
1. Calculate factors
1.1 Calculate Option Price
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.

1.2 Calculate the Pool's Value Factor ()
If ,
If ,
Since this is the first liquidity provision of the pool, this is and therefore, .


2. Updates
2.1 Update Deamortized Balance of the pool for each token
By the time the pool is created () , the and will be equal to the and since:

2.2 Update the User Balances for each token and the Pool Factor previously calculated
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.

2.3 Update Total Balance of the pool for each token

Add liquidity ✅
Last updated
Was this helpful?