feat(pumpswap): enhance flexible mint support and optimize performance

- Add base_mint/quote_mint parameters to PumpSwapParams for flexible trading pairs
- Implement pool reserves caching to reduce RPC calls and improve speed
- Refactor unified buy/sell instruction logic for different mint types
- Add volume accumulator PDA support and proper fee calculations
- Update pool discovery for both base and quote mint searches
- Bump version to 0.2.11

Breaking: PumpSwapParams now requires mint and reserves parameters
This commit is contained in:
ysq
2025-08-02 23:51:04 +08:00
parent 07a42641de
commit 45140ae789
10 changed files with 592 additions and 185 deletions
+8 -2
View File
@@ -23,6 +23,9 @@ pub mod seeds {
/// Seed for metadata PDAs
pub const METADATA_SEED: &[u8] = b"metadata";
pub const USER_VOLUME_ACCUMULATOR_SEED: &[u8] = b"user_volume_accumulator";
pub const GLOBAL_VOLUME_ACCUMULATOR_SEED: &[u8] = b"global_volume_accumulator";
}
/// Constants related to program accounts and authorities
@@ -32,8 +35,6 @@ pub mod accounts {
/// Public key for the fee recipient
pub const FEE_RECIPIENT: Pubkey = pubkey!("62qc2CNXwrYqQScmEdiZFFAnJR262PxWEuNQtxfafNgV");
pub const FEE_RECIPIENT_ATA: Pubkey = pubkey!("94qWNrtmfn42h3ZjUZwWvK1MEo9uVmmrBPd2hpNjYDjb");
/// Public key for the global PDA
pub const GLOBAL_ACCOUNT: Pubkey = pubkey!("ADyA8hdefvWN2dbGGWFotbzWxrAvLW83WG6QCVXvJKqw");
@@ -60,6 +61,11 @@ pub mod accounts {
pub const RENT: Pubkey = pubkey!("SysvarRent111111111111111111111111111111111");
pub const AMM_PROGRAM: Pubkey = pubkey!("pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA");
pub const LP_FEE_BASIS_POINTS: u64 = 20;
pub const PROTOCOL_FEE_BASIS_POINTS: u64 = 5;
pub const COIN_CREATOR_FEE_BASIS_POINTS: u64 = 5;
}
pub const BUY_DISCRIMINATOR: [u8; 8] = [102, 6, 61, 18, 1, 218, 235, 234];