Skip to content

Commit

Permalink
Update core in periphery (#156)
Browse files Browse the repository at this point in the history
Co-authored-by: Sara Reynolds <[email protected]>
  • Loading branch information
hensha256 and snreynolds authored Jul 17, 2024
1 parent a54a92e commit 087a262
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeAddInitialLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
311181
309858
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeAddLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
122990
121640
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeFirstSwap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
80220
78977
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeInitialize.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1015181
1008717
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeRemoveLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
110566
109724
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeRemoveLiquidityAndRebalance.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
240044
239812
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeSecondSwap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
45930
44555
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeSwap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
79351
78130
2 changes: 1 addition & 1 deletion .forge-snapshots/TWAMMSubmitOrder.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
122336
122043
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
@@ -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/"}]
Expand Down
2 changes: 1 addition & 1 deletion lib/v4-core
Submodule v4-core updated 180 files
18 changes: 14 additions & 4 deletions test/FullRange.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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}),
Expand Down
22 changes: 19 additions & 3 deletions test/GeomeanOracle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 087a262

Please sign in to comment.