From aad107a915b8d576e9c6304cf22506eeb6456fab Mon Sep 17 00:00:00 2001 From: Tina Zheng <tina.s.zheng+github@gmail.com> Date: Wed, 29 Nov 2023 12:36:07 -0500 Subject: [PATCH] fix inheritance order --- contracts/NonfungiblePositionManagerV4.sol | 2 ++ contracts/base/LiquidityManagement.sol | 2 +- contracts/interfaces/ILiquidityManagement.sol | 26 +++++++++++++++++++ .../INonfungiblePositionManagerV4.sol | 24 ----------------- 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/contracts/NonfungiblePositionManagerV4.sol b/contracts/NonfungiblePositionManagerV4.sol index 469334b7..8548f95b 100644 --- a/contracts/NonfungiblePositionManagerV4.sol +++ b/contracts/NonfungiblePositionManagerV4.sol @@ -14,6 +14,7 @@ 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 {LiquidityManagement} from "./base/LiquidityManagement.sol"; import {Multicall} from "./base/Multicall.sol"; contract NonfungiblePositionManagerV4 is @@ -22,6 +23,7 @@ contract NonfungiblePositionManagerV4 is PeripheryImmutableState, PeripheryValidation, PeripheryPayments, + LiquidityManagement, SelfPermit, Multicall { diff --git a/contracts/base/LiquidityManagement.sol b/contracts/base/LiquidityManagement.sol index 019687e6..85c934ee 100644 --- a/contracts/base/LiquidityManagement.sol +++ b/contracts/base/LiquidityManagement.sol @@ -16,7 +16,7 @@ abstract contract LiquidityManagement is ILockCallback, ILiquidityManagement, Pe } function lockAcquired(bytes calldata rawData) external override returns (bytes memory) { - // TODO: handle mint/add liquidity here + // TODO: handle mint/add/decrease liquidity here return abi.encode(0); } } diff --git a/contracts/interfaces/ILiquidityManagement.sol b/contracts/interfaces/ILiquidityManagement.sol index 02c4f2dd..5c13310e 100644 --- a/contracts/interfaces/ILiquidityManagement.sol +++ b/contracts/interfaces/ILiquidityManagement.sol @@ -4,6 +4,8 @@ pragma solidity ^0.8.19; import {ILockCallback} from "@uniswap/v4-core/contracts/interfaces/callback//ILockCallback.sol"; import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol"; +/// @title Liquidity management interface +/// @notice Wrapper around pool manager callbacks interface ILiquidityManagement is ILockCallback { struct MintParams { PoolKey poolKey; @@ -17,4 +19,28 @@ interface ILiquidityManagement is ILockCallback { uint256 deadline; bytes hookData; } + + struct IncreaseLiquidityParams { + uint256 tokenId; + uint256 amount0Desired; + uint256 amount1Desired; + uint256 amount0Min; + uint256 amount1Min; + uint256 deadline; + } + + struct DecreaseLiquidityParams { + uint256 tokenId; + uint128 liquidity; + uint256 amount0Min; + uint256 amount1Min; + uint256 deadline; + } + + struct CollectParams { + uint256 tokenId; + address recipient; + uint128 amount0Max; + uint128 amount1Max; + } } diff --git a/contracts/interfaces/INonfungiblePositionManagerV4.sol b/contracts/interfaces/INonfungiblePositionManagerV4.sol index 2c40ffac..a0d12cde 100644 --- a/contracts/interfaces/INonfungiblePositionManagerV4.sol +++ b/contracts/interfaces/INonfungiblePositionManagerV4.sol @@ -95,15 +95,6 @@ interface INonfungiblePositionManagerV4 is payable returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1); - struct IncreaseLiquidityParams { - uint256 tokenId; - uint256 amount0Desired; - uint256 amount1Desired; - uint256 amount0Min; - uint256 amount1Min; - uint256 deadline; - } - /// @notice Increases the amount of liquidity in a position, with tokens paid by the `msg.sender` /// @param params tokenId The ID of the token for which liquidity is being increased, /// amount0Desired The desired amount of token0 to be spent, @@ -119,14 +110,6 @@ interface INonfungiblePositionManagerV4 is payable returns (uint128 liquidity, uint256 amount0, uint256 amount1); - struct DecreaseLiquidityParams { - uint256 tokenId; - uint128 liquidity; - uint256 amount0Min; - uint256 amount1Min; - uint256 deadline; - } - /// @notice Decreases the amount of liquidity in a position and accounts it to the position /// @param params tokenId The ID of the token for which liquidity is being decreased, /// amount The amount by which liquidity will be decreased, @@ -140,13 +123,6 @@ interface INonfungiblePositionManagerV4 is payable returns (uint256 amount0, uint256 amount1); - struct CollectParams { - uint256 tokenId; - address recipient; - uint128 amount0Max; - uint128 amount1Max; - } - /// @notice Collects up to a maximum amount of fees owed to a specific position to the recipient /// @param params tokenId The ID of the NFT for which tokens are being collected, /// recipient The account that should receive the tokens,