Skip to content
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

Add Sepolia / Base Sepolia support for Base cross-chain #742

Merged
merged 9 commits into from
Feb 19, 2024
2 changes: 2 additions & 0 deletions cross-chain/base/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
!/deployments/mainnet/
!/deployments/base/
!/deployments/baseGoerli/
!/deployments/baseSepolia/

# OZ
/.openzeppelin/unknown-*.json
!/.openzeppelin/unknown-84531.json
!/.openzeppelin/unknown-8453.json
!/.openzeppelin/unknown-84532.json
5 changes: 3 additions & 2 deletions cross-chain/base/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ yarn deploy --network <network>

Supported networks:
- `hardhat` - for local development
- `baseGoerli` - L2 testing network
- `baseGoerli` - L2 testing network (will become deprecated with end of 2023)
- `baseSepolia` - L2 testing network
- `base` - L2 mainnet

Currently, this module does not deploy any contracts on L1. All the existing
Expand All @@ -54,6 +55,6 @@ the contracts before running the deployment script. This command produces
an `export.json` file containing contract deployment info. Note that for the
chains other than `hardhat` the following environment variables are needed:

- `L2_CHAIN_API_URL` - URL to access blockchain services, e.g. `https://goerli.base.org`
- `L2_CHAIN_API_URL` - URL to access blockchain services, e.g. `https://sepolia.base.org`
- `L2_ACCOUNTS_PRIVATE_KEYS` - Private keys for the deployer and council `<0xOwnerPrivKey,0xCouncilPrivKey>`
- `BASESCAN_API_KEY` - Base Etherscan API key
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { execute } = deployments
const { deployer } = await getNamedAccounts()

// See https://docs.wormhole.com/wormhole/blockchain-environments/evm#base
// This ID is valid for both Base Goerli and Base Mainnet
const wormholeChainID = 30
// See https://docs.wormhole.com/wormhole/blockchain-environments/evm#base and
// https://docs.wormhole.com/wormhole/blockchain-environments/evm#base-sepolia
// The value `30` is valid for both Base Goerli and Base Mainnet. The value
// for Base Sepolia is `10004`.
const wormholeChainID = hre.network.name === "baseSepolia" ? 10004 : 30

const baseWormholeGateway = await deployments.get("BaseWormholeGateway")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const fakeArbitrumWormholeGateway =
"0x1af5DC16568EFF2d480a43A77E6C409e497FcFb9"

// See https://book.wormhole.com/reference/contracts.html
// This ID is valid for both Arbitrum Goerli and Mainnet
const arbitrumWormholeChainID = 23
// See https://docs.wormhole.com/wormhole/blockchain-environments/evm#arbitrum
// and https://docs.wormhole.com/wormhole/blockchain-environments/evm#arbitrum-sepolia
// The value `23` is valid for both Arbitrum Goerli and Arbitrum Mainnet. The
// value for Arbitrum Sepolia is `10003`.
const arbitrumWormholeChainID =
hre.network.name === "baseSepolia" ? 10003 : 23

