pumpfun-mechanics
PumpFun bonding curve math, graduation mechanics, instruction parsing, and PumpSwap migration
By agiprolabs · 346 installs
npx skills add agiprolabs/claude-trading-skills --skill pumpfun-mechanics
Source repository · Upstream listing
PumpFun Mechanics — Bonding Curves, Graduation & Instruction Parsing
PumpFun is the dominant Solana token launchpad. Understanding its bonding curve math, graduation process, and instruction formats is essential for analyzing new token launches, building trading strategies around graduation events, and parsing on chain PumpFun activity.
Bonding Curve Math
PumpFun uses a virtual constant product (CPMM) bonding curve:
Initial Parameters
Parameter Value
Initial Virtual SOL 30 SOL (30,000,000,000 lamports)
Initial Virtual Tokens ~1.073B tokens (1,073,000,000,000,000 raw, 6 decimals)
Token Total Supply 1B tokens (1,000,000,000,000,000 raw)
Real Token Reserves ~793M tokens (793,000,000,000,000 raw)
Real SOL Reserves 0 (no real SOL at launch)
Fee 1% (applied externally by the program)
Virtual vs Real : Virtual reserves define the curve shape. Real reserves track actual withdrawable funds. The difference (1.073B 793M = 280M virtual tokens) shapes the initial price but can never be withdrawn.
Spot Price
Buy Tokens (SOL → Tokens)
Sell Tokens (Tokens → SOL)
Buy Cost (Exact token amount → SOL needed)
Fee Handling
The 1% fee is not part of the curve math. It's applied externally:
Market Cap
Graduation
Graduation occurs when realSolReserves reaches ~85 SOL (~$12K 14K depending on SOL price). Only ~1.4% of PumpFun tokens ever graduate.
What Happens
1. complete flag set to true on bonding curve account
2. CompleteEvent emitted (discriminator 5f72619cd42e9808 )
3. Bonding curve stops accepting trades
4. ~$12K liquidity deposited to the destination DEX
5. Token becomes tradeable on PumpSwap (or Raydium for older tokens)
Fill Percentage
Migration Targets
March 2025+ : PumpSwap ( pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA ) — native AMM, no migration fee
Before March 2025 : Raydium V4 ( 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 ) — 6 SOL fee
PumpSwap Post Graduation
PumpSwap is a constant product AMM with 1% fee (same as bonding curve). Key differences:
Base asset is always WSOL, quote is token
Instruction semantics are inverted: "buy" instruction sells tokens, "sell" instruction buys tokens
Supports creator revenue sharing (0.05% of volume to original creator)
Program IDs & Addresses
Program/Account Address
PumpFun Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P
PumpSwap Program pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA
Fee Program pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ
Global Account 4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf
Fee Recipient 62qc2CNXwrYqQScmEdiZFFAnJR262PxWEuNQtxfafNgV
Event Authority Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1
Event Parsing
Events are Anchor style: sha256("event:<EventName ")[0..8]
Event Discriminator (hex)
CreateEvent 1b72a94ddeeb6376
TradeEvent bddb7fd34ee661ee
CompleteEvent 5f72619cd42e9808
TradeEvent Layout (after 8 byte discriminator)
Critical : Events are in CPI inner instructions. Search for discriminators anywhere in instruction data, not just at offset 0.
Bonding Curve Account Layout
PDA Derivation
PDA Seeds
Bonding Curve ["bonding curve", mint]
Bonding Curve V2 ["bonding curve v2", mint]
Creator Vault ["creator vault", creator]
Instruction Discriminators
Instruction Hex Notes
buy exact sol in (V2) 38fc74089edfcd5f Current production buy
sell (V2) 33e685a4017f83ad Current production sell
buy (V1/legacy) 66063d1201daebea Legacy, still seen occasionally
create 181ec828051c0777 Token creation
Buy Instruction Data (24 bytes)
Sell Instruction Data (24 bytes)
Price Impact & Sizing
Files
References
references/bonding curve math.md — Complete mathematical derivations with worked examples
references/graduation process.md — Graduation threshold, migration, PumpSwap mechanics
references/instruction reference.md — Full instruction and event layouts for parsing
Scripts
scripts/curve calculator.py — Interactive bonding curve calculator: price, impact, fill %
scripts/parse events.py — Parse PumpFun events from transaction data