diff --git a/Cargo.toml b/Cargo.toml index f4ba803..1d9bcdd 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "solana-streamer-sdk" -version = "1.5.16" +version = "2.0.0" edition = "2021" authors = ["William ", "sgxiang ", "wei <1415121722@qq.com>"] repository = "https://github.com/0xfnzero/solana-streamer" @@ -21,7 +21,7 @@ sdk-perf-stats = ["sol-parser-sdk/perf-stats"] sdk-ultra-perf = ["sol-parser-sdk/ultra-perf"] [dependencies] -sol-parser-sdk = { version = "0.5.15", default-features = false } +sol-parser-sdk = { version = "0.6.0", git = "https://github.com/0xfnzero/sol-parser-sdk", branch = "dev", default-features = false } solana-sdk = "3.0.0" solana-client = "3.1.12" solana-transaction-status = "3.1.12" diff --git a/idl/pump_amm.json b/idl/pump_amm.json index 372cf2a..a654b6f 100644 --- a/idl/pump_amm.json +++ b/idl/pump_amm.json @@ -288,6 +288,213 @@ } ] }, + { + "name": "boost_buy_and_burn", + "discriminator": [ + 105, + 68, + 6, + 175, + 0, + 7, + 35, + 162 + ], + "accounts": [ + { + "name": "pool" + }, + { + "name": "authority", + "writable": true, + "signer": true + }, + { + "name": "global_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + } + ] + } + }, + { + "name": "base_mint", + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "quote_mint", + "relations": [ + "pool" + ] + }, + { + "name": "pool_base_token_account", + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "pool_quote_token_account", + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "boost_vault_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 98, + 111, + 111, + 115, + 116, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool" + } + ] + } + }, + { + "name": "boost_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "boost_vault_authority" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "base_token_program" + }, + { + "name": "quote_token_program" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "quote_amount_in", + "type": "u64" + }, + { + "name": "min_base_amount_burned", + "type": "u64" + } + ] + }, { "name": "buy", "docs": [ @@ -2587,6 +2794,208 @@ ], "args": [] }, + { + "name": "init_boost", + "discriminator": [ + 140, + 233, + 33, + 94, + 132, + 90, + 194, + 143 + ], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "global_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + } + ] + } + }, + { + "name": "creator", + "writable": true, + "signer": true + }, + { + "name": "base_mint", + "relations": [ + "pool" + ] + }, + { + "name": "quote_mint", + "relations": [ + "pool" + ] + }, + { + "name": "pool_base_token_account", + "relations": [ + "pool" + ] + }, + { + "name": "pool_quote_token_account", + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "boost_vault_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 98, + 111, + 111, + 115, + 116, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool" + } + ] + } + }, + { + "name": "boost_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "boost_vault_authority" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "quote_token_program" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, { "name": "init_user_volume_accumulator", "discriminator": [ @@ -3175,6 +3584,72 @@ } ] }, + { + "name": "set_boost_authority", + "discriminator": [ + 227, + 149, + 76, + 42, + 130, + 39, + 234, + 205 + ], + "accounts": [ + { + "name": "admin", + "signer": true, + "relations": [ + "global_config" + ] + }, + { + "name": "global_config", + "writable": true + }, + { + "name": "boost_authority" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, { "name": "set_coin_creator", "docs": [ @@ -3610,6 +4085,38 @@ ], "args": [] }, + { + "name": "toggle_boost", + "discriminator": [ + 117, + 161, + 160, + 74, + 223, + 137, + 118, + 99 + ], + "accounts": [ + { + "name": "admin", + "signer": true, + "relations": [ + "global_config" + ] + }, + { + "name": "global_config", + "writable": true + } + ], + "args": [ + { + "name": "enabled", + "type": "bool" + } + ] + }, { "name": "toggle_cashback_enabled", "discriminator": [ @@ -3965,6 +4472,254 @@ ], "args": [] }, + { + "name": "transfer_creator_fees_to_pump_v2", + "discriminator": [ + 1, + 33, + 78, + 185, + 33, + 67, + 44, + 92 + ], + "accounts": [ + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "quote_mint" + }, + { + "name": "token_program" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "coin_creator" + }, + { + "name": "coin_creator_vault_authority", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "coin_creator" + } + ] + } + }, + { + "name": "coin_creator_vault_ata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "coin_creator_vault_authority" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "pump_creator_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 45, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "coin_creator" + } + ], + "program": { + "kind": "const", + "value": [ + 1, + 86, + 224, + 246, + 147, + 102, + 90, + 207, + 68, + 219, + 21, + 104, + 191, + 23, + 91, + 170, + 81, + 137, + 203, + 151, + 245, + 210, + 255, + 59, + 101, + 93, + 43, + 182, + 253, + 109, + 24, + 176 + ] + } + } + }, + { + "name": "pump_creator_vault_ata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "pump_creator_vault" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "account", + "path": "associated_token_program" + } + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, { "name": "update_admin", "discriminator": [ @@ -4027,6 +4782,72 @@ ], "args": [] }, + { + "name": "update_buyback_config", + "discriminator": [ + 251, + 224, + 171, + 146, + 160, + 26, + 113, + 233 + ], + "accounts": [ + { + "name": "admin", + "signer": true, + "relations": [ + "global_config" + ] + }, + { + "name": "global_config", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "buyback_basis_points", + "type": { + "option": "u64" + } + } + ] + }, { "name": "update_fee_config", "discriminator": [ @@ -4358,6 +5179,19 @@ 222 ] }, + { + "name": "BoostBuyAndBurnEvent", + "discriminator": [ + 63, + 69, + 28, + 22, + 48, + 92, + 194, + 185 + ] + }, { "name": "BuyEvent", "discriminator": [ @@ -4488,6 +5322,19 @@ 124 ] }, + { + "name": "InitBoostEvent", + "discriminator": [ + 174, + 124, + 74, + 249, + 4, + 81, + 246, + 17 + ] + }, { "name": "InitUserVolumeAccumulatorEvent", "discriminator": [ @@ -4553,6 +5400,19 @@ 211 ] }, + { + "name": "SetBoostAuthorityEvent", + "discriminator": [ + 89, + 128, + 240, + 141, + 91, + 202, + 71, + 105 + ] + }, { "name": "SetMetaplexCoinCreatorEvent", "discriminator": [ @@ -4836,6 +5696,78 @@ { "code": 6052, "name": "TokensInVaultLessThanCashbackEarned" + }, + { + "code": 6053, + "name": "BuybackFeeRecipientNotAuthorized", + "msg": "Buyback fee recipient not authorized" + }, + { + "code": 6054, + "name": "AllBuybackFeeRecipientsShouldBeNonZero" + }, + { + "code": 6055, + "name": "NotUniqueBuybackFeeRecipients" + }, + { + "code": 6056, + "name": "BuybackBasisPointsOutOfRange", + "msg": "buyback_basis_points must be <= 10_000" + }, + { + "code": 6057, + "name": "WrongBuybackFeeRecipientsCount", + "msg": "buyback fee recipients require exactly 8 remaining accounts (or none)" + }, + { + "code": 6058, + "name": "BuybackFeeRecipientMissing" + }, + { + "code": 6059, + "name": "MissingCashbackAccounts", + "msg": "Cashback trade is missing the required remaining accounts" + }, + { + "code": 6060, + "name": "InvalidCashbackAccumulator", + "msg": "Cashback user_volume_accumulator account is invalid" + }, + { + "code": 6061, + "name": "InvalidCashbackAccumulatorAta", + "msg": "Cashback user_volume_accumulator ATA is missing or invalid" + }, + { + "code": 6062, + "name": "InvalidPoolV2", + "msg": "pool_v2 remaining account is missing or invalid" + }, + { + "code": 6063, + "name": "InsufficientRealQuoteReserves", + "msg": "BOOST: sell output exceeds the real quote vault. effective = real + virtual is pricing-only; payout is capped at real_vault, so quote min(out, real_vault)" + }, + { + "code": 6064, + "name": "BoostPoolLiquidityUnsupported", + "msg": "BOOST: deposit/withdraw don't apply to boost pools" + }, + { + "code": 6065, + "name": "PoolCannotBoost", + "msg": "BOOST: pool cannot be boosted (no virtual reserves)" + }, + { + "code": 6066, + "name": "BoostDisabled", + "msg": "BOOST: boost is disabled" + }, + { + "code": 6067, + "name": "SeedLockViolation", + "msg": "BOOST: lp_supply must never drop below the circulating LP mint supply" } ], "types": [ @@ -4951,6 +5883,62 @@ ] } }, + { + "name": "BoostBuyAndBurnEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "bonding_curve", + "type": "pubkey" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "authority", + "type": "pubkey" + }, + { + "name": "quote_amount_in_requested", + "type": "u64" + }, + { + "name": "quote_amount_in_used", + "type": "u64" + }, + { + "name": "base_amount_burned", + "type": "u64" + }, + { + "name": "virtual_quote_reserves", + "type": "i128" + }, + { + "name": "real_quote_reserves_after", + "type": "u64" + }, + { + "name": "base_reserves_after", + "type": "u64" + }, + { + "name": "boost_vault_remaining", + "type": "u64" + } + ] + } + }, { "name": "BuyEvent", "docs": [ @@ -5086,6 +6074,26 @@ { "name": "cashback", "type": "u64" + }, + { + "name": "buyback_fee_basis_points", + "type": "u64" + }, + { + "name": "buyback_fee", + "type": "u64" + }, + { + "name": "virtual_quote_reserves", + "type": "i128" + }, + { + "name": "can_boost", + "type": "bool" + }, + { + "name": "base_supply", + "type": "u64" } ] } @@ -5523,6 +6531,16 @@ } } } + }, + { + "name": "stable_fee_tiers", + "type": { + "vec": { + "defined": { + "name": "FeeTier" + } + } + } } ] } @@ -5646,6 +6664,27 @@ { "name": "is_cashback_enabled", "type": "bool" + }, + { + "name": "buyback_fee_recipients", + "type": { + "array": [ + "pubkey", + 8 + ] + } + }, + { + "name": "buyback_basis_points", + "type": "u64" + }, + { + "name": "boost_authority", + "type": "pubkey" + }, + { + "name": "boost_enabled", + "type": "bool" } ] } @@ -5692,6 +6731,38 @@ ] } }, + { + "name": "InitBoostEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "bonding_curve", + "type": "pubkey" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "virtual_quote_reserves", + "type": "i128" + }, + { + "name": "real_quote_reserves_after", + "type": "u64" + } + ] + } + }, { "name": "InitUserVolumeAccumulatorEvent", "type": { @@ -5808,6 +6879,13 @@ { "name": "is_cashback_coin", "type": "bool" + }, + { + "name": "virtual_quote_reserves", + "docs": [ + "For non-boost pools, value is 0, so the behavior is identical to legacy pools." + ], + "type": "i128" } ] } @@ -5941,6 +7019,26 @@ { "name": "cashback", "type": "u64" + }, + { + "name": "buyback_fee_basis_points", + "type": "u64" + }, + { + "name": "buyback_fee", + "type": "u64" + }, + { + "name": "virtual_quote_reserves", + "type": "i128" + }, + { + "name": "can_boost", + "type": "bool" + }, + { + "name": "base_supply", + "type": "u64" } ] } @@ -5973,6 +7071,30 @@ ] } }, + { + "name": "SetBoostAuthorityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "old_boost_authority", + "type": "pubkey" + }, + { + "name": "new_boost_authority", + "type": "pubkey" + } + ] + } + }, { "name": "SetMetaplexCoinCreatorEvent", "type": { diff --git a/src/streaming/event_parser/core/merger_event.rs b/src/streaming/event_parser/core/merger_event.rs index d473f86..4a847bc 100644 --- a/src/streaming/event_parser/core/merger_event.rs +++ b/src/streaming/event_parser/core/merger_event.rs @@ -342,6 +342,11 @@ pub fn merge(instruction_event: &mut DexEvent, cpi_log_event: DexEvent) { e.ix_name = cpie.ix_name.clone(); e.cashback_fee_basis_points = cpie.cashback_fee_basis_points; e.cashback = cpie.cashback; + e.buyback_fee_basis_points = cpie.buyback_fee_basis_points; + e.buyback_fee = cpie.buyback_fee; + e.virtual_quote_reserves = cpie.virtual_quote_reserves; + e.can_boost = cpie.can_boost; + e.base_supply = cpie.base_supply; e.is_pump_pool = cpie.is_pump_pool; fill_pubkey(&mut e.base_mint, cpie.base_mint); fill_pubkey(&mut e.quote_mint, cpie.quote_mint); @@ -387,6 +392,11 @@ pub fn merge(instruction_event: &mut DexEvent, cpi_log_event: DexEvent) { e.coin_creator_fee = cpie.coin_creator_fee; e.cashback_fee_basis_points = cpie.cashback_fee_basis_points; e.cashback = cpie.cashback; + e.buyback_fee_basis_points = cpie.buyback_fee_basis_points; + e.buyback_fee = cpie.buyback_fee; + e.virtual_quote_reserves = cpie.virtual_quote_reserves; + e.can_boost = cpie.can_boost; + e.base_supply = cpie.base_supply; e.is_pump_pool = cpie.is_pump_pool; fill_pubkey(&mut e.base_mint, cpie.base_mint); fill_pubkey(&mut e.quote_mint, cpie.quote_mint); @@ -858,6 +868,7 @@ mod tests { use crate::streaming::event_parser::protocols::pumpfun::events::{ PumpFeesShareholder, PumpFunTradeEvent, }; + use crate::streaming::event_parser::protocols::pumpswap::events::PumpSwapSellEvent; #[test] fn pumpfun_merge_keeps_instruction_context_and_copies_latest_trade_tail() { @@ -912,6 +923,30 @@ mod tests { } } + #[test] + fn pumpswap_merge_preserves_signed_virtual_quote_reserves() { + let mut instruction_event = DexEvent::PumpSwapSellEvent(PumpSwapSellEvent::default()); + let log_event = DexEvent::PumpSwapSellEvent(PumpSwapSellEvent { + virtual_quote_reserves: -500, + buyback_fee_basis_points: 11, + buyback_fee: 22, + can_boost: true, + base_supply: 33, + ..Default::default() + }); + + merge(&mut instruction_event, log_event); + + let DexEvent::PumpSwapSellEvent(event) = instruction_event else { + panic!("expected PumpSwapSellEvent"); + }; + assert_eq!(event.virtual_quote_reserves, -500); + assert_eq!(event.buyback_fee_basis_points, 11); + assert_eq!(event.buyback_fee, 22); + assert!(event.can_boost); + assert_eq!(event.base_supply, 33); + } + #[test] fn pumpfun_merge_replaces_sol_quote_sentinel_with_real_quote_mint() { let quote_mint = Pubkey::new_unique(); diff --git a/src/streaming/event_parser/protocols/pumpswap/events.rs b/src/streaming/event_parser/protocols/pumpswap/events.rs index 6764109..f3297a4 100755 --- a/src/streaming/event_parser/protocols/pumpswap/events.rs +++ b/src/streaming/event_parser/protocols/pumpswap/events.rs @@ -44,6 +44,11 @@ pub struct PumpSwapBuyEvent { pub ix_name: String, pub cashback_fee_basis_points: u64, pub cashback: u64, + pub buyback_fee_basis_points: u64, + pub buyback_fee: u64, + pub virtual_quote_reserves: i128, + pub can_boost: bool, + pub base_supply: u64, #[borsh(skip)] pub is_pump_pool: bool, #[borsh(skip)] @@ -105,6 +110,11 @@ pub struct PumpSwapSellEvent { pub coin_creator_fee: u64, pub cashback_fee_basis_points: u64, pub cashback: u64, + pub buyback_fee_basis_points: u64, + pub buyback_fee: u64, + pub virtual_quote_reserves: i128, + pub can_boost: bool, + pub base_supply: u64, #[borsh(skip)] pub is_pump_pool: bool, #[borsh(skip)] diff --git a/src/streaming/event_parser/protocols/pumpswap/types.rs b/src/streaming/event_parser/protocols/pumpswap/types.rs index e56a2a3..c1f7f3a 100644 --- a/src/streaming/event_parser/protocols/pumpswap/types.rs +++ b/src/streaming/event_parser/protocols/pumpswap/types.rs @@ -33,13 +33,12 @@ pub struct Pool { pub coin_creator: Pubkey, pub is_mayhem_mode: bool, pub is_cashback_coin: bool, - /// On-chain reserved tail (7 bytes); keep in sync with pump_amm pool account layout. - pub reserved: [u8; 7], + pub virtual_quote_reserves: i128, } -/// Legacy pool account body (before `is_cashback_coin` + reserved). -pub const POOL_BODY_LEGACY: usize = 1 + 2 + 32 * 6 + 8 + 32 + 1; -/// Current pool account body including flags and reserved. -pub const POOL_BODY: usize = POOL_BODY_LEGACY + 1 + 7; +/// Legacy allocated pool account body. +pub const POOL_BODY_LEGACY: usize = 244; +/// Current serialized pool account body including signed virtual quote reserves. +pub const POOL_BODY: usize = 253; pub const POOL_SIZE: usize = POOL_BODY; diff --git a/src/streaming/parser_sdk_bridge/bonk_accounts.rs b/src/streaming/parser_sdk_bridge/bonk_accounts.rs index 491eb5a..9db7cc5 100644 --- a/src/streaming/parser_sdk_bridge/bonk_accounts.rs +++ b/src/streaming/parser_sdk_bridge/bonk_accounts.rs @@ -185,7 +185,7 @@ pub(crate) fn pumpswap_pool_from_pb(p: sol_parser_sdk::core::events::PumpSwapPoo coin_creator: p.coin_creator, is_mayhem_mode: p.is_mayhem_mode, is_cashback_coin: p.is_cashback_coin, - reserved: [0u8; 7], + virtual_quote_reserves: p.virtual_quote_reserves, } } diff --git a/src/streaming/parser_sdk_bridge/mod.rs b/src/streaming/parser_sdk_bridge/mod.rs index e5f7a9f..61a5e0a 100644 --- a/src/streaming/parser_sdk_bridge/mod.rs +++ b/src/streaming/parser_sdk_bridge/mod.rs @@ -43,10 +43,10 @@ mod tests { use sol_parser_sdk::core::events::{ EventMetadata, MeteoraDlmmSwapEvent as PbDlmmSwap, OrcaWhirlpoolSwapEvent as PbOrcaSwap, PumpFunCreateV2TokenEvent as PbPumpCreateV2, PumpFunTradeEvent as PbPumpTrade, - PumpSwapCreatePoolEvent as PbPumpSwapCreatePool, PumpSwapPool as PbPumpSwapPool, - PumpSwapPoolAccountEvent as PbPumpSwapPoolAccount, - RaydiumLaunchlabTradeEvent as PbBonkTrade, TokenInfoEvent as PbTokenInfo, - TradeDirection as PbBonkDir, + PumpSwapBuyEvent as PbPumpSwapBuy, PumpSwapCreatePoolEvent as PbPumpSwapCreatePool, + PumpSwapPool as PbPumpSwapPool, PumpSwapPoolAccountEvent as PbPumpSwapPoolAccount, + PumpSwapSellEvent as PbPumpSwapSell, RaydiumLaunchlabTradeEvent as PbBonkTrade, + TokenInfoEvent as PbTokenInfo, TradeDirection as PbBonkDir, }; use sol_parser_sdk::DexEvent as PbDexEvent; use solana_sdk::{pubkey::Pubkey, signature::Signature}; @@ -242,6 +242,52 @@ mod tests { } } + #[test] + fn converts_pumpswap_buy_boost_tail() { + let event = PbPumpSwapBuy { + virtual_quote_reserves: -123, + buyback_fee_basis_points: 11, + buyback_fee: 22, + can_boost: true, + base_supply: 33, + ..Default::default() + }; + + let converted = + convert_parser_event(PbDexEvent::PumpSwapBuy(event), None, 999).expect("convert"); + let DexEvent::PumpSwapBuyEvent(converted) = converted else { + panic!("expected PumpSwapBuyEvent"); + }; + assert_eq!(converted.virtual_quote_reserves, -123); + assert_eq!(converted.buyback_fee_basis_points, 11); + assert_eq!(converted.buyback_fee, 22); + assert!(converted.can_boost); + assert_eq!(converted.base_supply, 33); + } + + #[test] + fn converts_pumpswap_sell_boost_tail() { + let event = PbPumpSwapSell { + virtual_quote_reserves: 123, + buyback_fee_basis_points: 44, + buyback_fee: 55, + can_boost: true, + base_supply: 66, + ..Default::default() + }; + + let converted = + convert_parser_event(PbDexEvent::PumpSwapSell(event), None, 999).expect("convert"); + let DexEvent::PumpSwapSellEvent(converted) = converted else { + panic!("expected PumpSwapSellEvent"); + }; + assert_eq!(converted.virtual_quote_reserves, 123); + assert_eq!(converted.buyback_fee_basis_points, 44); + assert_eq!(converted.buyback_fee, 55); + assert!(converted.can_boost); + assert_eq!(converted.base_supply, 66); + } + #[test] fn converts_pumpswap_pool_account_cashback_flag() { let pool_pubkey = Pubkey::new_unique(); @@ -272,6 +318,7 @@ mod tests { coin_creator: Pubkey::new_unique(), is_mayhem_mode: true, is_cashback_coin: true, + virtual_quote_reserves: -777, }, }; @@ -283,6 +330,7 @@ mod tests { assert_eq!(st.pubkey, pool_pubkey); assert!(st.pool.is_mayhem_mode); assert!(st.pool.is_cashback_coin); + assert_eq!(st.pool.virtual_quote_reserves, -777); } _ => panic!("expected PumpSwapPoolAccountEvent"), } diff --git a/src/streaming/parser_sdk_bridge/pump_pumpswap.rs b/src/streaming/parser_sdk_bridge/pump_pumpswap.rs index 26a80e2..0a79486 100644 --- a/src/streaming/parser_sdk_bridge/pump_pumpswap.rs +++ b/src/streaming/parser_sdk_bridge/pump_pumpswap.rs @@ -523,6 +523,11 @@ pub(crate) fn pumpswap_buy_full_from_parser( ix_name: b.ix_name, cashback_fee_basis_points: b.cashback_fee_basis_points, cashback: b.cashback, + buyback_fee_basis_points: b.buyback_fee_basis_points, + buyback_fee: b.buyback_fee, + virtual_quote_reserves: b.virtual_quote_reserves, + can_boost: b.can_boost, + base_supply: b.base_supply, is_pump_pool: b.is_pump_pool, base_mint: b.base_mint, quote_mint: b.quote_mint, @@ -569,6 +574,11 @@ pub(crate) fn pumpswap_sell_full_from_parser( coin_creator_fee: s.coin_creator_fee, cashback_fee_basis_points: s.cashback_fee_basis_points, cashback: s.cashback, + buyback_fee_basis_points: s.buyback_fee_basis_points, + buyback_fee: s.buyback_fee, + virtual_quote_reserves: s.virtual_quote_reserves, + can_boost: s.can_boost, + base_supply: s.base_supply, is_pump_pool: s.is_pump_pool, base_mint: s.base_mint, quote_mint: s.quote_mint,