Fix PumpFun V2 buyback fee mutability
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "sol-trade-sdk"
|
name = "sol-trade-sdk"
|
||||||
version = "4.0.11"
|
version = "4.0.12"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = [
|
authors = [
|
||||||
"William <byteblock6@gmail.com>",
|
"William <byteblock6@gmail.com>",
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ fn build_buy_v2(params: &SwapParams) -> Result<Vec<Instruction>> {
|
|||||||
AccountMeta::new_readonly(accounts::ASSOCIATED_TOKEN_PROGRAM, false),
|
AccountMeta::new_readonly(accounts::ASSOCIATED_TOKEN_PROGRAM, false),
|
||||||
fee_recipient_meta,
|
fee_recipient_meta,
|
||||||
AccountMeta::new(associated_quote_fee_recipient, false),
|
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(associated_quote_buyback_fee_recipient, false),
|
||||||
AccountMeta::new(bonding_curve_addr, false),
|
AccountMeta::new(bonding_curve_addr, false),
|
||||||
AccountMeta::new(associated_base_bonding_curve, 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),
|
AccountMeta::new_readonly(accounts::ASSOCIATED_TOKEN_PROGRAM, false),
|
||||||
fee_recipient_meta,
|
fee_recipient_meta,
|
||||||
AccountMeta::new(associated_quote_fee_recipient, false),
|
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(associated_quote_buyback_fee_recipient, false),
|
||||||
AccountMeta::new(bonding_curve_addr, false),
|
AccountMeta::new(bonding_curve_addr, false),
|
||||||
AccountMeta::new(associated_base_bonding_curve, 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(¶ms).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(¶ms).unwrap().pop().unwrap();
|
||||||
|
assert!(global_constants::BUYBACK_FEE_RECIPIENTS.contains(&sell_ix.accounts[8].pubkey));
|
||||||
|
assert!(sell_ix.accounts[8].is_writable);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn pumpfun_v1_sell_fixed_output_uses_min_sol_directly() {
|
fn pumpfun_v1_sell_fixed_output_uses_min_sol_directly() {
|
||||||
let mint = pump_mint();
|
let mint = pump_mint();
|
||||||
|
|||||||
Reference in New Issue
Block a user