Skip to content

feat(pumpfun): update IDLs and add bonding_curve_v2 + cashback support#159

Merged
smypmsa merged 1 commit intomainfrom
feat/pf-updates
Feb 27, 2026
Merged

feat(pumpfun): update IDLs and add bonding_curve_v2 + cashback support#159
smypmsa merged 1 commit intomainfrom
feat/pf-updates

Conversation

@smypmsa
Copy link
Member

@smypmsa smypmsa commented Feb 27, 2026

Summary

  • Update all 3 pump.fun IDL files (pump_fun, pump_swap, pump_fees) with new cashback rewards and fee-sharing features
  • Fix IDL parser crash on tuple struct types (OptionBool) that broke create_v2 instruction decoding
  • Add bonding_curve_v2 remaining account to all buy/sell instructions as required by the pump.fun program upgrade
  • Add is_cashback_coin support: propagate from CreateEvent/create_v2 through TokenInfo to conditionally include user_volume_accumulator in sell transactions for cashback coins

Closes #158

Test plan

  • IDL parser loads all 3 updated IDLs without crashing (29 instructions, 23 events for pump_fun)
  • OptionBool tuple struct type decodes correctly
  • CreateEvent decoding includes new is_cashback_enabled field
  • BondingCurve decoding includes new is_cashback_coin field
  • Live test: bot-sniper-3 (blocks listener) — full cycle buy+sell confirmed on-chain
  • Live test: bot-sniper-2 (logs listener) — full cycle buy+sell confirmed on-chain
  • Live test: bot-sniper-1 (geyser listener) — full cycle buy+sell confirmed on-chain

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Added cashback functionality: Users can now claim earned cashback from trading activity.
    • Introduced fee-sharing configuration system: Creators can establish and manage fee distribution among multiple shareholders.
    • Added fee distribution mechanism: Automated distribution of creator fees to configured recipients.
  • Enhancements

    • Expanded bonding curve system with v2 variant support.
    • Extended trade event tracking with cashback metrics.

Update all 3 pump.fun IDL files (pump_fun, pump_swap, pump_fees) with
new cashback rewards and fee-sharing features. Fix IDL parser to handle
tuple struct types (OptionBool). Add bonding_curve_v2 remaining account
to all buy/sell instructions as required by the pump.fun program upgrade.

Key changes:
- Fix IDL parser crash on tuple struct fields (string vs dict)
- Add bonding_curve_v2 PDA derivation and append as remaining account
- Add is_cashback_coin field to TokenInfo and BondingCurve decoding
- Propagate is_cashback_enabled from CreateEvent/create_v2 to TokenInfo
- Conditionally include user_volume_accumulator for cashback sell txs

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 27, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b6779c and a02e905.

📒 Files selected for processing (9)
  • idl/pump_fees.json
  • idl/pump_fun_idl.json
  • idl/pump_swap_idl.json
  • src/interfaces/core.py
  • src/platforms/pumpfun/address_provider.py
  • src/platforms/pumpfun/curve_manager.py
  • src/platforms/pumpfun/event_parser.py
  • src/platforms/pumpfun/instruction_builder.py
  • src/utils/idl_parser.py

📝 Walkthrough

Walkthrough

This PR adds comprehensive fee-sharing and cashback support to the Pump.Fun ecosystem. It introduces new IDL instructions, renames existing ones for clarity, adds multiple new public types and events across three IDL files (pump_fees.json, pump_fun_idl.json, pump_swap_idl.json), expands error handling, and updates platform-level code to integrate the new features including bonding curve v2 derivation, cashback field propagation, and IDL parsing enhancements.

Changes

