From c2f2113211b322b602185a7e2efdb335a8343c2e Mon Sep 17 00:00:00 2001 From: Estereg Date: Sat, 21 Feb 2026 09:51:02 +0000 Subject: [PATCH] feat(pumpfun): align IDL for V2, Mayhem & Cashback Update BondingCurve & Global structs, fix account mappings (Create/Buy/Sell), improve trade event merging, add missing fields to create events, and fix create_v2 user mapping. --- Cargo.toml | 26 -------------- .../event_parser/core/merger_event.rs | 5 +++ .../event_parser/protocols/pumpfun/events.rs | 36 +++++++++++++++++++ .../event_parser/protocols/pumpfun/parser.rs | 22 +++++++++++- .../event_parser/protocols/pumpfun/types.rs | 6 ++-- 5 files changed, 66 insertions(+), 29 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index be3aed4..51fea51 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,24 +16,13 @@ crate-type = ["cdylib", "rlib"] solana-sdk = "3.0.0" solana-client = "3.1.9" solana-program = "3.0.0" -solana-rpc-client = "3.1.9" -solana-rpc-client-api = "3.1.9" solana-transaction-status = "3.1.9" solana-account-decoder = "3.1.9" -solana-hash = "4.2.0" solana-entry = { version = "3.1.9", features = ["agave-unstable-api"] } -solana-rpc-client-nonce-utils = "3.1.9" -solana-perf = "3.1.9" -solana-metrics = "3.1.9" -spl-associated-token-account = "8.0.0" borsh = { version = "1.6.0", features = ["derive"] } serde = { version = "1.0.228", features = ["derive"] } -serde_json = "1.0.149" serde-big-array = "0.5.1" futures = "0.3.32" -futures-util = "0.3.32" -base64 = "0.22.1" -rand = "0.9.2" bincode = "1.3" anyhow = "1.0.102" yellowstone-grpc-client = { version = "10.2.0" } @@ -41,30 +30,15 @@ yellowstone-grpc-proto = { version = "10.1.1" } tokio = { version = "1.49.0", features = ["full", "rt-multi-thread"]} tonic = { version = "0.14.5", features = ["transport"] } rustls = { version = "0.23.36", features = ["ring"], default-features = false } -rustls-native-certs = "0.8.3" -tokio-rustls = "0.26.4" log = "0.4.29" chrono = "0.4.43" -regex = "1" -tracing = "0.1.44" -thiserror = "2.0.18" -async-trait = "0.1.89" lazy_static = "1.5.0" once_cell = "1.21.3" dashmap = "6.1.0" prost = "0.14.3" prost-types = "0.14.3" -num_enum = "0.7.5" -num-derive = "0.4.2" -num-traits = "0.2.19" -hex = "0.4.3" -bytemuck = { version = "1.25.0" } -arrayref = "0.3.9" -borsh-derive = "1.6.0" -indicatif = "0.18.4" maplit = "1.0.2" env_logger = "0.11.9" -crossbeam = "0.8.4" crossbeam-queue = "0.3.12" parking_lot = "0.12.5" wide = "1.1.1" diff --git a/src/streaming/event_parser/core/merger_event.rs b/src/streaming/event_parser/core/merger_event.rs index 3dd6371..b406fe3 100644 --- a/src/streaming/event_parser/core/merger_event.rs +++ b/src/streaming/event_parser/core/merger_event.rs @@ -21,6 +21,11 @@ pub fn merge(instruction_event: &mut DexEvent, cpi_log_event: DexEvent) { e.creator = cpie.creator; e.creator_fee_basis_points = cpie.creator_fee_basis_points; e.creator_fee = cpie.creator_fee; + e.track_volume = cpie.track_volume; + e.total_unclaimed_tokens = cpie.total_unclaimed_tokens; + e.total_claimed_tokens = cpie.total_claimed_tokens; + e.current_sol_volume = cpie.current_sol_volume; + e.last_update_timestamp = cpie.last_update_timestamp; e.ix_name = cpie.ix_name.clone(); e.mayhem_mode = cpie.mayhem_mode; e.cashback_fee_basis_points = cpie.cashback_fee_basis_points; diff --git a/src/streaming/event_parser/protocols/pumpfun/events.rs b/src/streaming/event_parser/protocols/pumpfun/events.rs index 678232c..f09838d 100755 --- a/src/streaming/event_parser/protocols/pumpfun/events.rs +++ b/src/streaming/event_parser/protocols/pumpfun/events.rs @@ -32,6 +32,22 @@ pub struct PumpFunCreateTokenEvent { pub mint_authority: Pubkey, #[borsh(skip)] pub associated_bonding_curve: Pubkey, + #[borsh(skip)] + pub global: Pubkey, + #[borsh(skip)] + pub mpl_token_metadata: Pubkey, + #[borsh(skip)] + pub metadata_account: Pubkey, + #[borsh(skip)] + pub system_program: Pubkey, + #[borsh(skip)] + pub associated_token_program: Pubkey, + #[borsh(skip)] + pub rent: Pubkey, + #[borsh(skip)] + pub event_authority: Pubkey, + #[borsh(skip)] + pub program: Pubkey, } #[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, BorshDeserialize)] @@ -58,6 +74,26 @@ pub struct PumpFunCreateV2TokenEvent { pub mint_authority: Pubkey, #[borsh(skip)] pub associated_bonding_curve: Pubkey, + #[borsh(skip)] + pub global: Pubkey, + #[borsh(skip)] + pub system_program: Pubkey, + #[borsh(skip)] + pub associated_token_program: Pubkey, + #[borsh(skip)] + pub mayhem_program_id: Pubkey, + #[borsh(skip)] + pub global_params: Pubkey, + #[borsh(skip)] + pub sol_vault: Pubkey, + #[borsh(skip)] + pub mayhem_state: Pubkey, + #[borsh(skip)] + pub mayhem_token_vault: Pubkey, + #[borsh(skip)] + pub event_authority: Pubkey, + #[borsh(skip)] + pub program: Pubkey, } pub fn pumpfun_create_v2_token_event_log_decode(data: &[u8]) -> Option { diff --git a/src/streaming/event_parser/protocols/pumpfun/parser.rs b/src/streaming/event_parser/protocols/pumpfun/parser.rs index 2e0447f..78058bb 100755 --- a/src/streaming/event_parser/protocols/pumpfun/parser.rs +++ b/src/streaming/event_parser/protocols/pumpfun/parser.rs @@ -168,7 +168,16 @@ fn parse_create_token_instruction( mint_authority: accounts[1], bonding_curve: accounts[2], associated_bonding_curve: accounts[3], + global: accounts[4], + mpl_token_metadata: accounts[5], + metadata_account: accounts[6], user: accounts[7], + system_program: accounts[8], + token_program: accounts[9], + associated_token_program: accounts[10], + rent: accounts[11], + event_authority: accounts[12], + program: accounts[13], ..Default::default() })) } @@ -231,7 +240,18 @@ fn parse_create_v2_token_instruction( mint_authority: accounts[1], bonding_curve: accounts[2], associated_bonding_curve: accounts[3], - user: accounts[7], + global: accounts[4], + user: accounts[5], + system_program: accounts[6], + token_program: accounts[7], + associated_token_program: accounts[8], + mayhem_program_id: accounts[9], + global_params: accounts[10], + sol_vault: accounts[11], + mayhem_state: accounts[12], + mayhem_token_vault: accounts[13], + event_authority: accounts[14], + program: accounts[15], ..Default::default() })) } diff --git a/src/streaming/event_parser/protocols/pumpfun/types.rs b/src/streaming/event_parser/protocols/pumpfun/types.rs index 376f2b7..5118866 100644 --- a/src/streaming/event_parser/protocols/pumpfun/types.rs +++ b/src/streaming/event_parser/protocols/pumpfun/types.rs @@ -21,9 +21,10 @@ pub struct BondingCurve { pub complete: bool, pub creator: Pubkey, pub is_mayhem_mode: bool, + pub is_cashback_coin: bool, } -pub const BONDING_CURVE_SIZE: usize = 8 * 5 + 1 + 32 + 1; +pub const BONDING_CURVE_SIZE: usize = 8 * 5 + 1 + 32 + 1 + 1; pub fn bonding_curve_decode(data: &[u8]) -> Option { if data.len() < BONDING_CURVE_SIZE { @@ -78,9 +79,10 @@ pub struct Global { pub reserved_fee_recipient: Pubkey, pub mayhem_mode_enabled: bool, pub reserved_fee_recipients: [Pubkey; 7], + pub is_cashback_enabled: bool, } -pub const GLOBAL_SIZE: usize = 1 + 32 * 2 + 8 * 5 + 32 + 1 + 8 * 2 + 32 * 7 + 32 * 2 + 1 + 32 * 2 + 1 + 32 * 7; +pub const GLOBAL_SIZE: usize = 1 + 32 * 2 + 8 * 5 + 32 + 1 + 8 * 2 + 32 * 7 + 32 * 2 + 1 + 32 * 2 + 1 + 32 * 7 + 1; pub fn global_decode(data: &[u8]) -> Option { if data.len() < GLOBAL_SIZE {