forked from aragon/aragonOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
truffle-config.js
69 lines (57 loc) · 1.62 KB
/
truffle-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
const homedir = require('os').homedir
const path = require('path')
const HDWalletProvider = require('@truffle/hdwallet-provider')
const DEFAULT_MNEMONIC =
'explain tackle mirror kit van hammer degree position ginger unfair soup bonus'
const defaultRPC = network => `https://${network}.eth.aragon.network`
const configFilePath = filename => path.join(homedir(), `.aragon/${filename}`)
const mnemonic = () => {
try {
return require(configFilePath('mnemonic.json')).mnemonic
} catch (e) {
return DEFAULT_MNEMONIC
}
}
const settingsForNetwork = network => {
try {
return require(configFilePath(`${network}_key.json`))
} catch (e) {
return {}
}
}
// Lazily loaded provider
const providerForNetwork = network => () => {
let { rpc, keys } = settingsForNetwork(network)
rpc = rpc || defaultRPC(network)
if (!keys || keys.length === 0) {
return new HDWalletProvider(mnemonic(), rpc)
}
return new HDWalletProvider(keys, rpc)
}
const mochaGasSettings = {
reporter: 'eth-gas-reporter',
reporterOptions: {
currency: 'USD',
gasPrice: 3,
},
}
const mocha = process.env.GAS_REPORTER ? mochaGasSettings : {}
module.exports = {
networks: {
matic: {
network_id: 137,
provider: providerForNetwork('matic'),
gasPrice: 200e9
}
},
build: {},
mocha,
solc: {
optimizer: {
// See the solidity docs for advice about optimization and evmVersion
// https://solidity.readthedocs.io/en/v0.5.12/using-the-compiler.html#setting-the-evm-version-to-target
enabled: true,
runs: 10000, // Optimize for how many times you intend to run the code
},
},
}