Skip to content

chore: deploy new SpokePoolPeriphery contracts #1055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: may-14-audit
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions deploy/112_deploy_spokepool_periphery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { L1_ADDRESS_MAP, L2_ADDRESS_MAP } from "./consts";
import { CHAIN_IDs } from "@across-protocol/constants";

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const contractName = "SpokePoolPeriphery";
const { deployer } = await hre.getNamedAccounts();
const chainId = parseInt(await hre.getChainId());

const isMainnet = [CHAIN_IDs.MAINNET, CHAIN_IDs.SEPOLIA].includes(chainId);
const permit2Address = isMainnet ? L1_ADDRESS_MAP[chainId].permit2 : L2_ADDRESS_MAP[chainId].permit2;

if (!permit2Address) {
throw new Error(`Permit2 address not found for chain ${chainId}`);
}

const constructorArgs = [permit2Address];

const deployment = await hre.deployments.deploy("SpokePoolPeriphery", {
contract: contractName,
from: deployer,
log: true,
skipIfAlreadyDeployed: true,
deterministicDeployment: "0x1235", // Salt for the create2 call.
args: constructorArgs,
});

await hre.run("verify:verify", {
address: deployment.address,
constructorArguments: constructorArgs,
});
};
module.exports = func;
func.tags = ["SpokePoolPeriphery"];
49 changes: 49 additions & 0 deletions deploy/113_deploy_spokepool_periphery_zk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import * as zk from "zksync-web3";
import { Deployer as zkDeployer } from "@matterlabs/hardhat-zksync-deploy";
import { DeployFunction, DeploymentSubmission } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { L1_ADDRESS_MAP, L2_ADDRESS_MAP } from "./consts";
import { CHAIN_IDs } from "@across-protocol/constants";

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const contractName = "SpokePoolPeriphery";
const { deployments } = hre;
const chainId = parseInt(await hre.getChainId());

const mnemonic = hre.network.config.accounts.mnemonic;
const wallet = zk.Wallet.fromMnemonic(mnemonic);
const deployer = new zkDeployer(hre, wallet);

const artifact = await deployer.loadArtifact(contractName);

const isMainnet = [CHAIN_IDs.MAINNET, CHAIN_IDs.SEPOLIA].includes(chainId);
const permit2Address = isMainnet ? L1_ADDRESS_MAP[chainId].permit2 : L2_ADDRESS_MAP[chainId].permit2;

if (!permit2Address) {
throw new Error(`Permit2 address not found for chain ${chainId}`);
}

const constructorArgs = [permit2Address];

const _deployment = await deployer.deploy(artifact, constructorArgs);
const newAddress = _deployment.address;
console.log(`New ${contractName} deployed @ ${newAddress}`);

// Save the deployment manually because OZ's hardhat-upgrades packages bypasses hardhat-deploy.
// See also: https://stackoverflow.com/questions/74870472
const extendedArtifact = await deployments.getExtendedArtifact(contractName);
const deployment: DeploymentSubmission = {
address: newAddress,
...extendedArtifact,
};
await deployments.save(contractName, deployment);

await hre.run("verify:verify", {
address: newAddress,
contract: "contracts/SpokePoolPeriphery.sol:SpokePoolPeriphery",
constructorArguments: constructorArgs,
});
};

module.exports = func;
func.tags = ["SpokePoolPeripheryZk"];
36 changes: 36 additions & 0 deletions deploy/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
zkBridgeHub: "0x303a465B659cBB0ab36eE643eA362c509EEb5213",
zkUsdcSharedBridge_232: "0xf553E6D903AA43420ED7e3bc2313bE9286A8F987",
zkUsdcSharedBridge_324: "0xD7f9f54194C633F36CCD5F3da84ad4a1c38cB2cB", // This is the standard shared bridge contract.
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
},
[CHAIN_IDs.SEPOLIA]: {
finder: "0xeF684C38F94F48775959ECf2012D7E864ffb9dd4",
Expand All @@ -71,6 +72,7 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
polygonRegistry: "0xfE92F7c3a701e43d8479738c8844bCc555b9e5CD",
polygonDepositManager: "0x44Ad17990F9128C6d823Ee10dB7F0A5d40a731A4",
zkBridgeHub: "0x236D1c3Ff32Bd0Ca26b72Af287E895627c0478cE",
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
},
};

