-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.cts
137 lines (131 loc) · 4.42 KB
/
hardhat.config.cts
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import { writeFile } from 'node:fs/promises';
import { join } from 'node:path';
import '@nomicfoundation/hardhat-toolbox-viem';
import 'dotenv/config';
import { TASK_COMPILE_SOLIDITY } from 'hardhat/builtin-tasks/task-names.js';
import { type HardhatUserConfig, subtask } from 'hardhat/config.js';
import {
astar,
base,
baseSepolia,
bob,
mainnet,
moonbeam,
moonriver,
polygonMumbai,
sepolia,
} from 'viem/chains';
subtask(TASK_COMPILE_SOLIDITY).setAction(async (_, { config }, runSuper) => {
const superRes = await runSuper();
try {
await writeFile(join(config.paths.artifacts, 'package.json'), '{ "type": "commonjs" }');
} catch (error) {
console.error('Error writing package.json: ', error);
}
return superRes;
});
const config: HardhatUserConfig = {
solidity: '0.8.21',
networks: {
base: {
url: process.env.BASE || 'https://mainnet.base.org',
chainId: base.id,
accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
baseSepolia: {
chainId: baseSepolia.id,
url: process.env.BASE_GOERLI_URL || 'https://sepolia.base.org',
accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
mumbai: {
url: process.env.MUMBAI_URL || 'https://rpc-mumbai.maticvigil.com',
chainId: polygonMumbai.id,
accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
gasPrice: 2500000000,
},
sepolia: {
url: process.env.SEPOLIA_URL || 'https://rpc.sepolia.dev',
chainId: sepolia.id,
accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
ethereum: {
url: process.env.ETHEREUM_URL || 'https://eth.drpc.org',
chainId: mainnet.id,
accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
// gasPrice: 12000000000,
},
astar: {
url: process.env.ASTAR_URL || 'https://evm.astar.network',
chainId: astar.id,
accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
moonbeam: {
url: process.env.MOONBEAM_URL || 'https://rpc.api.moonbeam.network',
chainId: moonbeam.id,
accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
moonbaseAlpha: {
url: 'https://moonbase-alpha.public.blastapi.io',
chainId: 1287,
accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
gasPrice: 1000000000,
},
moonriver: {
url: process.env.MOONRIVER_URL || 'https://rpc.api.moonriver.moonbeam.network',
chainId: moonriver.id,
accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
bob: {
url: 'https://rpc.gobob.xyz/',
chainId: bob.id,
accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
},
etherscan: {
apiKey: {
base: process.env.BASESCAN_API_KEY || '', // Base Etherscan API Key
baseSepolia: process.env.BASESCAN_API_KEY || '', // Base Goerli Etherscan API Key
sepolia: process.env.ETHERSCAN_API_KEY || '', // Sepolia Etherscan API Key
mumbai: process.env.POLYGONSCAN_API_KEY || '', // Polygon Mumbai Etherscan API Key
ethereum: process.env.ETHERSCAN_API_KEY || '', // Ethereum Etherscan API Key
moonbeam: process.env.MOONSCAN_APIKEY || '', // Moonbeam Moonscan API Key
moonbaseAlpha: process.env.MOONBEAM_MOONSCAN_APIKEY || '', // Moonbeam Moonscan API Key
bob: process.env.BOBSCAN_APIKEY || '', // Bob Testnet API Key
},
customChains: [
{
network: 'baseSepolia',
chainId: baseSepolia.id,
urls: {
apiURL: 'https://base-sepolia.blockscout.com/api',
browserURL: 'https://base-sepolia.blockscout.com',
},
},
{
network: 'astar',
chainId: astar.id,
urls: {
apiURL: 'https://blockscout.com/astar/api',
browserURL: 'https://blockscout.com/astar',
},
},
{
network: 'base',
chainId: base.id,
urls: {
apiURL: 'https://api.basescan.org/api',
browserURL: 'https://basescan.org',
},
},
{
network: 'bob',
chainId: 60808,
urls: {
apiURL: 'https://explorer.gobob.xyz/api',
browserURL: 'https://explorer.gobob.xyz/',
},
},
],
},
};
export default config;