Skip to content

Commit

Permalink
add periphery immutable state
Browse files Browse the repository at this point in the history
  • Loading branch information
tinaszheng committed Nov 29, 2023
1 parent 6e82a2e commit 3166045
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
6 changes: 3 additions & 3 deletions contracts/NonfungiblePositionManagerV4.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ import {Currency} from "@uniswap/v4-core/contracts/types/Currency.sol";
import {INonfungiblePositionManagerV4} from "./interfaces/INonfungiblePositionManagerV4.sol";
import {PeripheryValidation} from "./base/PeripheryValidation.sol";
import {PeripheryPayments} from "./base/PeripheryPayments.sol";
import {PeripheryImmutableState} from "./base/PeripheryImmutableState.sol";
import {SelfPermit} from "./base/SelfPermit.sol";
import {Multicall} from "./base/Multicall.sol";

contract NonfungiblePositionManagerV4 is
INonfungiblePositionManagerV4,
ERC721,
PeripheryImmutableState,
PeripheryValidation,
PeripheryPayments,
SelfPermit,
Multicall
{
using PoolIdLibrary for PoolKey;

IPoolManager public immutable poolManager;

error InvalidTokenID();
error NotApproved();
error NotCleared();
Expand Down Expand Up @@ -68,9 +68,9 @@ contract NonfungiblePositionManagerV4 is
// TODO: does it still need WETH address in the constructor here?
// TODO: use ERC721Permit2 here
constructor(IPoolManager _poolManager, address _tokenDescriptor_)
PeripheryImmutableState(_poolManager)
ERC721("Uniswap V4 Positions NFT-V1", "UNI-V4-POS")
{
poolManager = _poolManager;
_tokenDescriptor = _tokenDescriptor_;
}

Expand Down
15 changes: 15 additions & 0 deletions contracts/base/PeripheryImmutableState.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

import {IPoolManager} from "@uniswap/v4-core/contracts/interfaces/IPoolManager.sol";
import {IPeripheryImmutableState} from "../interfaces/IPeripheryImmutableState.sol";

/// @title Immutable state
/// @notice Immutable state used by periphery contracts
abstract contract PeripheryImmutableState is IPeripheryImmutableState {
IPoolManager public immutable override poolManager;

constructor(IPoolManager _poolManager) {
poolManager = _poolManager;
}
}
9 changes: 8 additions & 1 deletion contracts/interfaces/INonfungiblePositionManagerV4.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@ import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol";
import {Currency} from "@uniswap/v4-core/contracts/types/Currency.sol";

import {IPeripheryPayments} from "./IPeripheryPayments.sol";
import {IPeripheryImmutableState} from "./IPeripheryImmutableState.sol";

/// @title Non-fungible token for positions
/// @notice Wraps Uniswap V4 positions in a non-fungible token interface which allows for them to be transferred
/// and authorized.
interface INonfungiblePositionManagerV4 is ILockCallback, IPeripheryPayments, IERC721Metadata, IERC721Enumerable {
interface INonfungiblePositionManagerV4 is
ILockCallback,
IPeripheryPayments,
IPeripheryImmutableState,
IERC721Metadata,
IERC721Enumerable
{
/// @notice Emitted when liquidity is increased for a position NFT
/// @dev Also emitted when a token is minted
/// @param tokenId The ID of the token for which liquidity was increased
Expand Down
11 changes: 11 additions & 0 deletions contracts/interfaces/IPeripheryImmutableState.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

import {IPoolManager} from "@uniswap/v4-core/contracts/interfaces/IPoolManager.sol";

/// @title Immutable state
/// @notice Functions that return immutable state
interface IPeripheryImmutableState {
/// @return Returns the pool manager
function poolManager() external view returns (IPoolManager);
}

0 comments on commit 3166045

Please sign in to comment.