diff --git a/programs/whirlpool/src/manager/swap_manager.rs b/programs/whirlpool/src/manager/swap_manager.rs index eaadeb1..a05682f 100644 --- a/programs/whirlpool/src/manager/swap_manager.rs +++ b/programs/whirlpool/src/manager/swap_manager.rs @@ -1,3 +1,5 @@ +use solana_program::msg; + use crate::{ errors::ErrorCode, manager::{ @@ -186,6 +188,15 @@ pub fn swap( (amount_calculated, amount - amount_remaining) }; + let fee_growth = if a_to_b { + curr_fee_growth_global_input - whirlpool.fee_growth_global_a + } else { + curr_fee_growth_global_input - whirlpool.fee_growth_global_b + }; + + // Log delta in fee growth to track pool usage over time with off-chain analytics + msg!("fee_growth: {}", fee_growth); + Ok(PostSwapUpdate { amount_a, amount_b, diff --git a/programs/whirlpool/src/math/token_math.rs b/programs/whirlpool/src/math/token_math.rs index e4bab93..b8cf694 100644 --- a/programs/whirlpool/src/math/token_math.rs +++ b/programs/whirlpool/src/math/token_math.rs @@ -8,8 +8,8 @@ use super::{ // Fee rate is represented as hundredths of a basis point. // Fee amount = total_amount * fee_rate / 1_000_000. -// Max fee rate supported is 1%. -pub const MAX_FEE_RATE: u16 = 10_000; +// Max fee rate supported is 3%. +pub const MAX_FEE_RATE: u16 = 30_000; // Assuming that FEE_RATE is represented as hundredths of a basis point // We want FEE_RATE_MUL_VALUE = 1/FEE_RATE_UNIT, so 1e6