From 0ba3f32e26ebe732be520550328bfb7496fb65a6 Mon Sep 17 00:00:00 2001 From: ChefMist <133624774+ChefMist@users.noreply.github.com> Date: Mon, 29 Apr 2024 10:10:27 +0800 Subject: [PATCH] chore: gas tweak --- .../BinHookTest#testBurnSucceedsWithHook.snap | 2 +- ...inHookTest#testDonateSucceedsWithHook.snap | 2 +- ...okTest#testInitializeSucceedsWithHook.snap | 2 +- .../BinHookTest#testMintSucceedsWithHook.snap | 2 +- .../BinHookTest#testSwapSucceedsWithHook.snap | 2 +- ...oolManagerTest#testBurnNativeCurrency.snap | 2 +- ...BinPoolManagerTest#testGasBurnHalfBin.snap | 2 +- ...inPoolManagerTest#testGasBurnNineBins.snap | 2 +- .../BinPoolManagerTest#testGasBurnOneBin.snap | 2 +- .../BinPoolManagerTest#testGasDonate.snap | 2 +- ...nPoolManagerTest#testGasMintNneBins-1.snap | 2 +- ...nPoolManagerTest#testGasMintNneBins-2.snap | 2 +- ...inPoolManagerTest#testGasMintOneBin-1.snap | 2 +- ...inPoolManagerTest#testGasMintOneBin-2.snap | 2 +- ...olManagerTest#testGasSwapMultipleBins.snap | 2 +- ...nagerTest#testGasSwapOverBigBinIdGate.snap | 2 +- ...nPoolManagerTest#testGasSwapSingleBin.snap | 2 +- ...oolManagerTest#testMintNativeCurrency.snap | 2 +- .../BinPoolManagerTest#testNoOpGas_Burn.snap | 2 +- ...BinPoolManagerTest#testNoOpGas_Donate.snap | 2 +- ...oolManagerTest#testNoOpGas_Initialize.snap | 2 +- .../BinPoolManagerTest#testNoOpGas_Mint.snap | 2 +- .../BinPoolManagerTest#testNoOpGas_Swap.snap | 2 +- ...BinPoolManagerTest#testSetProtocolFee.snap | 2 +- ...oolManagerTest#addLiquidity_fromEmpty.snap | 2 +- ...ManagerTest#addLiquidity_fromNonEmpty.snap | 2 +- ...lManagerTest#addLiquidity_nativeToken.snap | 2 +- .../CLPoolManagerTest#donateBothTokens.snap | 2 +- .../CLPoolManagerTest#gasDonateOneToken.snap | 2 +- ...oolManagerTest#initializeWithoutHooks.snap | 2 +- ...anagerTest#removeLiquidity_toNonEmpty.snap | 2 +- ...PoolManagerTest#swap_againstLiquidity.snap | 2 +- ...gerTest#swap_leaveSurplusTokenInVault.snap | 2 +- ...oolManagerTest#swap_runOutOfLiquidity.snap | 2 +- .../CLPoolManagerTest#swap_simple.snap | 2 +- ...nagerTest#swap_useSurplusTokenAsInput.snap | 2 +- .../CLPoolManagerTest#swap_withHooks.snap | 2 +- .../CLPoolManagerTest#swap_withNative.snap | 2 +- ...CLPoolManagerTest#testNoOp_gas_Donate.snap | 2 +- ...olManagerTest#testNoOp_gas_Initialize.snap | 2 +- ...nagerTest#testNoOp_gas_ModifyPosition.snap | 2 +- .../CLPoolManagerTest#testNoOp_gas_Swap.snap | 2 +- src/pool-bin/BinPoolManager.sol | 20 +++++++------- src/pool-cl/CLPoolManager.sol | 26 +++++++++---------- 44 files changed, 64 insertions(+), 66 deletions(-) diff --git a/.forge-snapshots/BinHookTest#testBurnSucceedsWithHook.snap b/.forge-snapshots/BinHookTest#testBurnSucceedsWithHook.snap index 322fcc75..cfddf70e 100644 --- a/.forge-snapshots/BinHookTest#testBurnSucceedsWithHook.snap +++ b/.forge-snapshots/BinHookTest#testBurnSucceedsWithHook.snap @@ -1 +1 @@ -142950 \ No newline at end of file +143903 \ No newline at end of file diff --git a/.forge-snapshots/BinHookTest#testDonateSucceedsWithHook.snap b/.forge-snapshots/BinHookTest#testDonateSucceedsWithHook.snap index 8dbedb00..db45cf73 100644 --- a/.forge-snapshots/BinHookTest#testDonateSucceedsWithHook.snap +++ b/.forge-snapshots/BinHookTest#testDonateSucceedsWithHook.snap @@ -1 +1 @@ -134297 \ No newline at end of file +135247 \ No newline at end of file diff --git a/.forge-snapshots/BinHookTest#testInitializeSucceedsWithHook.snap b/.forge-snapshots/BinHookTest#testInitializeSucceedsWithHook.snap index 980a2587..82b81a8c 100644 --- a/.forge-snapshots/BinHookTest#testInitializeSucceedsWithHook.snap +++ b/.forge-snapshots/BinHookTest#testInitializeSucceedsWithHook.snap @@ -1 +1 @@ -108533 \ No newline at end of file +109118 \ No newline at end of file diff --git a/.forge-snapshots/BinHookTest#testMintSucceedsWithHook.snap b/.forge-snapshots/BinHookTest#testMintSucceedsWithHook.snap index ee5f839f..086607f7 100644 --- a/.forge-snapshots/BinHookTest#testMintSucceedsWithHook.snap +++ b/.forge-snapshots/BinHookTest#testMintSucceedsWithHook.snap @@ -1 +1 @@ -300345 \ No newline at end of file +301295 \ No newline at end of file diff --git a/.forge-snapshots/BinHookTest#testSwapSucceedsWithHook.snap b/.forge-snapshots/BinHookTest#testSwapSucceedsWithHook.snap index b6149057..59e2fe2a 100644 --- a/.forge-snapshots/BinHookTest#testSwapSucceedsWithHook.snap +++ b/.forge-snapshots/BinHookTest#testSwapSucceedsWithHook.snap @@ -1 +1 @@ -138390 \ No newline at end of file +139320 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testBurnNativeCurrency.snap b/.forge-snapshots/BinPoolManagerTest#testBurnNativeCurrency.snap index 7cbc479f..0e901dcc 100644 --- a/.forge-snapshots/BinPoolManagerTest#testBurnNativeCurrency.snap +++ b/.forge-snapshots/BinPoolManagerTest#testBurnNativeCurrency.snap @@ -1 +1 @@ -93346 \ No newline at end of file +90617 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testGasBurnHalfBin.snap b/.forge-snapshots/BinPoolManagerTest#testGasBurnHalfBin.snap index a4d12d29..77509a32 100644 --- a/.forge-snapshots/BinPoolManagerTest#testGasBurnHalfBin.snap +++ b/.forge-snapshots/BinPoolManagerTest#testGasBurnHalfBin.snap @@ -1 +1 @@ -68539 \ No newline at end of file +65810 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testGasBurnNineBins.snap b/.forge-snapshots/BinPoolManagerTest#testGasBurnNineBins.snap index 7b2cfa14..c9417e09 100644 --- a/.forge-snapshots/BinPoolManagerTest#testGasBurnNineBins.snap +++ b/.forge-snapshots/BinPoolManagerTest#testGasBurnNineBins.snap @@ -1 +1 @@ -152077 \ No newline at end of file +149365 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testGasBurnOneBin.snap b/.forge-snapshots/BinPoolManagerTest#testGasBurnOneBin.snap index af5c4805..715b65be 100644 --- a/.forge-snapshots/BinPoolManagerTest#testGasBurnOneBin.snap +++ b/.forge-snapshots/BinPoolManagerTest#testGasBurnOneBin.snap @@ -1 +1 @@ -69718 \ No newline at end of file +66989 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testGasDonate.snap b/.forge-snapshots/BinPoolManagerTest#testGasDonate.snap index 4f7d508c..05f5091e 100644 --- a/.forge-snapshots/BinPoolManagerTest#testGasDonate.snap +++ b/.forge-snapshots/BinPoolManagerTest#testGasDonate.snap @@ -1 +1 @@ -55313 \ No newline at end of file +52582 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testGasMintNneBins-1.snap b/.forge-snapshots/BinPoolManagerTest#testGasMintNneBins-1.snap index 1d9494c7..aa25e617 100644 --- a/.forge-snapshots/BinPoolManagerTest#testGasMintNneBins-1.snap +++ b/.forge-snapshots/BinPoolManagerTest#testGasMintNneBins-1.snap @@ -1 +1 @@ -971345 \ No newline at end of file +968582 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testGasMintNneBins-2.snap b/.forge-snapshots/BinPoolManagerTest#testGasMintNneBins-2.snap index de47e2ca..f22c5e5a 100644 --- a/.forge-snapshots/BinPoolManagerTest#testGasMintNneBins-2.snap +++ b/.forge-snapshots/BinPoolManagerTest#testGasMintNneBins-2.snap @@ -1 +1 @@ -122859 \ No newline at end of file +120096 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testGasMintOneBin-1.snap b/.forge-snapshots/BinPoolManagerTest#testGasMintOneBin-1.snap index 63036760..a27a0639 100644 --- a/.forge-snapshots/BinPoolManagerTest#testGasMintOneBin-1.snap +++ b/.forge-snapshots/BinPoolManagerTest#testGasMintOneBin-1.snap @@ -1 +1 @@ -340528 \ No newline at end of file +337772 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testGasMintOneBin-2.snap b/.forge-snapshots/BinPoolManagerTest#testGasMintOneBin-2.snap index 23e9deb3..6c3b1dd4 100644 --- a/.forge-snapshots/BinPoolManagerTest#testGasMintOneBin-2.snap +++ b/.forge-snapshots/BinPoolManagerTest#testGasMintOneBin-2.snap @@ -1 +1 @@ -57589 \ No newline at end of file +54833 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testGasSwapMultipleBins.snap b/.forge-snapshots/BinPoolManagerTest#testGasSwapMultipleBins.snap index 9b31843b..c12c16ee 100644 --- a/.forge-snapshots/BinPoolManagerTest#testGasSwapMultipleBins.snap +++ b/.forge-snapshots/BinPoolManagerTest#testGasSwapMultipleBins.snap @@ -1 +1 @@ -92098 \ No newline at end of file +89370 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testGasSwapOverBigBinIdGate.snap b/.forge-snapshots/BinPoolManagerTest#testGasSwapOverBigBinIdGate.snap index 53edc1db..96d5c05d 100644 --- a/.forge-snapshots/BinPoolManagerTest#testGasSwapOverBigBinIdGate.snap +++ b/.forge-snapshots/BinPoolManagerTest#testGasSwapOverBigBinIdGate.snap @@ -1 +1 @@ -94083 \ No newline at end of file +91355 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testGasSwapSingleBin.snap b/.forge-snapshots/BinPoolManagerTest#testGasSwapSingleBin.snap index 9d50608b..c724ad85 100644 --- a/.forge-snapshots/BinPoolManagerTest#testGasSwapSingleBin.snap +++ b/.forge-snapshots/BinPoolManagerTest#testGasSwapSingleBin.snap @@ -1 +1 @@ -73587 \ No newline at end of file +70859 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testMintNativeCurrency.snap b/.forge-snapshots/BinPoolManagerTest#testMintNativeCurrency.snap index ee190d58..345aa66a 100644 --- a/.forge-snapshots/BinPoolManagerTest#testMintNativeCurrency.snap +++ b/.forge-snapshots/BinPoolManagerTest#testMintNativeCurrency.snap @@ -1 +1 @@ -322235 \ No newline at end of file +319479 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Burn.snap b/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Burn.snap index a9d320e2..3293c880 100644 --- a/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Burn.snap +++ b/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Burn.snap @@ -1 +1 @@ -44517 \ No newline at end of file +41726 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Donate.snap b/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Donate.snap index 38017dac..2dfafdff 100644 --- a/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Donate.snap +++ b/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Donate.snap @@ -1 +1 @@ -20863 \ No newline at end of file +19494 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Initialize.snap b/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Initialize.snap index 8bf3bdbc..07d18bee 100644 --- a/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Initialize.snap +++ b/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Initialize.snap @@ -1 +1 @@ -42510 \ No newline at end of file +37255 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Mint.snap b/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Mint.snap index c43230aa..a7ed01ba 100644 --- a/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Mint.snap +++ b/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Mint.snap @@ -1 +1 @@ -42175 \ No newline at end of file +39359 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Swap.snap b/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Swap.snap index 4fb042f4..cbc2e8f4 100644 --- a/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Swap.snap +++ b/.forge-snapshots/BinPoolManagerTest#testNoOpGas_Swap.snap @@ -1 +1 @@ -25539 \ No newline at end of file +22739 \ No newline at end of file diff --git a/.forge-snapshots/BinPoolManagerTest#testSetProtocolFee.snap b/.forge-snapshots/BinPoolManagerTest#testSetProtocolFee.snap index 7c3fc46d..f40efcf6 100644 --- a/.forge-snapshots/BinPoolManagerTest#testSetProtocolFee.snap +++ b/.forge-snapshots/BinPoolManagerTest#testSetProtocolFee.snap @@ -1 +1 @@ -8153 \ No newline at end of file +8148 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#addLiquidity_fromEmpty.snap b/.forge-snapshots/CLPoolManagerTest#addLiquidity_fromEmpty.snap index 5d0fae35..d32d5462 100644 --- a/.forge-snapshots/CLPoolManagerTest#addLiquidity_fromEmpty.snap +++ b/.forge-snapshots/CLPoolManagerTest#addLiquidity_fromEmpty.snap @@ -1 +1 @@ -351744 \ No newline at end of file +349002 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#addLiquidity_fromNonEmpty.snap b/.forge-snapshots/CLPoolManagerTest#addLiquidity_fromNonEmpty.snap index 89dea19e..32a71e0f 100644 --- a/.forge-snapshots/CLPoolManagerTest#addLiquidity_fromNonEmpty.snap +++ b/.forge-snapshots/CLPoolManagerTest#addLiquidity_fromNonEmpty.snap @@ -1 +1 @@ -62292 \ No newline at end of file +59550 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#addLiquidity_nativeToken.snap b/.forge-snapshots/CLPoolManagerTest#addLiquidity_nativeToken.snap index 6c431e01..29b67248 100644 --- a/.forge-snapshots/CLPoolManagerTest#addLiquidity_nativeToken.snap +++ b/.forge-snapshots/CLPoolManagerTest#addLiquidity_nativeToken.snap @@ -1 +1 @@ -245337 \ No newline at end of file +242595 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#donateBothTokens.snap b/.forge-snapshots/CLPoolManagerTest#donateBothTokens.snap index a232f935..9bd5ab99 100644 --- a/.forge-snapshots/CLPoolManagerTest#donateBothTokens.snap +++ b/.forge-snapshots/CLPoolManagerTest#donateBothTokens.snap @@ -1 +1 @@ -85388 \ No newline at end of file +82660 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#gasDonateOneToken.snap b/.forge-snapshots/CLPoolManagerTest#gasDonateOneToken.snap index fb638ead..32123d34 100644 --- a/.forge-snapshots/CLPoolManagerTest#gasDonateOneToken.snap +++ b/.forge-snapshots/CLPoolManagerTest#gasDonateOneToken.snap @@ -1 +1 @@ -55350 \ No newline at end of file +52622 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#initializeWithoutHooks.snap b/.forge-snapshots/CLPoolManagerTest#initializeWithoutHooks.snap index 776b1c34..3a3cbca4 100644 --- a/.forge-snapshots/CLPoolManagerTest#initializeWithoutHooks.snap +++ b/.forge-snapshots/CLPoolManagerTest#initializeWithoutHooks.snap @@ -1 +1 @@ -41952 \ No newline at end of file +36693 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#removeLiquidity_toNonEmpty.snap b/.forge-snapshots/CLPoolManagerTest#removeLiquidity_toNonEmpty.snap index a283a34a..af4951da 100644 --- a/.forge-snapshots/CLPoolManagerTest#removeLiquidity_toNonEmpty.snap +++ b/.forge-snapshots/CLPoolManagerTest#removeLiquidity_toNonEmpty.snap @@ -1 +1 @@ -45262 \ No newline at end of file +42520 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#swap_againstLiquidity.snap b/.forge-snapshots/CLPoolManagerTest#swap_againstLiquidity.snap index cce42307..31a06501 100644 --- a/.forge-snapshots/CLPoolManagerTest#swap_againstLiquidity.snap +++ b/.forge-snapshots/CLPoolManagerTest#swap_againstLiquidity.snap @@ -1 +1 @@ -57550 \ No newline at end of file +54818 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#swap_leaveSurplusTokenInVault.snap b/.forge-snapshots/CLPoolManagerTest#swap_leaveSurplusTokenInVault.snap index 962a085b..96c741ec 100644 --- a/.forge-snapshots/CLPoolManagerTest#swap_leaveSurplusTokenInVault.snap +++ b/.forge-snapshots/CLPoolManagerTest#swap_leaveSurplusTokenInVault.snap @@ -1 +1 @@ -103626 \ No newline at end of file +100894 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#swap_runOutOfLiquidity.snap b/.forge-snapshots/CLPoolManagerTest#swap_runOutOfLiquidity.snap index 9cb0cc27..87094420 100644 --- a/.forge-snapshots/CLPoolManagerTest#swap_runOutOfLiquidity.snap +++ b/.forge-snapshots/CLPoolManagerTest#swap_runOutOfLiquidity.snap @@ -1 +1 @@ -25043336 \ No newline at end of file +25040604 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#swap_simple.snap b/.forge-snapshots/CLPoolManagerTest#swap_simple.snap index e44e7c53..a5f4b631 100644 --- a/.forge-snapshots/CLPoolManagerTest#swap_simple.snap +++ b/.forge-snapshots/CLPoolManagerTest#swap_simple.snap @@ -1 +1 @@ -38750 \ No newline at end of file +36018 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#swap_useSurplusTokenAsInput.snap b/.forge-snapshots/CLPoolManagerTest#swap_useSurplusTokenAsInput.snap index ae2086a9..50d34fe8 100644 --- a/.forge-snapshots/CLPoolManagerTest#swap_useSurplusTokenAsInput.snap +++ b/.forge-snapshots/CLPoolManagerTest#swap_useSurplusTokenAsInput.snap @@ -1 +1 @@ -104388 \ No newline at end of file +101656 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#swap_withHooks.snap b/.forge-snapshots/CLPoolManagerTest#swap_withHooks.snap index eee3d6fd..db0b257f 100644 --- a/.forge-snapshots/CLPoolManagerTest#swap_withHooks.snap +++ b/.forge-snapshots/CLPoolManagerTest#swap_withHooks.snap @@ -1 +1 @@ -44489 \ No newline at end of file +41733 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#swap_withNative.snap b/.forge-snapshots/CLPoolManagerTest#swap_withNative.snap index 5acefc72..b1fc476a 100644 --- a/.forge-snapshots/CLPoolManagerTest#swap_withNative.snap +++ b/.forge-snapshots/CLPoolManagerTest#swap_withNative.snap @@ -1 +1 @@ -38753 \ No newline at end of file +36021 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#testNoOp_gas_Donate.snap b/.forge-snapshots/CLPoolManagerTest#testNoOp_gas_Donate.snap index fd89c046..148ffac8 100644 --- a/.forge-snapshots/CLPoolManagerTest#testNoOp_gas_Donate.snap +++ b/.forge-snapshots/CLPoolManagerTest#testNoOp_gas_Donate.snap @@ -1 +1 @@ -22231 \ No newline at end of file +19431 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#testNoOp_gas_Initialize.snap b/.forge-snapshots/CLPoolManagerTest#testNoOp_gas_Initialize.snap index 345509f1..f1eec8c8 100644 --- a/.forge-snapshots/CLPoolManagerTest#testNoOp_gas_Initialize.snap +++ b/.forge-snapshots/CLPoolManagerTest#testNoOp_gas_Initialize.snap @@ -1 +1 @@ -42902 \ No newline at end of file +37643 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#testNoOp_gas_ModifyPosition.snap b/.forge-snapshots/CLPoolManagerTest#testNoOp_gas_ModifyPosition.snap index 2995ee9b..776a83cb 100644 --- a/.forge-snapshots/CLPoolManagerTest#testNoOp_gas_ModifyPosition.snap +++ b/.forge-snapshots/CLPoolManagerTest#testNoOp_gas_ModifyPosition.snap @@ -1 +1 @@ -32427 \ No newline at end of file +29618 \ No newline at end of file diff --git a/.forge-snapshots/CLPoolManagerTest#testNoOp_gas_Swap.snap b/.forge-snapshots/CLPoolManagerTest#testNoOp_gas_Swap.snap index e966df5c..2cc7a635 100644 --- a/.forge-snapshots/CLPoolManagerTest#testNoOp_gas_Swap.snap +++ b/.forge-snapshots/CLPoolManagerTest#testNoOp_gas_Swap.snap @@ -1 +1 @@ -24680 \ No newline at end of file +21883 \ No newline at end of file diff --git a/src/pool-bin/BinPoolManager.sol b/src/pool-bin/BinPoolManager.sol index 71d394db..4f673523 100644 --- a/src/pool-bin/BinPoolManager.sol +++ b/src/pool-bin/BinPoolManager.sol @@ -106,7 +106,7 @@ contract BinPoolManager is IBinPoolManager, Fees, Extsload { uint24 swapFee = key.fee.getInitialSwapFee(); if (swapFee.isSwapFeeTooLarge(SwapFeeLibrary.TEN_PERCENT_FEE)) revert FeeTooLarge(); - if (key.parameters.shouldCall(HOOKS_BEFORE_INITIALIZE_OFFSET, key.hooks)) { + if (key.parameters.shouldCall(HOOKS_BEFORE_INITIALIZE_OFFSET, hooks)) { if (hooks.beforeInitialize(msg.sender, key, activeId, hookData) != IBinHooks.beforeInitialize.selector) { revert Hooks.InvalidHookResponse(); } @@ -120,7 +120,7 @@ contract BinPoolManager is IBinPoolManager, Fees, Extsload { /// @notice Make sure the first event is noted, so that later events from afterHook won't get mixed up with this one emit Initialize(id, key.currency0, key.currency1, key.fee, binStep, hooks); - if (key.parameters.shouldCall(HOOKS_AFTER_INITIALIZE_OFFSET, key.hooks)) { + if (key.parameters.shouldCall(HOOKS_AFTER_INITIALIZE_OFFSET, hooks)) { if (hooks.afterInitialize(msg.sender, key, activeId, hookData) != IBinHooks.afterInitialize.selector) { revert Hooks.InvalidHookResponse(); } @@ -139,7 +139,7 @@ contract BinPoolManager is IBinPoolManager, Fees, Extsload { _checkPoolInitialized(id); IBinHooks hooks = IBinHooks(address(key.hooks)); - if (key.parameters.shouldCall(HOOKS_BEFORE_SWAP_OFFSET, key.hooks)) { + if (key.parameters.shouldCall(HOOKS_BEFORE_SWAP_OFFSET, hooks)) { bytes4 selector = hooks.beforeSwap(msg.sender, key, swapForY, amountIn, hookData); if (key.parameters.isValidNoOpCall(HOOKS_NO_OP_OFFSET, selector)) { // Sentinel return value used to signify that a NoOp occurred. @@ -170,7 +170,7 @@ contract BinPoolManager is IBinPoolManager, Fees, Extsload { emit Swap(id, msg.sender, delta.amount0(), delta.amount1(), activeId, swapFee, feeForProtocol); } - if (key.parameters.shouldCall(HOOKS_AFTER_SWAP_OFFSET, key.hooks)) { + if (key.parameters.shouldCall(HOOKS_AFTER_SWAP_OFFSET, hooks)) { if (hooks.afterSwap(msg.sender, key, swapForY, amountIn, delta, hookData) != IBinHooks.afterSwap.selector) { revert Hooks.InvalidHookResponse(); } @@ -241,7 +241,7 @@ contract BinPoolManager is IBinPoolManager, Fees, Extsload { _checkPoolInitialized(id); IBinHooks hooks = IBinHooks(address(key.hooks)); - if (key.parameters.shouldCall(HOOKS_BEFORE_MINT_OFFSET, key.hooks)) { + if (key.parameters.shouldCall(HOOKS_BEFORE_MINT_OFFSET, hooks)) { bytes4 selector = hooks.beforeMint(msg.sender, key, params, hookData); if (key.parameters.isValidNoOpCall(HOOKS_NO_OP_OFFSET, selector)) { // Sentinel return value used to signify that a NoOp occurred. @@ -274,7 +274,7 @@ contract BinPoolManager is IBinPoolManager, Fees, Extsload { /// @notice Make sure the first event is noted, so that later events from afterHook won't get mixed up with this one emit Mint(id, msg.sender, mintArray.ids, mintArray.amounts, compositionFee, feeForProtocol); - if (key.parameters.shouldCall(HOOKS_AFTER_MINT_OFFSET, key.hooks)) { + if (key.parameters.shouldCall(HOOKS_AFTER_MINT_OFFSET, hooks)) { if (hooks.afterMint(msg.sender, key, params, delta, hookData) != IBinHooks.afterMint.selector) { revert Hooks.InvalidHookResponse(); } @@ -292,7 +292,7 @@ contract BinPoolManager is IBinPoolManager, Fees, Extsload { _checkPoolInitialized(id); IBinHooks hooks = IBinHooks(address(key.hooks)); - if (key.parameters.shouldCall(HOOKS_BEFORE_BURN_OFFSET, key.hooks)) { + if (key.parameters.shouldCall(HOOKS_BEFORE_BURN_OFFSET, hooks)) { bytes4 selector = hooks.beforeBurn(msg.sender, key, params, hookData); if (key.parameters.isValidNoOpCall(HOOKS_NO_OP_OFFSET, selector)) { // Sentinel return value used to signify that a NoOp occurred. @@ -312,7 +312,7 @@ contract BinPoolManager is IBinPoolManager, Fees, Extsload { /// @notice Make sure the first event is noted, so that later events from afterHook won't get mixed up with this one emit Burn(id, msg.sender, binIds, amountRemoved); - if (key.parameters.shouldCall(HOOKS_AFTER_BURN_OFFSET, key.hooks)) { + if (key.parameters.shouldCall(HOOKS_AFTER_BURN_OFFSET, hooks)) { if (hooks.afterBurn(msg.sender, key, params, delta, hookData) != IBinHooks.afterBurn.selector) { revert Hooks.InvalidHookResponse(); } @@ -330,7 +330,7 @@ contract BinPoolManager is IBinPoolManager, Fees, Extsload { _checkPoolInitialized(id); IBinHooks hooks = IBinHooks(address(key.hooks)); - if (key.parameters.shouldCall(HOOKS_BEFORE_DONATE_OFFSET, key.hooks)) { + if (key.parameters.shouldCall(HOOKS_BEFORE_DONATE_OFFSET, hooks)) { bytes4 selector = hooks.beforeDonate(msg.sender, key, amount0, amount1, hookData); if (key.parameters.isValidNoOpCall(HOOKS_NO_OP_OFFSET, selector)) { // Sentinel return value used to signify that a NoOp occurred. @@ -347,7 +347,7 @@ contract BinPoolManager is IBinPoolManager, Fees, Extsload { /// @notice Make sure the first event is noted, so that later events from afterHook won't get mixed up with this one emit Donate(id, msg.sender, delta.amount0(), delta.amount1(), binId); - if (key.parameters.shouldCall(HOOKS_AFTER_DONATE_OFFSET, key.hooks)) { + if (key.parameters.shouldCall(HOOKS_AFTER_DONATE_OFFSET, hooks)) { if (hooks.afterDonate(msg.sender, key, amount0, amount1, hookData) != IBinHooks.afterDonate.selector) { revert Hooks.InvalidHookResponse(); } diff --git a/src/pool-cl/CLPoolManager.sol b/src/pool-cl/CLPoolManager.sol index 13776cce..8b10a21d 100644 --- a/src/pool-cl/CLPoolManager.sol +++ b/src/pool-cl/CLPoolManager.sol @@ -101,7 +101,7 @@ contract CLPoolManager is ICLPoolManager, Fees, Extsload { uint24 swapFee = key.fee.getInitialSwapFee(); if (swapFee.isSwapFeeTooLarge(SwapFeeLibrary.ONE_HUNDRED_PERCENT_FEE)) revert FeeTooLarge(); - if (key.parameters.shouldCall(HOOKS_BEFORE_INITIALIZE_OFFSET, key.hooks)) { + if (key.parameters.shouldCall(HOOKS_BEFORE_INITIALIZE_OFFSET, hooks)) { if (hooks.beforeInitialize(msg.sender, key, sqrtPriceX96, hookData) != ICLHooks.beforeInitialize.selector) { revert Hooks.InvalidHookResponse(); } @@ -114,7 +114,7 @@ contract CLPoolManager is ICLPoolManager, Fees, Extsload { /// @notice Make sure the first event is noted, so that later events from afterHook won't get mixed up with this one emit Initialize(id, key.currency0, key.currency1, key.fee, tickSpacing, hooks); - if (key.parameters.shouldCall(HOOKS_AFTER_INITIALIZE_OFFSET, key.hooks)) { + if (key.parameters.shouldCall(HOOKS_AFTER_INITIALIZE_OFFSET, hooks)) { if ( hooks.afterInitialize(msg.sender, key, sqrtPriceX96, tick, hookData) != ICLHooks.afterInitialize.selector @@ -138,7 +138,7 @@ contract CLPoolManager is ICLPoolManager, Fees, Extsload { ICLHooks hooks = ICLHooks(address(key.hooks)); - if (params.liquidityDelta > 0 && key.parameters.shouldCall(HOOKS_BEFORE_ADD_LIQUIDITY_OFFSET, key.hooks)) { + if (params.liquidityDelta > 0 && key.parameters.shouldCall(HOOKS_BEFORE_ADD_LIQUIDITY_OFFSET, hooks)) { bytes4 selector = hooks.beforeAddLiquidity(msg.sender, key, params, hookData); if (key.parameters.isValidNoOpCall(HOOKS_NO_OP_OFFSET, selector)) { // Sentinel return value used to signify that a NoOp occurred. @@ -146,9 +146,8 @@ contract CLPoolManager is ICLPoolManager, Fees, Extsload { } else if (selector != ICLHooks.beforeAddLiquidity.selector) { revert Hooks.InvalidHookResponse(); } - } else if ( - params.liquidityDelta <= 0 && key.parameters.shouldCall(HOOKS_BEFORE_REMOVE_LIQUIDITY_OFFSET, key.hooks) - ) { + } else if (params.liquidityDelta <= 0 && key.parameters.shouldCall(HOOKS_BEFORE_REMOVE_LIQUIDITY_OFFSET, hooks)) + { bytes4 selector = hooks.beforeRemoveLiquidity(msg.sender, key, params, hookData); if (key.parameters.isValidNoOpCall(HOOKS_NO_OP_OFFSET, selector)) { // Sentinel return value used to signify that a NoOp occurred. @@ -173,15 +172,14 @@ contract CLPoolManager is ICLPoolManager, Fees, Extsload { /// @notice Make sure the first event is noted, so that later events from afterHook won't get mixed up with this one emit ModifyLiquidity(id, msg.sender, params.tickLower, params.tickUpper, params.liquidityDelta); - if (params.liquidityDelta > 0 && key.parameters.shouldCall(HOOKS_AFTER_ADD_LIQUIDITY_OFFSET, key.hooks)) { + if (params.liquidityDelta > 0 && key.parameters.shouldCall(HOOKS_AFTER_ADD_LIQUIDITY_OFFSET, hooks)) { if ( hooks.afterAddLiquidity(msg.sender, key, params, delta, hookData) != ICLHooks.afterAddLiquidity.selector ) { revert Hooks.InvalidHookResponse(); } - } else if ( - params.liquidityDelta <= 0 && key.parameters.shouldCall(HOOKS_AFTER_REMOVE_LIQUIDITY_OFFSET, key.hooks) - ) { + } else if (params.liquidityDelta <= 0 && key.parameters.shouldCall(HOOKS_AFTER_REMOVE_LIQUIDITY_OFFSET, hooks)) + { if ( hooks.afterRemoveLiquidity(msg.sender, key, params, delta, hookData) != ICLHooks.afterRemoveLiquidity.selector @@ -204,7 +202,7 @@ contract CLPoolManager is ICLPoolManager, Fees, Extsload { ICLHooks hooks = ICLHooks(address(key.hooks)); - if (key.parameters.shouldCall(HOOKS_BEFORE_SWAP_OFFSET, key.hooks)) { + if (key.parameters.shouldCall(HOOKS_BEFORE_SWAP_OFFSET, hooks)) { bytes4 selector = hooks.beforeSwap(msg.sender, key, params, hookData); if (key.parameters.isValidNoOpCall(HOOKS_NO_OP_OFFSET, selector)) { // Sentinel return value used to signify that a NoOp occurred. @@ -247,7 +245,7 @@ contract CLPoolManager is ICLPoolManager, Fees, Extsload { state.protocolFee ); - if (key.parameters.shouldCall(HOOKS_AFTER_SWAP_OFFSET, key.hooks)) { + if (key.parameters.shouldCall(HOOKS_AFTER_SWAP_OFFSET, hooks)) { if (hooks.afterSwap(msg.sender, key, params, delta, hookData) != ICLHooks.afterSwap.selector) { revert Hooks.InvalidHookResponse(); } @@ -266,7 +264,7 @@ contract CLPoolManager is ICLPoolManager, Fees, Extsload { _checkPoolInitialized(id); ICLHooks hooks = ICLHooks(address(key.hooks)); - if (key.parameters.shouldCall(HOOKS_BEFORE_DONATE_OFFSET, key.hooks)) { + if (key.parameters.shouldCall(HOOKS_BEFORE_DONATE_OFFSET, hooks)) { bytes4 selector = hooks.beforeDonate(msg.sender, key, amount0, amount1, hookData); if (key.parameters.isValidNoOpCall(HOOKS_NO_OP_OFFSET, selector)) { // Sentinel return value used to signify that a NoOp occurred. @@ -283,7 +281,7 @@ contract CLPoolManager is ICLPoolManager, Fees, Extsload { /// @notice Make sure the first event is noted, so that later events from afterHook won't get mixed up with this one emit Donate(id, msg.sender, amount0, amount1, tick); - if (key.parameters.shouldCall(HOOKS_AFTER_DONATE_OFFSET, key.hooks)) { + if (key.parameters.shouldCall(HOOKS_AFTER_DONATE_OFFSET, hooks)) { if (hooks.afterDonate(msg.sender, key, amount0, amount1, hookData) != ICLHooks.afterDonate.selector) { revert Hooks.InvalidHookResponse(); }