-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.js
89 lines (76 loc) · 2.26 KB
/
hardhat.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
require("@nomicfoundation/hardhat-ethers");
require("@nomicfoundation/hardhat-ledger");
require("@nomicfoundation/hardhat-toolbox");
require("dotenv").config({ path: `.env.${process.env.NODE_ENV}` });
// https://docs.base.org/guides/deploy-smart-contracts
const isUsingLedgerHardwareWallet = Boolean(process.env.LEDGER_HARDWARE_WALLET_PUB_KEY);
console.log(`Initializing hardhat.config.js with isUsingLedgerHardwareWallet=${isUsingLedgerHardwareWallet}`);
const config = {
solidity: {
version: "0.8.26",
},
networks: {},
defaultNetwork: "base-local",
etherscan: {
apiKey: {
'base-mainnet': process.env.BASESCAN_PRIVATE_API_KEY,
'base-sepolia': process.env.BASESCAN_PRIVATE_API_KEY,
},
customChains: [{
network: "base-mainnet",
chainId: 8453,
urls: {
apiURL: "https://api.basescan.org/api",
browserURL: "https://basescan.org"
}
}, {
network: "base-sepolia",
chainId: 84532,
urls: {
apiURL: "https://api-sepolia.basescan.org/api",
browserURL: "https://sepolia.basescan.org"
}
}]
},
};
if (process.env.NODE_ENV === "development") {
config.networks["base-local"] = {
url: "http://localhost:8545",
accounts: [
process.env.WALLET_PRIVATE_KEY_OWNER,
process.env.WALLET_PRIVATE_KEY_NON_OWNER,
],
gasPrice: 1000000000,
};
} else if (process.env.NODE_ENV === "staging") {
config.networks["base-sepolia"] = {
url: "https://sepolia.base.org",
accounts:
isUsingLedgerHardwareWallet ? undefined : [process.env.WALLET_PRIVATE_KEY_OWNER],
ledgerAccounts:
isUsingLedgerHardwareWallet ? [process.env.LEDGER_HARDWARE_WALLET_PUB_KEY] : undefined,
gasPrice: 1000000000,
verify: {
etherscan: {
apiUrl: "https://api-sepolia.basescan.org",
apiKey: process.env.BASESCAN_PRIVATE_API_KEY,
},
},
};
} else if (process.env.NODE_ENV === "production") {
config.networks["base-mainnet"] = {
url: "https://mainnet.base.org",
accounts:
isUsingLedgerHardwareWallet ? undefined : [process.env.WALLET_PRIVATE_KEY_OWNER],
ledgerAccounts:
isUsingLedgerHardwareWallet ? [process.env.LEDGER_HARDWARE_WALLET_PUB_KEY] : undefined,
gasPrice: 1000000000,
verify: {
etherscan: {
apiUrl: "https://api.basescan.org",
apiKey: process.env.BASESCAN_PRIVATE_API_KEY
},
},
};
}
module.exports = config;