mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-14 09:28:05 +00:00
Major architectural refactor, upgrading from simple logging system to comprehensive multi-protocol Solana DEX event streaming system: ✨ New Features: - Support for 5 DEX protocols: PumpFun, PumpSwap, Bonk, Raydium CPMM, Raydium CLMM - Implement unified event interface (UnifiedEvent trait) and event factory pattern - Add dual streaming support: Yellowstone gRPC and ShredStream - Add Chinese documentation (README_CN.md) 🏗️ Architectural Improvements: - Refactor event parsing system with modular design - Implement protocol-specific parsers and event types - Optimize dependency management, update Cargo.toml - Remove legacy logging modules, clean up redundant code 📊 Statistics: - Added 46 files, 4511 lines of code - Removed 1381 lines of legacy code - Net addition of 3130 lines of code Tech Stack: - Rust async/await for asynchronous processing - Protocol Buffers support - Multi-protocol event parsing - High-performance event stream subscription
36 lines
1.1 KiB
Rust
Executable File
36 lines
1.1 KiB
Rust
Executable File
use crate::impl_unified_event;
|
|
use crate::streaming::event_parser::common::EventMetadata;
|
|
use borsh::BorshDeserialize;
|
|
use serde::{Deserialize, Serialize};
|
|
use solana_sdk::pubkey::Pubkey;
|
|
|
|
/// 交易
|
|
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, BorshDeserialize)]
|
|
pub struct RaydiumCpmmSwapEvent {
|
|
pub metadata: EventMetadata,
|
|
pub amount_in: u64,
|
|
pub minimum_amount_out: u64,
|
|
pub max_amount_in: u64,
|
|
pub amount_out: u64,
|
|
pub payer: Pubkey,
|
|
pub authority: Pubkey,
|
|
pub amm_config: Pubkey,
|
|
pub pool_state: Pubkey,
|
|
pub input_token_account: Pubkey,
|
|
pub output_token_account: Pubkey,
|
|
pub input_vault: Pubkey,
|
|
pub output_vault: Pubkey,
|
|
pub input_token_mint: Pubkey,
|
|
pub output_token_mint: Pubkey,
|
|
pub observation_state: Pubkey,
|
|
}
|
|
|
|
impl_unified_event!(RaydiumCpmmSwapEvent,);
|
|
|
|
/// 事件鉴别器常量
|
|
pub mod discriminators {
|
|
// 指令鉴别器
|
|
pub const SWAP_BASE_IN: &[u8] = &[143, 190, 90, 218, 196, 30, 51, 222];
|
|
pub const SWAP_BASE_OUT: &[u8] = &[55, 217, 98, 86, 163, 74, 180, 173];
|
|
}
|