60 lines
3.4 KiB
Solidity
60 lines
3.4 KiB
Solidity
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
pragma solidity ^0.8.19;
|
|
|
|
import { IOptimizer, OptimizerInput } from "./IOptimizer.sol";
|
|
import { OptimizerV3Push3Lib } from "./OptimizerV3Push3Lib.sol";
|
|
|
|
/**
|
|
* @title OptimizerV3Push3
|
|
* @notice Standalone contract wrapping the Push3 transpiler output.
|
|
* The actual calculation logic lives in OptimizerV3Push3Lib and is
|
|
* shared with OptimizerV3 so that transpiler changes require only
|
|
* one edit point.
|
|
* @custom:experimental This contract is a transpiler harness / backtesting stub only.
|
|
* It must NOT be wired as the live optimizer in any production deployment.
|
|
* Use OptimizerV3 (UUPS proxy) for production.
|
|
*/
|
|
contract OptimizerV3Push3 is IOptimizer {
|
|
/**
|
|
* @dev Always reverts — this contract is a transpiler harness, not a production optimizer.
|
|
* Calling getLiquidityParams() on this stub is a deployment misconfiguration.
|
|
* LiquidityManager.recenter() has a try/catch that falls back to bear-mode defaults,
|
|
* so accidental wiring produces a permanent bear-mode lock rather than a silent failure.
|
|
* Use OptimizerV3 (which inherits Optimizer) for a live deployment with real inputs.
|
|
*/
|
|
function getLiquidityParams() external pure returns (uint256, uint256, uint24, uint256) {
|
|
revert("OptimizerV3Push3: not for production use");
|
|
}
|
|
|
|
/**
|
|
* @notice Compute liquidity parameters from 8 dyadic rational inputs.
|
|
* @dev Delegates to OptimizerV3Push3Lib.calculateParams — the single
|
|
* canonical copy of the transpiler output.
|
|
* capitalInefficiency (ci) is intentionally hardcoded to 0 in both the bear
|
|
* and bull branches of this implementation. CI is a pure risk lever that
|
|
* controls the VWAP bias applied when placing the floor position: CI=0 means
|
|
* the floor tracks the raw VWAP with no upward adjustment, which is the
|
|
* safest setting and carries zero effect on fee revenue. Any integrating
|
|
* proxy (e.g. ThreePositionStrategy) must therefore treat the floor scarcity
|
|
* and VWAP adjustment as if no capital-inefficiency premium is active.
|
|
* Future optimizer versions that expose non-zero CI values should document
|
|
* the resulting floor-placement and eth-scarcity effects explicitly.
|
|
* @param inputs 8-slot dyadic rational array (all values 0..1e18):
|
|
* slot 0 = percentageStaked, slot 1 = averageTaxRate,
|
|
* slot 2 = pricePosition, slot 3 = volatility, slot 4 = momentum,
|
|
* slot 5 = timeSinceRecenter, slot 6 = utilizationRate, slot 7 = reserved.
|
|
* This implementation uses only slots 0 and 1; slots 2-7 are available
|
|
* to future evolved programs that use the normalized indicators.
|
|
* @return ci Capital inefficiency (0..1e18). Always 0 in this implementation.
|
|
* @return anchorShare Fraction of non-floor ETH in anchor (0..1e18).
|
|
* @return anchorWidth Anchor position width in tick units.
|
|
* @return discoveryDepth Discovery liquidity density (0..1e18).
|
|
*/
|
|
function calculateParams(OptimizerInput[8] memory inputs)
|
|
public
|
|
pure
|
|
returns (uint256 ci, uint256 anchorShare, uint24 anchorWidth, uint256 discoveryDepth)
|
|
{
|
|
return OptimizerV3Push3Lib.calculateParams(inputs);
|
|
}
|
|
}
|