Compare commits

..

1 Commits

Author SHA1 Message Date
0xfnzero 57e4c5d221 Fix PumpFun V2 buyback fee mutability 2026-05-22 08:56:20 +08:00
2 changed files with 21 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "sol-trade-sdk"
version = "4.0.11"
version = "4.0.12"
edition = "2021"
authors = [
"William <byteblock6@gmail.com>",
+20 -2
View File
@@ -515,7 +515,7 @@ fn build_buy_v2(params: &SwapParams) -> Result<Vec<Instruction>> {
AccountMeta::new_readonly(accounts::ASSOCIATED_TOKEN_PROGRAM, false),
fee_recipient_meta,
AccountMeta::new(associated_quote_fee_recipient, false),
AccountMeta::new_readonly(buyback_fee_recipient, false),
AccountMeta::new(buyback_fee_recipient, false),
AccountMeta::new(associated_quote_buyback_fee_recipient, false),
AccountMeta::new(bonding_curve_addr, false),
AccountMeta::new(associated_base_bonding_curve, false),
@@ -705,7 +705,7 @@ fn build_sell_v2(params: &SwapParams) -> Result<Vec<Instruction>> {
AccountMeta::new_readonly(accounts::ASSOCIATED_TOKEN_PROGRAM, false),
fee_recipient_meta,
AccountMeta::new(associated_quote_fee_recipient, false),
AccountMeta::new_readonly(buyback_fee_recipient, false),
AccountMeta::new(buyback_fee_recipient, false),
AccountMeta::new(associated_quote_buyback_fee_recipient, false),
AccountMeta::new(bonding_curve_addr, false),
AccountMeta::new(associated_base_bonding_curve, false),
@@ -937,6 +937,24 @@ mod tests {
}
}
#[test]
fn pumpfun_v2_buyback_fee_recipient_is_writable() {
let mint = pump_mint();
let mut params = swap_params_for_buy(mint, TOKEN_PROGRAM);
params.create_output_mint_ata = false;
let buy_ix = build_buy_v2(&params).unwrap().pop().unwrap();
assert!(global_constants::BUYBACK_FEE_RECIPIENTS.contains(&buy_ix.accounts[8].pubkey));
assert!(buy_ix.accounts[8].is_writable);
params.trade_type = crate::swqos::TradeType::Sell;
params.input_mint = mint;
params.output_mint = crate::constants::SOL_TOKEN_ACCOUNT;
let sell_ix = build_sell_v2(&params).unwrap().pop().unwrap();
assert!(global_constants::BUYBACK_FEE_RECIPIENTS.contains(&sell_ix.accounts[8].pubkey));
assert!(sell_ix.accounts[8].is_writable);
}
#[test]
fn pumpfun_v1_sell_fixed_output_uses_min_sol_directly() {
let mint = pump_mint();