const arbitrumWormholeGateway = await deployments.getOrNull(
"ArbitrumWormholeGateway"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
"0x1af5DC16568EFF2d480a43A77E6C409e497FcFb9"

// See https://book.wormhole.com/reference/contracts.html
// This ID is valid for both Polygon Testnet (Mumbai) and Mainnet
// This ID is valid for both Polygonn Goerli-based Testnet (Mumbai) and
// Mainnet. Wormhole does not support the Sepolia-based Amoy Testnet yet.
// TODO: Update the ID once the support is added.
const polygonWormholeChainID = 5
Comment on lines +14 to 17
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure how the deploy on baseSepolia will behave when the polygonWormholeChainID does point to the value which is good for Mumbai and Polygon Mainnet, but not for Sepolia--based Amoy... Should I skip this script for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Until new Polygon testnet is supported by Wormhole, we can skip this script during deploy.


const polygonWormholeGateway = await deployments.getOrNull(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const fakeOptimismWormholeGateway =
"0x2af5DC16568EFF2d480a43A77E6C409e497FcFb9"

// See https://book.wormhole.com/reference/contracts.html
// This ID is valid for both Optimism Goerli and Mainnet
const optimismWormholeChainID = 24
// See https://docs.wormhole.com/wormhole/blockchain-environments/evm#optimism
// and https://docs.wormhole.com/wormhole/blockchain-environments/evm#optimism-sepolia
// The value `24` is valid for both Optimism Goerli and Optimism Mainnet. The
// value for Optimism Sepolia is `10005`.
const optimismWormholeChainID =
hre.network.name === "baseSepolia" ? 10005 : 24

const optimismWormholeGateway = await deployments.getOrNull(
"OptimismWormholeGateway"
Expand Down
42 changes: 42 additions & 0 deletions cross-chain/base/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ const config: HardhatUserConfig = {
: undefined,
tags: ["etherscan"],
},
sepolia: {
url: process.env.L1_CHAIN_API_URL || "",
chainId: 11155111,
deploy: ["deploy_l1"],
accounts: process.env.L1_ACCOUNTS_PRIVATE_KEYS
? process.env.L1_ACCOUNTS_PRIVATE_KEYS.split(",")
: undefined,
tags: ["etherscan"],
},
mainnet: {
url: process.env.L1_CHAIN_API_URL || "",
chainId: 1,
Expand All @@ -68,6 +77,21 @@ const config: HardhatUserConfig = {
// l1: "goerli",
// },
},
baseSepolia: {
url: process.env.L2_CHAIN_API_URL || "",
chainId: 84532,
deploy: ["deploy_l2"],
accounts: process.env.L2_ACCOUNTS_PRIVATE_KEYS
? process.env.L2_ACCOUNTS_PRIVATE_KEYS.split(",")
: undefined,
tags: ["basescan"],
// In case of deployment failing with underpriced transaction error set
// the `gasPrice` parameter.
// gasPrice: 1000000000,
// companionNetworks: {
// l1: "sepolia",
// },
},
base: {
url: process.env.L2_CHAIN_API_URL || "",
chainId: 8453,
Expand All @@ -88,24 +112,30 @@ const config: HardhatUserConfig = {
external: {
deployments: {
goerli: ["./external/goerli"],
sepolia: ["./external/sepolia"],
mainnet: ["./external/mainnet"],
baseGoerli: ["./external/baseGoerli"],
baseSepolia: ["./external/baseSepolia"],
base: ["./external/base"],
},
},

deploymentArtifactsExport: {
goerli: "artifacts/l1",
sepolia: "artifacts/l1",
mainnet: "artifacts/l1",
baseGoerli: "artifacts/l2",
baseSepolia: "artifacts/l2",
base: "artifacts/l2",
},

etherscan: {
apiKey: {
goerli: process.env.ETHERSCAN_API_KEY,
sepolia: process.env.ETHERSCAN_API_KEY,
mainnet: process.env.ETHERSCAN_API_KEY,
"base-goerli": process.env.BASESCAN_API_KEY,
"base-sepolia": process.env.BASESCAN_API_KEY,
"base-mainnet": process.env.BASESCAN_API_KEY,
},
customChains: [
Expand All @@ -117,6 +147,14 @@ const config: HardhatUserConfig = {
browserURL: "https://goerli.basescan.org",
},
},
{
network: "base-sepolia",
chainId: 84532,
urls: {
apiURL: "https://api-sepolia.basescan.org/api",
browserURL: "https://sepolia.basescan.org",
},
},
{
network: "base-mainnet",
chainId: 8453,
Expand All @@ -132,14 +170,18 @@ const config: HardhatUserConfig = {
deployer: {
default: 1,
goerli: 0,
sepolia: 0,
baseGoerli: 0,
baseSepolia: 0,
mainnet: "0x123694886DBf5Ac94DDA07135349534536D14cAf",
base: "0x123694886DBf5Ac94DDA07135349534536D14cAf",
},
governance: {
default: 2,
goerli: 0,
sepolia: 0,
baseGoerli: 0,
baseSepolia: 0,
mainnet: "0x9f6e831c8f8939dc0c830c6e492e7cef4f9c2f5f", // Threshold Council
base: "0x518385dd31289F1000fE6382b0C65df4d1Cd3bfC", // Threshold Council
},
Expand Down
1 change: 1 addition & 0 deletions cross-chain/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"lint:config:fix": "prettier --write '**/*.@(json|yaml)'",
"prepack": "tsc -p tsconfig.export.json && hardhat export-artifacts export/artifacts",
"export-artifacts:goerli": "yarn hardhat export-deployment-artifacts --network baseGoerli",
"export-artifacts:sepolia": "yarn hardhat export-deployment-artifacts --network baseSepolia",
"export-artifacts:mainnet": "yarn hardhat export-deployment-artifacts --network base",
"prepublishOnly": "npm run export-artifacts:$npm_config_network",
"test": "hardhat test"
Expand Down