Skip to content

Commit cc0810c

Browse files
committed
chore: deploy new SpokePoolPeriphery contracts
1 parent b5d169f commit cc0810c

File tree

45 files changed

+39454
-98
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+39454
-98
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { DeployFunction } from "hardhat-deploy/types";
2+
import { HardhatRuntimeEnvironment } from "hardhat/types";
3+
import { L1_ADDRESS_MAP, L2_ADDRESS_MAP } from "./consts";
4+
import { CHAIN_IDs } from "@across-protocol/constants";
5+
6+
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
7+
const contractName = "SpokePoolPeriphery";
8+
const { deployer } = await hre.getNamedAccounts();
9+
const chainId = parseInt(await hre.getChainId());
10+
11+
const isMainnet = [CHAIN_IDs.MAINNET, CHAIN_IDs.SEPOLIA].includes(chainId);
12+
const permit2Address = isMainnet ? L1_ADDRESS_MAP[chainId].permit2 : L2_ADDRESS_MAP[chainId].permit2;
13+
14+
if (!permit2Address) {
15+
throw new Error(`Permit2 address not found for chain ${chainId}`);
16+
}
17+
18+
const constructorArgs = [permit2Address];
19+
20+
const deployment = await hre.deployments.deploy("SpokePoolPeriphery", {
21+
contract: contractName,
22+
from: deployer,
23+
log: true,
24+
skipIfAlreadyDeployed: true,
25+
deterministicDeployment: "0x1235", // Salt for the create2 call.
26+
args: constructorArgs,
27+
});
28+
29+
await hre.run("verify:verify", {
30+
address: deployment.address,
31+
constructorArguments: constructorArgs,
32+
});
33+
};
34+
module.exports = func;
35+
func.tags = ["SpokePoolPeriphery"];
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import * as zk from "zksync-web3";
2+
import { Deployer as zkDeployer } from "@matterlabs/hardhat-zksync-deploy";
3+
import { DeployFunction, DeploymentSubmission } from "hardhat-deploy/types";
4+
import { HardhatRuntimeEnvironment } from "hardhat/types";
5+
import { L1_ADDRESS_MAP, L2_ADDRESS_MAP } from "./consts";
6+
import { CHAIN_IDs } from "@across-protocol/constants";
7+
8+
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
9+
const contractName = "SpokePoolPeriphery";
10+
const { deployments } = hre;
11+
const chainId = parseInt(await hre.getChainId());
12+
13+
const mnemonic = hre.network.config.accounts.mnemonic;
14+
const wallet = zk.Wallet.fromMnemonic(mnemonic);
15+
const deployer = new zkDeployer(hre, wallet);
16+
17+
const artifact = await deployer.loadArtifact(contractName);
18+
19+
const isMainnet = [CHAIN_IDs.MAINNET, CHAIN_IDs.SEPOLIA].includes(chainId);
20+
const permit2Address = isMainnet ? L1_ADDRESS_MAP[chainId].permit2 : L2_ADDRESS_MAP[chainId].permit2;
21+
22+
if (!permit2Address) {
23+
throw new Error(`Permit2 address not found for chain ${chainId}`);
24+
}
25+
26+
const constructorArgs = [permit2Address];
27+
28+
const _deployment = await deployer.deploy(artifact, constructorArgs);
29+
const newAddress = _deployment.address;
30+
console.log(`New ${contractName} deployed @ ${newAddress}`);
31+
32+
// Save the deployment manually because OZ's hardhat-upgrades packages bypasses hardhat-deploy.
33+
// See also: https://stackoverflow.com/questions/74870472
34+
const extendedArtifact = await deployments.getExtendedArtifact(contractName);
35+
const deployment: DeploymentSubmission = {
36+
address: newAddress,
37+
...extendedArtifact,
38+
};
39+
await deployments.save(contractName, deployment);
40+
41+
await hre.run("verify:verify", {
42+
address: newAddress,
43+
contract: "contracts/SpokePoolPeriphery.sol:SpokePoolPeriphery",
44+
constructorArguments: constructorArgs,
45+
});
46+
};
47+
48+
module.exports = func;
49+
func.tags = ["SpokePoolPeripheryZk"];

deploy/consts.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
5050
zkBridgeHub: "0x303a465B659cBB0ab36eE643eA362c509EEb5213",
5151
zkUsdcSharedBridge_232: "0xf553E6D903AA43420ED7e3bc2313bE9286A8F987",
5252
zkUsdcSharedBridge_324: "0xD7f9f54194C633F36CCD5F3da84ad4a1c38cB2cB", // This is the standard shared bridge contract.
53+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
5354
},
5455
[CHAIN_IDs.SEPOLIA]: {
5556
finder: "0xeF684C38F94F48775959ECf2012D7E864ffb9dd4",
@@ -72,6 +73,7 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
7273
polygonRegistry: "0xfE92F7c3a701e43d8479738c8844bCc555b9e5CD",
7374
polygonDepositManager: "0x44Ad17990F9128C6d823Ee10dB7F0A5d40a731A4",
7475
zkBridgeHub: "0x236D1c3Ff32Bd0Ca26b72Af287E895627c0478cE",
76+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
7577
},
7678
};
7779

