Constructs a new pool.
the algorand client that this pool is created on.
the application id for the pool.
The primary asset for the pool.
The secondary asset for the pool.
The asset that is given to liquidity providers.
The current internal state for the pool.
The Algorand client to use.
The application id for the pool.
Contains the code to do the math behind the pool.
The fee in basis points for swaps trading on the pool.
The global state on the blockchain for this pool.
The asset for the liquidity pool token (LP token) that is given when liquidity is added, and burned when liquidity is withdrawn.
Different pool types use different formulas for making swaps.
The asset of the liquidity pool with the lower index.
The asset of the liquidity pool with the higher index.
Contains the current state of the pool.
The version of the contract. May be 0 for some old pools which don't expose the version in the global state.
Builds the transactions to add liquidity for the primary asset and secondary asset of the pool as per the options passed in.
In typical circumstances 3 transactions are generated:
The initial liquidity must satisfy the expression sqrt(a * b) - 1000 > 0
.
Options for adding the liquidity.
Array of transactions to add the liquidity.
This creates two transactions in a group for the remove operation.
Options for removing the liquidity.
Array of transactions to remove the liquidity.
Builds two transactions:
Swap options.
Array of transactions to perform the swap.
Builds the transactions to perform a Zap on the pool as per the options passed in. Zap allows to add liquidity to the pool by providing only one asset.
This function will generate swap Txs to get a proper amount of the second asset and then generate add liquidity Txs with both of those assets. See Pool.buildSwapTxs and Pool.buildAddLiquidityTxs for more details.
This feature is supposed to work with constant product pools only. Stableswaps can accept one asset to add liquidity by default.
Options for building Zap txs.
Array of transactions to swap & add liquidity.
Get the escrow address of the pool.
The address corresponding to that pools's escrow account.
Check if the asset is the primary or secondary asset of this pool.
The asset to check is in the pool.
True if the asset is in the pool or false otherwise.
Read the new pool state from the global state of the application.
Global state for the application.
Parsed state.
Creates a new LiquidityAddition instance.
Options for adding the liquidity.
A new LiquidityAddition object.
Prepares a TransactionGroup for adding liquidity to the pool. See Pool.buildAddLiquidityTxs for details.
Options for adding the liquidity.
A transaction group that when executed will add liquidity to the pool.
Prepares the transaction group for removing liquidity from the pool.
Options for removing the liquidity.
Transaction group that when executed will remove liquidity from the pool.
Creates a new swap instance for receiving the amount of asset within the slippage percent from the pool.
Swap options.
A new swap object.
Prepares a transaction group that when executed will perform a swap on the pool.
Swap options.
Transaction group that when executed will perform a swap on the pool.
Creates a new zap instance for getting all required data for performing a zap.
Zap options.
A new zap object.
Prepares a TransactionGroup for performing a Zap on the pool. See Pool.buildZapTxs for details.
Options for Zap.
A transaction group that when executed will add liquidity to the pool by getting only one amount.
Updates the internal and pool state properties by re-reading the global state in the blockchain.
Updating the pool state is recommended if there is a pause between the construction of the pool and the creation of the transactions on the pool. Calling this method ensures that the the pool state is not stale.
The new pool state.
Generated using TypeDoc
Pool represents a liquidity pool in the PACT AMM.
Typically, users don't have to instantiate this class manually. Use PactClient.fetchPoolById or PactClient.fetchPoolsByAssets instead.
The primary methods of the pool are to create the transaction groups to enable you to