fix: CodeDocs.vue shows stale recenter() with recenterAccess guard (#837)
Remove the obsolete recenterAccess pattern from the liquidityManagerSol snippet: drop the recenterAccess state variable, setRecenterAccess(), revokeRecenterAccess(), and onlyFeeDestination modifier. Update recenter() to reflect the current cooldown-only access model, fix the VWAP direction logic, and update the _scrapePositions() call signature to match LiquidityManager.sol. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
367dae31b8
commit
076b25f4dd
1 changed files with 6 additions and 24 deletions
|
|
@ -263,7 +263,6 @@ contract LiquidityManager is ThreePositionStrategy, PriceOracle {
|
||||||
PoolKey private poolKey;
|
PoolKey private poolKey;
|
||||||
|
|
||||||
address private immutable deployer;
|
address private immutable deployer;
|
||||||
address public recenterAccess;
|
|
||||||
address public feeDestination;
|
address public feeDestination;
|
||||||
|
|
||||||
int24 public lastRecenterTick;
|
int24 public lastRecenterTick;
|
||||||
|
|
@ -275,11 +274,6 @@ contract LiquidityManager is ThreePositionStrategy, PriceOracle {
|
||||||
error ZeroAddressInSetter();
|
error ZeroAddressInSetter();
|
||||||
error AddressAlreadySet();
|
error AddressAlreadySet();
|
||||||
|
|
||||||
modifier onlyFeeDestination() {
|
|
||||||
require(msg.sender == address(feeDestination), "only callable by feeDestination");
|
|
||||||
_;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(address _factory, address _WETH9, address _kraiken, address _optimizer) {
|
constructor(address _factory, address _WETH9, address _kraiken, address _optimizer) {
|
||||||
deployer = msg.sender;
|
deployer = msg.sender;
|
||||||
factory = _factory;
|
factory = _factory;
|
||||||
|
|
@ -313,22 +307,12 @@ contract LiquidityManager is ThreePositionStrategy, PriceOracle {
|
||||||
feeDestination = feeDestination_;
|
feeDestination = feeDestination_;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setRecenterAccess(address addr) external onlyFeeDestination {
|
|
||||||
recenterAccess = addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
function revokeRecenterAccess() external onlyFeeDestination {
|
|
||||||
recenterAccess = address(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function recenter() external returns (bool isUp) {
|
function recenter() external returns (bool isUp) {
|
||||||
(, int24 currentTick,,,,,) = pool.slot0();
|
(, int24 currentTick,,,,,) = pool.slot0();
|
||||||
if (recenterAccess != address(0)) {
|
|
||||||
require(msg.sender == recenterAccess, "access denied");
|
// Always enforce cooldown and TWAP price stability — no bypass path
|
||||||
} else {
|
require(block.timestamp >= lastRecenterTime + MIN_RECENTER_INTERVAL, "recenter cooldown");
|
||||||
require(block.timestamp >= lastRecenterTime + MIN_RECENTER_INTERVAL, "recenter cooldown");
|
require(_isPriceStable(currentTick), "price deviated from oracle");
|
||||||
require(_isPriceStable(currentTick), "price deviated from oracle");
|
|
||||||
}
|
|
||||||
lastRecenterTime = block.timestamp;
|
lastRecenterTime = block.timestamp;
|
||||||
|
|
||||||
isUp = false;
|
isUp = false;
|
||||||
|
|
@ -344,14 +328,12 @@ contract LiquidityManager is ThreePositionStrategy, PriceOracle {
|
||||||
bool shouldRecordVWAP;
|
bool shouldRecordVWAP;
|
||||||
if (cumulativeVolume == 0) {
|
if (cumulativeVolume == 0) {
|
||||||
shouldRecordVWAP = true;
|
shouldRecordVWAP = true;
|
||||||
} else if (lastRecenterTick != 0) {
|
|
||||||
shouldRecordVWAP = token0isWeth ? (currentTick < lastRecenterTick) : (currentTick > lastRecenterTick);
|
|
||||||
} else {
|
} else {
|
||||||
shouldRecordVWAP = true;
|
shouldRecordVWAP = token0isWeth ? (currentTick > lastRecenterTick) : (currentTick < lastRecenterTick);
|
||||||
}
|
}
|
||||||
lastRecenterTick = currentTick;
|
lastRecenterTick = currentTick;
|
||||||
|
|
||||||
_scrapePositions(shouldRecordVWAP);
|
_scrapePositions(shouldRecordVWAP, currentTick);
|
||||||
|
|
||||||
if (isUp) {
|
if (isUp) {
|
||||||
kraiken.setPreviousTotalSupply(kraiken.totalSupply());
|
kraiken.setPreviousTotalSupply(kraiken.totalSupply());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue