Skip to content

Commit c88b410

Browse files
Remove mandatory IR (#421)
* feat: add scoping to _increaseFromDeltas * feat: assign params to memory in _burn * feat: dont compile posm with ir * chore: gas * feat: change optimizer runs to be below size limit * revert compilation changes * regenerate snapshots with existing compilation parameters * restore new line --------- Co-authored-by: Abdulla Al-Kamil <[email protected]>
1 parent c42499d commit c88b410

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/PositionManager.sol

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -309,16 +309,19 @@ contract PositionManager is
309309
{
310310
(PoolKey memory poolKey, PositionInfo info) = getPoolAndPositionInfo(tokenId);
311311

312-
(uint160 sqrtPriceX96,,,) = poolManager.getSlot0(poolKey.toId());
313-
314-
// Use the credit on the pool manager as the amounts for the mint.
315-
uint256 liquidity = LiquidityAmounts.getLiquidityForAmounts(
316-
sqrtPriceX96,
317-
TickMath.getSqrtPriceAtTick(info.tickLower()),
318-
TickMath.getSqrtPriceAtTick(info.tickUpper()),
319-
_getFullCredit(poolKey.currency0),
320-
_getFullCredit(poolKey.currency1)
321-
);
312+
uint256 liquidity;
313+
{
314+
(uint160 sqrtPriceX96,,,) = poolManager.getSlot0(poolKey.toId());
315+
316+
// Use the credit on the pool manager as the amounts for the mint.
317+
liquidity = LiquidityAmounts.getLiquidityForAmounts(
318+
sqrtPriceX96,
319+
TickMath.getSqrtPriceAtTick(info.tickLower()),
320+
TickMath.getSqrtPriceAtTick(info.tickUpper()),
321+
_getFullCredit(poolKey.currency0),
322+
_getFullCredit(poolKey.currency1)
323+
);
324+
}
322325

323326
// Note: The tokenId is used as the salt for this position, so every minted position has unique storage in the pool manager.
324327
(BalanceDelta liquidityDelta, BalanceDelta feesAccrued) =
@@ -423,16 +426,13 @@ contract PositionManager is
423426
if (liquidity > 0) {
424427
BalanceDelta liquidityDelta;
425428
// do not use _modifyLiquidity as we do not need to notify on modification for burns.
426-
(liquidityDelta, feesAccrued) = poolManager.modifyLiquidity(
427-
poolKey,
428-
IPoolManager.ModifyLiquidityParams({
429-
tickLower: info.tickLower(),
430-
tickUpper: info.tickUpper(),
431-
liquidityDelta: -(liquidity.toInt256()),
432-
salt: bytes32(tokenId)
433-
}),
434-
hookData
435-
);
429+
IPoolManager.ModifyLiquidityParams memory params = IPoolManager.ModifyLiquidityParams({
430+
tickLower: info.tickLower(),
431+
tickUpper: info.tickUpper(),
432+
liquidityDelta: -(liquidity.toInt256()),
433+
salt: bytes32(tokenId)
434+
});
435+
(liquidityDelta, feesAccrued) = poolManager.modifyLiquidity(poolKey, params, hookData);
436436
// Slippage checks should be done on the principal liquidityDelta which is the liquidityDelta - feesAccrued
437437
(liquidityDelta - feesAccrued).validateMinOut(amount0Min, amount1Min);
438438
}

0 commit comments

Comments
 (0)