Module Functions & Pool Specific Logic

Liquidity and Swap Information Retrieval:

The getPoolBalance function fetches information about liquidity and swaps for a specific token within a given liquidity pool. This information is crucial for understanding the availability of assets and their distribution within the pool.


Token Transfer Inscription for Liquidity Addition:

The inscribeTokenTransferForAddLiquidity function handles the process of inscribing token transfers when a user adds liquidity to a pool.

It checks the user's token balances, inscribes transfers for the specified tokens, and updates the order object with transfer details. If there is insufficient balance or if the transfer fails, it sets an appropriate error description.


Token Amount Calculation for Liquidity Addition:

The getTokenAmountForAddLiquidity function calculates the actual token amounts involved in adding liquidity. It considers pool balances, rates, and various factors to determine the real token amounts. The results are then stored in the order object.


LP Token Transfer Inscription for Liquidity Addition:

The inscribeLpTokenTransferForAddLiquidity function manages the inscribing of transfers for LP (Liquidity Provider) tokens after adding liquidity to the pool. It calculates changes in token amounts, inscribes transfers accordingly, and updates the order object with transfer details. If any transfer fails, it sets an error description.


LP Token Sending After Liquidity Addition:

The sendLpTokenForAddLiquidity function initiates the actual sending of LP tokens to the user after adding liquidity. It considers changes in token amounts, initiates the transfer, and updates the order object with the transaction ID for the LP token transfer. If the transfer fails, it sets an error description.


System Flow:

User Request:

A user initiates a request to add liquidity to a specific pool.

Token Balances Check:

The system checks the user's token balances to ensure they have sufficient funds for the liquidity addition.

Token Transfer Inscription:

Token transfers are inscribed for the specified tokens, and the order object is updated with transfer details.

Actual Token Amount Calculation:

The system calculates the actual token amounts involved in adding liquidity, considering pool balances and rates.

LP Token Transfer Inscription:

Transfers for LP tokens are inscribed, considering changes in token amounts, and the order object is updated.

LP Token Sending:

The system initiates the actual sending of LP tokens to the user, and the order object is updated with the transaction ID.


Last updated