feat: PumpFun & PumpSwap Cashback support

- Sync IDL from pump-public-docs into idl/
- Add is_cashback_coin to BondingCurve and Pool
- Pump sell: append UserVolumeAccumulator as remaining account when cashback coin
- PumpSwap buy/sell: append cashback remaining accounts after fee_config/fee_program
- Add claim_cashback instructions and TradingClient.claim_cashback_pumpfun/pumpswap()
- Add docs/PUMP_CASHBACK_README.md

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Wood
2026-02-18 23:01:14 +08:00
co-authored by Cursor
parent feaac5ddd2
commit a048f3b6ad
11 changed files with 16352 additions and 5 deletions
+10
View File
@@ -185,6 +185,16 @@ pub fn get_user_volume_accumulator_pda(user: &Pubkey) -> Option<Pubkey> {
)
}
/// WSOL ATA of UserVolumeAccumulator for Pump AMM (used for cashback remaining accounts).
pub fn get_user_volume_accumulator_wsol_ata(user: &Pubkey) -> Option<Pubkey> {
let accumulator = get_user_volume_accumulator_pda(user)?;
Some(crate::common::fast_fn::get_associated_token_address_with_program_id_fast(
&accumulator,
&crate::constants::WSOL_TOKEN_ACCOUNT,
&crate::constants::TOKEN_PROGRAM,
))
}
pub fn get_global_volume_accumulator_pda() -> Option<Pubkey> {
let seeds: &[&[u8]; 1] = &[&seeds::GLOBAL_VOLUME_ACCUMULATOR_SEED];
let program_id: &Pubkey = &&accounts::AMM_PROGRAM;
+3 -1
View File
@@ -15,9 +15,11 @@ pub struct Pool {
pub lp_supply: u64,
pub coin_creator: Pubkey,
pub is_mayhem_mode: bool,
/// Whether this pool's coin has cashback enabled
pub is_cashback_coin: bool,
}
pub const POOL_SIZE: usize = 1 + 2 + 32 * 6 + 8 + 32 + 1;
pub const POOL_SIZE: usize = 1 + 2 + 32 * 6 + 8 + 32 + 1 + 1;
pub fn pool_decode(data: &[u8]) -> Option<Pool> {
if data.len() < POOL_SIZE {