forked from eth-infinitism/account-abstraction
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.ts
81 lines (68 loc) · 2.2 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
import '@nomiclabs/hardhat-waffle'
import '@typechain/hardhat'
import { HardhatUserConfig, task } from 'hardhat/config'
import 'hardhat-deploy'
import '@nomiclabs/hardhat-etherscan'
import 'solidity-coverage'
import * as fs from 'fs'
const SALT = '0x90d8084deab30c2a37c45e8d47f49f2f7965183cb6990a98943ef94940681de3'
process.env.SALT = process.env.SALT ?? SALT
task('deploy', 'Deploy contracts')
.addFlag('simpleAccountFactory', 'deploy sample factory (by default, enabled only on localhost)')
const mnemonicFileName = process.env.MNEMONIC_FILE!
let mnemonic = 'test '.repeat(11) + 'junk'
if (fs.existsSync(mnemonicFileName)) { mnemonic = fs.readFileSync(mnemonicFileName, 'ascii') }
function getNetwork1 (url: string): { url: string, accounts: { mnemonic: string } } {
return {
url,
accounts: { mnemonic }
}
}
function getNetwork (name: string): { url: string, accounts: { mnemonic: string } } {
return getNetwork1(`https://${name}.infura.io/v3/${process.env.INFURA_ID}`)
// return getNetwork1(`wss://${name}.infura.io/ws/v3/${process.env.INFURA_ID}`)
}
const optimizedComilerSettings = {
version: '0.8.23',
settings: {
optimizer: { enabled: true, runs: 1000000 },
viaIR: true
}
}
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
const config: HardhatUserConfig = {
solidity: {
compilers: [{
version: '0.8.23',
settings: {
optimizer: { enabled: true, runs: 1000000 }
}
}],
overrides: {
'contracts/core/EntryPoint.sol': optimizedComilerSettings,
'contracts/samples/SimpleAccount.sol': optimizedComilerSettings
}
},
networks: {
dev: { url: 'http://localhost:8545' },
// github action starts localgeth service, for gas calculations
localgeth: { url: 'http://localgeth:8545' },
goerli: getNetwork('goerli'),
sepolia: getNetwork('sepolia'),
proxy: getNetwork1('http://localhost:8545')
},
mocha: {
timeout: 10000
},
// @ts-ignore
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY
}
}
// coverage chokes on the "compilers" settings
if (process.env.COVERAGE != null) {
// @ts-ignore
config.solidity = config.solidity.compilers[0]
}
export default config