Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
snreynolds committed Sep 5, 2024
1 parent 2200534 commit 48f5376
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_mint_native.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
364076
364112
Original file line number Diff line number Diff line change
@@ -1 +1 @@
372456
372492
Original file line number Diff line number Diff line change
@@ -1 +1 @@
371822
371858
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_mint_onSameTickLower.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
316941
316957
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_mint_onSameTickUpper.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
317611
317627
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_mint_sameRange.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
243180
243196
Original file line number Diff line number Diff line change
@@ -1 +1 @@
418068
418104
Original file line number Diff line number Diff line change
@@ -1 +1 @@
322972
322988
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_mint_withClose.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
419474
419510
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_mint_withSettlePair.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
418674
418710
Original file line number Diff line number Diff line change
@@ -1 +1 @@
463642
463678
16 changes: 7 additions & 9 deletions src/PositionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -289,17 +289,17 @@ contract PositionManager is
PositionInfo info = PositionInfoLibrary.initialize(poolKey, tickLower, tickUpper);
positionInfo[tokenId] = info;

// fee delta can be ignored as this is a new position
(BalanceDelta liquidityDelta,) =
_modifyLiquidity(info, poolKey, liquidity.toInt256(), bytes32(tokenId), hookData);
(liquidityDelta).validateMaxIn(amount0Max, amount1Max);

bytes25 poolId = info.poolId();
// Store the poolKey if it is not already stored.
// On UniswapV4, the minimum tick spacing is 1, which means that if the tick spacing is 0, the pool key has not been set.
bytes25 poolId = info.poolId();
if (poolKeys[poolId].tickSpacing == 0) {
poolKeys[poolId] = poolKey;
}

// fee delta can be ignored as this is a new position
(BalanceDelta liquidityDelta,) =
_modifyLiquidity(info, poolKey, liquidity.toInt256(), bytes32(tokenId), hookData);
(liquidityDelta).validateMaxIn(amount0Max, amount1Max);
}

/// @dev this is overloaded with ERC721Permit_v4._burn
Expand All @@ -311,8 +311,6 @@ contract PositionManager is

uint256 liquidity = uint256(_getLiquidity(tokenId, poolKey, info.tickLower(), info.tickUpper()));

bool hasSubscriber = info.hasSubscriber();

// Clear the position info.
positionInfo[tokenId] = PositionInfoLibrary.EMPTY_POSITION_INFO;
// Burn the token.
Expand All @@ -326,7 +324,7 @@ contract PositionManager is
(liquidityDelta - feesAccrued).validateMinOut(amount0Min, amount1Min);
}

if (hasSubscriber) _unsubscribe(tokenId);
if (info.hasSubscriber()) _unsubscribe(tokenId);
}

function _settlePair(Currency currency0, Currency currency1) internal {
Expand Down

0 comments on commit 48f5376

Please sign in to comment.