Skip to content

Commit

Permalink
shenanigansssss (#284)
Browse files Browse the repository at this point in the history
* shenanigansssss

* more pretty

* remove mock
  • Loading branch information
snreynolds authored Aug 7, 2024
1 parent d0fac81 commit 7484e20
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 20 deletions.
5 changes: 4 additions & 1 deletion src/PositionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion src/base/Permit2Forwarder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions src/base/PositionActionsRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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,
Expand All @@ -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")
{}

Expand Down
11 changes: 0 additions & 11 deletions test/mocks/MockPermit2Forwarder.sol

This file was deleted.

6 changes: 3 additions & 3 deletions test/position-managers/Permit2Forwarder.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit 7484e20

Please sign in to comment.