[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78DNTDAGD3H8WRH0HBVR5BE":3,"skill-same:01M78DNTDAGD3H8WRH0HBVR5BE":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M78DNTDAGD3H8WRH0HBVR5BE","pump-bonding-curve",null,"Implement Pump.fun bonding-curve math for token pricing, buy\u002Fsell quotes, fee-aware calculations, market cap, tiered fees, ceiling division, virtual versus real reserves, and migration edge cases. Use when reviewing or coding Pump.fun pricing logic.","Solizardking\u002Fskillhub-main","Solizardking","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F108096810?v=4","01M786KDB10AYV042N0F9BD5B5","Clawd","01M786NYYXSZK1D05WM8JQPC48",0,"MIT","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fpump-bonding-curve\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: pump-bonding-curve\ndescription: Implement Pump.fun bonding-curve math for token pricing, buy\u002Fsell quotes, fee-aware calculations, market cap, tiered fees, ceiling division, virtual versus real reserves, and migration edge cases. Use when reviewing or coding Pump.fun pricing logic.\n---\n\n# Bonding Curve — Pricing, Quoting & AMM Mathematics\n\nImplement and maintain the constant-product AMM bonding curve math that powers Pump token pricing — including buy\u002Fsell quoting, fee-aware calculations, market cap computation, reserve management, and edge-case handling for new, active, and migrated curves.\n\n## Context\n\nPump tokens are priced using a constant-product bonding curve ($x \\times y = k$) where $x$ = virtual SOL reserves and $y$ = virtual token reserves. The bonding curve determines token prices during the pre-graduation phase. Once market cap reaches a threshold, the token \"graduates\" and migrates to a PumpAMM pool.\n\n## Key Files\n\n- `src\u002FbondingCurve.ts` — all bonding curve math functions (buy\u002Fsell quoting, market cap)\n- `src\u002Ffees.ts` — fee computation (basis points, tiered fees, ceiling division)\n- `src\u002Fstate.ts` — `BondingCurve`, `Global`, `FeeConfig`, `FeeTier` interfaces\n\n## Constant-Product Formula\n\n$$x \\times y = k$$\n\n**Buy (tokens out for SOL in):**\n$$\\text{tokensOut} = \\frac{dx \\times Y}{X + dx}$$\n\nWhere $dx$ = SOL input (after fees), $X$ = virtual SOL reserves, $Y$ = virtual token reserves.\n\n**Sell (SOL out for tokens in):**\n$$\\text{solOut} = \\frac{dy \\times X}{Y + dy}$$\n\nWhere $dy$ = tokens sold, $X$ = virtual SOL reserves, $Y$ = virtual token reserves.\n\n## Fee Stripping\n\nFees are deducted from the SOL amount **before** applying the bonding curve formula:\n\n```typescript\ninputAmount = (amount - 1) * 10000 \u002F (totalFeeBps + 10000)\n```\n\nThe `- 1` before fee stripping is intentional to handle rounding edge cases.\n\n## Market Cap Calculation\n\n$$\\text{marketCap} = \\frac{\\text{virtualSolReserves} \\times \\text{mintSupply}}{\\text{virtualTokenReserves}}$$\n\nWhere `mintSupply` defaults to `ONE_BILLION_SUPPLY` ($1 \\times 10^{15}$ — 1B tokens with 6 decimals).\n\n## Fee Tiers\n\nWhen a `FeeConfig` exists, fees are market-cap-dependent. Fee tiers are iterated in **reverse** order — the first tier from the end whose `marketCapLamportsThreshold ≤ currentMarketCap` is selected.\n\n```typescript\ninterface FeeTier {\n    marketCapLamportsThreshold: BN;\n    fees: { lpFeeBps: BN; protocolFeeBps: BN; creatorFeeBps: BN };\n}\n```\n\n## Ceiling Division\n\n$$\\text{ceilDiv}(a, b) = \\frac{a + b - 1}{b}$$\n\n```typescript\nfunction ceilDiv(a: BN, b: BN): BN {\n    return a.add(b).sub(new BN(1)).div(b);\n}\n```\n\n## Virtual vs Real Reserves\n\n| Reserve Type | Includes | Used For |\n|-------------|----------|----------|\n| `virtualSolReserves` | Real SOL + protocol-added virtual offset | AMM formula calculation |\n| `virtualTokenReserves` | Real tokens + virtual offset | AMM formula calculation |\n| `realTokenReserves` | Actual tokens available | Buy output cap |\n| `realSolReserves` | Actual SOL deposited | Withdrawal limit |\n\n## Edge Cases\n\n| Case | Behavior |\n|------|----------|\n| Zero amount | Returns `BN(0)` |\n| Migrated curve (`complete === true`, zero reserves) | Returns `BN(0)` |\n| Null bonding curve | Creates a fresh curve via `newBondingCurve(global)` |\n| Tokens exceed real reserves | Caps at `realTokenReserves` |\n| Creator fee | Only charged if `bondingCurve.creator != PublicKey.default` or it's a new curve |\n\n## BondingCurve State\n\n```typescript\ninterface BondingCurve {\n    virtualTokenReserves: BN;\n    virtualSolReserves: BN;\n    realTokenReserves: BN;\n    realSolReserves: BN;\n    tokenTotalSupply: BN;\n    complete: boolean;        \u002F\u002F true = graduated to AMM\n    creator: PublicKey;\n    isMayhemMode: boolean;\n}\n```\n\n## Patterns to Follow\n\n- All amounts use `BN` (bn.js) for arbitrary-precision integer arithmetic — never use JavaScript `number`\n- Fee amounts are in **basis points** (1 bps = 0.01%, 10,000 bps = 100%)\n- Always deduct fees **before** applying the AMM formula, not after\n- Use ceiling division (`ceilDiv`) for fee computation to ensure the protocol never loses dust\n- Quote functions are pure — no network calls, no side effects, no mutable state\n- Always check `bondingCurve.complete` before building trade instructions\n\n## Common Pitfalls\n\n- Confusing virtual reserves (includes virtual offset) with real reserves (actual amounts)\n- Not accounting for fees when quoting — raw quote functions give different results than fee-aware ones\n- Trying to trade on a graduated curve (`complete === true`) will fail on-chain\n- Fee tiers iterate in **reverse** order — not forward\n- Market cap calculation uses `mintSupply` not `tokenTotalSupply`\n- The fee stripping formula subtracts 1 from the amount first — this is intentional\n- `getBuySolAmountFromTokenAmountQuote` adds `+ 1` to the result to ensure sufficient SOL\n","# Bonding Curve — Pricing, Quoting & AMM Mathematics\n\nImplement and maintain the constant-product AMM bonding curve math that powers Pump token pricing — including buy\u002Fsell quoting, fee-aware calculations, market cap computation, reserve management, and edge-case handling for new, active, and migrated curves.\n\n## Context\n\nPump tokens are priced using a constant-product bonding curve ($x \\times y = k$) where $x$ = virtual SOL reserves and $y$ = virtual token reserves. The bonding curve determines token prices during the pre-graduation phase. Once market cap reaches a threshold, the token \"graduates\" and migrates to a PumpAMM pool.\n\n## Key Files\n\n- `src\u002FbondingCurve.ts` — all bonding curve math functions (buy\u002Fsell quoting, market cap)\n- `src\u002Ffees.ts` — fee computation (basis points, tiered fees, ceiling division)\n- `src\u002Fstate.ts` — `BondingCurve`, `Global`, `FeeConfig`, `FeeTier` interfaces\n\n## Constant-Product Formula\n\n$$x \\times y = k$$\n\n**Buy (tokens out for SOL in):**\n$$\\text{tokensOut} = \\frac{dx \\times Y}{X + dx}$$\n\nWhere $dx$ = SOL input (after fees), $X$ = virtual SOL reserves, $Y$ = virtual token reserves.\n\n**Sell (SOL out for tokens in):**\n$$\\text{solOut} = \\frac{dy \\times X}{Y + dy}$$\n\nWhere $dy$ = tokens sold, $X$ = virtual SOL reserves, $Y$ = virtual token reserves.\n\n## Fee Stripping\n\nFees are deducted from the SOL amount **before** applying the bonding curve formula:\n\n```typescript\ninputAmount = (amount - 1) * 10000 \u002F (totalFeeBps + 10000)\n```\n\nThe `- 1` before fee stripping is intentional to handle rounding edge cases.\n\n## Market Cap Calculation\n\n$$\\text{marketCap} = \\frac{\\text{virtualSolReserves} \\times \\text{mintSupply}}{\\text{virtualTokenReserves}}$$\n\nWhere `mintSupply` defaults to `ONE_BILLION_SUPPLY` ($1 \\times 10^{15}$ — 1B tokens with 6 decimals).\n\n## Fee Tiers\n\nWhen a `FeeConfig` exists, fees are market-cap-dependent. Fee tiers are iterated in **reverse** order — the first tier from the end whose `marketCapLamportsThreshold ≤ currentMarketCap` is selected.\n\n```typescript\ninterface FeeTier {\n    marketCapLamportsThreshold: BN;\n    fees: { lpFeeBps: BN; protocolFeeBps: BN; creatorFeeBps: BN };\n}\n```\n\n## Ceiling Division\n\n$$\\text{ceilDiv}(a, b) = \\frac{a + b - 1}{b}$$\n\n```typescript\nfunction ceilDiv(a: BN, b: BN): BN {\n    return a.add(b).sub(new BN(1)).div(b);\n}\n```\n\n## Virtual vs Real Reserves\n\n| Reserve Type | Includes | Used For |\n|-------------|----------|----------|\n| `virtualSolReserves` | Real SOL + protocol-added virtual offset | AMM formula calculation |\n| `virtualTokenReserves` | Real tokens + virtual offset | AMM formula calculation |\n| `realTokenReserves` | Actual tokens available | Buy output cap |\n| `realSolReserves` | Actual SOL deposited | Withdrawal limit |\n\n## Edge Cases\n\n| Case | Behavior |\n|------|----------|\n| Zero amount | Returns `BN(0)` |\n| Migrated curve (`complete === true`, zero reserves) | Returns `BN(0)` |\n| Null bonding curve | Creates a fresh curve via `newBondingCurve(global)` |\n| Tokens exceed real reserves | Caps at `realTokenReserves` |\n| Creator fee | Only charged if `bondingCurve.creator != PublicKey.default` or it's a new curve |\n\n## BondingCurve State\n\n```typescript\ninterface BondingCurve {\n    virtualTokenReserves: BN;\n    virtualSolReserves: BN;\n    realTokenReserves: BN;\n    realSolReserves: BN;\n    tokenTotalSupply: BN;\n    complete: boolean;        \u002F\u002F true = graduated to AMM\n    creator: PublicKey;\n    isMayhemMode: boolean;\n}\n```\n\n## Patterns to Follow\n\n- All amounts use `BN` (bn.js) for arbitrary-precision integer arithmetic — never use JavaScript `number`\n- Fee amounts are in **basis points** (1 bps = 0.01%, 10,000 bps = 100%)\n- Always deduct fees **before** applying the AMM formula, not after\n- Use ceiling division (`ceilDiv`) for fee computation to ensure the protocol never loses dust\n- Quote functions are pure — no network calls, no side effects, no mutable state\n- Always check `bondingCurve.complete` before building trade instructions\n\n## Common Pitfalls\n\n- Confusing virtual reserves (includes virtual offset) with real reserves (actual amounts)\n- Not accounting for fees when quoting — raw quote functions give different results than fee-aware ones\n- Trying to trade on a graduated curve (`complete === true`) will fail on-chain\n- Fee tiers iterate in **reverse** order — not forward\n- Market cap calculation uses `mintSupply` not `tokenTotalSupply`\n- The fee stripping formula subtracts 1 from the amount first — this is intentional\n- `getBuySolAmountFromTokenAmountQuote` adds `+ 1` to the result to ensure sufficient SOL\n",{"name":5,"description":7},"main","be3de0244dc1a57e323d8160787ebb40fb64930e","skills\u002Fpump-bonding-curve","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main","https:\u002F\u002Fskills.x402.wtf","https:\u002F\u002Fgithub.com\u002FSolizardking","https:\u002F\u002Fmusebook.trade","Got a mile high and never came down","2026-10-08 23:20:13",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add Solizardking\u002Fskillhub-main --skill pump-bonding-curve",{"tool":39,"command":40},"bunx","bunx skills add Solizardking\u002Fskillhub-main --skill pump-bonding-curve",{"tool":42,"command":43},"pnpm","pnpm dlx skills add Solizardking\u002Fskillhub-main --skill pump-bonding-curve","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fpump-bonding-curve\u002FSKILL.md",true,[],[48,55,62,69,76,84],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M78E0TGCAMNPS207BA3G07S7","zkrouter","Self-hosted OpenAI-compatible LLM router — smart tier-based routing, ZK-stamped routing decisions, mode overrides, free OpenRouter at install via the Birth bot. Save 60-80% on inference costs by routing to the cheapest capable model across 12+ OpenRouter models.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fzkrouter\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M78E0R1Z8BDT6EDTHY17MTNB","zk","For custom ZK Solana programs and privacy-preserving applications to prevent double spending. Guide to integrate rent-free nullifier PDAs for double-spend prevention.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fzk\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M78E0P3ZTZ1YWF8MD5MM23QE","zk-omni-messaging","Zero-knowledge omnichain messaging between Robinhood Chain and Solana using CheshireZkOmniMessenger (msgType 4) with nullifier anti-replay and the zk-omni-relayer service.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fzk-omni-messaging\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M78E0JXZ2PNB1896VXAGDBWD","zerion-wallet-data","Use when the user asks to check a wallet's portfolio, token balances, DeFi positions, PnL, transaction history, or NFTs. Provides interpreted on-chain data across 40+ EVM chains and Solana via x402 pay-per-request or API key — no raw RPC decoding needed.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fzerion-wallet-data\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":80,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M78E0G14FH9GRRTQYMKD5E59","youtube-clipper","YouTube 视频智能剪辑工具。下载视频和字幕，AI 分析生成精细章节（几分钟级别）， 用户选择片段后自动剪辑、翻译字幕为中英双语、烧录字幕到视频，并生成总结文案。 使用场景：当用户需要剪辑 YouTube 视频、生成短视频片段、制作双语字幕版本时。 关键词：视频剪辑、YouTube、字幕翻译、双语字幕、视频下载、clip video","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube-clipper\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube-clipper\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M78E0C2ZYA99CFFDNB7ZMK5S","yield-optimization","Multi-chain yield optimization via yield.xyz (StakeKit). Discover 2,988+ yield opportunities across 75+ blockchains, build deposit\u002Fwithdrawal transactions with shell scripts, and sign them with a MoonPay wallet. Use when the user wants to earn yield, find the best lending or staking rate, enter\u002Fexit a position, or check portfolio balances.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fyield-optimization\u002FSKILL.md",[],[]]