@@ -179,16 +181,19 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
179181
cctpMessageTransmitter: "0xC30362313FBBA5cf9163F0bb16a0e01f01A896ca",
180182
uniswapV3SwapRouter: "0xE592427A0AEce92De3Edee1F18E0157C05861564",
181183
"1inchV6Router": "0x111111125421cA6dc452d289314280a0f8842A65",
184+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
182185
},
183186
[CHAIN_IDs.BSC]: {
184187
helios: "0xB04926aF663cB52899361B1F6313bcFEa5A58B29",
188+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
185189
},
186190
[CHAIN_IDs.POLYGON]: {
187191
fxChild: "0x8397259c983751DAf40400790063935a11afa28a",
188192
cctpTokenMessenger: "0x9daF8c91AEFAE50b9c0E69629D3F6Ca40cA3B3FE",
189193
cctpMessageTransmitter: "0xF3be9355363857F3e001be68856A2f96b4C39Ba9",
190194
uniswapV3SwapRouter: "0xE592427A0AEce92De3Edee1F18E0157C05861564",
191195
"1inchV6Router": "0x111111125421cA6dc452d289314280a0f8842A65",
196+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
192197
},
193198
[CHAIN_IDs.POLYGON_AMOY]: {
194199
fxChild: "0xE5930336866d0388f0f745A2d9207C7781047C0f",
@@ -199,12 +204,14 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
199204
zkErc20Bridge: "0x11f943b2c77b743AB90f4A0Ae7d5A4e7FCA3E102",
200205
cctpTokenMessenger: ZERO_ADDRESS, // CCTP not available on zkSync.
201206
"1inchV6Router": "0x6fd4383cB451173D5f9304F041C7BCBf27d561fF",
207+
permit2: "0x0000000000225e31d15943971f47ad3022f714fa",
202208
},
203209
[CHAIN_IDs.OPTIMISM]: {
204210
cctpTokenMessenger: "0x2B4069517957735bE00ceE0fadAE88a26365528f",
205211
cctpMessageTransmitter: "0x4d41f22c5a0e5c74090899e5a8fb597a8842b3e8",
206212
uniswapV3SwapRouter: "0xE592427A0AEce92De3Edee1F18E0157C05861564",
207213
"1inchV6Router": "0x111111125421cA6dc452d289314280a0f8842A65",
214+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
208215
},
209216
[CHAIN_IDs.OPTIMISM_SEPOLIA]: {
210217
cctpTokenMessenger: "0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5",
@@ -216,6 +223,7 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
216223
cctpMessageTransmitter: "0xAD09780d193884d503182aD4588450C416D6F9D4",
217224
uniswapV3SwapRouter: "0x2626664c2603336E57B271c5C0b26F421741e481",
218225
"1inchV6Router": "0x111111125421cA6dc452d289314280a0f8842A65",
226+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
219227
},
220228
[CHAIN_IDs.BASE_SEPOLIA]: {
221229
cctpTokenMessenger: "0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5",
@@ -226,6 +234,7 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
226234
zkErc20Bridge: "0xfBEC23c5BB0E076F2ef4d0AaD7fe331aE5A01143",
227235
zkUSDCBridge: "0x7188B6975EeC82ae914b6eC7AC32b3c9a18b2c81",
228236
cctpTokenMessenger: ZERO_ADDRESS, // Not available on Lens.
237+
permit2: "0x0000000000225e31D15943971F47aD3022F714Fa",
229238
},
230239
[CHAIN_IDs.LENS_SEPOLIA]: {
231240
zkErc20Bridge: "0x427373Be173120D7A042b44D0804E37F25E7330b",
@@ -234,6 +243,7 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
234243
lineaMessageService: "0x508Ca82Df566dCD1B0DE8296e70a96332cD644ec",
235244
cctpV2TokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d",
236245
lineaTokenBridge: "0x353012dc4a9A6cF55c941bADC267f82004A8ceB9",
246+
permit2: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768", // PancakeSwap Permit2
237247
},
238248
[CHAIN_IDs.SCROLL_SEPOLIA]: {
239249
scrollERC20GatewayRouter: "0x9aD3c5617eCAa556d6E166787A97081907171230",
@@ -244,6 +254,7 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
244254
scrollERC20GatewayRouter: "0x4C0926FF5252A435FD19e10ED15e5a249Ba19d79",
245255
scrollGasPriceOracle: "0x5300000000000000000000000000000000000002",
246256
scrollMessenger: "0x781e90f1c8Fc4611c9b7497C3B47F99Ef6969CbC",
257+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
247258
},
248259
1442: {
249260
// Custom WETH for testing because there is no "official" WETH
@@ -253,11 +264,36 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
253264
[CHAIN_IDs.UNICHAIN]: {
254265
cctpTokenMessenger: "0x4e744b28E787c3aD0e810eD65A24461D4ac5a762",
255266
cctpMessageTransmitter: "0x353bE9E2E38AB1D19104534e4edC21c643Df86f4",
267+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
256268
},
257269
[CHAIN_IDs.UNICHAIN_SEPOLIA]: {
258270
cctpTokenMessenger: "0x8ed94B8dAd2Dc5453862ea5e316A8e71AAed9782",
259271
cctpMessageTransmitter: "0xbc498c326533d675cf571B90A2Ced265ACb7d086",
260272
},
273+
[CHAIN_IDs.BLAST]: {
274+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
275+
},
276+
[CHAIN_IDs.ZORA]: {
277+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
278+
},
279+
[CHAIN_IDs.WORLD_CHAIN]: {
280+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
281+
},
282+
[CHAIN_IDs.INK]: {
283+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
284+
},
285+
[CHAIN_IDs.SONEIUM]: {
286+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
287+
},
288+
[CHAIN_IDs.LISK]: {
289+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
290+
},
291+
[CHAIN_IDs.REDSTONE]: {
292+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
293+
},
294+
[CHAIN_IDs.MODE]: {
295+
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
296+
},
261297
};
262298

263299
export const POLYGON_CHAIN_IDS: { [l1ChainId: number]: number } = {

0 commit comments

Comments
 (0)