Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename Snaps #535

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .forge-snapshots/PoolManager.swap_againstLiquidity.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
60138
1 change: 1 addition & 0 deletions .forge-snapshots/PoolManager.swap_burn6909ForInput.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
80315
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
76165
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
155723
4 changes: 2 additions & 2 deletions test/DynamicFees.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ contract TestDynamicFees is Test, Deployers, GasSnapshot {
vm.expectEmit(true, true, true, true, address(manager));
emit Swap(key.toId(), address(swapRouter), -100, 98, 79228162514264329749955861424, 1e18, -1, 123);

snapStart("update dynamic fee in before swap");
snapStart("DynamicFees.swap_updateDynamicFeeInBeforeSwap");
swapRouter.swap(key, params, testSettings, ZERO_BYTES);
snapEnd();

Expand All @@ -166,7 +166,7 @@ contract TestDynamicFees is Test, Deployers, GasSnapshot {
vm.expectEmit(true, true, true, true, address(manager));
emit Swap(key.toId(), address(swapRouter), -100, 98, 79228162514264329749955861424, 1e18, -1, 123);

snapStart("swap with dynamic fee");
snapStart("DynamicFees.swap_withDynamicFee");
swapRouter.swap(key, params, testSettings, ZERO_BYTES);
snapEnd();
}
Expand Down
40 changes: 20 additions & 20 deletions test/PoolManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {
}

function test_bytecodeSize() public {
snapSize("poolManager bytecode size", address(manager));
snapSize("PoolManager.bytecodeSize", address(manager));
}

function test_setProtocolFeeController_succeeds() public {
Expand Down Expand Up @@ -380,25 +380,25 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {
}

function test_addLiquidity_gas() public {
snapStart("addLiquidity");
snapStart("PoolManager.addLiquidity");
modifyLiquidityRouter.modifyLiquidity(key, LIQ_PARAMS, ZERO_BYTES);
snapEnd();
}

function test_removeLiquidity_gas() public {
snapStart("removeLiquidity");
snapStart("PoolManager.removeLiquidity");
modifyLiquidityRouter.modifyLiquidity(key, REMOVE_LIQ_PARAMS, ZERO_BYTES);
snapEnd();
}

function test_addLiquidity_withNative_gas() public {
snapStart("addLiquidity with native token");
snapStart("PoolManager.addLiquidity_withNative");
modifyLiquidityRouter.modifyLiquidity{value: 1 ether}(nativeKey, LIQ_PARAMS, ZERO_BYTES);
snapEnd();
}

function test_removeLiquidity_withNative_gas() public {
snapStart("removeLiquidity with native token");
snapStart("PoolManager.removeLiquidity_withNative");
modifyLiquidityRouter.modifyLiquidity{value: 1 ether}(nativeKey, REMOVE_LIQ_PARAMS, ZERO_BYTES);
snapEnd();
}
Expand All @@ -411,7 +411,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {

(key,) = initPool(currency0, currency1, mockHooks, 3000, SQRT_RATIO_1_1, ZERO_BYTES);

snapStart("addLiquidity with empty hook");
snapStart("PoolManager.addLiquidity_withEmptyHook");
modifyLiquidityRouter.modifyLiquidity(key, LIQ_PARAMS, ZERO_BYTES);
snapEnd();
}
Expand All @@ -425,7 +425,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {
(key,) = initPool(currency0, currency1, mockHooks, 3000, SQRT_RATIO_1_1, ZERO_BYTES);
modifyLiquidityRouter.modifyLiquidity(key, LIQ_PARAMS, ZERO_BYTES);

snapStart("removeLiquidity with empty hook");
snapStart("PoolManager.removeLiquidity_withEmptyHook");
modifyLiquidityRouter.modifyLiquidity(key, REMOVE_LIQ_PARAMS, ZERO_BYTES);
snapEnd();
}
Expand Down Expand Up @@ -580,7 +580,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {
PoolSwapTest.TestSettings memory testSettings =
PoolSwapTest.TestSettings({withdrawTokens: true, settleUsingTransfer: true, currencyAlreadySent: false});

snapStart("simple swap");
snapStart("PoolManager.swap_simple");
swapRouter.swap(key, swapParams, testSettings, ZERO_BYTES);
snapEnd();
}
Expand All @@ -592,7 +592,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {
PoolSwapTest.TestSettings memory testSettings =
PoolSwapTest.TestSettings({withdrawTokens: true, settleUsingTransfer: true, currencyAlreadySent: false});

snapStart("simple swap with native");
snapStart("PoolManager.swap_simpleWithNative");
swapRouter.swap{value: 100}(nativeKey, swapParams, testSettings, ZERO_BYTES);
snapEnd();
}
Expand All @@ -619,7 +619,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {
testSettings =
PoolSwapTest.TestSettings({withdrawTokens: true, settleUsingTransfer: true, currencyAlreadySent: false});

snapStart("swap with hooks");
snapStart("PoolManager.swap_withHooks");
swapRouter.swap(key, swapParams, testSettings, ZERO_BYTES);
snapEnd();
}
Expand All @@ -633,7 +633,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {

vm.expectEmit();
emit Transfer(address(swapRouter), address(0), address(this), CurrencyLibrary.toId(currency1), 98);
snapStart("swap mint output as 6909");
snapStart("PoolManager.swap_mintOutputAs6909");
swapRouter.swap(key, params, testSettings, ZERO_BYTES);
snapEnd();

Expand All @@ -650,7 +650,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {

vm.expectEmit();
emit Transfer(address(swapRouter), address(0), address(this), CurrencyLibrary.toId(CurrencyLibrary.NATIVE), 98);
snapStart("swap mint native output as 6909");
snapStart("PoolManager.swap_mintNativeOutputAs6909");
swapRouter.swap(nativeKey, params, testSettings, ZERO_BYTES);
snapEnd();

Expand Down Expand Up @@ -682,7 +682,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {

vm.expectEmit();
emit Transfer(address(swapRouter), address(this), address(0), CurrencyLibrary.toId(currency1), 27);
snapStart("swap burn 6909 for input");
snapStart("PoolManager.swap_burn6909ForInput");
swapRouter.swap(key, params, testSettings, ZERO_BYTES);
snapEnd();

Expand Down Expand Up @@ -714,7 +714,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {

vm.expectEmit();
emit Transfer(address(swapRouter), address(this), address(0), CurrencyLibrary.toId(CurrencyLibrary.NATIVE), 27);
snapStart("swap burn native 6909 for input");
snapStart("PoolManager.swap_burnNative6909ForInput");
// don't have to send in native currency since burning 6909 for input
swapRouter.swap(nativeKey, params, testSettings, ZERO_BYTES);
snapEnd();
Expand All @@ -734,7 +734,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {

params = IPoolManager.SwapParams({zeroForOne: true, amountSpecified: -100, sqrtPriceLimitX96: SQRT_RATIO_1_4});

snapStart("swap against liquidity");
snapStart("PoolManager.swap_againstLiquidity");
swapRouter.swap(key, params, testSettings, ZERO_BYTES);
snapEnd();
}
Expand All @@ -750,7 +750,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {

params = IPoolManager.SwapParams({zeroForOne: true, amountSpecified: -100, sqrtPriceLimitX96: SQRT_RATIO_1_4});

snapStart("swap against liquidity with native token");
snapStart("PoolManager.swap_againstLiquidityWithNativeToken");
swapRouter.swap{value: 1 ether}(nativeKey, params, testSettings, ZERO_BYTES);
snapEnd();
}
Expand Down Expand Up @@ -819,7 +819,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {
assertEq(feeGrowthGlobal0X128, 0);
assertEq(feeGrowthGlobal1X128, 0);

snapStart("donate gas with 2 tokens");
snapStart("PoolManager.donate_gasWith2Tokens");
donateRouter.donate(key, 100, 200, ZERO_BYTES);
snapEnd();

Expand Down Expand Up @@ -878,7 +878,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {
}

function test_donate_OneToken_gas() public {
snapStart("donate gas with 1 token");
snapStart("PoolManager.donate_gasWith1Token");
donateRouter.donate(key, 100, 0, ZERO_BYTES);
snapEnd();
}
Expand Down Expand Up @@ -1019,7 +1019,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {
assertEq(manager.protocolFeesAccrued(currency1), 0);
assertEq(currency0.balanceOf(address(1)), 0);
vm.prank(address(feeController));
snapStart("erc20 collect protocol fees");
snapStart("PoolManager.collectProtocolFees_erc20");
manager.collectProtocolFees(address(1), currency0, expectedFees);
snapEnd();
assertEq(currency0.balanceOf(address(1)), expectedFees);
Expand Down Expand Up @@ -1073,7 +1073,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {
assertEq(manager.protocolFeesAccrued(currency1), 0);
assertEq(nativeCurrency.balanceOf(address(1)), 0);
vm.prank(address(feeController));
snapStart("native collect protocol fees");
snapStart("PoolManager.collectProtocolFees_native");
manager.collectProtocolFees(address(1), nativeCurrency, expectedFees);
snapEnd();
assertEq(nativeCurrency.balanceOf(address(1)), expectedFees);
Expand Down
2 changes: 1 addition & 1 deletion test/PoolManagerInitialize.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ contract PoolManagerInitializeTest is Test, Deployers, GasSnapshot {
}

function test_initialize_gas() public {
snapStart("initialize");
snapStart("PoolManager.initialize");
manager.initialize(uninitializedKey, SQRT_RATIO_1_1, ZERO_BYTES);
snapEnd();
}
Expand Down
2 changes: 1 addition & 1 deletion test/SkipCallsTestHook.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ contract SkipCallsTest is Test, Deployers, GasSnapshot {
assertEq(skipCallsTestHook.counter(), 0);

// swaps and increments counter
snapStart("swap skips hook call if hook is caller");
snapStart("SkipCallsTestsHook.swap_skipsHookCallifHookIsCaller");
swapRouter.swap(key, swapParams, testSettings, abi.encode(address(this)));
snapEnd();
assertEq(skipCallsTestHook.counter(), 1);
Expand Down
2 changes: 1 addition & 1 deletion test/libraries/Hooks.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ contract HooksTest is Test, Deployers, GasSnapshot {
}

function testGas() public {
snapStart("HooksShouldCallBeforeSwap");
snapStart("Hooks.callBeforeSwap");
IHooks(address(0)).hasPermission(Hooks.BEFORE_SWAP_FLAG);
snapEnd();
}
Expand Down
Loading