From a7aa9dc89935610375c3e543e6befba43328dc94 Mon Sep 17 00:00:00 2001 From: jsy1218 <91580504+jsy1218@users.noreply.github.com> Date: Mon, 10 Jun 2024 10:53:17 -0700 Subject: [PATCH] feat(universal-router-sdk): add universal router deploy address on zksync (#38) ## Description Update ur-sdk address with router on ZkSync ## How Has This Been Tested? unit tests ## Are there any breaking changes? No If there are breaking changes, please ensure you bump the major version Bump the major version (by using the title `feat(breaking): ...`), post a notice in #eng-sdks, and explicitly notify all Uniswap Labs consumers of the SDK. ## (Optional) Feedback Focus No ## (Optional) Follow Ups No --- .../integration/test/RelayOrder.spec.ts | 1 - .../integration/test/utils/permit2.ts | 9 +++---- sdks/universal-router-sdk/package.json | 6 ++--- .../src/utils/constants.ts | 5 ++++ yarn.lock | 24 +++++++++---------- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/sdks/uniswapx-sdk/integration/test/RelayOrder.spec.ts b/sdks/uniswapx-sdk/integration/test/RelayOrder.spec.ts index c099e08dc..490ff3482 100644 --- a/sdks/uniswapx-sdk/integration/test/RelayOrder.spec.ts +++ b/sdks/uniswapx-sdk/integration/test/RelayOrder.spec.ts @@ -13,7 +13,6 @@ import { RelayOrderReactor } from '../../src/contracts'; import { RelayOrderBuilder } from '../../'; -import { PERMIT2_ADDRESS } from '@uniswap/permit2-sdk'; import { deployAndReturnPermit2 } from './utils/permit2'; describe('RelayOrder', () => { diff --git a/sdks/uniswapx-sdk/integration/test/utils/permit2.ts b/sdks/uniswapx-sdk/integration/test/utils/permit2.ts index 318cd43b1..f1ef91015 100644 --- a/sdks/uniswapx-sdk/integration/test/utils/permit2.ts +++ b/sdks/uniswapx-sdk/integration/test/utils/permit2.ts @@ -1,7 +1,8 @@ +import {ChainId} from "@uniswap/sdk-core"; import { Signer } from "ethers"; import { ethers } from "hardhat"; +import { permit2Address } from "@uniswap/permit2-sdk"; import Permit2Abi from '../../../abis/Permit2.json'; -import { PERMIT2_ADDRESS } from "@uniswap/permit2-sdk"; import { Permit2 } from "../../../src/contracts"; export async function deployAndReturnPermit2(signer: Signer) { @@ -11,8 +12,8 @@ export async function deployAndReturnPermit2(signer: Signer) { "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3" ]); - if(await signer.provider?.getCode(PERMIT2_ADDRESS) !== '0x') { - return await ethers.getContractAt(Permit2Abi.abi, PERMIT2_ADDRESS) as Permit2; + if(await signer.provider?.getCode(permit2Address(ChainId.MAINNET)) !== '0x') { + return await ethers.getContractAt(Permit2Abi.abi, permit2Address(ChainId.MAINNET)) as Permit2; } // deploy permit2 @@ -22,5 +23,5 @@ export async function deployAndReturnPermit2(signer: Signer) { }); await res.wait(); - return await ethers.getContractAt(Permit2Abi.abi, PERMIT2_ADDRESS) as Permit2; + return await ethers.getContractAt(Permit2Abi.abi, permit2Address(ChainId.MAINNET)) as Permit2; } \ No newline at end of file diff --git a/sdks/universal-router-sdk/package.json b/sdks/universal-router-sdk/package.json index 0dcf143d1..6a09d25ee 100644 --- a/sdks/universal-router-sdk/package.json +++ b/sdks/universal-router-sdk/package.json @@ -30,12 +30,12 @@ "test:hardhat": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' hardhat test" }, "dependencies": { - "@uniswap/permit2-sdk": "^1.2.1", + "@uniswap/permit2-sdk": "^1.3.0", "@uniswap/router-sdk": "^1.9.2", - "@uniswap/sdk-core": "^5.0.0", + "@uniswap/sdk-core": "^5.3.0", "@uniswap/universal-router": "1.6.0", "@uniswap/v2-sdk": "^4.3.2", - "@uniswap/v3-sdk": "^3.11.2", + "@uniswap/v3-sdk": "^3.13.0", "bignumber.js": "^9.0.2", "ethers": "^5.7.0" }, diff --git a/sdks/universal-router-sdk/src/utils/constants.ts b/sdks/universal-router-sdk/src/utils/constants.ts index b6961ca20..598481dc3 100644 --- a/sdks/universal-router-sdk/src/utils/constants.ts +++ b/sdks/universal-router-sdk/src/utils/constants.ts @@ -109,6 +109,11 @@ const CHAIN_CONFIGS: { [key: number]: ChainConfig } = { weth: '0x4200000000000000000000000000000000000006', creationBlock: 11832155, }, + [324]: { + router: '0x28731BCC616B5f51dD52CF2e4dF0E78dD1136C06', + weth: '0x5aea5775959fbc2557cc8789bc1bf90a239d9a91', + creationBlock: 12640979, + }, } export const UNIVERSAL_ROUTER_ADDRESS = (chainId: number): string => { diff --git a/yarn.lock b/yarn.lock index fb66533a6..b3f637458 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4580,13 +4580,13 @@ __metadata: languageName: node linkType: hard -"@uniswap/permit2-sdk@npm:^1.2.1": - version: 1.2.1 - resolution: "@uniswap/permit2-sdk@npm:1.2.1" +"@uniswap/permit2-sdk@npm:^1.2.1, @uniswap/permit2-sdk@npm:^1.3.0": + version: 1.3.0 + resolution: "@uniswap/permit2-sdk@npm:1.3.0" dependencies: ethers: ^5.7.0 tiny-invariant: ^1.1.0 - checksum: 7c4fcc0aaa6e53da0f01c25984b7b37aaf95aa43479a2f374d5867956033ed34d9477b31aa1c0998c51ae3af28ab5dd2902c97f2acd176dac6dfed171ca5b6a4 + checksum: 828a63c52673a5b4eefa769c0ecc2da667fe5573a3c447d0fea3809b46e7a71376a48917d959f253abba01e9faa442a503dd65649687a6bf7b385ee9f6d41afd languageName: node linkType: hard @@ -4719,12 +4719,12 @@ __metadata: "@types/mocha": ^9.1.1 "@types/node": ^18.7.16 "@types/node-fetch": ^2.6.2 - "@uniswap/permit2-sdk": ^1.2.1 + "@uniswap/permit2-sdk": ^1.3.0 "@uniswap/router-sdk": ^1.9.2 - "@uniswap/sdk-core": ^5.0.0 + "@uniswap/sdk-core": ^5.3.0 "@uniswap/universal-router": 1.6.0 "@uniswap/v2-sdk": ^4.3.2 - "@uniswap/v3-sdk": ^3.11.2 + "@uniswap/v3-sdk": ^3.13.0 bignumber.js: ^9.0.2 chai: ^4.3.6 dotenv: ^16.0.3 @@ -4815,19 +4815,19 @@ __metadata: languageName: node linkType: hard -"@uniswap/v3-sdk@npm:^3.11.2": - version: 3.11.2 - resolution: "@uniswap/v3-sdk@npm:3.11.2" +"@uniswap/v3-sdk@npm:^3.11.2, @uniswap/v3-sdk@npm:^3.13.0": + version: 3.13.0 + resolution: "@uniswap/v3-sdk@npm:3.13.0" dependencies: "@ethersproject/abi": ^5.5.0 "@ethersproject/solidity": ^5.0.9 - "@uniswap/sdk-core": ^5.0.0 + "@uniswap/sdk-core": ^5.3.0 "@uniswap/swap-router-contracts": ^1.3.0 "@uniswap/v3-periphery": ^1.1.1 "@uniswap/v3-staker": 1.0.0 tiny-invariant: ^1.1.0 tiny-warning: ^1.0.3 - checksum: 82092b239b482b8fd9fd21afdcc4cf9860315af4c524e100a7ac02d25aba0bf25ad1aaf12d97105874590bad97eed4ff2f95dd56e849f881596ac32148cce726 + checksum: b1eebd0a0fd11ea6f71edb76a1c604f80bd0401461bbadb8164dd0cfbb24ec524a9194ae8dc6a7f3c1a38c71d23d3c35ff9a7c8a4aae1ed64e53a5098932fe0e languageName: node linkType: hard