diff --git a/.forge-snapshots/CLPoolManagerTest#setLmPool.snap b/.forge-snapshots/CLPoolManagerTest#setLmPool.snap index 987ab187..88cf4b10 100644 --- a/.forge-snapshots/CLPoolManagerTest#setLmPool.snap +++ b/.forge-snapshots/CLPoolManagerTest#setLmPool.snap @@ -1 +1 @@ -26273 \ No newline at end of file +26296 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#setMasterChef.snap b/.forge-snapshots/CLPoolManagerTest#setMasterChef.snap index 48345f5c..19c0eed1 100644 --- a/.forge-snapshots/CLPoolManagerTest#setMasterChef.snap +++ b/.forge-snapshots/CLPoolManagerTest#setMasterChef.snap @@ -1 +1 @@ -30715 \ No newline at end of file +30760 \ No newline at end of file diff --git a/src/libraries/SwapFeeLibrary.sol b/src/libraries/SwapFeeLibrary.sol index 179cf0ef..b19640f1 100644 --- a/src/libraries/SwapFeeLibrary.sol +++ b/src/libraries/SwapFeeLibrary.sol @@ -5,7 +5,7 @@ pragma solidity ^0.8.24; /// @dev Library for parsing swap fee info from PoolKey.fee: /// 24 bits (upper 4 bits are used to store flag, if swap fee is static, parse lower 20 bits to get swap fee) /// 1. flag to indicate the activation of dynamic swap fee, otherwise static swap fee is used -/// - if dynamic swap fee is activated, then the swap fee is controlled by hook +/// - if dynamic swap fee is activated, then the swap fee can be updated by hook /// - if dynamic swap fee is not activated, then the swap fee is controlled by PoolKey.fee itself /// 2. protocol fee is controlled by protocolFeeController, not PoolKey.fee /// - protocol fee is controlled by IProtocolFeeController(hook).protocolFeeForPool() diff --git a/src/pool-cl/CLPoolManager.sol b/src/pool-cl/CLPoolManager.sol index 7ceaca73..dbed1c4e 100644 --- a/src/pool-cl/CLPoolManager.sol +++ b/src/pool-cl/CLPoolManager.sol @@ -12,6 +12,7 @@ import {CLPosition} from "./libraries/CLPosition.sol"; import {PoolKey} from "../types/PoolKey.sol"; import {IPoolManager} from "../interfaces/IPoolManager.sol"; import {Hooks} from "../libraries/Hooks.sol"; +import {Tick} from "./libraries/Tick.sol"; import {CLPoolParametersHelper} from "./libraries/CLPoolParametersHelper.sol"; import {SwapFeeLibrary} from "../libraries/SwapFeeLibrary.sol"; import {PoolId, PoolIdLibrary} from "../types/PoolId.sol"; @@ -293,6 +294,14 @@ contract CLPoolManager is ICLPoolManager, Fees, Extsload { } } + function getPoolTickInfo(PoolId id, int24 tick) external view returns (Tick.Info memory) { + return pools[id].ticks[tick]; + } + + function getPoolBitmapInfo(PoolId id, int16 word) external view returns (uint256 tickBitmap) { + return pools[id].tickBitmap[word]; + } + /// @inheritdoc ICLPoolManager function setMasterChef(address _masterChef) external override onlyOwner { masterChef = _masterChef; diff --git a/test/pool-cl/CLFees.t.sol b/test/pool-cl/CLFees.t.sol index 3bc38688..65cfe83b 100644 --- a/test/pool-cl/CLFees.t.sol +++ b/test/pool-cl/CLFees.t.sol @@ -97,9 +97,10 @@ contract CLFeesTest is Test, Deployers, TokenFixture, GasSnapshot { } function testNoProtocolFee(uint16 protocolSwapFee) public { - vm.assume(protocolSwapFee < 2 ** 16); - vm.assume(protocolSwapFee >> 8 >= 4); - vm.assume(protocolSwapFee % 256 >= 4); + // Early return instead of vm.assume (too many input rejected) + if (protocolSwapFee >= 2 ** 16) return; + if (protocolSwapFee >> 8 < 4) return; + if (protocolSwapFee % 256 < 4) return; protocolFeeController.setSwapFeeForPool(key.toId(), protocolSwapFee); manager.setProtocolFeeController(IProtocolFeeController(protocolFeeController));