Skip to content

Commit 2d3180d

Browse files
authored
fix: migrate zksync to the zkstack adapter (#918)
* fix: migrate zksync to the zkstack adapter Signed-off-by: bennett <bennett@umaproject.org> * update deployments.json Signed-off-by: bennett <bennett@umaproject.org> * update script Signed-off-by: bennett <bennett@umaproject.org> --------- Signed-off-by: bennett <bennett@umaproject.org>
1 parent 7443d48 commit 2d3180d

File tree

5 files changed

+461
-3
lines changed

5 files changed

+461
-3
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import assert from "assert";
2+
import { HardhatRuntimeEnvironment } from "hardhat/types";
3+
import { DeployFunction } from "hardhat-deploy/types";
4+
import {
5+
L1_ADDRESS_MAP,
6+
WETH,
7+
ZK_L2_GAS_LIMIT,
8+
ZK_L1_GAS_TO_L2_GAS_PER_PUBDATA_LIMIT,
9+
ZK_MAX_GASPRICE,
10+
} from "./consts";
11+
12+
/**
13+
* Note:
14+
* This adapter supports ZkStack L2s.
15+
*
16+
* Usage:
17+
* $ SPOKE_CHAIN_ID=37111 yarn hardhat deploy --network sepolia --tags ZkStackCustomGasTokenAdapter
18+
*/
19+
20+
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
21+
// Excess bridge fees will go to this address on L2.
22+
const L2_REFUND_ADDRESS = "0x07aE8551Be970cB1cCa11Dd7a11F47Ae82e70E67";
23+
24+
const { SPOKE_CHAIN_ID } = process.env;
25+
assert(SPOKE_CHAIN_ID !== undefined, "SPOKE_CHAIN_ID not defined in environment");
26+
assert(
27+
parseInt(SPOKE_CHAIN_ID).toString() === SPOKE_CHAIN_ID,
28+
"SPOKE_CHAIN_ID (${SPOKE_CHAIN_ID}) must be an integer"
29+
);
30+
31+
const { deployer } = await hre.getNamedAccounts();
32+
const chainId = parseInt(await hre.getChainId());
33+
34+
const constructorArguments = [
35+
SPOKE_CHAIN_ID,
36+
L1_ADDRESS_MAP[chainId][`zkBridgeHub_${SPOKE_CHAIN_ID}`],
37+
WETH[chainId],
38+
L2_REFUND_ADDRESS,
39+
ZK_L2_GAS_LIMIT,
40+
ZK_L1_GAS_TO_L2_GAS_PER_PUBDATA_LIMIT,
41+
ZK_MAX_GASPRICE,
42+
];
43+
44+
const { address: deployment } = await hre.deployments.deploy("ZkStack_Adapter", {
45+
from: deployer,
46+
log: true,
47+
skipIfAlreadyDeployed: true,
48+
args: constructorArguments,
49+
});
50+
51+
await hre.run("verify:verify", { address: deployment, constructorArguments });
52+
};
53+
54+
module.exports = func;
55+
func.tags = ["ZkStackAdapter", "mainnet"];

deploy/consts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
4444
l1AlephZeroInbox: "0x56D8EC76a421063e1907503aDd3794c395256AEb",
4545
l1AlephZeroERC20GatewayRouter: "0xeBb17f398ed30d02F2e8733e7c1e5cf566e17812",
4646
donationBox: "0x0d57392895Db5aF3280e9223323e20F3951E81B1",
47-
// bridgeHub contract for Lens,
47+
zkBridgeHub_324: "0x303a465B659cBB0ab36eE643eA362c509EEb5213",
4848
zkBridgeHub_232: "0x9dA9f5dad070649811D77c40CcDcab479cE3Fa07",
4949
},
5050
[CHAIN_IDs.SEPOLIA]: {
@@ -69,7 +69,7 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
6969
polygonRegistry: "0xfE92F7c3a701e43d8479738c8844bCc555b9e5CD",
7070
polygonDepositManager: "0x44Ad17990F9128C6d823Ee10dB7F0A5d40a731A4",
7171

72-
zkBridgeHub: "0x236D1c3Ff32Bd0Ca26b72Af287E895627c0478cE",
72+
zkBridgeHub_37111: "0x236D1c3Ff32Bd0Ca26b72Af287E895627c0478cE",
7373
},
7474
};
7575

deployments/deployments.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"Optimism_Adapter": { "address": "0xE1e74B3D6A8E2A479B62958D4E4E6eEaea5B612b", "blockNumber": 19915034 },
1414
"PolygonTokenBridger": { "address": "0x0330E9b4D0325cCfF515E81DFbc7754F2a02ac57", "blockNumber": 14819539 },
1515
"Polygon_Adapter": { "address": "0xb4AeF0178f5725392A26eE18684C2aB62adc912e", "blockNumber": 19915066 },
16-
"ZkSync_Adapter": { "address": "0xE233009838CB898b50e0012a6E783FC9FeE447FB", "blockNumber": 17842162 },
16+
"ZkSync_Adapter": { "address": "0x3155A91D2EBAe69443B45556e1DE5ed8eB79C90D", "blockNumber": 22031982 },
1717
"Base_Adapter": { "address": "0xE1421233BF7158A19f89F17c9735F9cbd3D9529c", "blockNumber": 19915087 },
1818
"Linea_Adapter": { "address": "0x7Ea0D1882D610095A45E512B0113f79cA98a8EfE", "blockNumber": 19402413 },
1919
"BondToken": { "address": "0xee1dc6bcf1ee967a350e9ac6caaaa236109002ea", "blockNumber": 17980554 },

deployments/mainnet/ZkStack_Adapter.json

Lines changed: 345 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)