-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtruffle-config.js
More file actions
executable file
·70 lines (62 loc) · 1.88 KB
/
truffle-config.js
File metadata and controls
executable file
·70 lines (62 loc) · 1.88 KB
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
const ContractKit = require('@celo/contractkit');
const Web3 = require('web3');
require('dotenv').config({path: '.env'});
const HDWalletProvider = require('@truffle/hdwallet-provider');
const web3_alfajores = new Web3(process.env.ALFAJORES_REST_URL);
const web3_celo = new Web3(process.env.CELO_REST_URL);
// Initialise a Celo client
const client = ContractKit.newKitFromWeb3(web3_celo);
// Initialize account from our private key
const account = web3_celo.eth.accounts.privateKeyToAccount(process.env.PRIVATE_KEY);
// We need to add private key to ContractKit in order to sign transactions
client.addAccount(account.privateKey);
// Mnemonic phrase used with HDWallet
const mnemonicPhrase = process.env.MNEMONIC;
module.exports = {
compilers: {
solc: {
version: "0.8.0", // Fetch exact version from solc-bin
settings: { // See the solidity docs for advice about optimization and evmVersion
optimizer: {
runs: 200,
enabled: true
}
},
}
},
networks: {
test: {
host: "127.0.0.1",
port: 7545,
network_id: "*"
},
alfajores: {
provider: client.connection.web3.currentProvider, // CeloProvider
network_id: 44787 // Alfajores network id
},
celo: {
provider: client.connection.web3.currentProvider, // CeloProvider
network_id: 42220 // Celo network id
},
gnosis: {
provider: () =>
new HDWalletProvider({
mnemonic: {
phrase: mnemonicPhrase
},
providerOrUrl: process.env.GNOSIS_REST_URL,
}),
gas: 5000000,
gasPrice: 10000000000,
network_id: 100,
networkCheckTimeout: 1000000000,
confirmations: 5,
timeoutBlocks: 900
},
goerli: {
provider: () => new HDWalletProvider(mnemonic, `${process.env.GOERLI_REST_URL}${infuraProjectId}`),
network_id: 5,
chain_id: 5
},
}
};