-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtruffle.js
78 lines (70 loc) · 1.97 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
// Allows us to use ES6 in our migrations and tests.
require('babel-register');
const fs = require('fs');
const copySync = (src, dest, overwrite) => {
if (overwrite && fs.existsSync(dest)) {
fs.unlinkSync(dest);
}
const data = fs.readFileSync(src);
fs.writeFileSync(dest, data);
};
const createIfDoesntExist = dest => {
if (!fs.existsSync(dest)) {
fs.mkdirSync(dest);
}
};
// todo: support infura using client sign http://truffleframework.com/tutorials/using-infura-custom-provider
module.exports = {
build: (options, callback) => {
// copy truffle compiled contracts json to the web proj source directory so they can be used by truffle-contract
const srcDir = options.destination_directory + '/contracts/';
const dstDir = './src/contracts/';
createIfDoesntExist(dstDir);
fs.readdirSync(srcDir)
.forEach((file) => {
console.log(`Copying ${file}...`);
copySync(srcDir + file, dstDir + file);
});
},
version: '0.0.1',
rpc: {
host: 'localhost',
port: 8545,
gas: 4000000,
network_id: 5,
},
migrations_directory: './migrations',
networks: {
development: {
host: 'localhost',
port: 8545,
network_id: 5,
//gas: 3141592,
//gasPrice: 20000000000
},
testnet: { //ropsten
host: 'localhost',
port: 8545,
network_id: 3,
gas: 4000000,
gasPrice: 20000000000,
from: '0xeBA8e033aE04CF7B4fC9CFc3109e333692d3fb42'
},
rinkeby: {
host: 'localhost',
port: 8545,
network_id: 4
// optional config values:
// gas
// gasPrice
// from - default address to use for any transaction Truffle makes during migrations
// provider - web3 provider instance Truffle should use to talk to the Ethereum network.
// - if specified, host and port are ignored.
},
live: {
network_id: 1,
host: 'localhost',
port: 8546 // Different than the default test ports
}
}
};