diff --git a/src/PositionManager.sol b/src/PositionManager.sol index 5a5da38a..c13cbce9 100644 --- a/src/PositionManager.sol +++ b/src/PositionManager.sol @@ -104,7 +104,11 @@ contract PositionManager is } /// @inheritdoc IPositionManager - function modifyLiquiditiesDirect(bytes calldata actions, bytes[] calldata params) external payable isNotLocked { + function modifyLiquiditiesWithoutUnlock(bytes calldata actions, bytes[] calldata params) + external + payable + isNotLocked + { _executeActions(actions, params); } diff --git a/src/interfaces/IPositionManager.sol b/src/interfaces/IPositionManager.sol index fe879e44..5f75c623 100644 --- a/src/interfaces/IPositionManager.sol +++ b/src/interfaces/IPositionManager.sol @@ -22,7 +22,7 @@ interface IPositionManager is INotifier { /// @dev This must be called by a contract that has already unlocked the v4 PoolManager /// @param actions the actions to perform /// @param params the parameters to provide for the actions - function modifyLiquiditiesDirect(bytes calldata actions, bytes[] calldata params) external payable; + function modifyLiquiditiesWithoutUnlock(bytes calldata actions, bytes[] calldata params) external payable; /// Returns the ID that will be used for the next minted liquidity position /// @return uint256 The next token ID diff --git a/test/position-managers/NativeToken.t.sol b/test/position-managers/NativeToken.t.sol index 30a675c2..662ddda1 100644 --- a/test/position-managers/NativeToken.t.sol +++ b/test/position-managers/NativeToken.t.sol @@ -87,7 +87,7 @@ contract PositionManagerTest is Test, PosmTestSetup, LiquidityFuzzers { TickMath.getSqrtPriceAtTick(params.tickUpper), liquidityToAdd.toUint128() ); - // add extra wei because modifyLiquiditiesDirect may be rounding up, LiquidityAmounts is imprecise? + // add extra wei because modifyLiquidities may be rounding up, LiquidityAmounts is imprecise? lpm.modifyLiquidities{value: amount0 + 1}(calls, _deadline); BalanceDelta delta = getLastDelta(); diff --git a/test/position-managers/PositionManager.modifiyLiquidities.t.sol b/test/position-managers/PositionManager.modifyLiquidities.t.sol similarity index 98% rename from test/position-managers/PositionManager.modifiyLiquidities.t.sol rename to test/position-managers/PositionManager.modifyLiquidities.t.sol index 0b034054..6244c456 100644 --- a/test/position-managers/PositionManager.modifiyLiquidities.t.sol +++ b/test/position-managers/PositionManager.modifyLiquidities.t.sol @@ -49,7 +49,7 @@ contract PositionManagerModifyLiquiditiesTest is Test, PosmTestSetup, LiquidityF approvePosmFor(alice); // must deploy after posm - // Deploys a hook which can accesses IPositionManager.modifyLiquiditiesDirect + // Deploys a hook which can accesses IPositionManager.modifyLiquiditiesWithoutUnlock deployPosmHookModifyLiquidities(); seedBalance(address(hookModifyLiquidities)); @@ -259,7 +259,7 @@ contract PositionManagerModifyLiquiditiesTest is Test, PosmTestSetup, LiquidityF swap(key, true, -1e18, calls); } - /// @dev hook cannot re-enter modifyLiquiditiesDirect in beforeRemoveLiquidity + /// @dev hook cannot re-enter modifyLiquiditiesWithoutUnlock in beforeRemoveLiquidity function test_hook_increaseLiquidity_reenter_revert() public { uint256 initialLiquidity = 100e18; uint256 tokenId = lpm.nextTokenId(); @@ -271,7 +271,7 @@ contract PositionManagerModifyLiquiditiesTest is Test, PosmTestSetup, LiquidityF bytes memory hookCall = getIncreaseEncoded(tokenId, config, newLiquidity, ZERO_BYTES); bytes memory calls = getIncreaseEncoded(tokenId, config, newLiquidity, hookCall); - // should revert because hook is re-entering modifyLiquiditiesDirect + // should revert because hook is re-entering modifyLiquiditiesWithoutUnlock vm.expectRevert( abi.encodeWithSelector( Hooks.FailedHookCall.selector, abi.encodeWithSelector(ReentrancyLock.ContractLocked.selector) diff --git a/test/shared/HookModifyLiquidities.sol b/test/shared/HookModifyLiquidities.sol index 087f71a6..2e9b5ecf 100644 --- a/test/shared/HookModifyLiquidities.sol +++ b/test/shared/HookModifyLiquidities.sol @@ -14,7 +14,7 @@ import {IERC20} from "forge-std/interfaces/IERC20.sol"; import {IPositionManager} from "../../src/interfaces/IPositionManager.sol"; -/// @notice This contract is NOT a production use contract. It is meant to be used in testing to verify that external contracts can modify liquidity without a lock (IPositionManager.modifyLiquiditiesDirect) +/// @notice This contract is NOT a production use contract. It is meant to be used in testing to verify that external contracts can modify liquidity without a lock (IPositionManager.modifyLiquiditiesWithoutUnlock) /// @dev a hook that can modify liquidity in beforeSwap contract HookModifyLiquidities is HookSavesDelta { IPositionManager posm; @@ -35,7 +35,7 @@ contract HookModifyLiquidities is HookSavesDelta { approvePosmCurrency(key.currency1); (bytes memory actions, bytes[] memory params) = abi.decode(hookData, (bytes, bytes[])); - posm.modifyLiquiditiesDirect(actions, params); + posm.modifyLiquiditiesWithoutUnlock(actions, params); return (this.beforeSwap.selector, BeforeSwapDeltaLibrary.ZERO_DELTA, 0); } @@ -47,7 +47,7 @@ contract HookModifyLiquidities is HookSavesDelta { ) external override returns (bytes4) { if (hookData.length > 0) { (bytes memory actions, bytes[] memory params) = abi.decode(hookData, (bytes, bytes[])); - posm.modifyLiquiditiesDirect(actions, params); + posm.modifyLiquiditiesWithoutUnlock(actions, params); } return this.beforeAddLiquidity.selector; } @@ -60,7 +60,7 @@ contract HookModifyLiquidities is HookSavesDelta { ) external override returns (bytes4) { if (hookData.length > 0) { (bytes memory actions, bytes[] memory params) = abi.decode(hookData, (bytes, bytes[])); - posm.modifyLiquiditiesDirect(actions, params); + posm.modifyLiquiditiesWithoutUnlock(actions, params); } return this.beforeRemoveLiquidity.selector; } diff --git a/test/shared/LiquidityOperations.sol b/test/shared/LiquidityOperations.sol index 853ca207..fce648ed 100644 --- a/test/shared/LiquidityOperations.sol +++ b/test/shared/LiquidityOperations.sol @@ -45,7 +45,7 @@ abstract contract LiquidityOperations is CommonBase { liquidity.toUint128() ); bytes memory calls = getMintEncoded(config, liquidity, recipient, hookData); - // add extra wei because modifyLiquiditiesDirect may be rounding up, LiquidityAmounts is imprecise? + // add extra wei because modifyLiquiditiesWithoutUnlock may be rounding up, LiquidityAmounts is imprecise? lpm.modifyLiquidities{value: amount0 + 1}(calls, _deadline); } @@ -81,7 +81,7 @@ abstract contract LiquidityOperations is CommonBase { lpm.modifyLiquidities(calls, _deadline); } - // Helper functions for getting encoded calldata for .modifyLiquiditiesDirect + // Helper functions for getting encoded calldata for .modifyLiquiditiesWithoutUnlock function getMintEncoded(PositionConfig memory config, uint256 liquidity, address recipient, bytes memory hookData) internal pure