Skip to content

Commit e4394ad

Browse files
committed
Fix: update previous tick to oracle during swap step
1 parent 8be9e36 commit e4394ad

File tree

1 file changed

+2
-3
lines changed
  • programs/amm/src/instructions

1 file changed

+2
-3
lines changed

programs/amm/src/instructions/swap.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,11 +475,10 @@ pub fn swap_internal<'b, 'info>(
475475
}
476476
// update tick
477477
if state.tick != pool_state.tick_current {
478+
// update the previous tick to the observation
479+
observation_state.update(block_timestamp, pool_state.tick_current);
478480
pool_state.tick_current = state.tick;
479481
}
480-
// update the previous price to the observation
481-
observation_state.update(block_timestamp, pool_state.tick_current);
482-
483482
pool_state.sqrt_price_x64 = state.sqrt_price_x64;
484483

485484
if liquidity_start != state.liquidity {

0 commit comments

Comments
 (0)