From 95854f0491695f477b433781f691f60d9d413215 Mon Sep 17 00:00:00 2001 From: Estereg Date: Wed, 17 Dec 2025 21:16:28 -0300 Subject: [PATCH] fix(raydium-cpmm): Align account structures with IDL specification - Add missing creator_fee_rate field to AmmConfig - Update AmmConfig padding from [u64; 16] to [u64; 15] - Add missing creator fee fields to PoolState (creator_fee_on, enable_creator_fee, padding1, creator_fees_token0, creator_fees_token1) - Update PoolState padding from [u64; 31] to [u64; 28] - Recalculate AMM_CONFIG_SIZE to 236 bytes - Recalculate POOL_STATE_SIZE to 589 bytes All structures now match the IDL specification exactly. --- .../event_parser/protocols/raydium_cpmm/types.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/streaming/event_parser/protocols/raydium_cpmm/types.rs b/src/streaming/event_parser/protocols/raydium_cpmm/types.rs index 5b8e9fe..a046af6 100644 --- a/src/streaming/event_parser/protocols/raydium_cpmm/types.rs +++ b/src/streaming/event_parser/protocols/raydium_cpmm/types.rs @@ -24,10 +24,11 @@ pub struct AmmConfig { pub create_pool_fee: u64, pub protocol_owner: Pubkey, pub fund_owner: Pubkey, - pub padding: [u64; 16], + pub creator_fee_rate: u64, + pub padding: [u64; 15], } -pub const AMM_CONFIG_SIZE: usize = 228; +pub const AMM_CONFIG_SIZE: usize = 236; pub fn amm_config_decode(data: &[u8]) -> Option { if data.len() < AMM_CONFIG_SIZE { @@ -81,10 +82,15 @@ pub struct PoolState { pub fund_fees_token1: u64, pub open_time: u64, pub recent_epoch: u64, - pub padding: [u64; 31], + pub creator_fee_on: u8, + pub enable_creator_fee: bool, + pub padding1: [u8; 6], + pub creator_fees_token0: u64, + pub creator_fees_token1: u64, + pub padding: [u64; 28], } -pub const POOL_STATE_SIZE: usize = 629; +pub const POOL_STATE_SIZE: usize = 589; pub fn pool_state_decode(data: &[u8]) -> Option { if data.len() < POOL_STATE_SIZE {