Add `_hasRecenterTick` boolean guard to decouple bootstrap detection from VWAP volume tracking. Before this fix, the bootstrap condition relied solely on `cumulativeVolume == 0`, which made `lastRecenterTick==0` ambiguous: it could mean "never recentered" or "previous recenter landed at tick 0 (price = 1.0 token ratio)". The new guard ensures the direction comparison in the else-branch only runs after a recenter has explicitly set `lastRecenterTick`, eliminating the tick-0 ambiguity. Belt-and-suspenders: both `!_hasRecenterTick` and `cumulativeVolume == 0` trigger bootstrap. Tests added: - test_hasRecenterTickGuardPreventsTick0Ambiguity - test_vwapFrozenDuringBuyOnlyAfterSellRecenter Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| abstracts | ||
| helpers | ||
| interfaces | ||
| libraries | ||
| IOptimizer.sol | ||
| Kraiken.sol | ||
| LiquidityManager.sol | ||
| Optimizer.sol | ||
| OptimizerV3.sol | ||
| OptimizerV3Push3.sol | ||
| OptimizerV3Push3Lib.sol | ||
| Stake.sol | ||
| VWAPTracker.sol | ||