Skip to content

Commit b46a18f

Browse files
authored
add custom hardhat network for bold scripts (#317)
* add custom hardhat network * fix config * remove l1 rpc from env
1 parent 80c1659 commit b46a18f

File tree

5 files changed

+26
-20
lines changed

5 files changed

+26
-20
lines changed

.env-sample

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
L1_RPC_URL="http://127.0.0.1:8545"
21
L1_PRIV_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
32
CONFIG_NETWORK_NAME="custom"
43
DEPLOYED_CONTRACTS_DIR="./scripts/files/"
54
DISABLE_VERIFICATION=true
5+
6+
# to use the 'custom' hardhat network, set the following variables
7+
CUSTOM_RPC_URL="http://127.0.0.1:8545"
8+
CUSTOM_ETHERSCAN_API_KEY=
9+
CUSTOM_CHAINID=1337
10+
CUSTOM_ETHERSCAN_API_URL=
11+
CUSTOM_ETHERSCAN_BROWSER_URL=

hardhat.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ module.exports = {
203203
? [process.env['DEVNET_PRIVKEY']]
204204
: [],
205205
},
206+
custom: {
207+
url: process.env['CUSTOM_RPC_URL'] || 'N/A'
208+
},
206209
geth: {
207210
url: 'http://localhost:8545',
208211
},
@@ -217,6 +220,7 @@ module.exports = {
217220
arbSepolia: process.env['ARBISCAN_API_KEY'],
218221
base: process.env['BASESCAN_API_KEY'],
219222
baseSepolia: process.env['BASESCAN_API_KEY'],
223+
custom: process.env['CUSTOM_ETHERSCAN_API_KEY'],
220224
},
221225
customChains: [
222226
{
@@ -235,6 +239,14 @@ module.exports = {
235239
browserURL: 'https://sepolia.arbiscan.io/',
236240
},
237241
},
242+
{
243+
network: 'custom',
244+
chainId: process.env['CUSTOM_CHAINID'],
245+
urls: {
246+
apiURL: process.env['CUSTOM_ETHERSCAN_API_URL'],
247+
browserURL: process.env['CUSTOM_ETHERSCAN_BROWSER_URL'],
248+
}
249+
}
238250
],
239251
},
240252
mocha: {

scripts/executeBoldUpgrade.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -815,13 +815,7 @@ async function getAllowedInboxesOutboxesFromBridge(bridge: Bridge) {
815815
}
816816

817817
async function main() {
818-
const l1RpcVal = process.env.L1_RPC_URL
819-
if (!l1RpcVal) {
820-
throw new Error('L1_RPC_URL env variable not set')
821-
}
822-
const l1Rpc = new ethers.providers.JsonRpcProvider(
823-
l1RpcVal
824-
) as JsonRpcProvider
818+
const l1Rpc = ethers.provider
825819

826820
const configNetworkName = process.env.CONFIG_NETWORK_NAME
827821
if (!configNetworkName) {

scripts/populateLookup.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { ethers, Wallet } from 'ethers'
1+
import { ethers } from 'hardhat'
2+
import { Wallet } from 'ethers'
23
import { DeployedContracts, getConfig, getJsonFile } from './boldUpgradeCommon'
34
import { populateLookup } from './boldUpgradeFunctions'
45
import dotenv from 'dotenv'
@@ -7,11 +8,7 @@ import path from 'path'
78
dotenv.config()
89

910
async function main() {
10-
const l1RpcVal = process.env.L1_RPC_URL
11-
if (!l1RpcVal) {
12-
throw new Error('L1_RPC_URL env variable not set')
13-
}
14-
const l1Rpc = new ethers.providers.JsonRpcProvider(l1RpcVal)
11+
const l1Rpc = ethers.provider
1512

1613
const l1PrivKey = process.env.L1_PRIV_KEY
1714
if (!l1PrivKey) {

scripts/prepareBoldUpgrade.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { ethers, Wallet } from 'ethers'
1+
import { ethers } from 'hardhat'
2+
import { Wallet } from 'ethers'
23
import fs from 'fs'
34
import { DeployedContracts, getConfig, getJsonFile } from './boldUpgradeCommon'
45
import { deployBoldUpgrade } from './boldUpgradeFunctions'
@@ -8,11 +9,7 @@ import path from 'path'
89
dotenv.config()
910

1011
async function main() {
11-
const l1RpcVal = process.env.L1_RPC_URL
12-
if (!l1RpcVal) {
13-
throw new Error('L1_RPC_URL env variable not set')
14-
}
15-
const l1Rpc = new ethers.providers.JsonRpcProvider(l1RpcVal)
12+
const l1Rpc = ethers.provider
1613

1714
const l1PrivKey = process.env.L1_PRIV_KEY
1815
if (!l1PrivKey) {

0 commit comments

Comments
 (0)