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 1 commit
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
76727
1 change: 0 additions & 1 deletion .forge-snapshots/swap burn native 6909 for input.snap

This file was deleted.

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.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.swapWithDynamicFee");
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 @@ -66,7 +66,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {
}

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

function test_feeControllerSet() public {
Expand Down Expand Up @@ -366,25 +366,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.addLiquidityWithNativeToken");
modifyLiquidityRouter.modifyLiquidity{value: 1 ether}(nativeKey, LIQ_PARAMS, ZERO_BYTES);
snapEnd();
}

function test_removeLiquidity_withNative_gas() public {
snapStart("removeLiquidity with native token");
snapStart("PoolManager.removeLiquidityWithNativeToken");
Copy link
Contributor

@hensha256 hensha256 Mar 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to go
ContractName.functionName_extraNotes
e.g.
PoolManager.removeLiquidity_withNative
PoolManager.swap_simple
PoolManager.collectProtocolFees_withNative

modifyLiquidityRouter.modifyLiquidity{value: 1 ether}(nativeKey, REMOVE_LIQ_PARAMS, ZERO_BYTES);
snapEnd();
}
Expand All @@ -397,7 +397,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.addLiquidityWithEmptyHook");
modifyLiquidityRouter.modifyLiquidity(key, 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);
modifyLiquidityRouter.modifyLiquidity(key, LIQ_PARAMS, ZERO_BYTES);

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

snapStart("simple swap");
snapStart("PoolManager.simpleSwap");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
snapStart("PoolManager.simpleSwap");
snapStart("PoolManager.swap_simple");

swapRouter.swap(key, swapParams, testSettings, ZERO_BYTES);
snapEnd();
}
Expand All @@ -578,7 +578,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.simpleSwapWithNative");
swapRouter.swap{value: 100}(nativeKey, swapParams, testSettings, ZERO_BYTES);
snapEnd();
}
Expand All @@ -605,7 +605,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {
testSettings =
PoolSwapTest.TestSettings({withdrawTokens: true, settleUsingTransfer: true, currencyAlreadySent: false});

snapStart("swap with hooks");
snapStart("PoolManager.swapWithHooks");
swapRouter.swap(key, swapParams, testSettings, ZERO_BYTES);
snapEnd();
}
Expand All @@ -619,7 +619,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.swapMintOutputAs6909");
swapRouter.swap(key, params, testSettings, ZERO_BYTES);
snapEnd();

Expand All @@ -636,7 +636,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.swapMintNativeOutputAs6909");
swapRouter.swap(nativeKey, params, testSettings, ZERO_BYTES);
snapEnd();

Expand Down Expand Up @@ -668,7 +668,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.swapBurn6909ForInput");
swapRouter.swap(key, params, testSettings, ZERO_BYTES);
snapEnd();

Expand Down Expand Up @@ -700,7 +700,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.swapBurnNative6909ForInput");
// don't have to send in native currency since burning 6909 for input
swapRouter.swap(nativeKey, params, testSettings, ZERO_BYTES);
snapEnd();
Expand All @@ -720,7 +720,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.swapAgainstLiquidity");
swapRouter.swap(key, params, testSettings, ZERO_BYTES);
snapEnd();
}
Expand All @@ -736,7 +736,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.swapAgainstLiquidityWithNativeToken");
swapRouter.swap{value: 1 ether}(nativeKey, params, testSettings, ZERO_BYTES);
snapEnd();
}
Expand Down Expand Up @@ -805,7 +805,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot {
assertEq(feeGrowthGlobal0X128, 0);
assertEq(feeGrowthGlobal1X128, 0);

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

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

function test_donate_OneToken_gas() public {
snapStart("donate gas with 1 token");
snapStart("PoolManager.donateGasWith1Token");
donateRouter.donate(key, 100, 0, ZERO_BYTES);
snapEnd();
}
Expand Down Expand Up @@ -1009,7 +1009,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.erc20CollectProtocolFees");
manager.collectProtocolFees(address(1), currency0, expectedFees);
snapEnd();
assertEq(currency0.balanceOf(address(1)), expectedFees);
Expand Down Expand Up @@ -1065,7 +1065,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.nativeCollectProtocolFees");
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 @@ -387,7 +387,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/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.shouldCallBeforeSwap");
IHooks(address(0)).hasPermission(Hooks.BEFORE_SWAP_FLAG);
snapEnd();
}
Expand Down
Loading