From 087a262e3cfdc0989cdb0b2a4194c340ec0ac063 Mon Sep 17 00:00:00 2001 From: Alice <34962750+hensha256@users.noreply.github.com> Date: Wed, 17 Jul 2024 21:33:17 +0100 Subject: [PATCH] Update core in periphery (#156) Co-authored-by: Sara Reynolds <30504811+snreynolds@users.noreply.github.com> --- .../FullRangeAddInitialLiquidity.snap | 2 +- .forge-snapshots/FullRangeAddLiquidity.snap | 2 +- .forge-snapshots/FullRangeFirstSwap.snap | 2 +- .forge-snapshots/FullRangeInitialize.snap | 2 +- .../FullRangeRemoveLiquidity.snap | 2 +- .../FullRangeRemoveLiquidityAndRebalance.snap | 2 +- .forge-snapshots/FullRangeSecondSwap.snap | 2 +- .forge-snapshots/FullRangeSwap.snap | 2 +- .forge-snapshots/TWAMMSubmitOrder.snap | 2 +- foundry.toml | 2 +- lib/forge-gas-snapshot | 2 +- lib/forge-std | 2 +- lib/v4-core | 2 +- test/FullRange.t.sol | 18 +++++++++++---- test/GeomeanOracle.t.sol | 22 ++++++++++++++++--- 15 files changed, 46 insertions(+), 20 deletions(-) diff --git a/.forge-snapshots/FullRangeAddInitialLiquidity.snap b/.forge-snapshots/FullRangeAddInitialLiquidity.snap index 404cf12a..59e98b10 100644 --- a/.forge-snapshots/FullRangeAddInitialLiquidity.snap +++ b/.forge-snapshots/FullRangeAddInitialLiquidity.snap @@ -1 +1 @@ -311181 \ No newline at end of file +309858 \ No newline at end of file diff --git a/.forge-snapshots/FullRangeAddLiquidity.snap b/.forge-snapshots/FullRangeAddLiquidity.snap index a4a14676..45f04866 100644 --- a/.forge-snapshots/FullRangeAddLiquidity.snap +++ b/.forge-snapshots/FullRangeAddLiquidity.snap @@ -1 +1 @@ -122990 \ No newline at end of file +121640 \ No newline at end of file diff --git a/.forge-snapshots/FullRangeFirstSwap.snap b/.forge-snapshots/FullRangeFirstSwap.snap index da120795..34462841 100644 --- a/.forge-snapshots/FullRangeFirstSwap.snap +++ b/.forge-snapshots/FullRangeFirstSwap.snap @@ -1 +1 @@ -80220 \ No newline at end of file +78977 \ No newline at end of file diff --git a/.forge-snapshots/FullRangeInitialize.snap b/.forge-snapshots/FullRangeInitialize.snap index 7a0170eb..3451c605 100644 --- a/.forge-snapshots/FullRangeInitialize.snap +++ b/.forge-snapshots/FullRangeInitialize.snap @@ -1 +1 @@ -1015181 \ No newline at end of file +1008717 \ No newline at end of file diff --git a/.forge-snapshots/FullRangeRemoveLiquidity.snap b/.forge-snapshots/FullRangeRemoveLiquidity.snap index feea4936..de65ef10 100644 --- a/.forge-snapshots/FullRangeRemoveLiquidity.snap +++ b/.forge-snapshots/FullRangeRemoveLiquidity.snap @@ -1 +1 @@ -110566 \ No newline at end of file +109724 \ No newline at end of file diff --git a/.forge-snapshots/FullRangeRemoveLiquidityAndRebalance.snap b/.forge-snapshots/FullRangeRemoveLiquidityAndRebalance.snap index e0df7eb7..b1b786de 100644 --- a/.forge-snapshots/FullRangeRemoveLiquidityAndRebalance.snap +++ b/.forge-snapshots/FullRangeRemoveLiquidityAndRebalance.snap @@ -1 +1 @@ -240044 \ No newline at end of file +239812 \ No newline at end of file diff --git a/.forge-snapshots/FullRangeSecondSwap.snap b/.forge-snapshots/FullRangeSecondSwap.snap index e68df8d3..4a24b0e5 100644 --- a/.forge-snapshots/FullRangeSecondSwap.snap +++ b/.forge-snapshots/FullRangeSecondSwap.snap @@ -1 +1 @@ -45930 \ No newline at end of file +44555 \ No newline at end of file diff --git a/.forge-snapshots/FullRangeSwap.snap b/.forge-snapshots/FullRangeSwap.snap index b50d0ea2..7d69ddee 100644 --- a/.forge-snapshots/FullRangeSwap.snap +++ b/.forge-snapshots/FullRangeSwap.snap @@ -1 +1 @@ -79351 \ No newline at end of file +78130 \ No newline at end of file diff --git a/.forge-snapshots/TWAMMSubmitOrder.snap b/.forge-snapshots/TWAMMSubmitOrder.snap index eb3b0f6b..3d61294d 100644 --- a/.forge-snapshots/TWAMMSubmitOrder.snap +++ b/.forge-snapshots/TWAMMSubmitOrder.snap @@ -1 +1 @@ -122336 \ No newline at end of file +122043 \ No newline at end of file diff --git a/foundry.toml b/foundry.toml index f9da8541..7979bfb0 100644 --- a/foundry.toml +++ b/foundry.toml @@ -1,7 +1,7 @@ [profile.default] src = 'contracts' out = 'foundry-out' -solc_version = '0.8.24' +solc_version = '0.8.26' optimizer_runs = 1000000 ffi = true fs_permissions = [{ access = "read-write", path = ".forge-snapshots/"}] diff --git a/lib/forge-gas-snapshot b/lib/forge-gas-snapshot index 2f884282..9161f7c0 160000 --- a/lib/forge-gas-snapshot +++ b/lib/forge-gas-snapshot @@ -1 +1 @@ -Subproject commit 2f884282b4cd067298e798974f5b534288b13bc2 +Subproject commit 9161f7c0b6c6788a89081e2b3b9c67592b71e689 diff --git a/lib/forge-std b/lib/forge-std index 2b58ecbc..3d8086d4 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit 2b58ecbcf3dfde7a75959dc7b4eb3d0670278de6 +Subproject commit 3d8086d4911b36c1874531ce8c367e6cfd028e80 diff --git a/lib/v4-core b/lib/v4-core index 6e6ce35b..7a720315 160000 --- a/lib/v4-core +++ b/lib/v4-core @@ -1 +1 @@ -Subproject commit 6e6ce35b69b15cb61bd8cb8488c7d064fab52886 +Subproject commit 7a72031574fc4548ca8fce197114cf87d5a2c037 diff --git a/test/FullRange.t.sol b/test/FullRange.t.sol index 5edec106..8a35661b 100644 --- a/test/FullRange.t.sol +++ b/test/FullRange.t.sol @@ -29,7 +29,7 @@ contract TestFullRange is Test, Deployers, GasSnapshot { using StateLibrary for IPoolManager; event Initialize( - PoolId poolId, + PoolId indexed poolId, Currency indexed currency0, Currency indexed currency1, uint24 fee, @@ -41,7 +41,7 @@ contract TestFullRange is Test, Deployers, GasSnapshot { ); event Swap( PoolId indexed id, - address sender, + address indexed sender, int128 amount0, int128 amount1, uint160 sqrtPriceX96, @@ -140,7 +140,12 @@ contract TestFullRange is Test, Deployers, GasSnapshot { function testFullRange_beforeInitialize_RevertsIfWrongSpacing() public { PoolKey memory wrongKey = PoolKey(key.currency0, key.currency1, 0, TICK_SPACING + 1, fullRange); - vm.expectRevert(FullRange.TickSpacingNotDefault.selector); + vm.expectRevert( + abi.encodeWithSelector( + Hooks.FailedHookCall.selector, abi.encodeWithSelector(FullRange.TickSpacingNotDefault.selector) + ) + ); + manager.initialize(wrongKey, SQRT_PRICE_1_1, ZERO_BYTES); } @@ -757,7 +762,12 @@ contract TestFullRange is Test, Deployers, GasSnapshot { function testFullRange_BeforeModifyPositionFailsWithWrongMsgSender() public { manager.initialize(key, SQRT_PRICE_1_1, ZERO_BYTES); - vm.expectRevert(FullRange.SenderMustBeHook.selector); + vm.expectRevert( + abi.encodeWithSelector( + Hooks.FailedHookCall.selector, abi.encodeWithSelector(FullRange.SenderMustBeHook.selector) + ) + ); + modifyLiquidityRouter.modifyLiquidity( key, IPoolManager.ModifyLiquidityParams({tickLower: MIN_TICK, tickUpper: MAX_TICK, liquidityDelta: 100, salt: 0}), diff --git a/test/GeomeanOracle.t.sol b/test/GeomeanOracle.t.sol index e6ff1695..7fbcd995 100644 --- a/test/GeomeanOracle.t.sol +++ b/test/GeomeanOracle.t.sol @@ -69,7 +69,12 @@ contract TestGeomeanOracle is Test, Deployers { } function testBeforeInitializeRevertsIfFee() public { - vm.expectRevert(GeomeanOracle.OnlyOneOraclePoolAllowed.selector); + vm.expectRevert( + abi.encodeWithSelector( + Hooks.FailedHookCall.selector, abi.encodeWithSelector(GeomeanOracle.OnlyOneOraclePoolAllowed.selector) + ) + ); + manager.initialize( PoolKey(Currency.wrap(address(token0)), Currency.wrap(address(token1)), 1, MAX_TICK_SPACING, geomeanOracle), SQRT_PRICE_1_1, @@ -78,7 +83,12 @@ contract TestGeomeanOracle is Test, Deployers { } function testBeforeInitializeRevertsIfNotMaxTickSpacing() public { - vm.expectRevert(GeomeanOracle.OnlyOneOraclePoolAllowed.selector); + vm.expectRevert( + abi.encodeWithSelector( + Hooks.FailedHookCall.selector, abi.encodeWithSelector(GeomeanOracle.OnlyOneOraclePoolAllowed.selector) + ) + ); + manager.initialize( PoolKey(Currency.wrap(address(token0)), Currency.wrap(address(token1)), 0, 60, geomeanOracle), SQRT_PRICE_1_1, @@ -209,7 +219,13 @@ contract TestGeomeanOracle is Test, Deployers { ZERO_BYTES ); - vm.expectRevert(GeomeanOracle.OraclePoolMustLockLiquidity.selector); + vm.expectRevert( + abi.encodeWithSelector( + Hooks.FailedHookCall.selector, + abi.encodeWithSelector(GeomeanOracle.OraclePoolMustLockLiquidity.selector) + ) + ); + modifyLiquidityRouter.modifyLiquidity( key, IPoolManager.ModifyLiquidityParams(