diff --git a/.forge-snapshots/DynamicFees.swap_updateDynamicFeeInBeforeSwap.snap b/.forge-snapshots/DynamicFees.swap_updateDynamicFeeInBeforeSwap.snap index c592ac271..d3875f3d7 100644 --- a/.forge-snapshots/DynamicFees.swap_updateDynamicFeeInBeforeSwap.snap +++ b/.forge-snapshots/DynamicFees.swap_updateDynamicFeeInBeforeSwap.snap @@ -1 +1 @@ -131807 \ No newline at end of file +131731 \ No newline at end of file diff --git a/.forge-snapshots/DynamicFees.swap_withDynamicFee.snap b/.forge-snapshots/DynamicFees.swap_withDynamicFee.snap index 6802f81e7..d71a9ac1e 100644 --- a/.forge-snapshots/DynamicFees.swap_withDynamicFee.snap +++ b/.forge-snapshots/DynamicFees.swap_withDynamicFee.snap @@ -1 +1 @@ -90781 \ No newline at end of file +90705 \ No newline at end of file diff --git a/.forge-snapshots/PoolManager.bytecodeSize.snap b/.forge-snapshots/PoolManager.bytecodeSize.snap index e8b78f106..dfa56f0f4 100644 --- a/.forge-snapshots/PoolManager.bytecodeSize.snap +++ b/.forge-snapshots/PoolManager.bytecodeSize.snap @@ -1 +1 @@ -22630 \ No newline at end of file +22628 \ No newline at end of file diff --git a/.forge-snapshots/PoolManager.removeLiquidity.snap b/.forge-snapshots/PoolManager.removeLiquidity.snap index 9a90d6e30..996e81453 100644 --- a/.forge-snapshots/PoolManager.removeLiquidity.snap +++ b/.forge-snapshots/PoolManager.removeLiquidity.snap @@ -1 +1 @@ -137995 \ No newline at end of file +137843 \ No newline at end of file diff --git a/.forge-snapshots/PoolManager.removeLiquidity_withEmptyHook.snap b/.forge-snapshots/PoolManager.removeLiquidity_withEmptyHook.snap index 72af20123..938754b45 100644 --- a/.forge-snapshots/PoolManager.removeLiquidity_withEmptyHook.snap +++ b/.forge-snapshots/PoolManager.removeLiquidity_withEmptyHook.snap @@ -1 +1 @@ -53945 \ No newline at end of file +53793 \ No newline at end of file diff --git a/.forge-snapshots/PoolManager.removeLiquidity_withNative.snap b/.forge-snapshots/PoolManager.removeLiquidity_withNative.snap index 4c8a12801..05d2a33c7 100644 --- a/.forge-snapshots/PoolManager.removeLiquidity_withNative.snap +++ b/.forge-snapshots/PoolManager.removeLiquidity_withNative.snap @@ -1 +1 @@ -141717 \ No newline at end of file +141565 \ No newline at end of file diff --git a/.forge-snapshots/PoolManager.swap_againstLiquidityWithNativeToken.snap b/.forge-snapshots/PoolManager.swap_againstLiquidityWithNativeToken.snap index 4d02c1e89..72f1a1429 100644 --- a/.forge-snapshots/PoolManager.swap_againstLiquidityWithNativeToken.snap +++ b/.forge-snapshots/PoolManager.swap_againstLiquidityWithNativeToken.snap @@ -1 +1 @@ -71233 \ No newline at end of file +71157 \ No newline at end of file diff --git a/.forge-snapshots/PoolManager.swap_mintNativeOutputAs6909.snap b/.forge-snapshots/PoolManager.swap_mintNativeOutputAs6909.snap index 68c1d4dff..156c2a427 100644 --- a/.forge-snapshots/PoolManager.swap_mintNativeOutputAs6909.snap +++ b/.forge-snapshots/PoolManager.swap_mintNativeOutputAs6909.snap @@ -1 +1 @@ -135671 \ No newline at end of file +135595 \ No newline at end of file diff --git a/.forge-snapshots/PoolManager.swap_mintOutputAs6909.snap b/.forge-snapshots/PoolManager.swap_mintOutputAs6909.snap index 62b1cb75d..52472b8fd 100644 --- a/.forge-snapshots/PoolManager.swap_mintOutputAs6909.snap +++ b/.forge-snapshots/PoolManager.swap_mintOutputAs6909.snap @@ -1 +1 @@ -152294 \ No newline at end of file +152218 \ No newline at end of file diff --git a/.forge-snapshots/PoolManager.swap_simple.snap b/.forge-snapshots/PoolManager.swap_simple.snap index 613ea7682..166e90f2b 100644 --- a/.forge-snapshots/PoolManager.swap_simple.snap +++ b/.forge-snapshots/PoolManager.swap_simple.snap @@ -1 +1 @@ -138291 \ No newline at end of file +138215 \ No newline at end of file diff --git a/.forge-snapshots/PoolManager.swap_simpleWithNative.snap b/.forge-snapshots/PoolManager.swap_simpleWithNative.snap index eae97b187..48402771a 100644 --- a/.forge-snapshots/PoolManager.swap_simpleWithNative.snap +++ b/.forge-snapshots/PoolManager.swap_simpleWithNative.snap @@ -1 +1 @@ -126898 \ No newline at end of file +126822 \ No newline at end of file diff --git a/.forge-snapshots/PoolManager.swap_withHooks.snap b/.forge-snapshots/PoolManager.swap_withHooks.snap index 338e94681..c02f4b287 100644 --- a/.forge-snapshots/PoolManager.swap_withHooks.snap +++ b/.forge-snapshots/PoolManager.swap_withHooks.snap @@ -1 +1 @@ -61531 \ No newline at end of file +61455 \ No newline at end of file diff --git a/.forge-snapshots/swap against liquidity.snap b/.forge-snapshots/swap against liquidity.snap index bedd4d942..1c0a5d4a1 100644 --- a/.forge-snapshots/swap against liquidity.snap +++ b/.forge-snapshots/swap against liquidity.snap @@ -1 +1 @@ -61552 \ No newline at end of file +61476 \ No newline at end of file diff --git a/.forge-snapshots/swap burn 6909 for input.snap b/.forge-snapshots/swap burn 6909 for input.snap index ee34c59c9..8e9fd0cb6 100644 --- a/.forge-snapshots/swap burn 6909 for input.snap +++ b/.forge-snapshots/swap burn 6909 for input.snap @@ -1 +1 @@ -79445 \ No newline at end of file +79369 \ No newline at end of file diff --git a/.forge-snapshots/swap burn native 6909 for input.snap b/.forge-snapshots/swap burn native 6909 for input.snap index 3481ffac8..46bd735f4 100644 --- a/.forge-snapshots/swap burn native 6909 for input.snap +++ b/.forge-snapshots/swap burn native 6909 for input.snap @@ -1 +1 @@ -75288 \ No newline at end of file +75212 \ No newline at end of file diff --git a/.forge-snapshots/swap skips hook call if hook is caller.snap b/.forge-snapshots/swap skips hook call if hook is caller.snap index acd2c1281..7b95765fd 100644 --- a/.forge-snapshots/swap skips hook call if hook is caller.snap +++ b/.forge-snapshots/swap skips hook call if hook is caller.snap @@ -1 +1 @@ -158953 \ No newline at end of file +158801 \ No newline at end of file diff --git a/src/PoolManager.sol b/src/PoolManager.sol index 30fb40dc0..d81b3a83d 100644 --- a/src/PoolManager.sol +++ b/src/PoolManager.sol @@ -157,12 +157,10 @@ contract PoolManager is IPoolManager, ProtocolFees, NoDelegateCall, ERC6909Claim int256 current = currency.getDelta(msg.sender); int256 next = current + delta; - unchecked { - if (next == 0) { - NonZeroDeltaCount.decrement(); - } else if (current == 0) { - NonZeroDeltaCount.increment(); - } + if (next == 0) { + NonZeroDeltaCount.decrement(); + } else if (current == 0) { + NonZeroDeltaCount.increment(); } currency.setDelta(msg.sender, next); @@ -265,9 +263,11 @@ contract PoolManager is IPoolManager, ProtocolFees, NoDelegateCall, ERC6909Claim /// @inheritdoc IPoolManager function take(Currency currency, address to, uint256 amount) external override onlyWhenUnlocked { - // subtraction must be safe - _accountDelta(currency, -(amount.toInt128())); - currency.transfer(to, amount); + unchecked { + // subtraction must be safe + _accountDelta(currency, -(amount.toInt128())); + currency.transfer(to, amount); + } } /// @inheritdoc IPoolManager @@ -285,9 +285,11 @@ contract PoolManager is IPoolManager, ProtocolFees, NoDelegateCall, ERC6909Claim /// @inheritdoc IPoolManager function mint(address to, uint256 id, uint256 amount) external override onlyWhenUnlocked { - // subtraction must be safe - _accountDelta(CurrencyLibrary.fromId(id), -(amount.toInt128())); - _mint(to, id, amount); + unchecked { + // subtraction must be safe + _accountDelta(CurrencyLibrary.fromId(id), -(amount.toInt128())); + _mint(to, id, amount); + } } /// @inheritdoc IPoolManager