Expand Down Expand Up @@ -178,16 +180,19 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
cctpMessageTransmitter: "0xC30362313FBBA5cf9163F0bb16a0e01f01A896ca",
uniswapV3SwapRouter: "0xE592427A0AEce92De3Edee1F18E0157C05861564",
"1inchV6Router": "0x111111125421cA6dc452d289314280a0f8842A65",
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
},
[CHAIN_IDs.BSC]: {
helios: "0xB04926aF663cB52899361B1F6313bcFEa5A58B29",
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
},
[CHAIN_IDs.POLYGON]: {
fxChild: "0x8397259c983751DAf40400790063935a11afa28a",
cctpTokenMessenger: "0x9daF8c91AEFAE50b9c0E69629D3F6Ca40cA3B3FE",
cctpMessageTransmitter: "0xF3be9355363857F3e001be68856A2f96b4C39Ba9",
uniswapV3SwapRouter: "0xE592427A0AEce92De3Edee1F18E0157C05861564",
"1inchV6Router": "0x111111125421cA6dc452d289314280a0f8842A65",
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
},
[CHAIN_IDs.POLYGON_AMOY]: {
fxChild: "0xE5930336866d0388f0f745A2d9207C7781047C0f",
Expand All @@ -198,12 +203,14 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
zkErc20Bridge: "0x11f943b2c77b743AB90f4A0Ae7d5A4e7FCA3E102",
cctpTokenMessenger: ZERO_ADDRESS, // CCTP not available on zkSync.
"1inchV6Router": "0x6fd4383cB451173D5f9304F041C7BCBf27d561fF",
permit2: "0x0000000000225e31d15943971f47ad3022f714fa",
},
[CHAIN_IDs.OPTIMISM]: {
cctpTokenMessenger: "0x2B4069517957735bE00ceE0fadAE88a26365528f",
cctpMessageTransmitter: "0x4d41f22c5a0e5c74090899e5a8fb597a8842b3e8",
uniswapV3SwapRouter: "0xE592427A0AEce92De3Edee1F18E0157C05861564",
"1inchV6Router": "0x111111125421cA6dc452d289314280a0f8842A65",
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
},
[CHAIN_IDs.OPTIMISM_SEPOLIA]: {
cctpTokenMessenger: "0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5",
Expand All @@ -215,6 +222,7 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
cctpMessageTransmitter: "0xAD09780d193884d503182aD4588450C416D6F9D4",
uniswapV3SwapRouter: "0x2626664c2603336E57B271c5C0b26F421741e481",
"1inchV6Router": "0x111111125421cA6dc452d289314280a0f8842A65",
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
},
[CHAIN_IDs.BASE_SEPOLIA]: {
cctpTokenMessenger: "0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5",
Expand All @@ -225,6 +233,7 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
zkErc20Bridge: "0xfBEC23c5BB0E076F2ef4d0AaD7fe331aE5A01143",
zkUSDCBridge: "0x7188B6975EeC82ae914b6eC7AC32b3c9a18b2c81",
cctpTokenMessenger: ZERO_ADDRESS, // Not available on Lens.
permit2: "0x0000000000225e31D15943971F47aD3022F714Fa",
},
[CHAIN_IDs.LENS_SEPOLIA]: {
zkErc20Bridge: "0x427373Be173120D7A042b44D0804E37F25E7330b",
Expand All @@ -233,6 +242,7 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
lineaMessageService: "0x508Ca82Df566dCD1B0DE8296e70a96332cD644ec",
cctpV2TokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d",
lineaTokenBridge: "0x353012dc4a9A6cF55c941bADC267f82004A8ceB9",
permit2: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768", // PancakeSwap Permit2
},
[CHAIN_IDs.SCROLL_SEPOLIA]: {
scrollERC20GatewayRouter: "0x9aD3c5617eCAa556d6E166787A97081907171230",
Expand All @@ -243,6 +253,7 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
scrollERC20GatewayRouter: "0x4C0926FF5252A435FD19e10ED15e5a249Ba19d79",
scrollGasPriceOracle: "0x5300000000000000000000000000000000000002",
scrollMessenger: "0x781e90f1c8Fc4611c9b7497C3B47F99Ef6969CbC",
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
},
1442: {
// Custom WETH for testing because there is no "official" WETH
Expand All @@ -252,11 +263,36 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
[CHAIN_IDs.UNICHAIN]: {
cctpTokenMessenger: "0x4e744b28E787c3aD0e810eD65A24461D4ac5a762",
cctpMessageTransmitter: "0x353bE9E2E38AB1D19104534e4edC21c643Df86f4",
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
},
[CHAIN_IDs.UNICHAIN_SEPOLIA]: {
cctpTokenMessenger: "0x8ed94B8dAd2Dc5453862ea5e316A8e71AAed9782",
cctpMessageTransmitter: "0xbc498c326533d675cf571B90A2Ced265ACb7d086",
},
[CHAIN_IDs.BLAST]: {
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
},
[CHAIN_IDs.ZORA]: {
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
},
[CHAIN_IDs.WORLD_CHAIN]: {
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
},
[CHAIN_IDs.INK]: {
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
},
[CHAIN_IDs.SONEIUM]: {
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
},
[CHAIN_IDs.LISK]: {
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
},
[CHAIN_IDs.REDSTONE]: {
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
},
[CHAIN_IDs.MODE]: {
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
},
};

export const POLYGON_CHAIN_IDS: { [l1ChainId: number]: number } = {
Expand Down
Loading
Loading