From 85bb1373c09443bbcf85f3c736f347c30b0effdc Mon Sep 17 00:00:00 2001 From: malgus01 Date: Tue, 23 Sep 2025 09:56:33 -0700 Subject: [PATCH 1/5] feat: Add _createPosition Internal Function --- src/LiquidityManagerV2.sol | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/LiquidityManagerV2.sol b/src/LiquidityManagerV2.sol index eeabf2d..49db17e 100644 --- a/src/LiquidityManagerV2.sol +++ b/src/LiquidityManagerV2.sol @@ -761,4 +761,29 @@ contract LiquidityManagerV2 is Ownable, ReentrancyGuard, Pausable { emit VestingScheduleCreated(provider, token, amount, pool.vestingDuration, block.timestamp); } + + function _createPosition( + address user, + address token0, + address token1, + uint24 fee, + int24 tickLower, + int24 tickUpper, + uint256 liquidity, + uint256 amount0, + uint256 amount1 + ) internal { + userPositions[user].push(LiquidityPosition({ + token0: token0, + token1: token1, + fee: fee, + tickLower: tickLower, + tickUpper: tickUpper, + liquidity: liquidity, + token0Amount: amount0, + token1Amount: amount1, + timestamp: block.timestamp, + active: true + })); + } } From 78aec6e8f2972c40b812b1c9fd97d1807b098335 Mon Sep 17 00:00:00 2001 From: malgus01 Date: Tue, 23 Sep 2025 09:56:59 -0700 Subject: [PATCH 2/5] feat: Add _createPosition Internal Function Natspec Comment --- src/LiquidityManagerV2.sol | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/LiquidityManagerV2.sol b/src/LiquidityManagerV2.sol index 49db17e..361332d 100644 --- a/src/LiquidityManagerV2.sol +++ b/src/LiquidityManagerV2.sol @@ -762,6 +762,9 @@ contract LiquidityManagerV2 is Ownable, ReentrancyGuard, Pausable { emit VestingScheduleCreated(provider, token, amount, pool.vestingDuration, block.timestamp); } + /** + * @notice Create a position record + */ function _createPosition( address user, address token0, From ae6bd8b854739aeb1ea95ff98dfa66dd54d3be01 Mon Sep 17 00:00:00 2001 From: malgus01 Date: Tue, 23 Sep 2025 09:58:11 -0700 Subject: [PATCH 3/5] feat: Add _calculateLiquidity Internal Function --- src/LiquidityManagerV2.sol | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/LiquidityManagerV2.sol b/src/LiquidityManagerV2.sol index 361332d..065e9b6 100644 --- a/src/LiquidityManagerV2.sol +++ b/src/LiquidityManagerV2.sol @@ -789,4 +789,10 @@ contract LiquidityManagerV2 is Ownable, ReentrancyGuard, Pausable { active: true })); } + + function _calculateLiquidity(uint256 amount0, uint256 amount1) internal pure returns (uint256) { + // Simplified liquidity calculation + // In practice, this would use Uniswap V4's math libraries + return (amount0 + amount1) / 2; + } } From 231c40f9088bf68bd38d06c2ba1204cca7246c6f Mon Sep 17 00:00:00 2001 From: malgus01 Date: Tue, 23 Sep 2025 09:59:23 -0700 Subject: [PATCH 4/5] feat: Add unwrap To Events Emitted In Internal Functions --- src/LiquidityManagerV2.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/LiquidityManagerV2.sol b/src/LiquidityManagerV2.sol index 065e9b6..8bc682f 100644 --- a/src/LiquidityManagerV2.sol +++ b/src/LiquidityManagerV2.sol @@ -741,8 +741,8 @@ contract LiquidityManagerV2 is Ownable, ReentrancyGuard, Pausable { lpData.lockEndTime = block.timestamp + pool.vestingDuration; emit LiquidityThresholdReached( - address(poolKeys[poolId].currency0), - address(poolKeys[poolId].currency1), + Currency.unwrap(poolKeys[poolId].currency0), + Currency.unwrap(poolKeys[poolId].currency1), poolId, pool.totalLiquidity, block.timestamp @@ -755,7 +755,7 @@ contract LiquidityManagerV2 is Ownable, ReentrancyGuard, Pausable { */ function _setupVesting(bytes32 poolId, address provider, uint256 amount) internal { PoolInfo storage pool = poolInfo[poolId]; - address token = address(poolKeys[poolId].currency0); // Use token0 for vesting + address token = Currency.unwrap(poolKeys[poolId].currency0); // Use token0 for vesting vestingContract.setVestingSchedule(provider, token, block.timestamp, pool.vestingDuration, amount); From 7d09f7a5311ce5564353dbf1b22760d5f4e5b15e Mon Sep 17 00:00:00 2001 From: malgus01 Date: Tue, 23 Sep 2025 09:59:31 -0700 Subject: [PATCH 5/5] feat: forge fmt --- src/LiquidityManagerV2.sol | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/LiquidityManagerV2.sol b/src/LiquidityManagerV2.sol index 8bc682f..da3c9a2 100644 --- a/src/LiquidityManagerV2.sol +++ b/src/LiquidityManagerV2.sol @@ -775,19 +775,23 @@ contract LiquidityManagerV2 is Ownable, ReentrancyGuard, Pausable { uint256 liquidity, uint256 amount0, uint256 amount1 - ) internal { - userPositions[user].push(LiquidityPosition({ - token0: token0, - token1: token1, - fee: fee, - tickLower: tickLower, - tickUpper: tickUpper, - liquidity: liquidity, - token0Amount: amount0, - token1Amount: amount1, - timestamp: block.timestamp, - active: true - })); + ) + internal + { + userPositions[user].push( + LiquidityPosition({ + token0: token0, + token1: token1, + fee: fee, + tickLower: tickLower, + tickUpper: tickUpper, + liquidity: liquidity, + token0Amount: amount0, + token1Amount: amount1, + timestamp: block.timestamp, + active: true + }) + ); } function _calculateLiquidity(uint256 amount0, uint256 amount1) internal pure returns (uint256) {