From 15d698cb37745088b68e11ddf9ea47fa8ab326e4 Mon Sep 17 00:00:00 2001 From: saucepoint Date: Sun, 24 Mar 2024 11:34:42 -0400 Subject: [PATCH 1/2] forge install: v4-periphery --- .gitmodules | 3 +++ forge-lib/v4-periphery | 1 + 2 files changed, 4 insertions(+) create mode 160000 forge-lib/v4-periphery diff --git a/.gitmodules b/.gitmodules index 68a65278..340530b2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "forge-lib/v4-core"] path = forge-lib/v4-core url = https://github.com/uniswap/v4-core +[submodule "forge-lib/v4-periphery"] + path = forge-lib/v4-periphery + url = https://github.com/uniswap/v4-periphery diff --git a/forge-lib/v4-periphery b/forge-lib/v4-periphery new file mode 160000 index 00000000..6616b12d --- /dev/null +++ b/forge-lib/v4-periphery @@ -0,0 +1 @@ +Subproject commit 6616b12db25257ffb3c562f131612ebb2fd89082 From 8f2f8080b8cfa48b32de5172307b655806fab9c5 Mon Sep 17 00:00:00 2001 From: saucepoint Date: Mon, 25 Mar 2024 09:50:51 -0400 Subject: [PATCH 2/2] wip --- .gitmodules | 6 ------ remappings.txt | 3 ++- src/pages/quoter/Quoter.sol | 10 +++++----- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.gitmodules b/.gitmodules index 340530b2..44cc2bb5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,3 @@ -[submodule "contracts/lib/v4-core"] - path = contracts/lib/v4-core - url = https://github.com/uniswap/v4-core -[submodule "contracts/lib/v4-periphery"] - path = contracts/lib/v4-periphery - url = https://github.com/uniswap/v4-periphery [submodule "forge-lib/v4-core"] path = forge-lib/v4-core url = https://github.com/uniswap/v4-core diff --git a/remappings.txt b/remappings.txt index 13ba5e09..2090bd55 100644 --- a/remappings.txt +++ b/remappings.txt @@ -7,4 +7,5 @@ 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/ \ No newline at end of file +v4-core/=forge-lib/v4-core/ +forge-lib/v4-periphery:@uniswap/v4-core/=forge-lib/v4-core/ \ No newline at end of file diff --git a/src/pages/quoter/Quoter.sol b/src/pages/quoter/Quoter.sol index 2b908b1e..44766d6a 100644 --- a/src/pages/quoter/Quoter.sol +++ b/src/pages/quoter/Quoter.sol @@ -9,9 +9,9 @@ import {IPoolManager} from "v4-core/src/interfaces/IPoolManager.sol"; import {PoolKey} from "v4-core/src/types/PoolKey.sol"; import {BalanceDelta} from "v4-core/src/types/BalanceDelta.sol"; import {PoolId, PoolIdLibrary} from "v4-core/src/types/PoolId.sol"; -import {Constants} from "v4-core/src/../test/utils/Constants.sol"; +import {Constants} from "v4-core/test/utils/Constants.sol"; import {CurrencyLibrary, Currency} from "v4-core/src/types/Currency.sol"; -import {Deployers} from "v4-core/src/../test/utils/Deployers.sol"; +import {Deployers} from "v4-core/test/utils/Deployers.sol"; import {IQuoter} from "v4-periphery/interfaces/IQuoter.sol"; import {Quoter} from "v4-periphery/lens/Quoter.sol"; @@ -58,7 +58,7 @@ contract QuoterTest is Test, Deployers { console2.log("Quoted output amount: ", int256(outputAmount)); // Perform a test swap - BalanceDelta swapDelta = swap(poolKey, int256(uint256(amountIn)), zeroForOne, ZERO_BYTES); + BalanceDelta swapDelta = swap(poolKey, zeroForOne, int256(uint256(amountIn)), ZERO_BYTES); // quote agrees with the actual swap assertEq(outputAmount, swapDelta.amount1()); @@ -80,9 +80,9 @@ contract QuoterTest is Test, Deployers { console2.log("Quoted input amount: ", int256(inputAmount)); // Perform a exact-output swap - BalanceDelta swapDelta = swap(poolKey, -int256(uint256(amountOut)), zeroForOne, ZERO_BYTES); + BalanceDelta swapDelta = swap(poolKey, zeroForOne, -int256(uint256(amountOut)), ZERO_BYTES); assertEq(inputAmount, swapDelta.amount0()); - (uint160 sqrtPriceX96,,) = manager.getSlot0(poolId); + (uint160 sqrtPriceX96,,,) = manager.getSlot0(poolId); assertEq(sqrtPriceX96After, sqrtPriceX96); } }