From f965551fb6da9727c7477320de7ffbf90a0d0281 Mon Sep 17 00:00:00 2001 From: Akshat Mittal Date: Wed, 19 Jun 2024 16:46:23 +0530 Subject: [PATCH 1/3] Namespace Hook Deployments --- .vscode/settings.json | 3 +++ test/Counter.t.sol | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5b3ca6c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "solidity.formatter": "forge" +} diff --git a/test/Counter.t.sol b/test/Counter.t.sol index 75e28d5..d7e9427 100644 --- a/test/Counter.t.sol +++ b/test/Counter.t.sol @@ -18,7 +18,7 @@ import {StateLibrary} from "v4-core/src/libraries/StateLibrary.sol"; contract CounterTest is Test, Deployers { using PoolIdLibrary for PoolKey; using CurrencyLibrary for Currency; - using StateLibrary for State; + using StateLibrary for IPoolManager; Counter hook; PoolId poolId; @@ -33,7 +33,7 @@ contract CounterTest is Test, Deployers { uint160( Hooks.BEFORE_SWAP_FLAG | Hooks.AFTER_SWAP_FLAG | Hooks.BEFORE_ADD_LIQUIDITY_FLAG | Hooks.BEFORE_REMOVE_LIQUIDITY_FLAG - ) + ) ^ (0x7634 << 144) ); deployCodeTo("Counter.sol:Counter", abi.encode(manager), flags); hook = Counter(flags); @@ -79,7 +79,11 @@ contract CounterTest is Test, Deployers { // remove liquidity int256 liquidityDelta = -1e18; modifyLiquidityRouter.modifyLiquidity( - key, IPoolManager.ModifyLiquidityParams(TickMath.minUsableTick(60), TickMath.maxUsableTick(60), liquidityDelta, 0), ZERO_BYTES + key, + IPoolManager.ModifyLiquidityParams( + TickMath.minUsableTick(60), TickMath.maxUsableTick(60), liquidityDelta, 0 + ), + ZERO_BYTES ); assertEq(hook.beforeAddLiquidityCount(poolId), 1); From 09e1c8e42ff073250a68fa3d4e971869a175fb2d Mon Sep 17 00:00:00 2001 From: Akshat Mittal Date: Wed, 19 Jun 2024 16:47:12 +0530 Subject: [PATCH 2/3] Remove Settings --- .vscode/settings.json | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 5b3ca6c..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "solidity.formatter": "forge" -} From 9a9e836f7ca30e6a88bbe5e128ca7735714e476a Mon Sep 17 00:00:00 2001 From: Akshat Mittal Date: Fri, 21 Jun 2024 00:24:02 +0530 Subject: [PATCH 3/3] Update namespace --- test/Counter.t.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Counter.t.sol b/test/Counter.t.sol index d7e9427..1bfb8b9 100644 --- a/test/Counter.t.sol +++ b/test/Counter.t.sol @@ -33,7 +33,7 @@ contract CounterTest is Test, Deployers { uint160( Hooks.BEFORE_SWAP_FLAG | Hooks.AFTER_SWAP_FLAG | Hooks.BEFORE_ADD_LIQUIDITY_FLAG | Hooks.BEFORE_REMOVE_LIQUIDITY_FLAG - ) ^ (0x7634 << 144) + ) ^ (0x4444 << 144) // Namespace the hook to avoid collisions ); deployCodeTo("Counter.sol:Counter", abi.encode(manager), flags); hook = Counter(flags);