forked from cartesi/compute
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.ts
178 lines (171 loc) · 6.01 KB
/
hardhat.config.ts
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
import { HardhatUserConfig, task } from "hardhat/config";
import { HttpNetworkUserConfig } from "hardhat/types";
import "@nomiclabs/hardhat-waffle";
import "hardhat-typechain";
import "hardhat-deploy";
import "hardhat-deploy-ethers";
import "@nomiclabs/hardhat-solpp";
// import "solidity-coverage"; @dev WIP this plugin is not updated to hardhat yet
// This is a sample hardhat task. To learn how to create your own go to
// https://hardhat.dev/guides/create-task.html
task("accounts", "Prints the list of accounts", async (taskArgs, bre) => {
const accounts = await bre.ethers.getSigners();
for (const account of accounts) {
console.log(await account.getAddress());
}
});
// read MNEMONIC from file or from env variable
let mnemonic = process.env.MNEMONIC;
const infuraNetwork = (
network: string,
chainId?: number,
gas?: number
): HttpNetworkUserConfig => {
return {
url: `https://${network}.infura.io/v3/${process.env.PROJECT_ID}`,
chainId,
gas,
accounts: mnemonic ? { mnemonic } : undefined,
};
};
const config: HardhatUserConfig = {
networks: {
hardhat: mnemonic ? { accounts: { mnemonic } } : {},
localhost: {
url: "http://localhost:8545",
accounts: mnemonic ? { mnemonic } : undefined,
},
coverage: {
url: "http://localhost:8555", // <-- If you change this, also set the port option in .solcover.js.
// chainId: "*", // not set means it's ignored
gas: 0xfffffffffff, // <-- Use this high gas value
gasPrice: 0x01, // <-- Use this low gas price
},
rinkeby: infuraNetwork("rinkeby", 4, 6283185),
kovan: infuraNetwork("kovan", 42, 6283185),
goerli: infuraNetwork("goerli", 5, 6283185),
matic_testnet: infuraNetwork("polygon-mumbai", 80001),
bsc_testnet: {
url: "https://data-seed-prebsc-2-s2.binance.org:8545/",
chainId: 97,
accounts: mnemonic ? { mnemonic } : undefined,
},
avax_testnet: {
url: "https://api.avax-test.network/ext/bc/C/rpc",
chainId: 0xa869,
accounts: mnemonic ? { mnemonic } : undefined,
},
},
solidity: {
version: "0.7.4",
settings: {
optimizer: {
runs: 110,
enabled: true,
},
},
},
paths: {
artifacts: "artifacts",
deploy: "deploy",
deployments: "deployments",
},
external: {
contracts: [
{
artifacts: "node_modules/@cartesi/util/export/artifacts",
deploy: "node_modules/@cartesi/util/dist/deploy",
},
{
artifacts: "node_modules/@cartesi/arbitration/export/artifacts",
deploy: "node_modules/@cartesi/arbitration/dist/deploy",
},
{
artifacts: "node_modules/@cartesi/logger/export/artifacts",
deploy: "node_modules/@cartesi/logger/dist/deploy",
},
{
deploy:
"node_modules/@cartesi/machine-solidity-step/dist/deploy",
artifacts:
"node_modules/@cartesi/machine-solidity-step/export/artifacts",
},
],
deployments: {
rinkeby: [
"node_modules/@cartesi/util/deployments/rinkeby",
"node_modules/@cartesi/arbitration/deployments/rinkeby",
"node_modules/@cartesi/logger/deployments/rinkeby",
"node_modules/@cartesi/machine-solidity-step/deployments/rinkeby",
],
kovan: [
"node_modules/@cartesi/util/deployments/kovan",
"node_modules/@cartesi/arbitration/deployments/kovan",
"node_modules/@cartesi/logger/deployments/kovan",
"node_modules/@cartesi/machine-solidity-step/deployments/kovan",
],
goerli: [
"node_modules/@cartesi/util/deployments/goerli",
"node_modules/@cartesi/arbitration/deployments/goerli",
"node_modules/@cartesi/logger/deployments/goerli",
"node_modules/@cartesi/machine-solidity-step/deployments/goerli",
],
matic_testnet: [
"node_modules/@cartesi/util/deployments/matic_testnet",
"node_modules/@cartesi/arbitration/deployments/matic_testnet",
"node_modules/@cartesi/logger/deployments/matic_testnet",
"node_modules/@cartesi/machine-solidity-step/deployments/matic_testnet",
],
bsc_testnet: [
"node_modules/@cartesi/util/deployments/bsc_testnet",
"node_modules/@cartesi/arbitration/deployments/bsc_testnet",
"node_modules/@cartesi/logger/deployments/bsc_testnet",
"node_modules/@cartesi/machine-solidity-step/deployments/bsc_testnet",
],
avax_testnet: [
"node_modules/@cartesi/util/deployments/avax_testnet",
"node_modules/@cartesi/arbitration/deployments/avax_testnet",
"node_modules/@cartesi/logger/deployments/avax_testnet",
"node_modules/@cartesi/machine-solidity-step/deployments/avax_testnet",
],
},
},
solpp: {
defs: {
BUILD_TEST:
process.argv.includes("test") ||
process.argv.includes("coverage"),
},
},
typechain: {
outDir: "src/types",
target: "ethers-v5",
},
namedAccounts: {
deployer: {
default: 0,
},
user: {
default: 0,
},
worker: {
default: 1,
},
alice: {
default: 0,
},
bob: {
default: 1,
},
charlie: {
default: 2,
},
dave: {
default: 3,
},
proxy: {
default: 1,
},
},
};
export default config;