-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhardhat.config.ts
More file actions
97 lines (91 loc) · 2.1 KB
/
Copy pathhardhat.config.ts
File metadata and controls
97 lines (91 loc) · 2.1 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
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
import "@nomiclabs/hardhat-waffle";
import '@typechain/hardhat';
import '@nomiclabs/hardhat-ethers';
import '@nomiclabs/hardhat-waffle';
import '@nomiclabs/hardhat-solhint';
import 'solidity-coverage';
import 'hardhat-gas-reporter';
import 'hardhat-abi-exporter';
import '@primitivefi/hardhat-dodoc';
import "hardhat-deploy";
import { resolve } from "path";
import { config as dotenvConfig } from "dotenv";
import { HardhatUserConfig } from "hardhat/config";
import { NetworkUserConfig } from "hardhat/types";
dotenvConfig({ path: resolve(__dirname, "./.env") });
const chainIds = {
mainnet: 1,
rinkeby: 4,
ropsten: 3,
goerli: 5,
hardhat: 1337,
kovan: 42,
};
const privateKey = process.env.PRIVATE_KEY ?? "NO_PRIVATE_KEY";
const alchemyApiKey = process.env.ALCHEMY_API_KEY ?? "NO_ALCHEMY_API_KEY";
function getChainConfig(network: keyof typeof chainIds): NetworkUserConfig {
const url = `https://eth-${network}.alchemyapi.io/v2/${alchemyApiKey}`;
return {
accounts: [`${privateKey}`],
chainId: chainIds[network],
url,
};
}
/**
* @type import('hardhat/config').HardhatUserConfig
*/
const config: HardhatUserConfig = {
paths: {
artifacts: "./artifacts",
cache: "./cache",
sources: "./contracts",
tests: "./test",
deploy: "./scripts/deploy",
deployments: "./deployments",
},
solidity: {
version: "0.8.4",
settings: {
outputSelection: {
"*": {
"*": ["storageLayout"]
}
},
optimizer: {
enabled: true,
runs: 2
}
}
},
networks: {
hardhat: {
chainId: chainIds.hardhat,
},
mainnet: getChainConfig("mainnet"),
rinkeby: getChainConfig("rinkeby"),
ropsten: getChainConfig("ropsten"),
},
namedAccounts: {
deployer: {
default: 0,
},
treasury: {
default: 1,
4: 1
},
},
typechain: {
outDir: "types",
target: "ethers-v5",
},
abiExporter: {
path: './abi',
runOnCompile: true,
clear: true,
flat: true,
spacing: 2,
pretty: false,
except: ['Mock*'],
}
};
export default config;