enable access restrictions for recenter

This commit is contained in:
JulesCrown 2024-09-12 17:00:24 +02:00
parent 5a10f23e15
commit af351b9cfc

View file

@ -61,6 +61,7 @@ contract LiquidityManager {
IUniswapV3Pool private immutable pool;
bool private immutable token0isWeth;
PoolKey private poolKey;
address private recenterAccess;
// the 3 positions this contract is managing
enum Stage { FLOOR, ANCHOR, DISCOVERY }
@ -152,6 +153,14 @@ contract LiquidityManager {
harb.setMinStakeSupplyFraction(mssf_);
}
function setRecenterAccess(address addr) external onlyFeeDestination {
recenterAccess = addr;
}
function revokeRecenterAccess() external onlyFeeDestination {
recenterAccess = address(0);
}
receive() external payable {
}
@ -443,6 +452,9 @@ contract LiquidityManager {
/// @notice Adjusts liquidity positions in response to an increase or decrease in the Harberg token's price.
/// @dev This function should be called when significant price movement is detected. It recalibrates the liquidity ranges to align with the new market conditions.
function recenter() external {
if (recenterAccess != address(0)) {
require(msg.sender == recenterAccess, "access denied");
}
// Fetch the current tick from the Uniswap V3 pool
(, int24 currentTick, , , , , ) = pool.slot0();
// check slippage with oracle