forked from yarrumretep/PortCoin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
truffle.js
54 lines (48 loc) · 1.26 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
var Wallet = require('ethereumjs-wallet');
var WalletProvider = require("truffle-wallet-provider");
var fs = require('fs');
var network = null;
process.argv.forEach((arg,i) => {
if(arg === "--network"){
network = process.argv[i+1];
} else if(arg.startsWith("--network=")) {
network = arg.substring("--network=".length);
}
})
var maxgas = 4612388;
networks = {
development: {
host: "localhost",
port: 9545,
network_id: "*", // Match any network id
gas: maxgas
}
}
var key = fs.readFileSync('/Users/pete/.demo.private.key', 'utf8');
var wallet = Wallet.fromPrivateKey(Buffer.from(key.substring(2), 'hex'));
var nodes = {
'mainnet': 'https://mainnet.infura.io/bOyWfPGcs8jj2g9UXNYr',
'kovan': 'https://kovan.infura.io/bOyWfPGcs8jj2g9UXNYr'
}
function addNetwork(name) {
console.log("Configuring network: " + name);
if(!networks[name]) {
networks[name] = {
provider: new WalletProvider(wallet, nodes[name]),
from: wallet.getAddressString(),
network_id: "*", // Match any network id
gasPrice:20000000000,
gas: maxgas
};
}
}
if(network) {
addNetwork(network);
} else {
console.log("Configuring network: development");
network = 'development';
}
module.exports = {
network,
networks: networks
};