diff --git a/forge-test/Counter.sol b/forge-test/Counter.sol index a0578e6d..99854259 100644 --- a/forge-test/Counter.sol +++ b/forge-test/Counter.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.19; // TODO: update to v4-periphery/BaseHook.sol when its compatible -import {BaseHook} from "./forks/BaseHook.sol"; +import {BaseHook} from "@v4-by-example/utils/BaseHook.sol"; import {Hooks} from "v4-core/libraries/Hooks.sol"; import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol"; diff --git a/forge-test/Counter.t.sol b/forge-test/Counter.t.sol index 14d0d19f..71a79dcf 100644 --- a/forge-test/Counter.t.sol +++ b/forge-test/Counter.t.sol @@ -12,7 +12,7 @@ import {PoolId, PoolIdLibrary} from "v4-core/types/PoolId.sol"; import {Constants} from "v4-core/../test/utils/Constants.sol"; import {CurrencyLibrary, Currency} from "v4-core/types/Currency.sol"; import {HookTest} from "./utils/HookTest.sol"; -import {Counter} from "../src/Counter.sol"; +import {Counter} from "./Counter.sol"; import {HookMiner} from "./utils/HookMiner.sol"; contract CounterTest is HookTest { diff --git a/forge-test/FixedHookFee.t.sol b/forge-test/FixedHookFee.t.sol index f1b55d51..9a7cefd7 100644 --- a/forge-test/FixedHookFee.t.sol +++ b/forge-test/FixedHookFee.t.sol @@ -11,9 +11,9 @@ import {BalanceDelta} from "v4-core/types/BalanceDelta.sol"; import {PoolId, PoolIdLibrary} from "v4-core/types/PoolId.sol"; import {Constants} from "v4-core/../test/utils/Constants.sol"; import {CurrencyLibrary, Currency} from "v4-core/types/Currency.sol"; -import {HookTest} from "../utils/HookTest.sol"; -import {FixedHookFee} from "../../src/examples/FixedHookFee.sol"; -import {HookMiner} from "../utils/HookMiner.sol"; +import {HookTest} from "./utils/HookTest.sol"; +import {FixedHookFee} from "@v4-by-example/pages/fees/fixed-hook-fee/FixedHookFee.sol"; +import {HookMiner} from "./utils/HookMiner.sol"; contract FixedHookFeeTest is HookTest { using PoolIdLibrary for PoolKey; diff --git a/forge-test/NoOpSwap.t.sol b/forge-test/NoOpSwap.t.sol index f7a03d8e..51ab3c6a 100644 --- a/forge-test/NoOpSwap.t.sol +++ b/forge-test/NoOpSwap.t.sol @@ -12,7 +12,7 @@ import {PoolId, PoolIdLibrary} from "v4-core/types/PoolId.sol"; import {Constants} from "v4-core/../test/utils/Constants.sol"; import {CurrencyLibrary, Currency} from "v4-core/types/Currency.sol"; import {HookTest} from "./utils/HookTest.sol"; -import {NoOpSwap} from "../src/pages/hooks/no-op/NoOpSwap.sol"; +import {NoOpSwap} from "@v4-by-example/pages/hooks/no-op/NoOpSwap.sol"; import {HookMiner} from "./utils/HookMiner.sol"; contract NoOpSwapTest is HookTest { @@ -28,7 +28,7 @@ contract NoOpSwapTest is HookTest { HookTest.initHookTestEnv(); // Deploy the hook to an address with the correct flags - uint160 flags = uint160(Hooks.BEFORE_SWAP_FLAG | Hooks.AFTER_SWAP_FLAG | Hooks.NO_OP_FLAG); + uint160 flags = uint160(Hooks.BEFORE_SWAP_FLAG | Hooks.NO_OP_FLAG); (address hookAddress, bytes32 salt) = HookMiner.find(address(this), flags, type(NoOpSwap).creationCode, abi.encode(address(manager))); hook = new NoOpSwap{salt: salt}(IPoolManager(address(manager))); diff --git a/forge-test/utils/HookTest.sol b/forge-test/utils/HookTest.sol index c913caf6..18eb9f20 100644 --- a/forge-test/utils/HookTest.sol +++ b/forge-test/utils/HookTest.sol @@ -72,7 +72,7 @@ contract HookTest is Test { }); PoolSwapTest.TestSettings memory testSettings = - PoolSwapTest.TestSettings({withdrawTokens: true, settleUsingTransfer: true}); + PoolSwapTest.TestSettings({withdrawTokens: true, settleUsingTransfer: true, currencyAlreadySent: false}); swapDelta = swapRouter.swap(key, params, testSettings, hookData); } diff --git a/foundry.toml b/foundry.toml index 86b18269..794232dd 100644 --- a/foundry.toml +++ b/foundry.toml @@ -2,6 +2,7 @@ src = "src/pages" out = "out" libs = ["forge-lib"] +test = "forge-test" ffi = true fs_permissions = [{ access = "read-write", path = ".forge-snapshots/"}] cancun = true diff --git a/remappings.txt b/remappings.txt index 0a26ed51..af123e3c 100644 --- a/remappings.txt +++ b/remappings.txt @@ -1,4 +1,4 @@ -@v4-by-example=src/solidity-utils +@v4-by-example/=src/ @ensdomains/=forge-lib/v4-core/node_modules/@ensdomains/ @openzeppelin/=forge-lib/v4-core/lib/openzeppelin-contracts/ ds-test/=forge-lib/v4-core/lib/forge-std/lib/ds-test/src/ diff --git a/src/pages/fees/fixed-hook-fee/FixedHookFee.sol b/src/pages/fees/fixed-hook-fee/FixedHookFee.sol index c1971de0..fa601f90 100644 --- a/src/pages/fees/fixed-hook-fee/FixedHookFee.sol +++ b/src/pages/fees/fixed-hook-fee/FixedHookFee.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.19; // TODO: update to v4-periphery/BaseHook.sol when its compatible -import {BaseHook} from "@v4-by-example/BaseHook.sol"; +import {BaseHook} from "@v4-by-example/utils/BaseHook.sol"; import {Hooks} from "v4-core/libraries/Hooks.sol"; import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol"; diff --git a/src/pages/hooks/no-op/NoOpSwap.sol b/src/pages/hooks/no-op/NoOpSwap.sol index 1523a6af..ecba41b0 100644 --- a/src/pages/hooks/no-op/NoOpSwap.sol +++ b/src/pages/hooks/no-op/NoOpSwap.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; -import {BaseHook} from "@v4-by-example/BaseHook.sol"; +import {BaseHook} from "@v4-by-example/utils/BaseHook.sol"; import {Hooks} from "v4-core/libraries/Hooks.sol"; import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol"; diff --git a/src/solidity-utils/BaseHook.sol b/src/utils/BaseHook.sol similarity index 100% rename from src/solidity-utils/BaseHook.sol rename to src/utils/BaseHook.sol