6: Pool state structure
Complete Field Reference
interface PoolState {
// === Metadata ===
epoch: BN; // Account update epoch
auth_bump: number; // Authority PDA bump seed
status: number; // 0: Funding, 1: Migrate, 2: Trade
// === Token Info ===
base_decimals: number; // Token decimals (usually 6 or 9)
quote_decimals: number; // WSOL decimals (always 9)
migrate_type: number; // 0: AMM, 1: CPSwap
supply: BN; // Total token supply
total_base_sell: BN; // Total tokens available for sale
// === Reserves ===
virtual_base: BN; // Virtual token reserves (VA)
virtual_quote: BN; // Virtual SOL reserves (VB)
real_base: BN; // Actual tokens in pool (RA)
real_quote: BN; // Actual SOL raised (RB)
total_quote_fund_raising: BN; // Fundraising goal (e.g., 30 SOL)
// === Fees ===
quote_protocol_fee: BN; // Accumulated protocol fees
platform_fee: BN; // Accumulated platform fees
migrate_fee: BN; // Fee for migration
// === Vesting ===
vesting_schedule: {
total_locked_amount: BN; // Total tokens locked
cliff_period: BN; // Cliff period in seconds
unlock_period: BN; // Unlock period in seconds
start_time: BN; // Vesting start time
allocated_share_amount: BN; // Allocated shares
};
// === Accounts ===
global_config: PublicKey; // Global config account
platform_config: PublicKey; // Platform config account
base_mint: PublicKey; // Token mint
quote_mint: PublicKey; // WSOL mint
base_vault: PublicKey; // Token vault
quote_vault: PublicKey; // SOL vault
creator: PublicKey; // Token creator
// === Misc ===
token_program_flag: number; // Token program version flags
amm_creator_fee_on: object; // AMM creator fee settings
padding: number[]; // Reserved for future use
}Key Calculations
Below are common calculations derived from the PoolState fields. All code examples assume numeric conversion where BN values are used (e.g., toNumber()).
Fundraising Progress
const progress = (poolState.real_quote.toNumber() /
poolState.total_quote_fund_raising.toNumber()) * 100;This yields the fundraising completion percentage.
Current Price
const pricePerToken = (poolState.virtual_quote.toNumber() + poolState.real_quote.toNumber()) /
(poolState.virtual_base.toNumber() - poolState.real_base.toNumber());Price computed from combined virtual+real quote reserves over effective base supply in the pool.
Market Cap
const marketCap = poolState.supply.toNumber() * pricePerToken;Market cap = total token supply × current price per token.
Liquidity Available
const availableTokens = poolState.real_base;
const availableSOL = poolState.virtual_quote.add(poolState.real_quote);availableTokens: actual tokens in the pool (RA). availableSOL: combined virtual and real quote reserves (VB + RB).
