From e6dc53be924c9ca7aeb27a6ffd5564056cfbf46f Mon Sep 17 00:00:00 2001 From: dianakocsis Date: Mon, 25 Nov 2024 16:09:03 -0500 Subject: [PATCH 01/10] update periphery not working --- hardhat.config.ts | 2 +- lib/v4-periphery | 2 +- .../CheckOwnership.gas.test.ts.snap | 8 - .../__snapshots__/Payments.gas.test.ts.snap | 50 --- .../__snapshots__/Uniswap.gas.test.ts.snap | 351 ------------------ .../UniversalRouter.gas.test.ts.snap | 3 - .../UniversalVSSwapRouter.gas.test.ts.snap | 38 -- .../V3ToV4Migration.gas.test.ts.snap | 57 --- 8 files changed, 2 insertions(+), 509 deletions(-) delete mode 100644 test/integration-tests/gas-tests/__snapshots__/CheckOwnership.gas.test.ts.snap delete mode 100644 test/integration-tests/gas-tests/__snapshots__/Payments.gas.test.ts.snap delete mode 100644 test/integration-tests/gas-tests/__snapshots__/Uniswap.gas.test.ts.snap delete mode 100644 test/integration-tests/gas-tests/__snapshots__/UniversalRouter.gas.test.ts.snap delete mode 100644 test/integration-tests/gas-tests/__snapshots__/UniversalVSSwapRouter.gas.test.ts.snap delete mode 100644 test/integration-tests/gas-tests/__snapshots__/V3ToV4Migration.gas.test.ts.snap diff --git a/hardhat.config.ts b/hardhat.config.ts index a43562b4..ccecaa40 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -12,7 +12,7 @@ const DEFAULT_COMPILER_SETTINGS = { evmVersion: 'cancun', optimizer: { enabled: true, - runs: 1_000_000, + runs: 1, }, metadata: { bytecodeHash: 'none', diff --git a/lib/v4-periphery b/lib/v4-periphery index 3f295d84..3cbbd79b 160000 --- a/lib/v4-periphery +++ b/lib/v4-periphery @@ -1 +1 @@ -Subproject commit 3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7 +Subproject commit 3cbbd79b2eeb848943f75d971bc4cc420f1d03de diff --git a/test/integration-tests/gas-tests/__snapshots__/CheckOwnership.gas.test.ts.snap b/test/integration-tests/gas-tests/__snapshots__/CheckOwnership.gas.test.ts.snap deleted file mode 100644 index bf0cb358..00000000 --- a/test/integration-tests/gas-tests/__snapshots__/CheckOwnership.gas.test.ts.snap +++ /dev/null @@ -1,8 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Check Ownership Gas gas: balance check ERC20 1`] = ` -Object { - "calldataByteLength": 356, - "gasUsed": 37740, -} -`; diff --git a/test/integration-tests/gas-tests/__snapshots__/Payments.gas.test.ts.snap b/test/integration-tests/gas-tests/__snapshots__/Payments.gas.test.ts.snap deleted file mode 100644 index 0007e23c..00000000 --- a/test/integration-tests/gas-tests/__snapshots__/Payments.gas.test.ts.snap +++ /dev/null @@ -1,50 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Payments Gas Tests Individual Command Tests gas: SWEEP with ERC20 1`] = ` -Object { - "calldataByteLength": 356, - "gasUsed": 37042, -} -`; - -exports[`Payments Gas Tests Individual Command Tests gas: SWEEP_WITH_FEE 1`] = ` -Object { - "calldataByteLength": 516, - "gasUsed": 65786, -} -`; - -exports[`Payments Gas Tests Individual Command Tests gas: TRANSFER with ERC20 1`] = ` -Object { - "calldataByteLength": 356, - "gasUsed": 36070, -} -`; - -exports[`Payments Gas Tests Individual Command Tests gas: TRANSFER with ETH 1`] = ` -Object { - "calldataByteLength": 356, - "gasUsed": 31635, -} -`; - -exports[`Payments Gas Tests Individual Command Tests gas: UNWRAP_WETH 1`] = ` -Object { - "calldataByteLength": 324, - "gasUsed": 44621, -} -`; - -exports[`Payments Gas Tests Individual Command Tests gas: UNWRAP_WETH_WITH_FEE 1`] = ` -Object { - "calldataByteLength": 644, - "gasUsed": 51108, -} -`; - -exports[`Payments Gas Tests Individual Command Tests gas: WRAP_ETH 1`] = ` -Object { - "calldataByteLength": 324, - "gasUsed": 53423, -} -`; diff --git a/test/integration-tests/gas-tests/__snapshots__/Uniswap.gas.test.ts.snap b/test/integration-tests/gas-tests/__snapshots__/Uniswap.gas.test.ts.snap deleted file mode 100644 index 20e2556a..00000000 --- a/test/integration-tests/gas-tests/__snapshots__/Uniswap.gas.test.ts.snap +++ /dev/null @@ -1,351 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Batch reverts gas: 2 sub-plans, both fail but the transaction succeeds 1`] = ` -Object { - "calldataByteLength": 1764, - "gasUsed": 270252, -} -`; - -exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Batch reverts gas: 2 sub-plans, neither fails 1`] = ` -Object { - "calldataByteLength": 1764, - "gasUsed": 245975, -} -`; - -exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Batch reverts gas: 2 sub-plans, second sub plan fails 1`] = ` -Object { - "calldataByteLength": 1764, - "gasUsed": 245975, -} -`; - -exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Batch reverts gas: 2 sub-plans, the first fails 1`] = ` -Object { - "calldataByteLength": 1764, - "gasUsed": 270252, -} -`; - -exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Interleaving routes gas: V2, then V3 1`] = ` -Object { - "calldataByteLength": 836, - "gasUsed": 189563, -} -`; - -exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Interleaving routes gas: V3, then V2 1`] = ` -Object { - "calldataByteLength": 836, - "gasUsed": 177146, -} -`; - -exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ERC20 --> ERC20 split V2 and V2 different routes, different input tokens, each two hop, with batch permit 1`] = ` -Object { - "calldataByteLength": 1540, - "gasUsed": 297144, -} -`; - -exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ERC20 --> ERC20 split V2 and V2 different routes, each two hop, with explicit permit 1`] = ` -Object { - "calldataByteLength": 1220, - "gasUsed": 308074, -} -`; - -exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ERC20 --> ERC20 split V2 and V2 different routes, each two hop, with explicit permit transfer from batch 1`] = ` -Object { - "calldataByteLength": 1284, - "gasUsed": 309224, -} -`; - -exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ERC20 --> ERC20 split V2 and V2 different routes, each two hop, without explicit permit 1`] = ` -Object { - "calldataByteLength": 900, - "gasUsed": 304422, -} -`; - -exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ERC20 --> ERC20 split V2 and V3, one hop 1`] = ` -Object { - "calldataByteLength": 996, - "gasUsed": 177020, -} -`; - -exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ERC20 --> ERC20 split V2 and V3, one hop, ADDRESS_THIS flag 1`] = ` -Object { - "calldataByteLength": 996, - "gasUsed": 176795, -} -`; - -exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ERC20 --> ETH split V2 and V3, exactOut, one hop 1`] = ` -Object { - "calldataByteLength": 964, - "gasUsed": 192242, -} -`; - -exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ERC20 --> ETH split V2 and V3, one hop 1`] = ` -Object { - "calldataByteLength": 964, - "gasUsed": 184906, -} -`; - -exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ETH --> ERC20 split V2 and V3, one hop 1`] = ` -Object { - "calldataByteLength": 1124, - "gasUsed": 191978, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Router02. gas: ERC20 --> ERC20 exactIn, one trade, one hop 1`] = ` -Object { - "calldataByteLength": 420, - "gasUsed": 121407, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Router02. gas: ERC20 --> ERC20 exactIn, one trade, two hops 1`] = ` -Object { - "calldataByteLength": 452, - "gasUsed": 189985, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Router02. gas: ERC20 --> ERC20 exactOut, one trade, one hop 1`] = ` -Object { - "calldataByteLength": 420, - "gasUsed": 122001, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Router02. gas: ERC20 --> ETH exactOut ETH, one trade, one hop 1`] = ` -Object { - "calldataByteLength": 580, - "gasUsed": 122933, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Router02. gas: ETH --> ERC20 exactIn, one trade, one hop 1`] = ` -Object { - "calldataByteLength": 420, - "gasUsed": 124889, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactIn trade, where an output fee is taken 1`] = ` -Object { - "calldataByteLength": 836, - "gasUsed": 126765, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactIn, one trade, one hop 1`] = ` -Object { - "calldataByteLength": 516, - "gasUsed": 106870, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactIn, one trade, three hops 1`] = ` -Object { - "calldataByteLength": 580, - "gasUsed": 241475, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactIn, one trade, three hops, no deadline 1`] = ` -Object { - "calldataByteLength": 548, - "gasUsed": 241217, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactIn, one trade, two hops 1`] = ` -Object { - "calldataByteLength": 548, - "gasUsed": 174218, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactIn, one trade, two hops, MSG_SENDER flag 1`] = ` -Object { - "calldataByteLength": 548, - "gasUsed": 174218, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactOut, one trade, one hop 1`] = ` -Object { - "calldataByteLength": 516, - "gasUsed": 106478, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactOut, one trade, three hops 1`] = ` -Object { - "calldataByteLength": 580, - "gasUsed": 246314, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactOut, one trade, two hops 1`] = ` -Object { - "calldataByteLength": 548, - "gasUsed": 176469, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ETH gas: exactIn, one trade, one hop 1`] = ` -Object { - "calldataByteLength": 644, - "gasUsed": 123194, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ETH gas: exactOut, one trade, one hop 1`] = ` -Object { - "calldataByteLength": 804, - "gasUsed": 128062, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ETH gas: exactOut, with ETH fee 1`] = ` -Object { - "calldataByteLength": 964, - "gasUsed": 136110, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ETH --> ERC20 gas: exactIn, one trade, one hop 1`] = ` -Object { - "calldataByteLength": 644, - "gasUsed": 106787, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ETH --> ERC20 gas: exactOut, one trade, one hop 1`] = ` -Object { - "calldataByteLength": 772, - "gasUsed": 125263, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV3 with Router02. gas: ERC20 --> ERC20 exactIn, one trade, one hop 1`] = ` -Object { - "calldataByteLength": 420, - "gasUsed": 104144, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV3 with Router02. gas: ERC20 --> ERC20 exactIn, one trade, three hops 1`] = ` -Object { - "calldataByteLength": 484, - "gasUsed": 265954, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV3 with Router02. gas: ERC20 --> ERC20 exactIn, one trade, two hops 1`] = ` -Object { - "calldataByteLength": 484, - "gasUsed": 185123, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV3 with Router02. gas: ERC20 --> ERC20 exactOut, one trade, one hop 1`] = ` -Object { - "calldataByteLength": 420, - "gasUsed": 113677, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV3 with Router02. gas: ERC20 --> ERC20 exactOut, one trade, three hops 1`] = ` -Object { - "calldataByteLength": 484, - "gasUsed": 256480, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV3 with Router02. gas: ERC20 --> ERC20 exactOut, one trade, two hops 1`] = ` -Object { - "calldataByteLength": 484, - "gasUsed": 176659, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ERC20 --> ERC20 gas: exactIn, one trade, one hop 1`] = ` -Object { - "calldataByteLength": 516, - "gasUsed": 105529, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ERC20 --> ERC20 gas: exactIn, one trade, three hops 1`] = ` -Object { - "calldataByteLength": 548, - "gasUsed": 253970, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ERC20 --> ERC20 gas: exactIn, one trade, two hops 1`] = ` -Object { - "calldataByteLength": 548, - "gasUsed": 177135, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ERC20 --> ERC20 gas: exactOut, one trade, one hop 1`] = ` -Object { - "calldataByteLength": 516, - "gasUsed": 112964, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ERC20 --> ERC20 gas: exactOut, one trade, three hops 1`] = ` -Object { - "calldataByteLength": 548, - "gasUsed": 249016, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ERC20 --> ERC20 gas: exactOut, one trade, two hops 1`] = ` -Object { - "calldataByteLength": 548, - "gasUsed": 172694, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ERC20 --> ETH gas: exactIn swap 1`] = ` -Object { - "calldataByteLength": 644, - "gasUsed": 121901, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ERC20 --> ETH gas: exactOut swap 1`] = ` -Object { - "calldataByteLength": 644, - "gasUsed": 129408, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ETH --> ERC20 gas: exactIn swap 1`] = ` -Object { - "calldataByteLength": 644, - "gasUsed": 215453, -} -`; - -exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ETH --> ERC20 gas: exactOut swap 1`] = ` -Object { - "calldataByteLength": 772, - "gasUsed": 124631, -} -`; diff --git a/test/integration-tests/gas-tests/__snapshots__/UniversalRouter.gas.test.ts.snap b/test/integration-tests/gas-tests/__snapshots__/UniversalRouter.gas.test.ts.snap deleted file mode 100644 index bf3c9d29..00000000 --- a/test/integration-tests/gas-tests/__snapshots__/UniversalRouter.gas.test.ts.snap +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`UniversalRouter Gas Tests gas: bytecode size 1`] = `19575`; diff --git a/test/integration-tests/gas-tests/__snapshots__/UniversalVSSwapRouter.gas.test.ts.snap b/test/integration-tests/gas-tests/__snapshots__/UniversalVSSwapRouter.gas.test.ts.snap deleted file mode 100644 index 7a44253e..00000000 --- a/test/integration-tests/gas-tests/__snapshots__/UniversalVSSwapRouter.gas.test.ts.snap +++ /dev/null @@ -1,38 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Uniswap UX Tests gas: Approvals Cost for infinite approval of permit2/swaprouter02 contract 1`] = ` -Object { - "calldataByteLength": 68, - "gasUsed": 55846, -} -`; - -exports[`Uniswap UX Tests gas: Comparisons Casual Swapper - 3 swaps Permit2 Max Approval Swap 1`] = `1104632`; - -exports[`Uniswap UX Tests gas: Comparisons Casual Swapper - 3 swaps Permit2 Sign Per Swap 1`] = `1138943`; - -exports[`Uniswap UX Tests gas: Comparisons Casual Swapper - 3 swaps SwapRouter02 1`] = `1124979`; - -exports[`Uniswap UX Tests gas: Comparisons Frequent Swapper - 10 swaps Permit2 Max Approval Swap 1`] = `3082555`; - -exports[`Uniswap UX Tests gas: Comparisons Frequent Swapper - 10 swaps Permit2 Sign Per Swap 1`] = `3235649`; - -exports[`Uniswap UX Tests gas: Comparisons Frequent Swapper - 10 swaps SwapRouter02 1`] = `3195011`; - -exports[`Uniswap UX Tests gas: Comparisons Frequent Swapper across 3 swap router versions - 15 swaps across 3 versions Permit2 Max Approval Swap 1`] = `4104563`; - -exports[`Uniswap UX Tests gas: Comparisons Frequent Swapper across 3 swap router versions - 15 swaps across 3 versions Permit2 Sign Per Swap 1`] = `4307977`; - -exports[`Uniswap UX Tests gas: Comparisons Frequent Swapper across 3 swap router versions - 15 swaps across 3 versions SwapRouter02 1`] = `4282374`; - -exports[`Uniswap UX Tests gas: Comparisons One Time Swapper - Complex Swap Permit2 Max Approval Swap 1`] = `508932`; - -exports[`Uniswap UX Tests gas: Comparisons One Time Swapper - Complex Swap Permit2 Sign Per Swap 1`] = `509250`; - -exports[`Uniswap UX Tests gas: Comparisons One Time Swapper - Complex Swap SwapRouter02 1`] = `500008`; - -exports[`Uniswap UX Tests gas: Comparisons One Time Swapper - Simple Swap Permit2 Max Approval Swap 1`] = `299645`; - -exports[`Uniswap UX Tests gas: Comparisons One Time Swapper - Simple Swap Permit2 Sign Per Swap 1`] = `299581`; - -exports[`Uniswap UX Tests gas: Comparisons One Time Swapper - Simple Swap SwapRouter02 1`] = `270033`; diff --git a/test/integration-tests/gas-tests/__snapshots__/V3ToV4Migration.gas.test.ts.snap b/test/integration-tests/gas-tests/__snapshots__/V3ToV4Migration.gas.test.ts.snap deleted file mode 100644 index 48026842..00000000 --- a/test/integration-tests/gas-tests/__snapshots__/V3ToV4Migration.gas.test.ts.snap +++ /dev/null @@ -1,57 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`V3 to V4 Migration Gas Tests V3 Commands burn gas: erc721permit + decreaseLiquidity + collect + burn 1`] = ` -Object { - "calldataByteLength": 1092, - "gasUsed": 256271, -} -`; - -exports[`V3 to V4 Migration Gas Tests V3 Commands collect gas: erc721permit + decreaseLiquidity + collect 1`] = ` -Object { - "calldataByteLength": 964, - "gasUsed": 223920, -} -`; - -exports[`V3 to V4 Migration Gas Tests V3 Commands decrease liquidity gas: erc721permit + decreaseLiquidity 1`] = ` -Object { - "calldataByteLength": 740, - "gasUsed": 202191, -} -`; - -exports[`V3 to V4 Migration Gas Tests V3 Commands erc721permit gas: erc721permit 1`] = ` -Object { - "calldataByteLength": 484, - "gasUsed": 66034, -} -`; - -exports[`V3 to V4 Migration Gas Tests V4 Commands initialize pool gas: initialize a pool 1`] = ` -Object { - "calldataByteLength": 452, - "gasUsed": 58320, -} -`; - -exports[`V3 to V4 Migration Gas Tests V4 Commands mint gas: migrate and mint 1`] = ` -Object { - "calldataByteLength": 2500, - "gasUsed": 592479, -} -`; - -exports[`V3 to V4 Migration Gas Tests V4 Commands mint gas: migrate weth position into eth position with forwarding 1`] = ` -Object { - "calldataByteLength": 2788, - "gasUsed": 571198, -} -`; - -exports[`V3 to V4 Migration Gas Tests V4 Commands mint gas: mint 1`] = ` -Object { - "calldataByteLength": 1604, - "gasUsed": 438916, -} -`; From e2a778b61701a3004017288b247855d96d78987f Mon Sep 17 00:00:00 2001 From: dianakocsis Date: Tue, 26 Nov 2024 11:21:26 -0500 Subject: [PATCH 02/10] fix ur according to periphery update --- test/integration-tests/UniswapV4.test.ts | 60 ++- .../CheckOwnership.gas.test.ts.snap | 8 + .../__snapshots__/Payments.gas.test.ts.snap | 50 +++ .../__snapshots__/Uniswap.gas.test.ts.snap | 351 ++++++++++++++++++ .../UniversalRouter.gas.test.ts.snap | 3 + .../UniversalVSSwapRouter.gas.test.ts.snap | 38 ++ .../V3ToV4Migration.gas.test.ts.snap | 57 +++ test/integration-tests/shared/v4Planner.ts | 48 ++- 8 files changed, 576 insertions(+), 39 deletions(-) create mode 100644 test/integration-tests/gas-tests/__snapshots__/CheckOwnership.gas.test.ts.snap create mode 100644 test/integration-tests/gas-tests/__snapshots__/Payments.gas.test.ts.snap create mode 100644 test/integration-tests/gas-tests/__snapshots__/Uniswap.gas.test.ts.snap create mode 100644 test/integration-tests/gas-tests/__snapshots__/UniversalRouter.gas.test.ts.snap create mode 100644 test/integration-tests/gas-tests/__snapshots__/UniversalVSSwapRouter.gas.test.ts.snap create mode 100644 test/integration-tests/gas-tests/__snapshots__/V3ToV4Migration.gas.test.ts.snap diff --git a/test/integration-tests/UniswapV4.test.ts b/test/integration-tests/UniswapV4.test.ts index 6bb06a77..ca5a644f 100644 --- a/test/integration-tests/UniswapV4.test.ts +++ b/test/integration-tests/UniswapV4.test.ts @@ -137,7 +137,8 @@ describe('Uniswap V4 Tests:', () => { hookData: '0x', }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [usdcContract.address, wethContract.address]) + v4Planner.addAction(Actions.SETTLE_ALL, [usdcContract.address, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [wethContract.address, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) const { usdcBalanceBefore, usdcBalanceAfter, wethBalanceBefore, wethBalanceAfter } = await executeRouter( @@ -164,7 +165,8 @@ describe('Uniswap V4 Tests:', () => { amountOutMinimum: minAmountOutNative, }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [currencyIn, wethContract.address]) + v4Planner.addAction(Actions.SETTLE_ALL, [currencyIn, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [wethContract.address, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) @@ -192,7 +194,8 @@ describe('Uniswap V4 Tests:', () => { amountOutMinimum: minAmountOutNative, }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [currencyIn, wethContract.address]) + v4Planner.addAction(Actions.SETTLE_ALL, [currencyIn, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [wethContract.address, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) @@ -222,7 +225,8 @@ describe('Uniswap V4 Tests:', () => { ]) // take 1% of the output to alice, then settle and take the rest to the caller v4Planner.addAction(Actions.TAKE_PORTION, [WETH.address, alice.address, ONE_PERCENT_BIPS]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [currencyIn, wethContract.address]) + v4Planner.addAction(Actions.SETTLE_ALL, [currencyIn, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [wethContract.address, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) @@ -303,7 +307,8 @@ describe('Uniswap V4 Tests:', () => { ]) // take 1% of the output to alice, then settle and take the rest to the caller v4Planner.addAction(Actions.TAKE_PORTION, [ETH_ADDRESS, alice.address, ONE_PERCENT_BIPS]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [currencyIn, ETH_ADDRESS]) + v4Planner.addAction(Actions.SETTLE_ALL, [currencyIn, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [ETH_ADDRESS, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) @@ -338,7 +343,8 @@ describe('Uniswap V4 Tests:', () => { hookData: '0x', }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [usdcContract.address, wethContract.address]) + v4Planner.addAction(Actions.SETTLE_ALL, [usdcContract.address, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [wethContract.address, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) @@ -366,7 +372,8 @@ describe('Uniswap V4 Tests:', () => { amountInMaximum: maxAmountInUSDC, }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [usdcContract.address, wethContract.address]) + v4Planner.addAction(Actions.SETTLE_ALL, [usdcContract.address, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [wethContract.address, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) @@ -394,7 +401,8 @@ describe('Uniswap V4 Tests:', () => { amountInMaximum: maxAmountInDAI, }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [daiContract.address, wethContract.address]) + v4Planner.addAction(Actions.SETTLE_ALL, [daiContract.address, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [wethContract.address, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) @@ -423,7 +431,8 @@ describe('Uniswap V4 Tests:', () => { hookData: '0x', }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [ETH_ADDRESS, usdcContract.address]) + v4Planner.addAction(Actions.SETTLE_ALL, [ETH_ADDRESS, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [usdcContract.address, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) const { usdcBalanceBefore, usdcBalanceAfter, ethBalanceBefore, ethBalanceAfter, gasSpent } = await executeRouter( @@ -452,7 +461,8 @@ describe('Uniswap V4 Tests:', () => { amountOutMinimum: minAmountOutUSDC, }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [currencyIn, usdcContract.address]) + v4Planner.addAction(Actions.SETTLE_ALL, [currencyIn, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [usdcContract.address, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) @@ -482,7 +492,8 @@ describe('Uniswap V4 Tests:', () => { amountOutMinimum: minAmountOutDAI, }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [currencyIn, daiContract.address]) + v4Planner.addAction(Actions.SETTLE_ALL, [currencyIn, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [daiContract.address, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) @@ -512,7 +523,8 @@ describe('Uniswap V4 Tests:', () => { hookData: '0x', }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [ETH_ADDRESS, usdcContract.address]) + v4Planner.addAction(Actions.SETTLE_ALL, [ETH_ADDRESS, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [usdcContract.address, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) // sweep excess ETH leftover back to the caller! planner.addCommand(CommandType.SWEEP, [ETH_ADDRESS, MSG_SENDER, 0]) @@ -544,7 +556,8 @@ describe('Uniswap V4 Tests:', () => { amountInMaximum: maxAmountInNative, }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [ETH_ADDRESS, currencyOut]) + v4Planner.addAction(Actions.SETTLE_ALL, [ETH_ADDRESS, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [currencyOut, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) // sweep excess ETH leftover back to the caller! @@ -577,7 +590,8 @@ describe('Uniswap V4 Tests:', () => { amountInMaximum: maxAmountInNative, }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [ETH_ADDRESS, daiContract.address]) + v4Planner.addAction(Actions.SETTLE_ALL, [ETH_ADDRESS, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [daiContract.address, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) // sweep excess ETH leftover back to the caller! @@ -612,7 +626,8 @@ describe('Uniswap V4 Tests:', () => { hookData: '0x', }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [usdcContract.address, ETH_ADDRESS]) + v4Planner.addAction(Actions.SETTLE_ALL, [usdcContract.address, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [ETH_ADDRESS, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) const { usdcBalanceBefore, usdcBalanceAfter, ethBalanceBefore, ethBalanceAfter, gasSpent } = await executeRouter( @@ -640,7 +655,8 @@ describe('Uniswap V4 Tests:', () => { amountOutMinimum: minAmountOutNative, }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [currencyIn, ETH_ADDRESS]) + v4Planner.addAction(Actions.SETTLE_ALL, [currencyIn, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [ETH_ADDRESS, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) @@ -669,7 +685,8 @@ describe('Uniswap V4 Tests:', () => { amountOutMinimum: minAmountOutNative, }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [currencyIn, ETH_ADDRESS]) + v4Planner.addAction(Actions.SETTLE_ALL, [currencyIn, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [ETH_ADDRESS, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) @@ -698,7 +715,8 @@ describe('Uniswap V4 Tests:', () => { hookData: '0x', }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [usdcContract.address, ETH_ADDRESS]) + v4Planner.addAction(Actions.SETTLE_ALL, [usdcContract.address, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [ETH_ADDRESS, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) const { usdcBalanceBefore, usdcBalanceAfter, ethBalanceBefore, ethBalanceAfter, gasSpent } = await executeRouter( @@ -726,7 +744,8 @@ describe('Uniswap V4 Tests:', () => { amountInMaximum: maxAmountInUSDC, }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [usdcContract.address, currencyOut]) + v4Planner.addAction(Actions.SETTLE_ALL, [usdcContract.address, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [currencyOut, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) @@ -755,7 +774,8 @@ describe('Uniswap V4 Tests:', () => { amountInMaximum: maxAmountInDAI, }, ]) - v4Planner.addAction(Actions.SETTLE_TAKE_PAIR, [daiContract.address, currencyOut]) + v4Planner.addAction(Actions.SETTLE_ALL, [daiContract.address, MAX_UINT]) + v4Planner.addAction(Actions.TAKE_ALL, [currencyOut, 0]) planner.addCommand(CommandType.V4_SWAP, [v4Planner.actions, v4Planner.params]) diff --git a/test/integration-tests/gas-tests/__snapshots__/CheckOwnership.gas.test.ts.snap b/test/integration-tests/gas-tests/__snapshots__/CheckOwnership.gas.test.ts.snap new file mode 100644 index 00000000..d1f1ad0a --- /dev/null +++ b/test/integration-tests/gas-tests/__snapshots__/CheckOwnership.gas.test.ts.snap @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Check Ownership Gas gas: balance check ERC20 1`] = ` +Object { + "calldataByteLength": 356, + "gasUsed": 37977, +} +`; diff --git a/test/integration-tests/gas-tests/__snapshots__/Payments.gas.test.ts.snap b/test/integration-tests/gas-tests/__snapshots__/Payments.gas.test.ts.snap new file mode 100644 index 00000000..e5e171e5 --- /dev/null +++ b/test/integration-tests/gas-tests/__snapshots__/Payments.gas.test.ts.snap @@ -0,0 +1,50 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Payments Gas Tests Individual Command Tests gas: SWEEP with ERC20 1`] = ` +Object { + "calldataByteLength": 356, + "gasUsed": 37271, +} +`; + +exports[`Payments Gas Tests Individual Command Tests gas: SWEEP_WITH_FEE 1`] = ` +Object { + "calldataByteLength": 516, + "gasUsed": 66087, +} +`; + +exports[`Payments Gas Tests Individual Command Tests gas: TRANSFER with ERC20 1`] = ` +Object { + "calldataByteLength": 356, + "gasUsed": 36289, +} +`; + +exports[`Payments Gas Tests Individual Command Tests gas: TRANSFER with ETH 1`] = ` +Object { + "calldataByteLength": 356, + "gasUsed": 31842, +} +`; + +exports[`Payments Gas Tests Individual Command Tests gas: UNWRAP_WETH 1`] = ` +Object { + "calldataByteLength": 324, + "gasUsed": 44903, +} +`; + +exports[`Payments Gas Tests Individual Command Tests gas: UNWRAP_WETH_WITH_FEE 1`] = ` +Object { + "calldataByteLength": 644, + "gasUsed": 51466, +} +`; + +exports[`Payments Gas Tests Individual Command Tests gas: WRAP_ETH 1`] = ` +Object { + "calldataByteLength": 324, + "gasUsed": 53634, +} +`; diff --git a/test/integration-tests/gas-tests/__snapshots__/Uniswap.gas.test.ts.snap b/test/integration-tests/gas-tests/__snapshots__/Uniswap.gas.test.ts.snap new file mode 100644 index 00000000..a118b809 --- /dev/null +++ b/test/integration-tests/gas-tests/__snapshots__/Uniswap.gas.test.ts.snap @@ -0,0 +1,351 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Batch reverts gas: 2 sub-plans, both fail but the transaction succeeds 1`] = ` +Object { + "calldataByteLength": 1764, + "gasUsed": 273005, +} +`; + +exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Batch reverts gas: 2 sub-plans, neither fails 1`] = ` +Object { + "calldataByteLength": 1764, + "gasUsed": 248692, +} +`; + +exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Batch reverts gas: 2 sub-plans, second sub plan fails 1`] = ` +Object { + "calldataByteLength": 1764, + "gasUsed": 248692, +} +`; + +exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Batch reverts gas: 2 sub-plans, the first fails 1`] = ` +Object { + "calldataByteLength": 1764, + "gasUsed": 273005, +} +`; + +exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Interleaving routes gas: V2, then V3 1`] = ` +Object { + "calldataByteLength": 836, + "gasUsed": 191106, +} +`; + +exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Interleaving routes gas: V3, then V2 1`] = ` +Object { + "calldataByteLength": 836, + "gasUsed": 178643, +} +`; + +exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ERC20 --> ERC20 split V2 and V2 different routes, different input tokens, each two hop, with batch permit 1`] = ` +Object { + "calldataByteLength": 1540, + "gasUsed": 299684, +} +`; + +exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ERC20 --> ERC20 split V2 and V2 different routes, each two hop, with explicit permit 1`] = ` +Object { + "calldataByteLength": 1220, + "gasUsed": 310373, +} +`; + +exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ERC20 --> ERC20 split V2 and V2 different routes, each two hop, with explicit permit transfer from batch 1`] = ` +Object { + "calldataByteLength": 1284, + "gasUsed": 311629, +} +`; + +exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ERC20 --> ERC20 split V2 and V2 different routes, each two hop, without explicit permit 1`] = ` +Object { + "calldataByteLength": 900, + "gasUsed": 306693, +} +`; + +exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ERC20 --> ERC20 split V2 and V3, one hop 1`] = ` +Object { + "calldataByteLength": 996, + "gasUsed": 178692, +} +`; + +exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ERC20 --> ERC20 split V2 and V3, one hop, ADDRESS_THIS flag 1`] = ` +Object { + "calldataByteLength": 996, + "gasUsed": 178467, +} +`; + +exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ERC20 --> ETH split V2 and V3, exactOut, one hop 1`] = ` +Object { + "calldataByteLength": 964, + "gasUsed": 194001, +} +`; + +exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ERC20 --> ETH split V2 and V3, one hop 1`] = ` +Object { + "calldataByteLength": 964, + "gasUsed": 186631, +} +`; + +exports[`Uniswap Gas Tests Mixing V2 and V3 with Universal Router. Split routes gas: ETH --> ERC20 split V2 and V3, one hop 1`] = ` +Object { + "calldataByteLength": 1124, + "gasUsed": 193535, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Router02. gas: ERC20 --> ERC20 exactIn, one trade, one hop 1`] = ` +Object { + "calldataByteLength": 420, + "gasUsed": 121407, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Router02. gas: ERC20 --> ERC20 exactIn, one trade, two hops 1`] = ` +Object { + "calldataByteLength": 452, + "gasUsed": 189985, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Router02. gas: ERC20 --> ERC20 exactOut, one trade, one hop 1`] = ` +Object { + "calldataByteLength": 420, + "gasUsed": 122001, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Router02. gas: ERC20 --> ETH exactOut ETH, one trade, one hop 1`] = ` +Object { + "calldataByteLength": 580, + "gasUsed": 122933, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Router02. gas: ETH --> ERC20 exactIn, one trade, one hop 1`] = ` +Object { + "calldataByteLength": 420, + "gasUsed": 124889, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactIn trade, where an output fee is taken 1`] = ` +Object { + "calldataByteLength": 836, + "gasUsed": 127768, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactIn, one trade, one hop 1`] = ` +Object { + "calldataByteLength": 516, + "gasUsed": 107737, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactIn, one trade, three hops 1`] = ` +Object { + "calldataByteLength": 580, + "gasUsed": 243044, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactIn, one trade, three hops, no deadline 1`] = ` +Object { + "calldataByteLength": 548, + "gasUsed": 242786, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactIn, one trade, two hops 1`] = ` +Object { + "calldataByteLength": 548, + "gasUsed": 175436, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactIn, one trade, two hops, MSG_SENDER flag 1`] = ` +Object { + "calldataByteLength": 548, + "gasUsed": 175436, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactOut, one trade, one hop 1`] = ` +Object { + "calldataByteLength": 516, + "gasUsed": 107325, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactOut, one trade, three hops 1`] = ` +Object { + "calldataByteLength": 580, + "gasUsed": 248383, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ERC20 gas: exactOut, one trade, two hops 1`] = ` +Object { + "calldataByteLength": 548, + "gasUsed": 177927, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ETH gas: exactIn, one trade, one hop 1`] = ` +Object { + "calldataByteLength": 644, + "gasUsed": 124178, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ETH gas: exactOut, one trade, one hop 1`] = ` +Object { + "calldataByteLength": 804, + "gasUsed": 129116, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ERC20 --> ETH gas: exactOut, with ETH fee 1`] = ` +Object { + "calldataByteLength": 964, + "gasUsed": 137150, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ETH --> ERC20 gas: exactIn, one trade, one hop 1`] = ` +Object { + "calldataByteLength": 644, + "gasUsed": 107642, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV2 with Universal Router. ETH --> ERC20 gas: exactOut, one trade, one hop 1`] = ` +Object { + "calldataByteLength": 772, + "gasUsed": 126239, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV3 with Router02. gas: ERC20 --> ERC20 exactIn, one trade, one hop 1`] = ` +Object { + "calldataByteLength": 420, + "gasUsed": 104144, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV3 with Router02. gas: ERC20 --> ERC20 exactIn, one trade, three hops 1`] = ` +Object { + "calldataByteLength": 484, + "gasUsed": 265954, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV3 with Router02. gas: ERC20 --> ERC20 exactIn, one trade, two hops 1`] = ` +Object { + "calldataByteLength": 484, + "gasUsed": 185123, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV3 with Router02. gas: ERC20 --> ERC20 exactOut, one trade, one hop 1`] = ` +Object { + "calldataByteLength": 420, + "gasUsed": 113677, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV3 with Router02. gas: ERC20 --> ERC20 exactOut, one trade, three hops 1`] = ` +Object { + "calldataByteLength": 484, + "gasUsed": 256480, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV3 with Router02. gas: ERC20 --> ERC20 exactOut, one trade, two hops 1`] = ` +Object { + "calldataByteLength": 484, + "gasUsed": 176659, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ERC20 --> ERC20 gas: exactIn, one trade, one hop 1`] = ` +Object { + "calldataByteLength": 516, + "gasUsed": 106467, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ERC20 --> ERC20 gas: exactIn, one trade, three hops 1`] = ` +Object { + "calldataByteLength": 548, + "gasUsed": 256122, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ERC20 --> ERC20 gas: exactIn, one trade, two hops 1`] = ` +Object { + "calldataByteLength": 548, + "gasUsed": 178680, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ERC20 --> ERC20 gas: exactOut, one trade, one hop 1`] = ` +Object { + "calldataByteLength": 516, + "gasUsed": 113956, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ERC20 --> ERC20 gas: exactOut, one trade, three hops 1`] = ` +Object { + "calldataByteLength": 548, + "gasUsed": 251078, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ERC20 --> ERC20 gas: exactOut, one trade, two hops 1`] = ` +Object { + "calldataByteLength": 548, + "gasUsed": 174221, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ERC20 --> ETH gas: exactIn swap 1`] = ` +Object { + "calldataByteLength": 644, + "gasUsed": 122956, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ERC20 --> ETH gas: exactOut swap 1`] = ` +Object { + "calldataByteLength": 644, + "gasUsed": 130517, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ETH --> ERC20 gas: exactIn swap 1`] = ` +Object { + "calldataByteLength": 644, + "gasUsed": 216371, +} +`; + +exports[`Uniswap Gas Tests Trade on UniswapV3 with Universal Router. ETH --> ERC20 gas: exactOut swap 1`] = ` +Object { + "calldataByteLength": 772, + "gasUsed": 125752, +} +`; diff --git a/test/integration-tests/gas-tests/__snapshots__/UniversalRouter.gas.test.ts.snap b/test/integration-tests/gas-tests/__snapshots__/UniversalRouter.gas.test.ts.snap new file mode 100644 index 00000000..fd5ad1ac --- /dev/null +++ b/test/integration-tests/gas-tests/__snapshots__/UniversalRouter.gas.test.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`UniversalRouter Gas Tests gas: bytecode size 1`] = `14284`; diff --git a/test/integration-tests/gas-tests/__snapshots__/UniversalVSSwapRouter.gas.test.ts.snap b/test/integration-tests/gas-tests/__snapshots__/UniversalVSSwapRouter.gas.test.ts.snap new file mode 100644 index 00000000..e0ca2f03 --- /dev/null +++ b/test/integration-tests/gas-tests/__snapshots__/UniversalVSSwapRouter.gas.test.ts.snap @@ -0,0 +1,38 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Uniswap UX Tests gas: Approvals Cost for infinite approval of permit2/swaprouter02 contract 1`] = ` +Object { + "calldataByteLength": 68, + "gasUsed": 55846, +} +`; + +exports[`Uniswap UX Tests gas: Comparisons Casual Swapper - 3 swaps Permit2 Max Approval Swap 1`] = `1113404`; + +exports[`Uniswap UX Tests gas: Comparisons Casual Swapper - 3 swaps Permit2 Sign Per Swap 1`] = `1148109`; + +exports[`Uniswap UX Tests gas: Comparisons Casual Swapper - 3 swaps SwapRouter02 1`] = `1124979`; + +exports[`Uniswap UX Tests gas: Comparisons Frequent Swapper - 10 swaps Permit2 Max Approval Swap 1`] = `3107972`; + +exports[`Uniswap UX Tests gas: Comparisons Frequent Swapper - 10 swaps Permit2 Sign Per Swap 1`] = `3262839`; + +exports[`Uniswap UX Tests gas: Comparisons Frequent Swapper - 10 swaps SwapRouter02 1`] = `3195011`; + +exports[`Uniswap UX Tests gas: Comparisons Frequent Swapper across 3 swap router versions - 15 swaps across 3 versions Permit2 Max Approval Swap 1`] = `4137939`; + +exports[`Uniswap UX Tests gas: Comparisons Frequent Swapper across 3 swap router versions - 15 swaps across 3 versions Permit2 Sign Per Swap 1`] = `4343717`; + +exports[`Uniswap UX Tests gas: Comparisons Frequent Swapper across 3 swap router versions - 15 swaps across 3 versions SwapRouter02 1`] = `4282374`; + +exports[`Uniswap UX Tests gas: Comparisons One Time Swapper - Complex Swap Permit2 Max Approval Swap 1`] = `512660`; + +exports[`Uniswap UX Tests gas: Comparisons One Time Swapper - Complex Swap Permit2 Sign Per Swap 1`] = `512978`; + +exports[`Uniswap UX Tests gas: Comparisons One Time Swapper - Complex Swap SwapRouter02 1`] = `500008`; + +exports[`Uniswap UX Tests gas: Comparisons One Time Swapper - Simple Swap Permit2 Max Approval Swap 1`] = `301355`; + +exports[`Uniswap UX Tests gas: Comparisons One Time Swapper - Simple Swap Permit2 Sign Per Swap 1`] = `301291`; + +exports[`Uniswap UX Tests gas: Comparisons One Time Swapper - Simple Swap SwapRouter02 1`] = `270033`; diff --git a/test/integration-tests/gas-tests/__snapshots__/V3ToV4Migration.gas.test.ts.snap b/test/integration-tests/gas-tests/__snapshots__/V3ToV4Migration.gas.test.ts.snap new file mode 100644 index 00000000..10b0a1ea --- /dev/null +++ b/test/integration-tests/gas-tests/__snapshots__/V3ToV4Migration.gas.test.ts.snap @@ -0,0 +1,57 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`V3 to V4 Migration Gas Tests V3 Commands burn gas: erc721permit + decreaseLiquidity + collect + burn 1`] = ` +Object { + "calldataByteLength": 1092, + "gasUsed": 256840, +} +`; + +exports[`V3 to V4 Migration Gas Tests V3 Commands collect gas: erc721permit + decreaseLiquidity + collect 1`] = ` +Object { + "calldataByteLength": 964, + "gasUsed": 224482, +} +`; + +exports[`V3 to V4 Migration Gas Tests V3 Commands decrease liquidity gas: erc721permit + decreaseLiquidity 1`] = ` +Object { + "calldataByteLength": 740, + "gasUsed": 202577, +} +`; + +exports[`V3 to V4 Migration Gas Tests V3 Commands erc721permit gas: erc721permit 1`] = ` +Object { + "calldataByteLength": 484, + "gasUsed": 66250, +} +`; + +exports[`V3 to V4 Migration Gas Tests V4 Commands initialize pool gas: initialize a pool 1`] = ` +Object { + "calldataByteLength": 452, + "gasUsed": 59133, +} +`; + +exports[`V3 to V4 Migration Gas Tests V4 Commands mint gas: migrate and mint 1`] = ` +Object { + "calldataByteLength": 2500, + "gasUsed": 597186, +} +`; + +exports[`V3 to V4 Migration Gas Tests V4 Commands mint gas: migrate weth position into eth position with forwarding 1`] = ` +Object { + "calldataByteLength": 2788, + "gasUsed": 574417, +} +`; + +exports[`V3 to V4 Migration Gas Tests V4 Commands mint gas: mint 1`] = ` +Object { + "calldataByteLength": 1604, + "gasUsed": 443077, +} +`; diff --git a/test/integration-tests/shared/v4Planner.ts b/test/integration-tests/shared/v4Planner.ts index f6d3b683..e428d42b 100644 --- a/test/integration-tests/shared/v4Planner.ts +++ b/test/integration-tests/shared/v4Planner.ts @@ -12,34 +12,39 @@ export enum Actions { DECREASE_LIQUIDITY = 0x01, MINT_POSITION = 0x02, BURN_POSITION = 0x03, + INCREASE_LIQUIDITY_FROM_DELTAS = 0x04, + MINT_POSITION_FROM_DELTAS = 0x05, + // swapping - SWAP_EXACT_IN_SINGLE = 0x04, - SWAP_EXACT_IN = 0x05, - SWAP_EXACT_OUT_SINGLE = 0x06, - SWAP_EXACT_OUT = 0x07, + SWAP_EXACT_IN_SINGLE = 0x06, + SWAP_EXACT_IN = 0x07, + SWAP_EXACT_OUT_SINGLE = 0x08, + SWAP_EXACT_OUT = 0x09, // donate - // DONATE = 0x08, + // DONATE = 0x0a, // closing deltas on the pool manager // settling - SETTLE = 0x09, - SETTLE_ALL = 0x10, - // SETTLE_PAIR = 0x11, + SETTLE = 0x0b, + SETTLE_ALL = 0x0c, + // SETTLE_PAIR = 0x0d, // taking - TAKE = 0x12, - TAKE_ALL = 0x13, - TAKE_PORTION = 0x14, - // TAKE_PAIR = 0x15, + TAKE = 0x0e, + TAKE_ALL = 0x0f, + TAKE_PORTION = 0x10, + // TAKE_PAIR = 0x11, + - SETTLE_TAKE_PAIR = 0x16, + CLOSE_CURRENCY = 0x12, + // CLEAR_OR_TAKE = 0x13, + SWEEP = 0x14, - CLOSE_CURRENCY = 0x17, - // CLEAR_OR_TAKE = 0x18, - SWEEP = 0x19, + WRAP = 0x15, + UNWRAP = 0x16, // minting/burning 6909s to close deltas - // MINT_6909 = 0x20, - // BURN_6909 = 0x21, + // MINT_6909 = 0x17, + // BURN_6909 = 0x18, } const POOL_KEY_STRUCT = '(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks)' @@ -64,6 +69,8 @@ const ABI_DEFINITION: { [key in Actions]: string[] } = { [Actions.DECREASE_LIQUIDITY]: ['uint256', 'uint256', 'uint128', 'uint128', 'bytes'], [Actions.MINT_POSITION]: [POOL_KEY_STRUCT, 'int24', 'int24', 'uint256', 'uint128', 'uint128', 'address', 'bytes'], [Actions.BURN_POSITION]: ['uint256', 'uint128', 'uint128', 'bytes'], + [Actions.INCREASE_LIQUIDITY_FROM_DELTAS]: ['uint256', 'uint128', 'uint128', 'bytes'], + [Actions.MINT_POSITION_FROM_DELTAS]: [POOL_KEY_STRUCT, 'int24', 'int24', 'uint128', 'uint128', 'address', 'bytes'], // Swapping commands [Actions.SWAP_EXACT_IN_SINGLE]: [SWAP_EXACT_IN_SINGLE_STRUCT], @@ -77,9 +84,12 @@ const ABI_DEFINITION: { [key in Actions]: string[] } = { [Actions.TAKE]: ['address', 'address', 'uint256'], [Actions.TAKE_ALL]: ['address', 'uint256'], [Actions.TAKE_PORTION]: ['address', 'address', 'uint256'], - [Actions.SETTLE_TAKE_PAIR]: ['address', 'address'], + [Actions.CLOSE_CURRENCY]: ['address'], [Actions.SWEEP]: ['address', 'address'], + + [Actions.WRAP]: ['uint256'], + [Actions.UNWRAP]: ['uint256'], } export class V4Planner { From c8888794bb8488863d0ee91699250a9c8a04a492 Mon Sep 17 00:00:00 2001 From: dianakocsis Date: Tue, 26 Nov 2024 11:23:21 -0500 Subject: [PATCH 03/10] prettier --- test/integration-tests/shared/v4Planner.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/test/integration-tests/shared/v4Planner.ts b/test/integration-tests/shared/v4Planner.ts index e428d42b..07dc55a0 100644 --- a/test/integration-tests/shared/v4Planner.ts +++ b/test/integration-tests/shared/v4Planner.ts @@ -34,7 +34,6 @@ export enum Actions { TAKE_PORTION = 0x10, // TAKE_PAIR = 0x11, - CLOSE_CURRENCY = 0x12, // CLEAR_OR_TAKE = 0x13, SWEEP = 0x14, From 1abf02ec7f0747dc39281246fc8446eabbcdb1f4 Mon Sep 17 00:00:00 2001 From: gretzke Date: Tue, 26 Nov 2024 18:23:01 +0100 Subject: [PATCH 04/10] fix issue during hardhat tests fixed in version 2.22.14 --- package.json | 2 +- yarn.lock | 189 +++++++++++++++++++++++---------------------------- 2 files changed, 85 insertions(+), 106 deletions(-) diff --git a/package.json b/package.json index 8b61c702..b0b842df 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "bignumber.js": "^9.0.0", "chai": "^4.3.4", "ethers": "^5.7.2", - "hardhat": "2.22.5", + "hardhat": "2.22.14", "hardhat-typechain": "^0.3.5", "mocha-chai-jest-snapshot": "^1.1.0", "prettier": "^2.0.5", diff --git a/yarn.lock b/yarn.lock index fea8d552..5a2fd901 100644 --- a/yarn.lock +++ b/yarn.lock @@ -972,53 +972,53 @@ resolved "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.6.3.tgz" integrity sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ== -"@nomicfoundation/edr-darwin-arm64@0.4.2": - version "0.4.2" - resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.4.2.tgz#2ff98535f272c9f2a7d06eeda93fe7b207a348a4" - integrity sha512-S+hhepupfqpBvMa9M1PVS08sVjGXsLnjyAsjhrrsjsNuTHVLhKzhkguvBD5g4If5skrwgOaVqpag4wnQbd15kQ== - -"@nomicfoundation/edr-darwin-x64@0.4.2": - version "0.4.2" - resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.4.2.tgz#001dcd0e7fa4c52046d283b0dc61e63a60c614dd" - integrity sha512-/zM94AUrXz6CmcsecRNHJ50jABDUFafmGc4iBmkfX/mTp4tVZj7XTyIogrQIt0FnTaeb4CgZoLap2+8tW/Uldg== - -"@nomicfoundation/edr-linux-arm64-gnu@0.4.2": - version "0.4.2" - resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.4.2.tgz#6d19f8265c8ffb22e29bc5bbbb5d1913fe4b306b" - integrity sha512-TV3Pr2tFvvmCfPCi9PaCGLtqn+oLaPKfL2NWpnoCeFFdzDQXi2L930yP1oUPY5RXd78NLdVHMkEkbhb2b6Wuvg== - -"@nomicfoundation/edr-linux-arm64-musl@0.4.2": - version "0.4.2" - resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.4.2.tgz#0b01aa405fdc8048c7a8e95c737f29b437536a30" - integrity sha512-PALwrLBk1M9rolXyhSX8xdhe5jL0qf/PgiCIF7W7lUyVKrI/I0oiU0EHDk/Xw7yi2UJg4WRyhhZoHYa0g4g8Qg== - -"@nomicfoundation/edr-linux-x64-gnu@0.4.2": - version "0.4.2" - resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.4.2.tgz#10959fd4db9b333d3e0559cb893e109611889af0" - integrity sha512-5svkftypDjAZ1LxV1onojlaqPRxrTEjJLkrUwLL+Fao5ZMe7aTnk5QQ1Jv76gW6WYZnMXNgjPhRcnw3oSNrqFA== - -"@nomicfoundation/edr-linux-x64-musl@0.4.2": - version "0.4.2" - resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.4.2.tgz#8de64a2dfd869dad930dd0eb9572a0593d382379" - integrity sha512-qiMlXQTggdH9zfOB4Eil4rQ95z8s7QdLJcOfz5Aym12qJNkCyF9hi4cc4dDCWA0CdI3x3oLbuf8qb81SF8R45w== - -"@nomicfoundation/edr-win32-x64-msvc@0.4.2": - version "0.4.2" - resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.4.2.tgz#13ad4bab9fd68853930e1a3d87c78d69d1d0e2ef" - integrity sha512-hDkAb0iaMmGYwBY/rA1oCX8VpsezfQcHPEPIEGXEcWC3WbnOgIZo0Qkpu/g0OMtFOJSQlWLXvKZuV7blhnrQag== - -"@nomicfoundation/edr@^0.4.0": - version "0.4.2" - resolved "https://registry.yarnpkg.com/@nomicfoundation/edr/-/edr-0.4.2.tgz#9d7550182d4f75d7510e265ebd3474c4f6fcb62a" - integrity sha512-U7v0HuZHfrsl/5FpUzuB2FYA0+FUglHHwiO6NhvLtNYKMZcPzdS6iUriMp/7GWs0SVxW3bAht9GinZPxdhVwWg== - dependencies: - "@nomicfoundation/edr-darwin-arm64" "0.4.2" - "@nomicfoundation/edr-darwin-x64" "0.4.2" - "@nomicfoundation/edr-linux-arm64-gnu" "0.4.2" - "@nomicfoundation/edr-linux-arm64-musl" "0.4.2" - "@nomicfoundation/edr-linux-x64-gnu" "0.4.2" - "@nomicfoundation/edr-linux-x64-musl" "0.4.2" - "@nomicfoundation/edr-win32-x64-msvc" "0.4.2" +"@nomicfoundation/edr-darwin-arm64@0.6.5": + version "0.6.5" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.6.5.tgz#37a31565d7ef42bed9028ac44aed82144de30bd1" + integrity sha512-A9zCCbbNxBpLgjS1kEJSpqxIvGGAX4cYbpDYCU2f3jVqOwaZ/NU761y1SvuCRVpOwhoCXqByN9b7HPpHi0L4hw== + +"@nomicfoundation/edr-darwin-x64@0.6.5": + version "0.6.5" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.6.5.tgz#3252f6e86397af460b7a480bfe1b889464d75b89" + integrity sha512-x3zBY/v3R0modR5CzlL6qMfFMdgwd6oHrWpTkuuXnPFOX8SU31qq87/230f4szM+ukGK8Hi+mNq7Ro2VF4Fj+w== + +"@nomicfoundation/edr-linux-arm64-gnu@0.6.5": + version "0.6.5" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.6.5.tgz#e7dc2934920b6cfabeb5ee7a5e26c8fb0d4964ac" + integrity sha512-HGpB8f1h8ogqPHTyUpyPRKZxUk2lu061g97dOQ/W4CxevI0s/qiw5DB3U3smLvSnBHKOzYS1jkxlMeGN01ky7A== + +"@nomicfoundation/edr-linux-arm64-musl@0.6.5": + version "0.6.5" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.6.5.tgz#00459cd53e9fb7bd5b7e32128b508a6e89079d89" + integrity sha512-ESvJM5Y9XC03fZg9KaQg3Hl+mbx7dsSkTIAndoJS7X2SyakpL9KZpOSYrDk135o8s9P9lYJdPOyiq+Sh+XoCbQ== + +"@nomicfoundation/edr-linux-x64-gnu@0.6.5": + version "0.6.5" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.6.5.tgz#5c9e4e2655caba48e0196977cba395bbde6fe97d" + integrity sha512-HCM1usyAR1Ew6RYf5AkMYGvHBy64cPA5NMbaeY72r0mpKaH3txiMyydcHibByOGdQ8iFLWpyUdpl1egotw+Tgg== + +"@nomicfoundation/edr-linux-x64-musl@0.6.5": + version "0.6.5" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.6.5.tgz#9c220751b66452dc43a365f380e1e236a0a8c5a9" + integrity sha512-nB2uFRyczhAvWUH7NjCsIO6rHnQrof3xcCe6Mpmnzfl2PYcGyxN7iO4ZMmRcQS7R1Y670VH6+8ZBiRn8k43m7A== + +"@nomicfoundation/edr-win32-x64-msvc@0.6.5": + version "0.6.5" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.6.5.tgz#90d3ac2a6a8a687522bda5ff2e92dd97e68126ea" + integrity sha512-B9QD/4DSSCFtWicO8A3BrsnitO1FPv7axB62wq5Q+qeJ50yJlTmyeGY3cw62gWItdvy2mh3fRM6L1LpnHiB77A== + +"@nomicfoundation/edr@^0.6.4": + version "0.6.5" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr/-/edr-0.6.5.tgz#b3b1ebcdd0148cfe67cca128e7ebe8092e200359" + integrity sha512-tAqMslLP+/2b2sZP4qe9AuGxG3OkQ5gGgHE4isUuq6dUVjwCRPFhAOhpdFl+OjY5P3yEv3hmq9HjUGRa2VNjng== + dependencies: + "@nomicfoundation/edr-darwin-arm64" "0.6.5" + "@nomicfoundation/edr-darwin-x64" "0.6.5" + "@nomicfoundation/edr-linux-arm64-gnu" "0.6.5" + "@nomicfoundation/edr-linux-arm64-musl" "0.6.5" + "@nomicfoundation/edr-linux-x64-gnu" "0.6.5" + "@nomicfoundation/edr-linux-x64-musl" "0.6.5" + "@nomicfoundation/edr-win32-x64-msvc" "0.6.5" "@nomicfoundation/ethereumjs-common@4.0.4": version "4.0.4" @@ -1881,7 +1881,7 @@ check-error@^1.0.2: resolved "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz" integrity sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA== -chokidar@3.5.3, chokidar@^3.4.0, chokidar@^3.5.3: +chokidar@3.5.3, chokidar@^3.5.3: version "3.5.3" resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz" integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== @@ -1896,6 +1896,13 @@ chokidar@3.5.3, chokidar@^3.4.0, chokidar@^3.5.3: optionalDependencies: fsevents "~2.3.2" +chokidar@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-4.0.1.tgz#4a6dff66798fb0f72a94f616abbd7e1a19f31d41" + integrity sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA== + dependencies: + readdirp "^4.0.1" + ci-info@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz" @@ -1976,10 +1983,10 @@ command-line-args@^4.0.7: find-replace "^1.0.3" typical "^2.6.1" -commander@3.0.2: - version "3.0.2" - resolved "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz" - integrity sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow== +commander@^8.1.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" + integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== concat-map@0.0.1: version "0.0.1" @@ -2332,17 +2339,6 @@ fp-ts@^1.0.0: resolved "https://registry.npmjs.org/fp-ts/-/fp-ts-1.19.5.tgz" integrity sha512-wDNqTimnzs8QqpldiId9OavWK2NptormjXnRJTQecNjzwfyp6P/8s/zG8e4h3ja3oqkKaY72UlTjQYt/1yXf9A== -fs-extra@^0.30.0: - version "0.30.0" - resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz" - integrity sha512-UvSPKyhMn6LEd/WpUaV9C9t3zATuqoqfWc3QdPhPLb58prN9tqYPlPWi8Krxi44loBoUzlobqZ3+8tGpxxSzwA== - dependencies: - graceful-fs "^4.1.2" - jsonfile "^2.1.0" - klaw "^1.0.0" - path-is-absolute "^1.0.0" - rimraf "^2.2.8" - fs-extra@^7.0.0, fs-extra@^7.0.1: version "7.0.1" resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz" @@ -2406,7 +2402,7 @@ glob@7.2.0: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: +glob@^7.1.2, glob@^7.1.4: version "7.2.3" resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -2423,7 +2419,7 @@ globals@^11.1.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.9: +graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.9: version "4.2.10" resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz" integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== @@ -2440,14 +2436,14 @@ hardhat-watcher@^2.1.1: dependencies: chokidar "^3.5.3" -hardhat@2.22.5: - version "2.22.5" - resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.22.5.tgz#7e1a4311fa9e34a1cfe337784eae06706f6469a5" - integrity sha512-9Zq+HonbXCSy6/a13GY1cgHglQRfh4qkzmj1tpPlhxJDwNVnhxlReV6K7hCWFKlOrV13EQwsdcD0rjcaQKWRZw== +hardhat@2.22.14: + version "2.22.14" + resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.22.14.tgz#389bb3789a52adc0b1a3b4bfc9b891239d5a2b42" + integrity sha512-sD8vHtS9l5QQVHzyPPe3auwZDJyZ0fG3Z9YENVa4oOqVEefCuHcPzdU736rei3zUKTqkX0zPIHkSMHpu02Fq1A== dependencies: "@ethersproject/abi" "^5.1.2" "@metamask/eth-sig-util" "^4.0.0" - "@nomicfoundation/edr" "^0.4.0" + "@nomicfoundation/edr" "^0.6.4" "@nomicfoundation/ethereumjs-common" "4.0.4" "@nomicfoundation/ethereumjs-tx" "5.0.4" "@nomicfoundation/ethereumjs-util" "9.0.4" @@ -2460,7 +2456,7 @@ hardhat@2.22.5: ansi-escapes "^4.3.0" boxen "^5.1.2" chalk "^2.4.2" - chokidar "^3.4.0" + chokidar "^4.0.0" ci-info "^2.0.0" debug "^4.1.1" enquirer "^2.3.0" @@ -2473,6 +2469,7 @@ hardhat@2.22.5: glob "7.2.0" immutable "^4.0.0-rc.12" io-ts "1.10.4" + json-stream-stringify "^3.1.4" keccak "^3.0.2" lodash "^4.17.11" mnemonist "^0.38.0" @@ -2481,7 +2478,7 @@ hardhat@2.22.5: raw-body "^2.4.1" resolve "1.17.0" semver "^6.3.0" - solc "0.7.3" + solc "0.8.26" source-map-support "^0.5.13" stacktrace-parser "^0.1.10" tsort "0.0.1" @@ -2814,18 +2811,16 @@ jsesc@^2.5.1: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== +json-stream-stringify@^3.1.4: + version "3.1.6" + resolved "https://registry.yarnpkg.com/json-stream-stringify/-/json-stream-stringify-3.1.6.tgz#ebe32193876fb99d4ec9f612389a8d8e2b5d54d4" + integrity sha512-x7fpwxOkbhFCaJDJ8vb1fBY3DdSa4AlITaz+HHILQJzdPMnHEFjxPwVUi1ALIbcIxDE0PNe/0i7frnY8QnBQog== + json5@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== -jsonfile@^2.1.0: - version "2.4.0" - resolved "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz" - integrity sha512-PKllAqbgLgxHaj8TElYymKCAgrASebJrWpTnEkOaTowt23VKXXN0sUeriJ+eh7y6ufb/CC5ap11pz71/cM0hUw== - optionalDependencies: - graceful-fs "^4.1.6" - jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz" @@ -2851,13 +2846,6 @@ keccak@^3.0.2: node-gyp-build "^4.2.0" readable-stream "^3.6.0" -klaw@^1.0.0: - version "1.3.1" - resolved "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz" - integrity sha512-TED5xi9gGQjGpNnvRWknrwAB1eL5GciPfVFOt3Vk1OJCVDQbzuSfrF3hkUQKlsgKrG1F+0t5W0m+Fje1jIt8rw== - optionalDependencies: - graceful-fs "^4.1.9" - locate-path@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz" @@ -3270,6 +3258,11 @@ readable-stream@^3.6.0: string_decoder "^1.1.1" util-deprecate "^1.0.1" +readdirp@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-4.0.2.tgz#388fccb8b75665da3abffe2d8f8ed59fe74c230a" + integrity sha512-yDMz9g+VaZkqBYS/ozoBJwaBhTbZo3UNYQHNRw1D3UFQB8oHB4uS/tAODO+ZLjGWmUbKnIlOWO+aaIiAxrUWHA== + readdirp@~3.6.0: version "3.6.0" resolved "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz" @@ -3282,11 +3275,6 @@ require-directory@^2.1.1: resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== -require-from-string@^2.0.0: - version "2.0.2" - resolved "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz" - integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== - resolve-from@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" @@ -3308,13 +3296,6 @@ resolve@^1.8.1: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" -rimraf@^2.2.8: - version "2.7.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" - integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== - dependencies: - glob "^7.1.3" - ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.2" resolved "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz" @@ -3411,18 +3392,16 @@ slash@^3.0.0: resolved "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -solc@0.7.3: - version "0.7.3" - resolved "https://registry.npmjs.org/solc/-/solc-0.7.3.tgz" - integrity sha512-GAsWNAjGzIDg7VxzP6mPjdurby3IkGCjQcM8GFYZT6RyaoUZKmMU6Y7YwG+tFGhv7dwZ8rmR4iwFDrrD99JwqA== +solc@0.8.26: + version "0.8.26" + resolved "https://registry.yarnpkg.com/solc/-/solc-0.8.26.tgz#afc78078953f6ab3e727c338a2fefcd80dd5b01a" + integrity sha512-yiPQNVf5rBFHwN6SIf3TUUvVAFKcQqmSUFeq+fb6pNRCo0ZCgpYOZDi3BVoezCPIAcKrVYd/qXlBLUP9wVrZ9g== dependencies: command-exists "^1.2.8" - commander "3.0.2" + commander "^8.1.0" follow-redirects "^1.12.1" - fs-extra "^0.30.0" js-sha3 "0.8.0" memorystream "^0.3.1" - require-from-string "^2.0.0" semver "^5.5.0" tmp "0.0.33" From c829773f19aa56b29528568deff21d0808c283d2 Mon Sep 17 00:00:00 2001 From: dianakocsis Date: Tue, 26 Nov 2024 12:47:09 -0500 Subject: [PATCH 05/10] change optimizer size --- foundry.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foundry.toml b/foundry.toml index 799172b0..e01b3480 100644 --- a/foundry.toml +++ b/foundry.toml @@ -6,7 +6,7 @@ via_ir = true solc_version = '0.8.26' evm_version = "cancun" -optimizer_runs = 1_000_000 +optimizer_runs = 1 fs_permissions = [{ access = "read", path = "./script/deployParameters/"}] [fmt] From a6baeac888b110bae03427f101f6829aa6de7f98 Mon Sep 17 00:00:00 2001 From: dianakocsis Date: Wed, 27 Nov 2024 09:43:37 -0500 Subject: [PATCH 06/10] change optimizer runs for manager only --- foundry.toml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/foundry.toml b/foundry.toml index e01b3480..f17c829d 100644 --- a/foundry.toml +++ b/foundry.toml @@ -6,9 +6,17 @@ via_ir = true solc_version = '0.8.26' evm_version = "cancun" -optimizer_runs = 1 +optimizer_runs = 44444444 fs_permissions = [{ access = "read", path = "./script/deployParameters/"}] +additional_compiler_profiles = [ + { name = "manager", via_ir = true, optimizer_runs = 1 }, +] + +compilation_restrictions = [ + { paths = "lib/v4-periphery/src/PositionManager.sol", optimizer_runs = 1 }, +] + [fmt] line_length = 120 quote_style = 'single' From 91e6b35f03ccf88b6478115c362f5964ba251cf7 Mon Sep 17 00:00:00 2001 From: dianakocsis Date: Mon, 2 Dec 2024 12:59:42 -0500 Subject: [PATCH 07/10] update again --- lib/v4-periphery | 2 +- test/integration-tests/gas-tests/V3ToV4Migration.gas.test.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/v4-periphery b/lib/v4-periphery index 3cbbd79b..c71e4b9d 160000 --- a/lib/v4-periphery +++ b/lib/v4-periphery @@ -1 +1 @@ -Subproject commit 3cbbd79b2eeb848943f75d971bc4cc420f1d03de +Subproject commit c71e4b9d12cad2944d3547720f712c8eaa462c4a diff --git a/test/integration-tests/gas-tests/V3ToV4Migration.gas.test.ts b/test/integration-tests/gas-tests/V3ToV4Migration.gas.test.ts index d7fef138..ba13476a 100644 --- a/test/integration-tests/gas-tests/V3ToV4Migration.gas.test.ts +++ b/test/integration-tests/gas-tests/V3ToV4Migration.gas.test.ts @@ -26,8 +26,7 @@ import { encodeDecreaseLiquidity, encodeCollect, encodeBurn, - encodeModifyLiquidities, - encodeInitializePool, + encodeModifyLiquidities } from '../shared/encodeCall' const { ethers } = hre import { USDC_WETH, ETH_USDC } from '../shared/v4Helpers' From b65718ebb1e64e4fe96e37fb334aee76a79ec2a1 Mon Sep 17 00:00:00 2001 From: dianakocsis Date: Mon, 2 Dec 2024 13:00:29 -0500 Subject: [PATCH 08/10] prettier --- test/integration-tests/gas-tests/V3ToV4Migration.gas.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration-tests/gas-tests/V3ToV4Migration.gas.test.ts b/test/integration-tests/gas-tests/V3ToV4Migration.gas.test.ts index ba13476a..81821253 100644 --- a/test/integration-tests/gas-tests/V3ToV4Migration.gas.test.ts +++ b/test/integration-tests/gas-tests/V3ToV4Migration.gas.test.ts @@ -26,7 +26,7 @@ import { encodeDecreaseLiquidity, encodeCollect, encodeBurn, - encodeModifyLiquidities + encodeModifyLiquidities, } from '../shared/encodeCall' const { ethers } = hre import { USDC_WETH, ETH_USDC } from '../shared/v4Helpers' From 2921540e8b432343de813bb31c5a511374679e3e Mon Sep 17 00:00:00 2001 From: dianakocsis Date: Mon, 2 Dec 2024 15:44:30 -0500 Subject: [PATCH 09/10] update periphery again --- lib/v4-periphery | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/v4-periphery b/lib/v4-periphery index c71e4b9d..24ae83fe 160000 --- a/lib/v4-periphery +++ b/lib/v4-periphery @@ -1 +1 @@ -Subproject commit c71e4b9d12cad2944d3547720f712c8eaa462c4a +Subproject commit 24ae83fecbaef75bc53e73645199c09d88e5d76f From edf30585b7d4ce1f19b8da7cff8fa22ec4e698d2 Mon Sep 17 00:00:00 2001 From: dianakocsis Date: Tue, 3 Dec 2024 15:51:55 -0500 Subject: [PATCH 10/10] switch runs to 30000 --- foundry.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foundry.toml b/foundry.toml index f17c829d..b71a5732 100644 --- a/foundry.toml +++ b/foundry.toml @@ -10,11 +10,11 @@ optimizer_runs = 44444444 fs_permissions = [{ access = "read", path = "./script/deployParameters/"}] additional_compiler_profiles = [ - { name = "manager", via_ir = true, optimizer_runs = 1 }, + { name = "manager", via_ir = true, optimizer_runs = 30000 }, ] compilation_restrictions = [ - { paths = "lib/v4-periphery/src/PositionManager.sol", optimizer_runs = 1 }, + { paths = "lib/v4-periphery/src/PositionManager.sol", optimizer_runs = 30000 }, ] [fmt]