diff --git a/onchain/script/backtesting/StrategyExecutor.sol b/onchain/script/backtesting/StrategyExecutor.sol index 50f22b0..14708f5 100644 --- a/onchain/script/backtesting/StrategyExecutor.sol +++ b/onchain/script/backtesting/StrategyExecutor.sol @@ -176,6 +176,7 @@ contract StrategyExecutor { _logRecenter( blockNum, isUp, + aLiqPre == 0, // bootstrap: no anchor existed before this recenter fLiqPre, fLoPre, fHiPre, @@ -232,6 +233,7 @@ contract StrategyExecutor { function _logRecenter( uint256 blockNum, bool isUp, + bool isBootstrap, uint128 fLiqPre, int24 fLoPre, int24 fHiPre, @@ -256,7 +258,7 @@ contract StrategyExecutor { internal view { - console2.log(string.concat("=== Recenter #", totalRecenters.str(), " @ block ", blockNum.str(), " direction=", isUp ? "UP" : "DOWN", " ===")); + console2.log(string.concat("=== Recenter #", totalRecenters.str(), " @ block ", blockNum.str(), " direction=", isBootstrap ? "BOOTSTRAP" : (isUp ? "UP" : "DOWN"), " ===")); console2.log(string.concat(" Floor pre: tick [", int256(fLoPre).istr(), ", ", int256(fHiPre).istr(), "] liq=", uint256(fLiqPre).str())); console2.log(string.concat(" Anchor pre: tick [", int256(aLoPre).istr(), ", ", int256(aHiPre).istr(), "] liq=", uint256(aLiqPre).str())); console2.log(string.concat(" Disc pre: tick [", int256(dLoPre).istr(), ", ", int256(dHiPre).istr(), "] liq=", uint256(dLiqPre).str())); diff --git a/onchain/src/LiquidityManager.sol b/onchain/src/LiquidityManager.sol index 7041307..36ca718 100644 --- a/onchain/src/LiquidityManager.sol +++ b/onchain/src/LiquidityManager.sol @@ -161,9 +161,10 @@ contract LiquidityManager is ThreePositionStrategy, PriceOracle { /// - "amplitude not reached." — anchor position exists but price has not moved far enough /// from the anchor centre to warrant repositioning /// - /// @return isUp True if the current tick is above the previous anchor centre - /// (price moved up in pool terms); false if it moved down or if no anchor - /// position existed prior to this recenter (bootstrap case). + /// @return isUp True if the KRK price in ETH rose since the last recenter + /// (buy event / net ETH inflow), regardless of token0/token1 ordering. + /// False if the KRK price fell, or if no anchor position existed prior + /// to this recenter (bootstrap case, no directional reference point). /// Both values indicate a successful, fully-executed recenter. function recenter() external returns (bool isUp) { (, int24 currentTick,,,,,) = pool.slot0();