From c2e9341b6ae85190426a5f04e47177a6b646cd6f Mon Sep 17 00:00:00 2001 From: Eric Zhong Date: Wed, 1 Nov 2023 15:21:30 -0400 Subject: [PATCH 1/3] Add snaps for 1155 swaps --- .forge-snapshots/swap mint 1155 as output.snap | 1 + .forge-snapshots/swap with 1155 as input.snap | 1 + lib/erc-6909 | 1 + test/foundry-tests/PoolManager.t.sol | 4 ++++ 4 files changed, 7 insertions(+) create mode 100644 .forge-snapshots/swap mint 1155 as output.snap create mode 100644 .forge-snapshots/swap with 1155 as input.snap create mode 160000 lib/erc-6909 diff --git a/.forge-snapshots/swap mint 1155 as output.snap b/.forge-snapshots/swap mint 1155 as output.snap new file mode 100644 index 000000000..1cc754b90 --- /dev/null +++ b/.forge-snapshots/swap mint 1155 as output.snap @@ -0,0 +1 @@ +169555 \ No newline at end of file diff --git a/.forge-snapshots/swap with 1155 as input.snap b/.forge-snapshots/swap with 1155 as input.snap new file mode 100644 index 000000000..7b5e55af2 --- /dev/null +++ b/.forge-snapshots/swap with 1155 as input.snap @@ -0,0 +1 @@ +155963 \ No newline at end of file diff --git a/lib/erc-6909 b/lib/erc-6909 new file mode 160000 index 000000000..16bb143c1 --- /dev/null +++ b/lib/erc-6909 @@ -0,0 +1 @@ +Subproject commit 16bb143c170e53b3f8d0752bd20e6473b43c887f diff --git a/test/foundry-tests/PoolManager.t.sol b/test/foundry-tests/PoolManager.t.sol index 1f12de125..d04efa91f 100644 --- a/test/foundry-tests/PoolManager.t.sol +++ b/test/foundry-tests/PoolManager.t.sol @@ -819,7 +819,9 @@ contract PoolManagerTest is Test, Deployers, TokenFixture, GasSnapshot, IERC1155 vm.expectEmit(true, true, true, true); emit TransferSingle(address(swapRouter), address(0), address(this), CurrencyLibrary.toId(currency1), 98); + snapStart("swap mint 1155 as output"); swapRouter.swap(key, params, testSettings, ZERO_BYTES); + snapEnd(); uint256 erc1155Balance = manager.balanceOf(address(this), CurrencyLibrary.toId(currency1)); assertEq(erc1155Balance, 98); @@ -858,7 +860,9 @@ contract PoolManagerTest is Test, Deployers, TokenFixture, GasSnapshot, IERC1155 vm.expectEmit(true, true, true, true); emit TransferSingle(address(manager), address(manager), address(0), CurrencyLibrary.toId(currency1), 27); + snapStart("swap with 1155 as input"); swapRouter.swap(key, params, testSettings, ZERO_BYTES); + snapEnd(); erc1155Balance = manager.balanceOf(address(this), CurrencyLibrary.toId(currency1)); assertEq(erc1155Balance, 71); From 9bfa253626fb7f9300c443ddf3a0e2fc219ad520 Mon Sep 17 00:00:00 2001 From: Eric Zhong Date: Wed, 1 Nov 2023 18:02:38 -0400 Subject: [PATCH 2/3] remove lib --- lib/erc-6909 | 1 - 1 file changed, 1 deletion(-) delete mode 160000 lib/erc-6909 diff --git a/lib/erc-6909 b/lib/erc-6909 deleted file mode 160000 index 16bb143c1..000000000 --- a/lib/erc-6909 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 16bb143c170e53b3f8d0752bd20e6473b43c887f From ba5ed7003db09341187e79d98a57405ca79013b1 Mon Sep 17 00:00:00 2001 From: Eric Zhong Date: Fri, 3 Nov 2023 11:32:12 -0400 Subject: [PATCH 3/3] Add gas prefix --- test/foundry-tests/PoolManager.t.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/foundry-tests/PoolManager.t.sol b/test/foundry-tests/PoolManager.t.sol index d04efa91f..1a4ae6f8c 100644 --- a/test/foundry-tests/PoolManager.t.sol +++ b/test/foundry-tests/PoolManager.t.sol @@ -800,7 +800,7 @@ contract PoolManagerTest is Test, Deployers, TokenFixture, GasSnapshot, IERC1155 snapEnd(); } - function testSwapMintERC1155IfOutputNotTaken() public { + function testGasSwapMintERC1155IfOutputNotTaken() public { PoolKey memory key = PoolKey({currency0: currency0, currency1: currency1, fee: 3000, hooks: IHooks(address(0)), tickSpacing: 60}); @@ -827,7 +827,7 @@ contract PoolManagerTest is Test, Deployers, TokenFixture, GasSnapshot, IERC1155 assertEq(erc1155Balance, 98); } - function testSwapUse1155AsInput() public { + function testGasSwapUse1155AsInput() public { PoolKey memory key = PoolKey({currency0: currency0, currency1: currency1, fee: 3000, hooks: IHooks(address(0)), tickSpacing: 60});