diff --git a/forge-test/Counter.sol b/forge-test/Counter.sol index 532c5183..a0578e6d 100644 --- a/forge-test/Counter.sol +++ b/forge-test/Counter.sol @@ -4,11 +4,11 @@ pragma solidity ^0.8.19; // TODO: update to v4-periphery/BaseHook.sol when its compatible import {BaseHook} from "./forks/BaseHook.sol"; -import {Hooks} from "@uniswap/v4-core/contracts/libraries/Hooks.sol"; -import {IPoolManager} from "@uniswap/v4-core/contracts/interfaces/IPoolManager.sol"; -import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/contracts/types/PoolId.sol"; -import {BalanceDelta} from "@uniswap/v4-core/contracts/types/BalanceDelta.sol"; +import {Hooks} from "v4-core/libraries/Hooks.sol"; +import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol"; +import {PoolKey} from "v4-core/types/PoolKey.sol"; +import {PoolId, PoolIdLibrary} from "v4-core/types/PoolId.sol"; +import {BalanceDelta} from "v4-core/types/BalanceDelta.sol"; contract Counter is BaseHook { using PoolIdLibrary for PoolKey; diff --git a/forge-test/Counter.t.sol b/forge-test/Counter.t.sol index b75ea3f6..14d0d19f 100644 --- a/forge-test/Counter.t.sol +++ b/forge-test/Counter.t.sol @@ -2,15 +2,15 @@ pragma solidity ^0.8.19; import "forge-std/Test.sol"; -import {IHooks} from "@uniswap/v4-core/contracts/interfaces/IHooks.sol"; -import {Hooks} from "@uniswap/v4-core/contracts/libraries/Hooks.sol"; -import {TickMath} from "@uniswap/v4-core/contracts/libraries/TickMath.sol"; -import {IPoolManager} from "@uniswap/v4-core/contracts/interfaces/IPoolManager.sol"; -import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol"; -import {BalanceDelta} from "@uniswap/v4-core/contracts/types/BalanceDelta.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/contracts/types/PoolId.sol"; -import {Constants} from "@uniswap/v4-core/contracts/../test/utils/Constants.sol"; -import {CurrencyLibrary, Currency} from "@uniswap/v4-core/contracts/types/Currency.sol"; +import {IHooks} from "v4-core/interfaces/IHooks.sol"; +import {Hooks} from "v4-core/libraries/Hooks.sol"; +import {TickMath} from "v4-core/libraries/TickMath.sol"; +import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol"; +import {PoolKey} from "v4-core/types/PoolKey.sol"; +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 {Counter} from "../src/Counter.sol"; import {HookMiner} from "./utils/HookMiner.sol"; diff --git a/forge-test/FixedHookFee.t.sol b/forge-test/FixedHookFee.t.sol index 1d3a3bf1..f1b55d51 100644 --- a/forge-test/FixedHookFee.t.sol +++ b/forge-test/FixedHookFee.t.sol @@ -2,15 +2,15 @@ pragma solidity ^0.8.19; import "forge-std/Test.sol"; -import {IHooks} from "@uniswap/v4-core/contracts/interfaces/IHooks.sol"; -import {Hooks} from "@uniswap/v4-core/contracts/libraries/Hooks.sol"; -import {TickMath} from "@uniswap/v4-core/contracts/libraries/TickMath.sol"; -import {IPoolManager} from "@uniswap/v4-core/contracts/interfaces/IPoolManager.sol"; -import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol"; -import {BalanceDelta} from "@uniswap/v4-core/contracts/types/BalanceDelta.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/contracts/types/PoolId.sol"; -import {Constants} from "@uniswap/v4-core/contracts/../test/utils/Constants.sol"; -import {CurrencyLibrary, Currency} from "@uniswap/v4-core/contracts/types/Currency.sol"; +import {IHooks} from "v4-core/interfaces/IHooks.sol"; +import {Hooks} from "v4-core/libraries/Hooks.sol"; +import {TickMath} from "v4-core/libraries/TickMath.sol"; +import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol"; +import {PoolKey} from "v4-core/types/PoolKey.sol"; +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"; diff --git a/forge-test/NoOpSwap.t.sol b/forge-test/NoOpSwap.t.sol index 2b27e94d..f7a03d8e 100644 --- a/forge-test/NoOpSwap.t.sol +++ b/forge-test/NoOpSwap.t.sol @@ -2,15 +2,15 @@ pragma solidity ^0.8.19; import "forge-std/Test.sol"; -import {IHooks} from "@uniswap/v4-core/contracts/interfaces/IHooks.sol"; -import {Hooks} from "@uniswap/v4-core/contracts/libraries/Hooks.sol"; -import {TickMath} from "@uniswap/v4-core/contracts/libraries/TickMath.sol"; -import {IPoolManager} from "@uniswap/v4-core/contracts/interfaces/IPoolManager.sol"; -import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol"; -import {BalanceDelta} from "@uniswap/v4-core/contracts/types/BalanceDelta.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/contracts/types/PoolId.sol"; -import {Constants} from "@uniswap/v4-core/contracts/../test/utils/Constants.sol"; -import {CurrencyLibrary, Currency} from "@uniswap/v4-core/contracts/types/Currency.sol"; +import {IHooks} from "v4-core/interfaces/IHooks.sol"; +import {Hooks} from "v4-core/libraries/Hooks.sol"; +import {TickMath} from "v4-core/libraries/TickMath.sol"; +import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol"; +import {PoolKey} from "v4-core/types/PoolKey.sol"; +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 {NoOpSwap} from "../src/pages/hooks/no-op/NoOpSwap.sol"; import {HookMiner} from "./utils/HookMiner.sol"; diff --git a/forge-test/utils/HookTest.sol b/forge-test/utils/HookTest.sol index 81eb61b4..c913caf6 100644 --- a/forge-test/utils/HookTest.sol +++ b/forge-test/utils/HookTest.sol @@ -3,17 +3,17 @@ pragma solidity ^0.8.19; import "forge-std/Test.sol"; -import {PoolManager} from "@uniswap/v4-core/contracts/PoolManager.sol"; -import {IPoolManager} from "@uniswap/v4-core/contracts/interfaces/IPoolManager.sol"; -import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol"; -import {BalanceDelta} from "@uniswap/v4-core/contracts/types/BalanceDelta.sol"; -import {PoolInitializeTest} from "@uniswap/v4-core/contracts/test/PoolInitializeTest.sol"; -import {PoolModifyPositionTest} from "@uniswap/v4-core/contracts/test/PoolModifyPositionTest.sol"; -import {PoolSwapTest} from "@uniswap/v4-core/contracts/test/PoolSwapTest.sol"; -import {PoolDonateTest} from "@uniswap/v4-core/contracts/test/PoolDonateTest.sol"; +import {PoolManager} from "v4-core/PoolManager.sol"; +import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol"; +import {PoolKey} from "v4-core/types/PoolKey.sol"; +import {BalanceDelta} from "v4-core/types/BalanceDelta.sol"; +import {PoolInitializeTest} from "v4-core/test/PoolInitializeTest.sol"; +import {PoolModifyPositionTest} from "v4-core/test/PoolModifyPositionTest.sol"; +import {PoolSwapTest} from "v4-core/test/PoolSwapTest.sol"; +import {PoolDonateTest} from "v4-core/test/PoolDonateTest.sol"; -import {TestERC20} from "@uniswap/v4-core/contracts/test/TestERC20.sol"; -import {TickMath} from "@uniswap/v4-core/contracts/libraries/TickMath.sol"; +import {TestERC20} from "v4-core/test/TestERC20.sol"; +import {TickMath} from "v4-core/libraries/TickMath.sol"; /// @notice Contract to initialize some test helpers /// @dev Minimal initialization. Inheriting contract should set up pools and provision liquidity diff --git a/remappings.txt b/remappings.txt index 99977d03..0a26ed51 100644 --- a/remappings.txt +++ b/remappings.txt @@ -1,17 +1,10 @@ -@v4-by-example/=contracts/src/ -@openzeppelin/contracts/=contracts/lib/v4-periphery/lib/openzeppelin-contracts/contracts/ -@uniswap/v4-core/contracts/=contracts/lib/v4-core/src/ -ds-test/=contracts/lib/forge-std/lib/ds-test/src/ -forge-gas-snapshot/=contracts/lib/v4-periphery/lib/forge-gas-snapshot/src/ -forge-std/=contracts/lib/forge-std/src/ -openzeppelin-contracts/=contracts/lib/v4-periphery/lib/openzeppelin-contracts/ -solmate/=contracts/lib/v4-core/lib/solmate/src/ -v4-periphery/=contracts/lib/v4-periphery/contracts/ -lib/forge-std:ds-test/=contracts/lib/forge-std/lib/ds-test/src/ -lib/v4-periphery:@openzeppelin/contracts/=contracts/lib/v4-periphery/lib/openzeppelin-contracts/contracts/ -lib/v4-periphery:@uniswap/v4-core/contracts/=contracts/lib/v4-core/src/ -lib/v4-periphery:ds-test/=contracts/lib/v4-periphery/lib/forge-std/lib/ds-test/src/ -lib/v4-periphery:forge-gas-snapshot/=contracts/lib/v4-periphery/lib/forge-gas-snapshot/src/ -lib/v4-periphery:forge-std/=contracts/lib/forge-std/src/ -lib/v4-periphery:openzeppelin-contracts/=contracts/lib/v4-periphery/lib/openzeppelin-contracts/ -lib/v4-periphery:solmate/=contracts/lib/v4-core/lib/solmate/src/ +@v4-by-example=src/solidity-utils +@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/ +forge-gas-snapshot/=forge-lib/v4-core/lib/forge-gas-snapshot/src/ +forge-std/=forge-lib/v4-core/lib/forge-std/src/ +hardhat/=forge-lib/v4-core/node_modules/hardhat/ +openzeppelin-contracts/=forge-lib/v4-core/lib/openzeppelin-contracts/contracts/ +solmate/=forge-lib/v4-core/lib/solmate/src/ +v4-core/=forge-lib/v4-core/src/ diff --git a/src/pages/create-liquidity/CreateLiquidity.sol b/src/pages/create-liquidity/CreateLiquidity.sol index 8648eaa4..1b88a6d4 100644 --- a/src/pages/create-liquidity/CreateLiquidity.sol +++ b/src/pages/create-liquidity/CreateLiquidity.sol @@ -1,13 +1,13 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; -import {IPoolManager} from "@uniswap/v4-core/contracts/interfaces/IPoolManager.sol"; -import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol"; -import {PoolModifyPositionTest} from "@uniswap/v4-core/contracts/test/PoolModifyPositionTest.sol"; +import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol"; +import {PoolKey} from "v4-core/types/PoolKey.sol"; +import {PoolModifyPositionTest} from "v4-core/test/PoolModifyPositionTest.sol"; contract CreateLiquidity { // set the router address - PoolModifyPositionTest lpRouter = PoolModifyPositionTest(0x01); + PoolModifyPositionTest lpRouter = PoolModifyPositionTest(address(0x01)); function createLiquidity( PoolKey memory poolKey, diff --git a/src/pages/create-liquidity/CreateLiquidityExampleInputs.solsnippet b/src/pages/create-liquidity/CreateLiquidityExampleInputs.solsnippet index 3366c871..3827c144 100644 --- a/src/pages/create-liquidity/CreateLiquidityExampleInputs.solsnippet +++ b/src/pages/create-liquidity/CreateLiquidityExampleInputs.solsnippet @@ -1,4 +1,4 @@ -import {PoolModifyPositionTest} from "@uniswap/v4-core/contracts/test/PoolModifyPositionTest.sol"; +import {PoolModifyPositionTest} from "v4-core/test/PoolModifyPositionTest.sol"; PoolModifyPositionTest lpRouter = PoolModifyPositionTest(0x01); address token0 = address(0x11); diff --git a/src/pages/fees/fixed-hook-fee/EnableAccessLock.solsnippet b/src/pages/fees/fixed-hook-fee/EnableAccessLock.solsnippet index 60489d7a..02f265b1 100644 --- a/src/pages/fees/fixed-hook-fee/EnableAccessLock.solsnippet +++ b/src/pages/fees/fixed-hook-fee/EnableAccessLock.solsnippet @@ -1,4 +1,4 @@ -import {Hooks} from "@uniswap/v4-core/contracts/libraries/Hooks.sol"; +import {Hooks} from "v4-core/libraries/Hooks.sol"; function getHookPermissions() public pure override returns (Hooks.Permissions memory) { return Hooks.Permissions({ diff --git a/src/pages/fees/fixed-hook-fee/FixedHookFee.sol b/src/pages/fees/fixed-hook-fee/FixedHookFee.sol index 10d298d2..c1971de0 100644 --- a/src/pages/fees/fixed-hook-fee/FixedHookFee.sol +++ b/src/pages/fees/fixed-hook-fee/FixedHookFee.sol @@ -2,14 +2,14 @@ pragma solidity ^0.8.19; // TODO: update to v4-periphery/BaseHook.sol when its compatible -import {BaseHook} from "@v4-by-example/forks/BaseHook.sol"; +import {BaseHook} from "@v4-by-example/BaseHook.sol"; -import {Hooks} from "@uniswap/v4-core/contracts/libraries/Hooks.sol"; -import {IPoolManager} from "@uniswap/v4-core/contracts/interfaces/IPoolManager.sol"; -import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/contracts/types/PoolId.sol"; -import {BalanceDelta} from "@uniswap/v4-core/contracts/types/BalanceDelta.sol"; -import {Currency, CurrencyLibrary} from "@uniswap/v4-core/contracts/types/Currency.sol"; +import {Hooks} from "v4-core/libraries/Hooks.sol"; +import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol"; +import {PoolKey} from "v4-core/types/PoolKey.sol"; +import {PoolId, PoolIdLibrary} from "v4-core/types/PoolId.sol"; +import {BalanceDelta} from "v4-core/types/BalanceDelta.sol"; +import {Currency, CurrencyLibrary} from "v4-core/types/Currency.sol"; contract FixedHookFee is BaseHook { using PoolIdLibrary for PoolKey; @@ -49,7 +49,9 @@ contract FixedHookFee is BaseHook { /// @dev Hook fees are kept as PoolManager claims, so collecting ERC20s will require locking function collectFee(address recipient, Currency currency) external returns (uint256 amount) { - amount = abi.decode(poolManager.lock(abi.encodeCall(this.handleCollectFee, (recipient, currency))), (uint256)); + amount = abi.decode( + poolManager.lock(address(this), abi.encodeCall(this.handleCollectFee, (recipient, currency))), (uint256) + ); } /// @dev requires the lock pattern in order to call poolManager.burn diff --git a/src/pages/hooks/no-op/EnableNoOp.solsnippet b/src/pages/hooks/no-op/EnableNoOp.solsnippet index b8643569..b7d12959 100644 --- a/src/pages/hooks/no-op/EnableNoOp.solsnippet +++ b/src/pages/hooks/no-op/EnableNoOp.solsnippet @@ -1,4 +1,4 @@ -import {Hooks} from "@uniswap/v4-core/contracts/libraries/Hooks.sol"; +import {Hooks} from "v4-core/libraries/Hooks.sol"; function getHooksCalls() public pure override returns (Hooks.Calls memory) { return Hooks.Calls({ diff --git a/src/pages/hooks/no-op/NoOpSwap.sol b/src/pages/hooks/no-op/NoOpSwap.sol index 62057fd6..1523a6af 100644 --- a/src/pages/hooks/no-op/NoOpSwap.sol +++ b/src/pages/hooks/no-op/NoOpSwap.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; -import {BaseHook} from "v4-periphery/BaseHook.sol"; +import {BaseHook} from "@v4-by-example/BaseHook.sol"; -import {Hooks} from "@uniswap/v4-core/contracts/libraries/Hooks.sol"; -import {IPoolManager} from "@uniswap/v4-core/contracts/interfaces/IPoolManager.sol"; -import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/contracts/types/PoolId.sol"; +import {Hooks} from "v4-core/libraries/Hooks.sol"; +import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol"; +import {PoolKey} from "v4-core/types/PoolKey.sol"; +import {PoolId, PoolIdLibrary} from "v4-core/types/PoolId.sol"; contract NoOpSwap is BaseHook { using PoolIdLibrary for PoolKey; @@ -26,7 +26,8 @@ contract NoOpSwap is BaseHook { afterSwap: false, beforeDonate: false, afterDonate: false, - noOp: true // -- ENABLE NO-OP -- // + noOp: true, // -- ENABLE NO-OP -- // + accessLock: false }); } diff --git a/src/pages/initialize/PoolInitialize.sol b/src/pages/initialize/PoolInitialize.sol index 6250ea1b..14531684 100644 --- a/src/pages/initialize/PoolInitialize.sol +++ b/src/pages/initialize/PoolInitialize.sol @@ -1,17 +1,17 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; -import {IPoolManager} from "@uniswap/v4-core/contracts/interfaces/IPoolManager.sol"; -import {PoolInitializeTest} from "@uniswap/v4-core/contracts/test/PoolInitializeTest.sol"; -import {IHooks} from "@uniswap/v4-core/contracts/interfaces/IHooks.sol"; -import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol"; -import {CurrencyLibrary, Currency} from "@uniswap/v4-core/contracts/types/Currency.sol"; +import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol"; +import {PoolInitializeTest} from "v4-core/test/PoolInitializeTest.sol"; +import {IHooks} from "v4-core/interfaces/IHooks.sol"; +import {PoolKey} from "v4-core/types/PoolKey.sol"; +import {CurrencyLibrary, Currency} from "v4-core/types/Currency.sol"; contract PoolInitialize { using CurrencyLibrary for Currency; // set the initialize router - PoolInitializeTest initializeRouter = PoolInitializeTest(0x02); + PoolInitializeTest initializeRouter = PoolInitializeTest(address(0x02)); function init( address token0, diff --git a/src/pages/swap/Swap.sol b/src/pages/swap/Swap.sol index d5be89f1..53a12541 100644 --- a/src/pages/swap/Swap.sol +++ b/src/pages/swap/Swap.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; -import {IPoolManager} from "@uniswap/v4-core/contracts/interfaces/IPoolManager.sol"; -import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol"; -import {PoolSwapTest} from "@uniswap/v4-core/contracts/test/PoolSwapTest.sol"; -import {TickMath} from "@uniswap/v4-core/contracts/libraries/TickMath.sol"; +import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol"; +import {PoolKey} from "v4-core/types/PoolKey.sol"; +import {PoolSwapTest} from "v4-core/test/PoolSwapTest.sol"; +import {TickMath} from "v4-core/libraries/TickMath.sol"; contract Swap { // set the router address - PoolSwapTest swapRouter = PoolSwapTest(0x01); + PoolSwapTest swapRouter = PoolSwapTest(address(0x01)); // slippage tolerance to allow for unlimited price impact uint160 public constant MIN_PRICE_LIMIT = TickMath.MIN_SQRT_RATIO + 1; @@ -29,7 +29,7 @@ contract Swap { // in v4, users have the option to receieve native ERC20s or wrapped ERC1155 tokens // here, we'll take the ERC20s PoolSwapTest.TestSettings memory testSettings = - PoolSwapTest.TestSettings({withdrawTokens: true, settleUsingTransfer: true}); + PoolSwapTest.TestSettings({withdrawTokens: true, settleUsingTransfer: true, currencyAlreadySent: false}); swapRouter.swap(key, params, testSettings, hookData); } diff --git a/src/solidity-utils/BaseHook.sol b/src/solidity-utils/BaseHook.sol index 5ef2fce9..023b928b 100644 --- a/src/solidity-utils/BaseHook.sol +++ b/src/solidity-utils/BaseHook.sol @@ -7,11 +7,11 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.19; -import {Hooks} from "@uniswap/v4-core/contracts/libraries/Hooks.sol"; -import {IPoolManager} from "@uniswap/v4-core/contracts/interfaces/IPoolManager.sol"; -import {IHooks} from "@uniswap/v4-core/contracts/interfaces/IHooks.sol"; -import {BalanceDelta} from "@uniswap/v4-core/contracts/types/BalanceDelta.sol"; -import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol"; +import {Hooks} from "v4-core/libraries/Hooks.sol"; +import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol"; +import {IHooks} from "v4-core/interfaces/IHooks.sol"; +import {BalanceDelta} from "v4-core/types/BalanceDelta.sol"; +import {PoolKey} from "v4-core/types/PoolKey.sol"; abstract contract BaseHook is IHooks { error NotPoolManager(); @@ -55,7 +55,7 @@ abstract contract BaseHook is IHooks { Hooks.validateHookPermissions(_this, getHookPermissions()); } - function lockAcquired(bytes calldata data) external virtual poolManagerOnly returns (bytes memory) { + function lockAcquired(address, bytes calldata data) external virtual poolManagerOnly returns (bytes memory) { (bool success, bytes memory returnData) = address(this).call(data); if (success) return returnData; if (returnData.length == 0) revert LockFailure();