2026-03-10 23:13:57 +00:00
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
pragma solidity ^0.8.19;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @notice Dyadic rational input: mantissa × 2^(-shift).
|
2026-03-20 12:10:03 +00:00
|
|
|
|
* shift is reserved for future use and MUST be 0. All production
|
|
|
|
|
|
* Optimizer implementations require shift == 0 and revert otherwise.
|
|
|
|
|
|
* When shift == 0 (as produced by _toDyadic), value == mantissa.
|
2026-03-10 23:13:57 +00:00
|
|
|
|
*/
|
|
|
|
|
|
struct OptimizerInput {
|
|
|
|
|
|
int256 mantissa;
|
|
|
|
|
|
int256 shift;
|
|
|
|
|
|
}
|
2026-03-13 07:20:42 +00:00
|
|
|
|
|
2026-03-19 18:22:43 +00:00
|
|
|
|
/// @dev Safe bear-mode defaults shared by Optimizer._bearDefaults() and
|
|
|
|
|
|
/// LiquidityManager.recenter()'s catch block. Keep all four here so
|
|
|
|
|
|
/// the two call-sites cannot silently diverge.
|
|
|
|
|
|
uint256 constant BEAR_CAPITAL_INEFFICIENCY = 0;
|
|
|
|
|
|
uint256 constant BEAR_ANCHOR_SHARE = 3e17;
|
|
|
|
|
|
uint24 constant BEAR_ANCHOR_WIDTH = 100;
|
|
|
|
|
|
uint256 constant BEAR_DISCOVERY_DEPTH = 3e17;
|
|
|
|
|
|
|
2026-03-13 07:20:42 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @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().
|
2026-03-14 01:40:41 +00:00
|
|
|
|
* @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).
|
2026-03-14 23:21:30 +00:00
|
|
|
|
* @return anchorWidth Anchor position width in tick units (uint24); passed through to ThreePositionStrategy without clamping.
|
2026-03-14 01:40:41 +00:00
|
|
|
|
* @return discoveryDepth Discovery liquidity density (0..1e18, clamped to MAX_PARAM_SCALE).
|
2026-03-13 07:20:42 +00:00
|
|
|
|
*/
|
|
|
|
|
|
function getLiquidityParams()
|
|
|
|
|
|
external
|
|
|
|
|
|
view
|
|
|
|
|
|
returns (uint256 capitalInefficiency, uint256 anchorShare, uint24 anchorWidth, uint256 discoveryDepth);
|
|
|
|
|
|
}
|