Checks if the pool is currently empty.
A pool is empty if either the primary or secondary asset is zero.
true if the pool is empty, false otherwise.
Amount of secondary assets for a single primary asset.
Amount of primary assets for a single secondary asset.
Converts amount deposited in the contract to amount received from the contract. Includes fee calculations.
Asset to deposit in the contract.
Amount to deposit in the contract.
The amount to receive from the contract.
Simulates new asset price after changing the pool's liquidity.
The asset for which to calculate the price for.
The change of primary liquidity on the pool.
The change of secondary liquidity on the pool.
New asset price.
Calculates the exchange fee based on deposited amount.
The asset to deposit in the contract.
The amount to deposit in the contract.
The calculated fee.
Calculates the fee from the gross amount based on pool's feeBps.
The amount to receive from the contract not yet lessened by the fee.
The calculated fee.
Calculates the fee from the net amount based on pool's feeBps. This is used in the swap exact for calculations.
The amount to receive from the contract already lessened by the fee.
The calculated fee.
Returns the array of liquidities from the pool, sorting them by setting provided asset as primary.
The asset that is supposed to be the primary one.
Total liquidities of assets.
Based on the deposited amount and a slippage, calculate the minimum amount the user will receive from the contract.
The asset to deposit in the contract.
The amount to deposit in the contract.
Slippage in base points.
The minimum amount to receive from the contract.
Calculates the price impact of changing the liquidity in a certain way.
The asset for which to calculate the price impact for.
The change of primary liquidity on the pool.
The change of secondary liquidity on the pool.
The asset price impact.
Calculates the price for which the asset in going to be swapped.
The asset deposited in the contract.
The amount deposited in the contract.
The price of deposited asset in relation to received asset.
Converts amount received from the contract to amount deposited in the contract.
Asset to deposit in the contract.
Amount to receive from the contract.
The amount to deposit in the contract.
Generated using TypeDoc
Contains functions for calculation statistics and other numerical data about the pool.
The pool calculator uses internal data from the pool to calculate values like the Prices, Net Amounts and values for the swap. Uses different formulas based on pool type.