feat: major refactor with calculation utilities and instruction optimization

- Add comprehensive calculation utilities for all protocols (bonk, pumpfun, pumpswap, raydium)
- Refactor instruction modules to reduce code complexity and improve maintainability
- Optimize trading parameters structure and enhance common utilities
- Separate calculation logic from trading modules for better code organization
- Update dependencies and module exports
This commit is contained in:
ysq
2025-08-18 18:00:14 +08:00
parent 350e34e0a0
commit 57474bfa6e
21 changed files with 1513 additions and 1107 deletions
+6
View File
@@ -25,6 +25,12 @@ pub mod accounts {
pub const TOKEN_PROGRAM: Pubkey = spl_token::ID;
pub const WSOL_TOKEN_ACCOUNT: Pubkey = pubkey!("So11111111111111111111111111111111111111112");
pub const RAYDIUM_CPMM: Pubkey = pubkey!("CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C");
pub const FEE_RATE_DENOMINATOR_VALUE: u128 = 1_000_000;
pub const TRADE_FEE_RATE: u64 = 2500;
pub const CREATOR_FEE_RATE: u64 = 0;
pub const PROTOCOL_FEE_RATE: u64 = 120000;
pub const FUND_FEE_RATE: u64 = 40000;
}
pub const SWAP_BASE_IN_DISCRIMINATOR: &[u8] = &[143, 190, 90, 218, 196, 30, 51, 222];