forked from rarible/protocol-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
truffle-config.js
81 lines (73 loc) · 2.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
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
const os = require('os');
let apiKey;
try {
console.log(`Loading etherscan key from ${os.homedir() + "/.ethereum/etherscan.json"}`);
apiKey = require(os.homedir() + "/.ethereum/etherscan.json").apiKey;
console.log("loaded etherscan api key");
} catch {
console.log("unable to load etherscan key from config")
apiKey = "UNKNOWN"
}
function createNetwork(name) {
try {
var json = require(os.homedir() + "/.ethereum/" + name + ".json");
var gasPrice = json.gasPrice != null ? json.gasPrice : 2000000000;
return {
provider: () => {
const { estimate } = require("@rarible/estimate-middleware")
if (json.path != null) {
const { createProvider: createTrezorProvider } = require("@rarible/trezor-provider")
const provider = createTrezorProvider({ url: json.url, path: json.path, chainId: json.network_id })
provider.send = provider.sendAsync
return provider
} else {
return createProvider(json.address, json.key, json.url)
}
},
from: json.address,
gas: 1000000,
gasPrice: gasPrice + "000000000",
network_id: json.network_id,
skipDryRun: true,
networkCheckTimeout: 500000
};
} catch (e) {
return null;
}
}
function createProvider(address, key, url) {
console.log("creating provider for address: " + address);
var HDWalletProvider = require("@truffle/hdwallet-provider");
return new HDWalletProvider(key, url);
}
module.exports = {
api_keys: {
etherscan: apiKey
},
plugins: [
'truffle-plugin-verify'
],
networks: {
e2e: createNetwork("e2e"),
ops: createNetwork("ops"),
ropsten: createNetwork("ropsten"),
mainnet: createNetwork("mainnet"),
rinkeby: createNetwork("rinkeby"),
rinkeby2: createNetwork("rinkeby2"),
polygon_mumbai: createNetwork("polygon_mumbai"),
polygon_mainnet: createNetwork("polygon_mainnet"),
dev: createNetwork("dev")
},
compilers: {
solc: {
version: "0.7.6",
settings: {
optimizer: {
enabled : true,
runs: 200
},
evmVersion: "istanbul"
}
}
}
}