-
Notifications
You must be signed in to change notification settings - Fork 0
/
truffle-config.js
50 lines (47 loc) · 1.1 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
const path = require('path')
const HDWalletProvider = require('@truffle/hdwallet-provider')
require('dotenv').config()
const networkIds = {
mainnet: 1,
ropsten: 3,
rinkeby: 4,
goerli: 5,
kovan: 42,
}
const getInfuraNetworkConfig = networkName => {
return {
provider: () =>
new HDWalletProvider({
mnemonic: process.env.MNEMONIC,
providerOrUrl: `https://${networkName}.infura.io/v3/${process.env.INFURA_PRODUCT_ID}`,
}),
network_id: networkIds[networkName],
}
}
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
compilers: {
solc: {
version: '0.8.0',
},
},
// Contracts
contracts_build_directory: path.join(__dirname, 'client/src/contracts'),
// Networks
networks: {
// Local
develop: {
host: '127.0.0.1',
port: 8545,
network_id: 5777,
},
// Mainnet
mainnet: getInfuraNetworkConfig('mainnet'),
// Testnets
ropsten: getInfuraNetworkConfig('ropsten'),
rinkeby: getInfuraNetworkConfig('rinkeby'),
goerli: getInfuraNetworkConfig('goerli'),
kovan: getInfuraNetworkConfig('kovan'),
},
}