@@ -306,16 +306,19 @@ contract PositionManager is
306
306
{
307
307
(PoolKey memory poolKey , PositionInfo info ) = getPoolAndPositionInfo (tokenId);
308
308
309
- (uint160 sqrtPriceX96 ,,,) = poolManager.getSlot0 (poolKey.toId ());
310
-
311
- // Use the credit on the pool manager as the amounts for the mint.
312
- uint256 liquidity = LiquidityAmounts.getLiquidityForAmounts (
313
- sqrtPriceX96,
314
- TickMath.getSqrtPriceAtTick (info.tickLower ()),
315
- TickMath.getSqrtPriceAtTick (info.tickUpper ()),
316
- _getFullCredit (poolKey.currency0),
317
- _getFullCredit (poolKey.currency1)
318
- );
309
+ uint256 liquidity;
310
+ {
311
+ (uint160 sqrtPriceX96 ,,,) = poolManager.getSlot0 (poolKey.toId ());
312
+
313
+ // Use the credit on the pool manager as the amounts for the mint.
314
+ liquidity = LiquidityAmounts.getLiquidityForAmounts (
315
+ sqrtPriceX96,
316
+ TickMath.getSqrtPriceAtTick (info.tickLower ()),
317
+ TickMath.getSqrtPriceAtTick (info.tickUpper ()),
318
+ _getFullCredit (poolKey.currency0),
319
+ _getFullCredit (poolKey.currency1)
320
+ );
321
+ }
319
322
320
323
// Note: The tokenId is used as the salt for this position, so every minted position has unique storage in the pool manager.
321
324
(BalanceDelta liquidityDelta , BalanceDelta feesAccrued ) =
@@ -420,16 +423,13 @@ contract PositionManager is
420
423
if (liquidity > 0 ) {
421
424
BalanceDelta liquidityDelta;
422
425
// do not use _modifyLiquidity as we do not need to notify on modification for burns.
423
- (liquidityDelta, feesAccrued) = poolManager.modifyLiquidity (
424
- poolKey,
425
- IPoolManager.ModifyLiquidityParams ({
426
- tickLower: info.tickLower (),
427
- tickUpper: info.tickUpper (),
428
- liquidityDelta: - (liquidity.toInt256 ()),
429
- salt: bytes32 (tokenId)
430
- }),
431
- hookData
432
- );
426
+ IPoolManager.ModifyLiquidityParams memory params = IPoolManager.ModifyLiquidityParams ({
427
+ tickLower: info.tickLower (),
428
+ tickUpper: info.tickUpper (),
429
+ liquidityDelta: - (liquidity.toInt256 ()),
430
+ salt: bytes32 (tokenId)
431
+ });
432
+ (liquidityDelta, feesAccrued) = poolManager.modifyLiquidity (poolKey, params, hookData);
433
433
// Slippage checks should be done on the principal liquidityDelta which is the liquidityDelta - feesAccrued
434
434
(liquidityDelta - feesAccrued).validateMinOut (amount0Min, amount1Min);
435
435
}
0 commit comments