-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtruffle.js
124 lines (121 loc) · 4.63 KB
/
truffle.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
113
114
115
116
117
118
119
120
121
122
123
124
// Truffle 5 - https://github.com/trufflesuite/truffle/releases/tag/v5.0.0#user-content-what-s-new-in-truffle-v5-interacting-with-your-contracts-websockets
// Allows us to use ES6 in our migrations and tests.
require('@babel/register');
require('dotenv').config()
// Default Bulder for Truffle >v3.0
var DefaultBuilder = require("truffle-default-builder");
const HDWalletProvider = require("truffle-hdwallet-provider");
module.exports = {
/*
* Build config of front-end that uses `build` to either
* invokes Default Builder or Custom Build Pipeline process (i.e. webpack).
*
* Notes:
* - If string specified on right hand side ends in a "/" it is interpreted as a directory
* - All paths specified on right hand side are relative to the app/ directory
* - Build target must only be called app.js for the Default Builder to append code to
*
* Reference:
* - https://github.com/trufflesuite/truffle-default-builder/tree/master
* - http://truffleframework.com/docs/advanced/build_processes
*/
// Runs the `webpack` command on each build.
//
// The following environment variables are set when running the command:
// WORKING_DIRECTORY: root location of the project
// BUILD_DESTINATION_DIRECTORY: expected destination of built assets (important for `truffle serve`)
// BUILD_CONTRACTS_DIRECTORY: root location of your build contract files (.sol.js)
//
build: "webpack",
// RPC details of how to connect to Ethereum client for each network
//
// Options:
// - `host` and `port` keys required
//
rpc: {
host: "localhost",
port: 8545
},
// Networks optionally specified so that when contract abstractions detect that Ethereum client is
// connected to specific network it uses specific contract artifacts that were saved and
// recorded earlier during compiling and migrations that are associated with that network
// to simplify app deplyment.
//
// Notes:
// - Networks identified through Ethereums `net_version` RPC call
// - `networks` object has network name as key, and value is object defining parameters
// of the network.
// - Must specify `network_id` with value (i.e. `default` for catch-all, `*`)
// - `default` network used during development where contract artifacts not matter long-term
// and `network_id` continuously chances if TestRPC is restarted
networks: {
// Optional config values:
// - host - Hostname pointing to networ location of Ethereum client
// (defaults to "localhost" for development)
// - port - Port number where Ethereum client accepts requests (defaults to 8545)
// - gas - Gas limit for deploys (default is 3141592)
// - gasPrice - Gas price used for deploys (default is 100000000000) (100 Shannon)
// - from - From address used during any transaction Truffle makes during migrations
// (defaults to first available account provided by Ethereum client)
//
// Ethereum public network
"live": {
network_id: 1,
},
// Official Ethereum test network with Random IP
"morden": {
network_id: 2,
host: "178.25.19.88",
port: 80
},
"ropsten": {
provider: () => new HDWalletProvider(process.env.MNEMONIC, "https://ropsten.infura.io/v3/" + process.env.INFURA_API_PROJECT_ID),
network_id: 3,
gas: 5500000, // Ropsten has a lower block limit than mainnet
gasPrice: 10000000000,
confirmations: 2, // # of confs to wait between deployments. (default: 0)
skipDryRun: true,
// websockets: false
// gasPrice: 10000000000,
networkCheckTimeout: "100000",
// confirmations: 2, // # of confs to wait between deployments. (default: 0)
// skipDryRun: true,
websockets: false
},
"rinkeby": {
provider: () => new HDWalletProvider(process.env.MNEMONIC, "https://rinkeby.infura.io/v3/" + process.env.INFURA_API_PROJECT_ID),
network_id: 4,
gas: 3000000,
gasPrice: 10000000000,
websockets: false
},
// Custom private network using default rpc settings
"staging": {
network_id: 1337
},
// Triggered when `truffle develop` is run
develop: {
network_id: 3,
accounts: 5,
defaultEtherBalance: 500,
networkCheckTimeout: "10000",
port: 8545
},
"development": {
accounts: 5,
blockTime: 3,
defaultEtherBalance: 500,
host: "localhost",
port: 8545,
// `default` - Catch-all
// `*` - Match any network id
network_id: "*",
networkCheckTimeout: "10000",
websockets: true
}
},
// Config options for Mocha testing framework
mocha: {
useColors: true
}
};