feat: refactor event parsing architecture and add Raydium Launchpad support

Major changes:
- Refactor event parsing system: migrate scattered logs_* modules to unified event_parser architecture
- Add unified UnifiedEvent trait and EventParser trait for standardized event parsing interface
- Introduce GenericEventParser and EventParserFactory for plugin-style protocol extension
- Add match_event! macro to simplify event type matching and handling
- Add Raydium Launchpad (Bonk.fun) protocol support:
  - Complete buy/sell trading functionality
  - Pool state management and querying
  - Event parsing and subscription
- Update trading system to support new protocol architecture
- Refactor constants organization, rename raydium to raydium_launchpad
- Update documentation and example code

Technical improvements:
- Unified event interface design for better code maintainability
- Factory pattern implementation for dynamic protocol loading
- Generic event parser to reduce code duplication
- Improved error handling and type safety

Breaking Changes:
- Remove old logs_* modules, use new event_parser system
- Protocol constants path change: raydium -> raydium_launchpad
- Event subscription API updated to unified interface
This commit is contained in:
ysq
2025-07-09 22:29:29 +08:00
parent def16e6b92
commit 44ae51747b
64 changed files with 5122 additions and 4575 deletions
-1
View File
@@ -1 +0,0 @@
pub const DEFAULT_SLIPPAGE_BASIS_POINTS: u64 = 100;
-1
View File
@@ -1,4 +1,3 @@
pub mod constants;
pub mod params;
pub mod traits;
pub mod executor;
+20
View File
@@ -122,6 +122,26 @@ impl ProtocolParams for PumpSwapParams {
}
}
/// RaydiumLaunchpad协议特定参数
#[derive(Clone)]
pub struct RaydiumLaunchpadParams {
pub virtual_base: Option<u128>,
pub virtual_quote: Option<u128>,
pub real_base_before: Option<u128>,
pub real_quote_before: Option<u128>,
pub auto_handle_wsol: bool,
}
impl ProtocolParams for RaydiumLaunchpadParams {
fn as_any(&self) -> &dyn std::any::Any {
self
}
fn clone_box(&self) -> Box<dyn ProtocolParams> {
Box::new(self.clone())
}
}
impl BuyParams {
/// 转换为BuyWithTipParams
pub fn with_tip(self, swqos_clients: Vec<Arc<SwqosClient>>) -> BuyWithTipParams {