forked from clrfund/monorepo
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathhardhat.config.ts
167 lines (160 loc) · 3.82 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
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import fs from 'fs'
import path from 'path'
import dotenv from 'dotenv'
import { HardhatUserConfig, task } from 'hardhat/config'
import '@nomiclabs/hardhat-waffle'
import '@nomiclabs/hardhat-ganache'
import 'hardhat-contract-sizer'
dotenv.config()
const GAS_LIMIT = 20000000
const WALLET_MNEMONIC = process.env.WALLET_MNEMONIC
const WALLET_PRIVATE_KEY = process.env.WALLET_PRIVATE_KEY
let accounts
if (WALLET_MNEMONIC) {
accounts = { mnemonic: WALLET_MNEMONIC }
}
if (WALLET_PRIVATE_KEY) {
accounts = [WALLET_PRIVATE_KEY]
}
const config: HardhatUserConfig = {
networks: {
hardhat: {
gas: GAS_LIMIT,
blockGasLimit: GAS_LIMIT,
},
localhost: {
url: 'http://127.0.0.1:18545',
timeout: 60000,
gas: GAS_LIMIT,
blockGasLimit: GAS_LIMIT,
},
ganache: {
// Workaround for https://github.com/nomiclabs/hardhat/issues/518
url: 'http://127.0.0.1:8555',
gasLimit: GAS_LIMIT,
} as any,
rinkeby: {
url: process.env.JSONRPC_HTTP_URL || 'http://127.0.0.1:8545',
accounts,
},
gnosis: {
url: process.env.JSONRPC_HTTP_URL || 'https://rpc.xdaichain.com',
timeout: 60000,
accounts,
},
rinkarby: {
url: process.env.JSONRPC_HTTP_URL || 'https://rinkeby.arbitrum.io/rpc',
accounts,
},
arbitrum: {
url: process.env.JSONRPC_HTTP_URL || 'https://arb1.arbitrum.io/rpc',
accounts,
},
},
paths: {
artifacts: 'build/contracts',
tests: 'tests',
},
contractSizer: {
alphaSort: true,
runOnCompile: true,
disambiguatePaths: false,
},
solidity: {
version: '0.6.12',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
overrides: {
'contracts/FundingRoundFactory.sol': {
version: '0.6.12',
settings: {
optimizer: {
enabled: true,
runs: 1000000,
},
},
},
'contracts/FundingRound.sol': {
version: '0.6.12',
settings: {
optimizer: {
enabled: true,
runs: 1000000,
},
},
},
'contracts/snarkVerifiers/BatchUpdateStateTreeVerifier32.sol': {
version: '0.6.12',
settings: {
optimizer: {
enabled: true,
runs: 10000000,
},
},
},
'contracts/snarkVerifiers/QuadVoteTallyVerifier32.sol': {
version: '0.6.12',
settings: {
optimizer: {
enabled: true,
runs: 10000000,
},
},
},
'contracts/recipientRegistry/OptimisticRecipientRegistry.sol': {
version: '0.6.12',
settings: {
optimizer: {
enabled: true,
runs: 1000000,
},
},
},
'contracts/userRegistry/SimpleUserRegistry.sol': {
version: '0.6.12',
settings: {
optimizer: {
enabled: true,
runs: 1000000,
},
},
},
'contracts/userRegistry/BrightIdUserRegistry.sol': {
version: '0.6.12',
settings: {
optimizer: {
enabled: true,
runs: 1000000,
},
},
},
},
},
}
task(
'compile',
'Compiles the entire project, building all artifacts',
async (_, { config }, runSuper) => {
await runSuper()
// Copy Poseidon artifacts
const poseidons = ['PoseidonT3', 'PoseidonT6']
for (const contractName of poseidons) {
const artifact = JSON.parse(
fs
.readFileSync(
`../node_modules/maci-contracts/compiled/${contractName}.json`
)
.toString()
)
fs.writeFileSync(
path.join(config.paths.artifacts, `${contractName}.json`),
JSON.stringify({ ...artifact, linkReferences: {} })
)
}
}
)
export default config