Cohort / File(s) Summary
Fee-Sharing IDL Definitions
idl/pump_fees.json
Introduces create_fee_sharing_config instruction, renames update_admin → reset_fee_sharing_config, update_fee_config → revoke_fee_sharing_authority, and upsert_fee_tiers → update_fee_config. Adds comprehensive new types (SharingConfig, FeeConfig, FeeTier, Fees, Shareholder, Global, BondingCurve, Pool, ConfigStatus) and events with corresponding discriminators and error codes (6006–6020).
Pump.Fun IDL Enhancements
idl/pump_fun_idl.json
Adds claim_cashback instruction, renames extend_account → distribute_creator_fees with updated accounts and return type. Extends TradeEvent with mayhem_mode and cashback fields. Adds new public types (SharingConfig, Shareholder, ConfigStatus, DistributeCreatorFeesEvent, MigrateBondingCurveCreatorEvent, MinimumDistributableFeeEvent, UpdateMayhemVirtualParamsEvent, ClaimCashbackEvent). Expands Global and BondingCurve with cashback and mayhem-related fields.
Pump.Swap IDL Updates
idl/pump_swap_idl.json
Adds claim_cashback instruction and migrate_pool_coin_creator in migration path. Introduces ClaimCashbackEvent, MigratePoolCoinCreatorEvent, and updates SharingConfig, Shareholder, ConfigStatus types. Extends BondingCurve, Pool, GlobalConfig, and UserVolumeAccumulator with is_cashback_coin and cashback tracking fields. Adds error codes 6045–6052 for cashback and sharing config scenarios.
Core Data Structure
src/interfaces/core.py
Adds is_cashback_coin: bool field (default False) to TokenInfo dataclass for identifying cashback-enabled tokens.
Address Provider
src/platforms/pumpfun/address_provider.py
Introduces find_bonding_curve_v2() static method and derive_bonding_curve_v2() delegator for PDA derivation using "bonding-curve-v2" seed. Integrates bonding_curve_v2 into buy and sell instruction account generation.
Curve Manager
src/platforms/pumpfun/curve_manager.py
Adds is_cashback_coin field decoding from IDL state data and runtime validation that virtual reserves must be positive. Refactors price_per_token calculation to single-line expression.
Event Parser
src/platforms/pumpfun/event_parser.py
Extracts is_cashback_enabled from IDL-authored events and instruction arguments; threads this value through token creation paths in log-based, instruction-based, and account data parsing to populate is_cashback_coin on TokenInfo objects.
Instruction Builder
src/platforms/pumpfun/instruction_builder.py
Adds bonding_curve_v2 as required remaining account in buy instructions. Conditionally appends user_volume_accumulator for cashback tokens and always appends bonding_curve_v2 in sell instructions. Updates account lookup lists for priority computations. Removes SystemAddresses import.
IDL Parsing Utilities
src/utils/idl_parser.py
Updates struct size calculation to iterate over both named and tuple fields. Enhances enum size calculation to support variants with complex field structures. Refactors decoding logic to handle named fields (dicts) and tuple fields (strings/lists) uniformly across structs and enums.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • #142: Modifies TokenInfo dataclass with overlapping field additions (global_config, platform_config alongside is_cashback_coin).
  • #127: Implements SharingConfig, Shareholder types and cashback-related events/instructions across pump_fun and pump_swap IDLs and platform code.
  • #149: Adds mayhem-mode, Token2022, and cashback-related fields, PDAs, and instruction changes to Pump.Fun IDL and runtime handling.

Suggested labels

enhancement, bug

Suggested reviewers

  • akegaviar

Poem

🐰 Fee-sharing chains now gleam so bright,
Cashback rewards hop through the night,
V2 curves and shareholders unite,
While PDAs dance in lamport light!
The bunny's ledger—oh what a sight! ✨

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/pf-updates

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@smypmsa smypmsa self-assigned this Feb 27, 2026
@smypmsa smypmsa added bug Something isn't working enhancement New feature or request labels Feb 27, 2026
@smypmsa smypmsa merged commit 4a48f54 into main Feb 27, 2026
1 check was pending
@smypmsa smypmsa deleted the feat/pf-updates branch February 27, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

All buy transaction fail - Overflow error

1 participant