Skip to content

Commit

Permalink
fix: add gas snaps for swaps with 1155 as input/output (#383)
Browse files Browse the repository at this point in the history
* Add snaps for 1155 swaps

* remove lib

* Add gas prefix
  • Loading branch information
zhongeric committed Dec 14, 2023
1 parent ebaa5d1 commit 9a34f3e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions .forge-snapshots/swap mint 1155 as output.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
169555
1 change: 1 addition & 0 deletions .forge-snapshots/swap with 1155 as input.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
155963
4 changes: 4 additions & 0 deletions test/foundry-tests/PoolManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9a34f3e

Please sign in to comment.