From 9a34f3e923a29ee6a6e135ca48924aeae7c7ae81 Mon Sep 17 00:00:00 2001 From: Eric Zhong Date: Fri, 3 Nov 2023 12:22:08 -0400 Subject: [PATCH] fix: add gas snaps for swaps with 1155 as input/output (#383) * Add snaps for 1155 swaps * remove lib * Add gas prefix --- .forge-snapshots/swap mint 1155 as output.snap | 1 + .forge-snapshots/swap with 1155 as input.snap | 1 + test/foundry-tests/PoolManager.t.sol | 4 ++++ 3 files changed, 6 insertions(+) create mode 100644 .forge-snapshots/swap mint 1155 as output.snap create mode 100644 .forge-snapshots/swap with 1155 as input.snap 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/test/foundry-tests/PoolManager.t.sol b/test/foundry-tests/PoolManager.t.sol index ff54a5ddb..cf70950a2 100644 --- a/test/foundry-tests/PoolManager.t.sol +++ b/test/foundry-tests/PoolManager.t.sol @@ -816,7 +816,9 @@ contract PoolManagerTest is Test, Deployers, TokenFixture, GasSnapshot { 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 erc6909Balance = manager.balanceOf(address(this), CurrencyLibrary.toId(currency1)); assertEq(erc6909Balance, 98); @@ -855,7 +857,9 @@ contract PoolManagerTest is Test, Deployers, TokenFixture, GasSnapshot { 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(); erc6909Balance = manager.balanceOf(address(this), CurrencyLibrary.toId(currency1)); assertEq(erc6909Balance, 71);