diff --git a/src/PositionManager.sol b/src/PositionManager.sol index 9851bf1d..5b4648fd 100644 --- a/src/PositionManager.sol +++ b/src/PositionManager.sol @@ -11,7 +11,10 @@ import {Permit2Forwarder} from "./base/Permit2Forwarder.sol"; import {Multicall_v4} from "./base/Multicall_v4.sol"; contract PositionManager is IPositionManager, PositionActionsRouter, PoolInitializer, Permit2Forwarder, Multicall_v4 { - constructor(IPoolManager _poolManager, IAllowanceTransfer _permit2) PositionActionsRouter(_poolManager, _permit2) {} + constructor(IPoolManager _poolManager, IAllowanceTransfer _permit2) + PositionActionsRouter(_poolManager) + Permit2Forwarder(_permit2) + {} /// @inheritdoc IPositionManager function modifyLiquidities(bytes calldata unlockData, uint256 deadline) diff --git a/src/base/Permit2Forwarder.sol b/src/base/Permit2Forwarder.sol index 31ae1f43..3ef0735e 100644 --- a/src/base/Permit2Forwarder.sol +++ b/src/base/Permit2Forwarder.sol @@ -8,7 +8,9 @@ import {Permit2ImmutableState} from "./Permit2ImmutableState.sol"; /// @notice PermitForwarder allows permitting this contract as a spender on permit2 /// @dev This contract does not enforce the spender to be this contract, but that is the intended use case -abstract contract Permit2Forwarder is IPermit2Forwarder, Permit2ImmutableState { +contract Permit2Forwarder is IPermit2Forwarder, Permit2ImmutableState { + constructor(IAllowanceTransfer _permit2) Permit2ImmutableState(_permit2) {} + /// @notice allows forwarding a single permit to permit2 /// @dev this function is payable to allow multicall with NATIVE based actions function permit(address owner, IAllowanceTransfer.PermitSingle calldata permitSingle, bytes calldata signature) diff --git a/src/base/PositionActionsRouter.sol b/src/base/PositionActionsRouter.sol index 89ae03fe..17159342 100644 --- a/src/base/PositionActionsRouter.sol +++ b/src/base/PositionActionsRouter.sol @@ -10,7 +10,6 @@ import {SafeCast} from "@uniswap/v4-core/src/libraries/SafeCast.sol"; import {Position} from "@uniswap/v4-core/src/libraries/Position.sol"; import {StateLibrary} from "@uniswap/v4-core/src/libraries/StateLibrary.sol"; import {TransientStateLibrary} from "@uniswap/v4-core/src/libraries/TransientStateLibrary.sol"; -import {IAllowanceTransfer} from "permit2/src/interfaces/IAllowanceTransfer.sol"; import {ERC721Permit_v4} from "./ERC721Permit_v4.sol"; import {DeltaResolver} from "./DeltaResolver.sol"; @@ -24,7 +23,7 @@ import {ReentrancyLock} from "./ReentrancyLock.sol"; import {Permit2ImmutableState} from "./Permit2ImmutableState.sol"; import {IPositionActionsRouter} from "../interfaces/IPositionActionsRouter.sol"; -contract PositionActionsRouter is +abstract contract PositionActionsRouter is IPositionActionsRouter, ERC721Permit_v4, DeltaResolver, @@ -48,9 +47,8 @@ contract PositionActionsRouter is mapping(uint256 tokenId => bytes32 config) private _positionConfigs; - constructor(IPoolManager _poolManager, IAllowanceTransfer _permit2) + constructor(IPoolManager _poolManager) BaseActionsRouter(_poolManager) - Permit2ImmutableState(_permit2) ERC721Permit_v4("Uniswap V4 Positions NFT", "UNI-V4-POSM") {} diff --git a/test/mocks/MockPermit2Forwarder.sol b/test/mocks/MockPermit2Forwarder.sol deleted file mode 100644 index d02b52f2..00000000 --- a/test/mocks/MockPermit2Forwarder.sol +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -pragma solidity ^0.8.20; - -import {IAllowanceTransfer} from "permit2/src/interfaces/IAllowanceTransfer.sol"; - -import {Permit2Forwarder} from "../../src/base/Permit2Forwarder.sol"; -import {Permit2ImmutableState} from "../../src/base/Permit2ImmutableState.sol"; - -contract MockPermit2Forwarder is Permit2Forwarder { - constructor(IAllowanceTransfer _permit2) Permit2ImmutableState(_permit2) {} -} diff --git a/test/position-managers/Permit2Forwarder.t.sol b/test/position-managers/Permit2Forwarder.t.sol index 025167ba..30f7bbac 100644 --- a/test/position-managers/Permit2Forwarder.t.sol +++ b/test/position-managers/Permit2Forwarder.t.sol @@ -9,10 +9,10 @@ import {IAllowanceTransfer} from "permit2/src/interfaces/IAllowanceTransfer.sol" import {PosmTestSetup} from "../shared/PosmTestSetup.sol"; import {Permit2SignatureHelpers} from "../shared/Permit2SignatureHelpers.sol"; -import {MockPermit2Forwarder} from "../mocks/MockPermit2Forwarder.sol"; +import {Permit2Forwarder} from "../../src/base/Permit2Forwarder.sol"; contract Permit2ForwarderTest is Test, PosmTestSetup, Permit2SignatureHelpers { - MockPermit2Forwarder permit2Forwarder; + Permit2Forwarder permit2Forwarder; uint160 amount0 = 10e18; // the expiration of the allowance is large @@ -29,7 +29,7 @@ contract Permit2ForwarderTest is Test, PosmTestSetup, Permit2SignatureHelpers { (currency0, currency1) = deployAndMint2Currencies(); // also deploys permit2 deployPosm(manager); - permit2Forwarder = new MockPermit2Forwarder(permit2); + permit2Forwarder = new Permit2Forwarder(permit2); PERMIT2_DOMAIN_SEPARATOR = permit2.DOMAIN_SEPARATOR(); alicePrivateKey = 0x12341234;