-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhardhat.config.ts
108 lines (101 loc) · 3.16 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
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";
// This is a sample Buidler task. To learn how to create your own go to
// https://buidler.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,
},
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-1-s1.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: {
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",
},
],
deployments: {
localhost: ["node_modules/@cartesi/util/deployments/localhost"],
rinkeby: ["node_modules/@cartesi/util/deployments/rinkeby"],
kovan: ["node_modules/@cartesi/util/deployments/kovan"],
goerli: ["node_modules/@cartesi/util/deployments/goerli"],
matic_testnet: [
"node_modules/@cartesi/util/deployments/matic_testnet",
],
bsc_testnet: ["node_modules/@cartesi/util/deployments/bsc_testnet"],
avax_testnet: [
"node_modules/@cartesi/util/deployments/avax_testnet",
],
},
},
typechain: {
outDir: "src/types",
target: "ethers-v5",
},
namedAccounts: {
deployer: {
default: 0,
},
alice: {
default: 0,
},
proxy: {
default: 1,
},
},
};
export default config;