From 87e0b2fb2bb83d1a9e9f9fe8e88833d7abb08143 Mon Sep 17 00:00:00 2001 From: Tina Zheng Date: Wed, 29 Nov 2023 15:17:52 -0500 Subject: [PATCH] move stuff around --- contracts/NonfungiblePositionManagerV4.sol | 18 +++++++++--------- contracts/base/LiquidityManagement.sol | 19 ++++++++++++++++++- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/contracts/NonfungiblePositionManagerV4.sol b/contracts/NonfungiblePositionManagerV4.sol index 8548f95b..fd74569a 100644 --- a/contracts/NonfungiblePositionManagerV4.sol +++ b/contracts/NonfungiblePositionManagerV4.sol @@ -133,15 +133,6 @@ contract NonfungiblePositionManagerV4 is // will do something like return mintEntry(params) } - modifier isAuthorizedForToken(uint256 tokenId) { - if (!_isApprovedOrOwner(msg.sender, tokenId)) revert NotApproved(); - _; - } - - function tokenURI(uint256 tokenId) public view override(ERC721, IERC721Metadata) returns (string memory) { - // TODO: implement this - } - /// @inheritdoc INonfungiblePositionManagerV4 function increaseLiquidity(IncreaseLiquidityParams calldata params) external @@ -184,6 +175,15 @@ contract NonfungiblePositionManagerV4 is _burn(tokenId); } + modifier isAuthorizedForToken(uint256 tokenId) { + if (!_isApprovedOrOwner(msg.sender, tokenId)) revert NotApproved(); + _; + } + + function tokenURI(uint256 tokenId) public view override(ERC721, IERC721Metadata) returns (string memory) { + // TODO: implement this + } + /// @inheritdoc IERC721 function getApproved(uint256 tokenId) public view override(ERC721, IERC721) returns (address) { if (!_exists(tokenId)) revert NonexistentToken(); diff --git a/contracts/base/LiquidityManagement.sol b/contracts/base/LiquidityManagement.sol index 85c934ee..540a8096 100644 --- a/contracts/base/LiquidityManagement.sol +++ b/contracts/base/LiquidityManagement.sol @@ -1,6 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.19; +import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol"; import {BalanceDelta} from "@uniswap/v4-core/contracts/types/BalanceDelta.sol"; import {ILockCallback} from "@uniswap/v4-core/contracts/interfaces/callback//ILockCallback.sol"; import {IPeripheryPayments} from "../interfaces/IPeripheryPayments.sol"; @@ -8,11 +9,27 @@ import {ILiquidityManagement} from "../interfaces/ILiquidityManagement.sol"; import {PeripheryImmutableState} from "./PeripheryImmutableState.sol"; abstract contract LiquidityManagement is ILockCallback, ILiquidityManagement, PeripheryImmutableState { + struct AddLiquidityParams { + PoolKey poolKey; + int24 tickLower; + int24 tickUpper; + uint256 amount0Desired; + uint256 amount1Desired; + uint256 amount0Min; + uint256 amount1Min; + bytes hookData; + } + function mintEntry(MintParams memory params) internal returns (uint256 tokenId, uint128 liquidity, BalanceDelta delta) { - // poolManager.lock call here + // TODO: poolManager.lock call here + } + + /// @notice Add liquidity to an initialized pool + function addLiquidity(AddLiquidityParams memory params) internal returns (uint128 liquidity, BalanceDelta delta) { + // TODO: copy over addLiquidity helper here } function lockAcquired(bytes calldata rawData) external override returns (bytes memory) {