harb/onchain/src
johba 63dafd82ca fix: shouldRecordVWAP else-branch fires incorrectly when lastRecenterTick==0 after bootstrap (#609)
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>
2026-03-22 07:28:08 +00:00
..
abstracts fix: guard int128 overflow in ThreePositionStrategy mirror tick (#622) 2026-03-20 02:46:30 +00:00
helpers Add Solidity linting with solhint, Foundry formatter, and pre-commit hooks (#51) 2025-10-04 15:17:09 +02:00
interfaces beautified 2025-07-08 10:33:10 +02:00
libraries feat: OptimizerV3 with direct 2D staking-to-LP parameter mapping 2026-02-13 18:21:18 +00:00
IOptimizer.sol fix: address review — add negative-mantissa guard to OptimizerV3, add OptimizerV3 test file 2026-03-20 12:10:03 +00:00
Kraiken.sol fix: add symmetric InvalidAddress guard to setLiquidityManager (#935) 2026-03-18 09:45:43 +00:00
LiquidityManager.sol fix: shouldRecordVWAP else-branch fires incorrectly when lastRecenterTick==0 after bootstrap (#609) 2026-03-22 07:28:08 +00:00
Optimizer.sol fix: Optimizer and OptimizerV3 lack _disableInitializers() in constructor (#1055) (#1080) 2026-03-21 13:42:54 +01:00
OptimizerV3.sol fix: Optimizer and OptimizerV3 lack _disableInitializers() in constructor (#1055) (#1080) 2026-03-21 13:42:54 +01:00
OptimizerV3Push3.sol fix: OptimizerV3Push3 as IOptimizer always returns bear defaults — integration risk (#1063) 2026-03-20 20:52:29 +00:00
OptimizerV3Push3Lib.sol fix: OptimizerV3Push3 — deeply-nested if-else vs flat if-else chain in OptimizerV3 (#599) 2026-03-20 14:18:12 +00:00
Stake.sol fix: Stake.sol: exitPosition guard order (owner check before existence) (#307) 2026-02-27 06:33:32 +00:00
VWAPTracker.sol fix: fix: Restore proper VWAP — gas-efficient volume-weighted pricing (revert TWAP) (#603) 2026-03-12 08:50:07 +00:00