generated from gretzke/hardhat-typescript-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.ts
82 lines (76 loc) · 1.9 KB
/
hardhat.config.ts
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
import '@nomicfoundation/hardhat-toolbox';
import '@openzeppelin/hardhat-upgrades';
import '@primitivefi/hardhat-marmite';
import { HardhatUserConfig, task } from 'hardhat/config';
require('dotenv').config();
const baseConfig: HardhatUserConfig = {
defaultNetwork: 'hardhat',
networks: {},
solidity: {
compilers: [
{
version: '0.8.19',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
],
},
gasReporter: {
currency: 'USD',
// gasPrice: 100,
enabled: process.env.REPORT_GAS === 'true',
excludeContracts: [],
coinmarketcap: process.env.COINMARKETCAP_API_KEY,
token: 'MATIC',
},
mocha: {
timeout: 100000,
},
};
const networks = () => {
if (process.env.ENV === 'dev') {
return {
...baseConfig.networks,
sepolia: {
url: 'https://sepolia.infura.io/v3/' + process.env.INFURA_TOKEN,
chainId: 11155111,
accounts: {
mnemonic: process.env.MNEMONIC_DEV as string,
},
},
local: {
url: 'http://127.0.0.1:7545',
accounts: {
mnemonic: process.env.MNEMONIC_DEV_LOCAL as string,
},
},
};
} else if (process.env.ENV === 'prod') {
return {
...baseConfig.networks,
mainnet: {
url: 'https://mainnet.infura.io/v3/' + process.env.INFURA_TOKEN,
accounts: {
mnemonic: process.env.MNEMONIC as string,
},
},
};
}
return baseConfig.networks;
};
const config: HardhatUserConfig = {
...baseConfig,
networks: networks(),
etherscan: !process.env.ETHERSCAN_TOKEN ? {} : { apiKey: process.env.ETHERSCAN_TOKEN },
};
task('accounts', 'Prints the list of accounts', async (args, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(await account.address);
}
});
export default config;