# Pumpfun Mechanics

PumpFun bonding curve math, graduation mechanics, instruction parsing, and PumpSwap...

- Repository: https://github.com/agiprolabs/claude-trading-skills (507 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-09-03
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add agiprolabs/claude-trading-skills --skill pumpfun-mechanics -g -a claude-code -y`
Codex: `npx skills add agiprolabs/claude-trading-skills --skill pumpfun-mechanics -g -a codex -y`
Cursor: `npx skills add agiprolabs/claude-trading-skills --skill pumpfun-mechanics -g -a cursor -y`
Gemini CLI: `npx skills add agiprolabs/claude-trading-skills --skill pumpfun-mechanics -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add agiprolabs/claude-trading-skills`

## Description

PumpFun bonding curve math, graduation mechanics, instruction parsing, and PumpSwap migration

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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:

```
k = virtualSolReserves × virtualTokenReserves
```

### 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

```python
price_sol_per_token = virtual_sol_reserves / virtual_token_reserves

# In human-readable units:
price = (virtual_sol / 1e9) / (virtual_token / 1e6)

# At genesis: 30 / 1,073,000,000 ≈ 2.796e-8 SOL/token
# At graduation: ~4.1e-7 SOL/token (~14.7x from launch)
```

### Buy Tokens (SOL → Tokens)

```python
def buy_tokens(v_sol: int, v_tok: int, real_tok: int, sol_in: int) -> int:
    """Calculate tokens received for a given SOL input.

    Args:
        v_sol: Virtual SOL reserves (lamports).
        v_tok: Virtual token reserves (raw).
        real_tok: Real token reserves (raw).
        sol_in: SOL to spend (lamports, BEFORE 1% fee).

The rest: https://github.com/agiprolabs/claude-trading-skills/blob/HEAD/skills/pumpfun-mechanics/SKILL.md
