Skip to main content
Git Source Inherits: PoolBase, Initializable Author: @oscarsernarosero @mpetersoCode55 @cirsteve This contract serves the purpose of facilitating swaps between a pair of tokens, where one is an xToken and the other one is a yToken.

State Variables

tbc

Functions

constructor

constructor
Parameters

initializePool

This is the function to initialize the pool.
Parameters

simulateLiquidityDeposit

This is the function to simulate a liquidity deposit into the pool.
Parameters Returns

tokenDepositUpdate

depositLiquidity

If the tokenId provided is owned by the lp, this tokenId will be updated based on liquidity deposit This is the function to deposit liquidity into the pool.
Parameters Returns

simulateWithdrawLiquidity

This is the function to simulate a liquidity withdrawal from the pool. To get rj and uj, call the getLPToken function and pass in the rj and uj values
Parameters Returns

withdrawPartialLiquidity

This is the function to withdraw partial liquidity from the pool.
Parameters

withdrawAllLiquidity

This is the function to withdraw all token liquidity from the pool.
Parameters

_withdrawLiquidity

This is the function to withdraw liquidity from the pool.
Parameters

_emitLiquidityWithdrawn

This is the function to emit the LiquidityWithdrawn event.
Parameters

withdrawRevenue

This is the function to withdraw revenue from the pool.
Parameters Returns

revenueAvailable

This is the function to get the revenue available for a liquidity position.
Parameters Returns

_getRevenueAvailable

This is the function to get the revenue available for a liquidity provider.
Parameters Returns

_spotPrice

x + 1 is used for returning the price of the next token sold, not the price of the last token sold This is the function to retrieve the current spot price of the x token.
Returns

_updateParameters

This function updates the state of the math values of the pool.

_calculateAmountOfXRequiredBuyingY

This function calculates the amount of token X required for the user to purchase a specific amount of Token Y (buy y with x : out perspective).
Parameters Returns

_calculateAmountOfYRequiredBuyingX

This function calculates the amount of token Y required for the user to purchase a specific amount of Token X (buy x with y : out perspective).
Parameters Returns

_calculateAmountOfYReceivedSellingX

This function calculates the amount of token Y the user will receive when selling token X (sell x for y : in perspective).
Parameters Returns

_calculateAmountOfXReceivedSellingY

This function calculates the amount of token X the user will receive when selling token Y (sell y for x : in perspective).
Parameters Returns

_validateTBC

A helper function to validate most of constructor’s inputs.
Parameters

checkInactiveLiquidity

The threshold is set to 1% of the active liquidity units Check for ration of inactive to active (token Id 2) liquidity, reverts if ratio is above threshold
Parameters

retrieveH

_emitCurveState