7: Advanced topics
Token Migration
When real_quote >= total_quote_fund_raising, the pool becomes eligible for migration.
Post-Migration:
Token is now tradable on Raydium AMM
Bonding curve trading is disabled
LP tokens are locked or distributed according to platform config
Error Codes
Common errors from the program:
6000
NotApproved
Action not authorized
6001
InvalidOwner
Account owner mismatch
6002
InvalidInput
Invalid input parameters
6003
InputNotMatchCurveConfig
Input doesn't match curve configuration
6004
ExceededSlippage
Trade exceeds slippage tolerance
6005
PoolFunding
Pool is still in funding phase
6006
PoolMigrated
Pool has already migrated
6007
MigrateTypeNotMatch
Migration type mismatch
6008
MathOverflow
Arithmetic overflow
Events
The program emits events for monitoring:
PoolCreateEvent - Emitted when a new pool is created
{
pool_state: PublicKey;
creator: PublicKey;
config: PublicKey;
base_mint_param: MintParams;
curve_param: CurveParams;
vesting_param: VestingParams;
}TradeEvent - Emitted on every buy/sell
{
pool_state: PublicKey;
amount_in: u64;
amount_out: u64;
protocol_fee: u64;
platform_fee: u64;
creator_fee: u64;
trade_direction: 'Buy' | 'Sell';
pool_status: 'Fund' | 'Migrate' | 'Trade';
exact_in: boolean;
}Monitoring Pools
WebSocket Subscription:
import { Connection } from '@solana/web3.js';
const connection = new Connection('wss://api.mainnet-beta.solana.com');
// Monitor all program account changes
const subscriptionId = connection.onProgramAccountChange(
LAUNCHLAB_PROGRAM_ID,
(accountInfo, context) => {
console.log('Account changed:', accountInfo);
// Decode pool state and react to changes
},
'confirmed'
);Filter Specific Token:
// Monitor specific pool state
const subscriptionId = connection.onAccountChange(
poolStateAddress,
(accountInfo, context) => {
// Decode and handle pool state update
const poolState = decodePoolState(accountInfo.data);
console.log('Pool updated:', poolState.status);
},
'confirmed'
);Last updated
