Create Pool Functions
createPermissionlessConstantProductPoolWithConfig
Creates a new permissionless constant product pool with a predefined configuration. Function- Both token amounts must be greater than zero
- If using native SOL, it will be automatically wrapped to wSOL
- The
config
parameter should be a valid configuration account
createPermissionlessConstantProductPoolWithConfig2
Creates a new permissionless constant product pool with a predefined configuration. This function is similar tocreatePermissionlessConstantProductPoolWithConfig
but only if you need to set the activation point earlier than the default derived from the config.
Function
- Both token amounts must be greater than zero
- If using native SOL, it will be automatically wrapped to wSOL
- The
config
parameter should be a valid configuration account - The
activationPoint
parameter is the timestamp in seconds since the Unix epoch. If you want to set it to the current time, you can use'now'
.
createPermissionlessPool
Creates a new permissionless constant product pool. Function- Both token amounts must be greater than zero
- If using native SOL, it will be automatically wrapped to wSOL
- The
tradeFeeBps
parameter is the trade fee in basis points. - The
isStable
parameter is whether the pool is stable. - The
skipAta
parameter is whether to skip creating associated token account for token A.
createPermissionlessConstantProductMemecoinPoolWithConfig
Creates a new permissionless constant product memecoin pool with a predefined configuration. Function- Both token amounts must be greater than zero
- If using native SOL, it will be automatically wrapped to wSOL
- The
memecoinInfo
parameter is the information for the memecoin. - The
feeVault
parameter is the information for the fee vault.
State Functions
getLpSupply
Get the total supply of the pool. Function- The
pool
parameter is the instance of the pool.
getUserBalance
Get the balance of a user in the pool. Function- The
pool
parameter is the instance of the pool. - The
owner
parameter is the address of the user.
getSwapQuote
Get the swap quote for a given amount of token. Function- The
inTokenMint
parameter is the mint address of the input token. - The
inAmountLamport
parameter is the amount of input token to swap. - The
slippage
parameter is the slippage tolerance. - The
swapInitiator
parameter is the address of the swap initiator.
getDepositQuote
Get the deposit quote for a given amount of token. Function- The
tokenAInAmount
parameter is the amount of token A to deposit. - The
tokenBInAmount
parameter is the amount of token B to deposit. - The
balance
parameter is whether to use the balance of the user. - The
slippage
parameter is the slippage tolerance.
getWithdrawQuote
Get the withdraw quote for a given amount of pool token. Function- The
withdrawTokenAmount
parameter is the amount of pool token to withdraw. - The
slippage
parameter is the slippage tolerance.
updateState
Update the state of the pool. Function- The
pool
parameter is the instance of the pool.
Pool Functions
deposit
Deposit tokens into the pool. Function- The
owner
parameter is the address of the owner. - The
tokenAInAmount
parameter is the amount of token A to deposit. - The
tokenBInAmount
parameter is the amount of token B to deposit. - The
poolTokenAmount
parameter is the amount of pool token to deposit.
withdraw
Withdraw tokens from the pool. Function- The
owner
parameter is the address of the owner. - The
lpTokenAmount
parameter is the amount of pool token to withdraw. - The
tokenAOutAmount
parameter is the amount of token A to withdraw. - The
tokenBOutAmount
parameter is the amount of token B to withdraw.
swap
Swap tokens in the pool. Function- The
owner
parameter is the address of the owner. - The
inTokenMint
parameter is the mint address of the input token. - The
inAmountLamport
parameter is the amount of input token to swap. - The
outAmountLamport
parameter is the amount of output token to receive. - The
referralOwner
parameter is the address of the referral owner.