-
Notifications
You must be signed in to change notification settings - Fork 10
/
hardhat.config.js
112 lines (103 loc) · 2.67 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
const fs = require('fs');
const dotenv = require('dotenv');
const taskNames = require('hardhat/builtin-tasks/task-names');
require('@nomiclabs/hardhat-etherscan');
require('@nomiclabs/hardhat-waffle');
require('@nomiclabs/hardhat-ethers');
require('hardhat-gas-reporter');
require('hardhat-deploy');
require('solidity-coverage');
dotenv.config();
const defaultNetwork = 'hardhat';
function mnemonic() {
try {
// 0xc64533F8d8dEbC301cb4791e6ED941Cb38473DE6
return fs.readFileSync('./mnemonic.txt').toString().trim();
} catch (e) {
if (defaultNetwork !== 'localhost') {
console.log('☢️ WARNING: No mnemonic file created for a deploy account.');
}
}
return '';
}
const infuraId = process.env.INFURA_ID;
module.exports = {
defaultNetwork,
networks: {
hardhat: {
allowUnlimitedContractSize: true,
},
localhost: {
url: 'http://localhost:8545',
blockGasLimit: 0x1fffffffffffff,
},
goerli: {
url: 'https://goerli.infura.io/v3/' + infuraId,
accounts: {
mnemonic: mnemonic(),
},
},
sepolia: {
url: 'https://sepolia.infura.io/v3/' + infuraId,
accounts: {
mnemonic: mnemonic(),
},
},
mainnet: {
url: 'https://mainnet.infura.io/v3/' + infuraId,
accounts: {
mnemonic: mnemonic(),
},
},
},
namedAccounts: {
deployer: {
default: 0,
},
feeCollector: {
default: 0,
},
},
paths: {
sources: './contracts/',
},
solidity: {
version: '0.8.16',
settings: {
optimizer: {
enabled: true,
// https://docs.soliditylang.org/en/v0.8.10/internals/optimizer.html#:~:text=Optimizer%20Parameter%20Runs,-The%20number%20of&text=A%20%E2%80%9Cruns%E2%80%9D%20parameter%20of%20%E2%80%9C,is%202**32%2D1%20.
runs: 200,
},
},
},
mocha: {
// bail: true,
timeout: 100000000,
},
gasReporter: {
currency: 'USD',
// gasPrice: 21,
enabled: !!process.env.REPORT_GAS,
showTimeSpent: true,
},
etherscan: {
apiKey: `${process.env.ETHERSCAN_API_KEY}`,
},
};
task('deploy-ballot', 'Deploy a buffer ballot of a given duration')
.addParam('duration', 'Set the ballot duration (in seconds)')
.setAction(async (taskArgs, hre) => {
try {
const { deploy } = deployments;
const [deployer] = await hre.ethers.getSigners();
const JBReconfigurationBufferBallot = await deploy('JBReconfigurationBufferBallot', {
from: deployer.address,
log: true,
args: [taskArgs.duration],
});
console.log('Buffer ballot deployed at ' + JBReconfigurationBufferBallot.address);
} catch (error) {
console.log(error);
}
});