harb/onchain/src/IOptimizer.sol
openhands ac4aa745f6 fix: fix: remove MAX_ANCHOR_WIDTH clamp in ThreePositionStrategy (#783)
Remove the MAX_ANCHOR_WIDTH=100 constant and the corresponding clamp on
anchorWidth in LiquidityManager.recenter(). The optimizer is now free to
choose any anchor width; evolution run 7 immediately exploited AW=153.

Update IOptimizer.sol NatSpec to reflect no clamping. Update the
testAnchorWidthAbove100IsClamped test to testAnchorWidthAbove100IsNotClamped,
asserting the tick range matches the full AW=150 width.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 23:21:30 +00:00

32 lines
1.4 KiB
Solidity
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.19;
/**
* @notice Dyadic rational input: mantissa × 2^(-shift).
* For shift == 0 (current usage via _toDyadic), value == mantissa.
*/
struct OptimizerInput {
int256 mantissa;
int256 shift;
}
/**
* @title IOptimizer
* @notice Minimal interface for the Optimizer contract consumed by LiquidityManager.
* Declaring the ABI here makes upgrade-compatibility explicit: any new
* Optimizer implementation must satisfy this selector or the LiquidityManager
* will fall back to bear-mode defaults via its try-catch.
*/
interface IOptimizer {
/**
* @notice Returns the four liquidity parameters used by LiquidityManager.recenter().
* @return capitalInefficiency Capital buffer level (0..1e18, clamped to MAX_PARAM_SCALE). CI=0 is safest.
* @return anchorShare Fraction of non-floor ETH in anchor (0..1e18, clamped to MAX_PARAM_SCALE).
* @return anchorWidth Anchor position width in tick units (uint24); passed through to ThreePositionStrategy without clamping.
* @return discoveryDepth Discovery liquidity density (0..1e18, clamped to MAX_PARAM_SCALE).
*/
function getLiquidityParams()
external
view
returns (uint256 capitalInefficiency, uint256 anchorShare, uint24 anchorWidth, uint256 discoveryDepth);
}