fix: correct isUp NatSpec and bootstrap log direction (#570)
Fix the @return NatSpec for recenter() isUp: the previous description was wrong for the token0=WETH ordering (claimed tick above center, but the actual check is currentTick < centerTick when token0isWeth). The correct invariant is isUp=true ↔ KRK price in ETH rose (buy event / net ETH inflow), regardless of token ordering. Also address review nit: StrategyExecutor._logRecenter() now logs 'direction=BOOTSTRAP' instead of 'direction=DOWN' when no anchor position existed before the recenter (aLiqPre==0), eliminating the misleading directional label on the first recenter. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c1a0086d28
commit
54976184bc
2 changed files with 7 additions and 4 deletions
|
|
@ -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()));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue