Developer Docs
Last updated
Last updated
Learn how to create buy/ sell transactions for PixFun. The simplest way to interact with out Solana Program is by using the Anchor and .
You can create either a fixedIn
or fixedOut
type swap. Both types are available within the same instruction, passing values for your desired type and 0 for the other.
You should specify wether you want to buy or to sell with the isBuy
boolean.
For a fixedIn
swap, you pass the input SOL (or token) amount as amountIn
and the slippage adjusted value as minAmountOut
. You leave amountOut
and maxAmountIn
as 0.
For a fixedOut
swap, you pass the desired SOL (or token) amount as amountOut
and the slippage adjusted value as maxAmountIn
. You leave amountIn
and minAmountOut
as 0. The on-chain program will calculate your input value.
You can consider this code for a simplified view:
IMPORTANT: The program will take care of creating the Token Account, so you don't need to add a separate instruction for it.
Important: The bonding curve price, market cap and liquidity are calculated based on the virtual reserves above.
Once a token completes its bonding curve, it migrates to a pool, with its respective . The PixFun token is set as Base and SOL is set as Quote.