Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespace Hook Deployments #30

Merged
merged 3 commits into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions test/Counter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
)
) ^ (0x4444 << 144) // Namespace the hook to avoid collisions
);
deployCodeTo("Counter.sol:Counter", abi.encode(manager), flags);
hook = Counter(flags);
Expand Down Expand Up @@ -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);
Expand Down