Skip to content

Commit

Permalink
fix(universal-router-sdk): update universal router and v4 dependency …
Browse files Browse the repository at this point in the history
…version (#219)
  • Loading branch information
dianakocsis authored Jan 7, 2025
1 parent b25a2de commit 4e05367
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 54 deletions.
2 changes: 1 addition & 1 deletion sdks/universal-router-sdk/lib/universal-router
Submodule universal-router updated 65 files
+1 −0 .github/CODEOWNERS
+1 −1 contracts/UniversalRouter.sol
+20 −34 contracts/base/Dispatcher.sol
+0 −13 contracts/interfaces/external/IWETH9.sol
+1 −1 contracts/libraries/Commands.sol
+1 −1 contracts/modules/PaymentsImmutables.sol
+47 −4 contracts/modules/V3ToV4Migrator.sol
+0 −0 contracts/types/RouterParameters.sol
+4 −0 deploy-addresses/base-sepolia.json
+4 −0 deploy-addresses/op-sepolia.json
+4 −0 deploy-addresses/unichain-sepolia.json
+4 −0 deploy-addresses/worldchain.json
+15 −1 foundry.toml
+1 −1 hardhat.config.ts
+1 −1 lib/v4-periphery
+1 −1 package.json
+0 −1 remappings.txt
+1 −1 script/DeployUniversalRouter.s.sol
+1 −1 script/deployParameters/DeployArbitrum.s.sol
+1 −1 script/deployParameters/DeployArbitrumGoerli.s.sol
+1 −1 script/deployParameters/DeployAvalanche.s.sol
+1 −1 script/deployParameters/DeployBSC.s.sol
+1 −1 script/deployParameters/DeployBase.s.sol
+1 −1 script/deployParameters/DeployBaseGoerli.s.sol
+23 −0 script/deployParameters/DeployBaseSepolia.s.sol
+1 −1 script/deployParameters/DeployBlast.s.sol
+1 −1 script/deployParameters/DeployCelo.s.sol
+1 −1 script/deployParameters/DeployCeloAlfajores.s.sol
+1 −1 script/deployParameters/DeployGoerli.s.sol
+1 −1 script/deployParameters/DeployMainnet.s.sol
+23 −0 script/deployParameters/DeployOPSepolia.s.sol
+1 −1 script/deployParameters/DeployOptimism.s.sol
+1 −1 script/deployParameters/DeployOptimismGoerli.s.sol
+1 −1 script/deployParameters/DeployPolygon.s.sol
+1 −1 script/deployParameters/DeployPolygonMumbai.s.sol
+1 −1 script/deployParameters/DeploySepolia.s.sol
+23 −0 script/deployParameters/DeployUnichainSepolia.s.sol
+21 −0 script/deployParameters/DeployWorldchain.s.sol
+1 −1 test/foundry-tests/UniswapV2.t.sol
+1 −1 test/foundry-tests/UniversalRouter.t.sol
+1 −1 test/integration-tests/CheckOwnership.test.ts
+43 −2 test/integration-tests/UniswapMixed.test.ts
+32 −1 test/integration-tests/UniswapV2.test.ts
+1 −1 test/integration-tests/UniswapV3.test.ts
+42 −28 test/integration-tests/UniswapV4.test.ts
+5 −3 test/integration-tests/UniversalRouter.test.ts
+10 −19 test/integration-tests/V3ToV4Migration.test.ts
+1 −1 test/integration-tests/gas-tests/CheckOwnership.gas.test.ts
+2 −2 test/integration-tests/gas-tests/Payments.gas.test.ts
+1 −1 test/integration-tests/gas-tests/Uniswap.gas.test.ts
+2 −2 test/integration-tests/gas-tests/UniversalRouter.gas.test.ts
+7 −7 test/integration-tests/gas-tests/UniversalVSSwapRouter.gas.test.ts
+8 −17 test/integration-tests/gas-tests/V3ToV4Migration.gas.test.ts
+1 −1 test/integration-tests/gas-tests/__snapshots__/CheckOwnership.gas.test.ts.snap
+7 −7 test/integration-tests/gas-tests/__snapshots__/Payments.gas.test.ts.snap
+39 −39 test/integration-tests/gas-tests/__snapshots__/Uniswap.gas.test.ts.snap
+1 −1 test/integration-tests/gas-tests/__snapshots__/UniversalRouter.gas.test.ts.snap
+10 −10 test/integration-tests/gas-tests/__snapshots__/UniversalVSSwapRouter.gas.test.ts.snap
+8 −8 test/integration-tests/gas-tests/__snapshots__/V3ToV4Migration.gas.test.ts.snap
+1 −0 test/integration-tests/shared/constants.ts
+18 −4 test/integration-tests/shared/deployUniversalRouter.ts
+5 −1 test/integration-tests/shared/planner.ts
+6 −4 test/integration-tests/shared/v4Helpers.ts
+30 −25 test/integration-tests/shared/v4Planner.ts
+84 −105 yarn.lock
2 changes: 1 addition & 1 deletion sdks/universal-router-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@uniswap/v2-sdk": "^4.7.0",
"@uniswap/v3-core": "1.0.0",
"@uniswap/v3-sdk": "^3.19.0",
"@uniswap/v4-sdk": "^1.12.0",
"@uniswap/v4-sdk": "^1.12.3",
"bignumber.js": "^9.0.2",
"ethers": "^5.7.0"
},
Expand Down
44 changes: 22 additions & 22 deletions sdks/universal-router-sdk/test/forge/SwapERC20CallParameters.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -556,28 +556,28 @@ contract SwapERC20CallParametersTest is Test, Interop, DeployRouter {
// }

function testV4ExactInputUSDCForETHwithETHFee() public {
MethodParameters memory params = readFixture(json, "._UNISWAP_V4_USDC_FOR_1_ETH_2_HOP_WITH_ETH_FEE");
deal(address(USDC), from, BALANCE);
USDC.approve(address(permit2), BALANCE);
permit2.approve(address(USDC), address(router), uint160(BALANCE), uint48(block.timestamp + 1000));

assertEq(USDC.balanceOf(from), BALANCE);
uint256 startingRecipientBalance = RECIPIENT.balance;
uint256 startingFeeRecipientBalance = FEE_RECIPIENT.balance;
assertEq(WETH.balanceOf(FEE_RECIPIENT), 0);

(bool success,) = address(router).call{value: params.value}(params.data);
require(success, "call failed");

uint256 recipientOutETH = RECIPIENT.balance - startingRecipientBalance;
uint256 feeRecipientOutETH = FEE_RECIPIENT.balance - startingFeeRecipientBalance;
uint256 totalOut = recipientOutETH + feeRecipientOutETH;
uint256 expectedFee = totalOut * 500 / 10000;

assertLe(USDC.balanceOf(from), BALANCE);
assertEq(feeRecipientOutETH, expectedFee);
assertEq(recipientOutETH, totalOut - expectedFee);
assertEq(address(router).balance, 0);
MethodParameters memory params = readFixture(json, "._UNISWAP_V4_USDC_FOR_1_ETH_2_HOP_WITH_ETH_FEE");
deal(address(USDC), from, BALANCE);
USDC.approve(address(permit2), BALANCE);
permit2.approve(address(USDC), address(router), uint160(BALANCE), uint48(block.timestamp + 1000));

assertEq(USDC.balanceOf(from), BALANCE);
uint256 startingRecipientBalance = RECIPIENT.balance;
uint256 startingFeeRecipientBalance = FEE_RECIPIENT.balance;
assertEq(WETH.balanceOf(FEE_RECIPIENT), 0);

(bool success,) = address(router).call{value: params.value}(params.data);
require(success, "call failed");

uint256 recipientOutETH = RECIPIENT.balance - startingRecipientBalance;
uint256 feeRecipientOutETH = FEE_RECIPIENT.balance - startingFeeRecipientBalance;
uint256 totalOut = recipientOutETH + feeRecipientOutETH;
uint256 expectedFee = totalOut * 500 / 10000;

assertLe(USDC.balanceOf(from), BALANCE);
assertEq(feeRecipientOutETH, expectedFee);
assertEq(recipientOutETH, totalOut - expectedFee);
assertEq(address(router).balance, 0);
}

function testV4ExactOutNativeOutputWithUnwrap() public {
Expand Down
Loading

0 comments on commit 4e05367

Please sign in to comment.