Skip to content
Merged
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
10 changes: 7 additions & 3 deletions deploy/001_deploy_hubpool.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { L1_ADDRESS_MAP } from "./consts";

const func = async function (hre: any) {
// This import is needed to override the definition of the HardhatRuntimeEnvironment type.
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";
Comment on lines +4 to +5
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this to the deployment scripts so we could use the correct hre type.


const func = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

const { deployer } = await getNamedAccounts();

const chainId = await getChainId();
const chainId = parseInt(await getChainId());

const lpTokenFactory = await deploy("LpTokenFactory", { from: deployer, log: true, skipIfAlreadyDeployed: true });

Expand All @@ -24,4 +28,4 @@ const func = async function (hre: any) {
});
};
module.exports = func;
func.tags = ["hubpool"];
func.tags = ["HubPool", "mainnet"];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the tags so they're all the same style and so that it's easy to deploy all the contracts needed for a particular network.

10 changes: 7 additions & 3 deletions deploy/002_deploy_optimism_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@

import { L1_ADDRESS_MAP } from "./consts";

const func = async function (hre: any) {
// This import is needed to override the definition of the HardhatRuntimeEnvironment type.
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

const func = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

const { deployer } = await getNamedAccounts();

const chainId = await getChainId();
const chainId = parseInt(await getChainId());

await deploy("Optimism_Adapter", {
from: deployer,
Expand All @@ -25,4 +29,4 @@ const func = async function (hre: any) {

module.exports = func;
func.dependencies = ["HubPool"];
func.tags = ["optimism-adapter"];
func.tags = ["OptimismAdapter", "mainnet"];
8 changes: 6 additions & 2 deletions deploy/003_deploy_optimism_spokepool.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
const func = async function (hre: any) {
// This import is needed to override the definition of the HardhatRuntimeEnvironment type.
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

const func = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, companionNetworks } = hre;
const { deploy } = deployments;

Expand All @@ -21,4 +25,4 @@ const func = async function (hre: any) {
});
};
module.exports = func;
func.tags = ["optimism-spokepool"];
func.tags = ["OptimismSpokePool", "optimism"];
10 changes: 7 additions & 3 deletions deploy/004_deploy_arbitrum_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@

import { L1_ADDRESS_MAP } from "./consts";

const func = async function (hre: any) {
// This import is needed to override the definition of the HardhatRuntimeEnvironment type.
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

const func = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

const { deployer } = await getNamedAccounts();

const chainId = await getChainId();
const chainId = parseInt(await getChainId());

await deploy("Arbitrum_Adapter", {
from: deployer,
Expand All @@ -20,4 +24,4 @@ const func = async function (hre: any) {

module.exports = func;
func.dependencies = ["HubPool"];
func.tags = ["arbitrum-adapter"];
func.tags = ["ArbitrumAdapter", "mainnet"];
10 changes: 7 additions & 3 deletions deploy/005_deploy_arbitrum_spokepool.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// This import is needed to override the definition of the HardhatRuntimeEnvironment type.
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

import { L2_ADDRESS_MAP } from "./consts";

const func = async function (hre: any) {
const func = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, companionNetworks, getChainId } = hre;
const { deploy } = deployments;

Expand All @@ -11,7 +15,7 @@ const func = async function (hre: any) {
const hubPool = await l1Deployments.get("HubPool");
console.log(`Using l1 hub pool @ ${hubPool.address}`);

const chainId = await getChainId();
const chainId = parseInt(await getChainId());

await deploy("Arbitrum_SpokePool", {
from: deployer,
Expand All @@ -27,4 +31,4 @@ const func = async function (hre: any) {
});
};
module.exports = func;
func.tags = ["arbitrum-spokepool"];
func.tags = ["ArbitrumSpokePool", "arbitrum"];
8 changes: 6 additions & 2 deletions deploy/006_deploy_ethereum_adapter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
const func = async function (hre: any) {
// This import is needed to override the definition of the HardhatRuntimeEnvironment type.
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

const func = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;

Expand All @@ -14,4 +18,4 @@ const func = async function (hre: any) {

module.exports = func;
func.dependencies = ["HubPool"];
func.tags = ["ethereum-adapter"];
func.tags = ["EthereumAdapter", "mainnet"];
10 changes: 7 additions & 3 deletions deploy/007_deploy_ethereum_spokepool.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
// This import is needed to override the definition of the HardhatRuntimeEnvironment type.
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

import { L1_ADDRESS_MAP } from "./consts";

const func = async function (hre: any) {
const func = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

const { deployer } = await getNamedAccounts();

const chainId = await getChainId();
const chainId = parseInt(await getChainId());

const hubPool = await deployments.get("HubPool");
console.log(`Using l1 hub pool @ ${hubPool.address}`);
Expand All @@ -19,4 +23,4 @@ const func = async function (hre: any) {
});
};
module.exports = func;
func.tags = ["ethereum-spokepool"];
func.tags = ["EthereumSpokePool", "mainnet"];
27 changes: 27 additions & 0 deletions deploy/008_deploy_polygon_token_bridger_mainnet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// This import is needed to override the definition of the HardhatRuntimeEnvironment type.
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

import { L1_ADDRESS_MAP } from "./consts";

const func = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

const { deployer } = await getNamedAccounts();

const chainId = parseInt(await getChainId());
const hubPool = await deployments.get("HubPool");

await deploy("PolygonTokenBridger", {
from: deployer,
log: true,
skipIfAlreadyDeployed: true,
args: [hubPool.address, L1_ADDRESS_MAP[chainId].weth],
deterministicDeployment: "0x1234", // Salt for the create2 call.
});
};

module.exports = func;
func.dependencies = ["HubPool"];
func.tags = ["PolygonTokenBridgerL1", "mainnet"];
28 changes: 28 additions & 0 deletions deploy/009_deploy_polygon_adapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// This import is needed to override the definition of the HardhatRuntimeEnvironment type.
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

import { L1_ADDRESS_MAP } from "./consts";

const func = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

const { deployer } = await getNamedAccounts();

const chainId = parseInt(await getChainId());

await deploy("Polygon_Adapter", {
from: deployer,
log: true,
skipIfAlreadyDeployed: false,
args: [
L1_ADDRESS_MAP[chainId].polygonRootChainManager,
L1_ADDRESS_MAP[chainId].polygonFxRoot,
L1_ADDRESS_MAP[chainId].weth,
],
});
};

module.exports = func;
func.tags = ["PolygonAdapter", "mainnet"];
26 changes: 26 additions & 0 deletions deploy/010_deploy_polygon_token_bridger_polygon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// This import is needed to override the definition of the HardhatRuntimeEnvironment type.
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

import { L1_ADDRESS_MAP } from "./consts";

const func = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;

const { deployer } = await getNamedAccounts();

const l1ChainId = parseInt(await hre.companionNetworks.l1.getChainId());
const l1HubPool = await hre.companionNetworks.l1.deployments.get("HubPool");

await deploy("PolygonTokenBridger", {
from: deployer,
log: true,
skipIfAlreadyDeployed: true,
args: [l1HubPool.address, L1_ADDRESS_MAP[l1ChainId].weth],
deterministicDeployment: "0x1234", // Salt for the create2 call.
});
};

module.exports = func;
func.tags = ["PolygonTokenBridgerL2", "polygon"];
34 changes: 34 additions & 0 deletions deploy/011_deploy_polygon_spokepool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// This import is needed to override the definition of the HardhatRuntimeEnvironment type.
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

import { L2_ADDRESS_MAP } from "./consts";

const func = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

const { deployer } = await getNamedAccounts();

const chainId = parseInt(await getChainId());
const l1HubPool = await hre.companionNetworks.l1.deployments.get("HubPool");
const polygonTokenBridger = await deployments.get("PolygonTokenBridger");

await deploy("Polygon_SpokePool", {
from: deployer,
log: true,
skipIfAlreadyDeployed: true,
args: [
polygonTokenBridger.address,
l1HubPool.address,
l1HubPool.address,
L2_ADDRESS_MAP[chainId].wMatic,
L2_ADDRESS_MAP[chainId].fxChild,
"0x0000000000000000000000000000000000000000",
],
});
};

module.exports = func;
func.dependencies = ["PolygonTokenBridgerL2"];
func.tags = ["PolygonSpokePool", "polygon"];
20 changes: 20 additions & 0 deletions deploy/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,25 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
weth: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
optimismStandardBridge: "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1",
finder: "0x40f941E48A552bF496B154Af6bf55725f18D77c3",
polygonRootChainManager: "0xA0c68C638235ee32657e8f720a23ceC1bFc77C77",
polygonFxRoot: "0xfe5e5D361b2ad62c541bAb87C45a0B9B018389a2",
},
4: {
weth: "0xc778417E063141139Fce010982780140Aa0cD5Ab",
finder: "0xbb6206fb01fAad31e8aaFc3AD303cEA89D8c8157",
l1ArbitrumInbox: "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e",
l1ERC20Gateway: "0x91169Dbb45e6804743F94609De50D511C437572E",
},
5: {
optimismCrossDomainMessenger: "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1", // dummy
optimismStandardBridge: "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1", // dummy
l1ArbitrumInbox: "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", // dummy
l1ERC20Gateway: "0x91169Dbb45e6804743F94609De50D511C437572E", // dummy
finder: "0xDC6b80D38004F495861E081e249213836a2F3217",
polygonRootChainManager: "0xBbD7cBFA79faee899Eaf900F13C9065bF03B1A74",
polygonFxRoot: "0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA",
weth: "0x60D4dB9b534EF9260a88b0BED6c486fe13E604Fc",
},
42: {
optimismCrossDomainMessenger: "0x4361d0F75A0186C05f971c566dC6bEa5957483fD",
weth: "0xd0A1E359811322d97991E03f863a0C30C2cF029C",
Expand All @@ -31,4 +43,12 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
l2GatewayRouter: "0x5288c571Fd7aD117beA99bF60FE0846C4E84F933",
l2Weth: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
},
137: {
wMatic: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
fxChild: "0x8397259c983751DAf40400790063935a11afa28a",
},
80001: {
wMatic: "0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889",
fxChild: "0xCf73231F28B7331BBe3124B907840A94851f9f11",
},
};
1 change: 1 addition & 0 deletions deployments/goerli/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5
Loading