Skip to content

Commit

Permalink
feat(universal-router-sdk): add universal router deploy address on zk…
Browse files Browse the repository at this point in the history
…sync (#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
  • Loading branch information
jsy1218 authored Jun 10, 2024
1 parent ab33bf0 commit a7aa9dc
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 20 deletions.
1 change: 0 additions & 1 deletion sdks/uniswapx-sdk/integration/test/RelayOrder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
9 changes: 5 additions & 4 deletions sdks/uniswapx-sdk/integration/test/utils/permit2.ts
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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
Expand All @@ -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;
}
6 changes: 3 additions & 3 deletions sdks/universal-router-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
5 changes: 5 additions & 0 deletions sdks/universal-router-sdk/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
24 changes: 12 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit a7aa9dc

Please sign in to comment.