@@ -607,6 +607,10 @@ fn test_modify_position_basic() {
607607 )
608608 . unwrap ( ) ;
609609
610+ // Get tick infos before the swap/update
611+ let tick_low_info_before = Ticks :: < Test > :: get ( netuid, tick_low) . unwrap ( ) ;
612+ let tick_high_info_before = Ticks :: < Test > :: get ( netuid, tick_high) . unwrap ( ) ;
613+
610614 // Swap to create fees on the position
611615 let sqrt_limit_price = SqrtPrice :: from_num ( ( limit_price) . sqrt ( ) ) ;
612616 Pallet :: < Test > :: do_swap (
@@ -648,6 +652,27 @@ fn test_modify_position_basic() {
648652 assert_eq ! ( position. tick_low, tick_low) ;
649653 assert_eq ! ( position. tick_high, tick_high) ;
650654
655+ // Tick liquidity is updated properly for low and high position ticks
656+ let tick_low_info_after = Ticks :: < Test > :: get ( netuid, tick_low) . unwrap ( ) ;
657+ let tick_high_info_after = Ticks :: < Test > :: get ( netuid, tick_high) . unwrap ( ) ;
658+
659+ assert_eq ! (
660+ tick_low_info_before. liquidity_net - ( liquidity / 10 ) as i128 ,
661+ tick_low_info_after. liquidity_net,
662+ ) ;
663+ assert_eq ! (
664+ tick_low_info_before. liquidity_gross - ( liquidity / 10 ) ,
665+ tick_low_info_after. liquidity_gross,
666+ ) ;
667+ assert_eq ! (
668+ tick_high_info_before. liquidity_net + ( liquidity / 10 ) as i128 ,
669+ tick_high_info_after. liquidity_net,
670+ ) ;
671+ assert_eq ! (
672+ tick_high_info_before. liquidity_gross - ( liquidity / 10 ) ,
673+ tick_high_info_after. liquidity_gross,
674+ ) ;
675+
651676 // Modify liquidity again (ensure fees aren't double-collected)
652677 let modify_result = Pallet :: < Test > :: do_modify_position (
653678 netuid,
0 commit comments