-
Notifications
You must be signed in to change notification settings - Fork 1
/
hardhat.config.ts
112 lines (104 loc) · 2.81 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
import "@typechain/hardhat";
import "@nomiclabs/hardhat-ethers";
import "@nomiclabs/hardhat-web3";
import "@nomiclabs/hardhat-waffle";
import "@nomiclabs/hardhat-etherscan"
import "hardhat-contract-sizer";
import "hardhat-deploy";
import "hardhat-deploy-ethers"
import { resolve } from "path";
import { config as dotenvConfig } from "dotenv";
import { HardhatUserConfig } from "hardhat/config";
dotenvConfig({ path: resolve(__dirname, "./.env") });
const alchemy = {
mainnet: 'https://eth-mainnet.alchemyapi.io/v2/',
arbitrum: 'https://arb-mainnet.g.alchemy.com/v2/',
optimism: 'https://opt-mainnet.g.alchemy.com/v2/',
polygon: 'https://polygon-mainnet.g.alchemy.com/v2/',
goerli: 'https://eth-goerli.alchemyapi.io/v2/'
}
let alchemyKey: string;
if (!process.env.ALCHEMY_KEY) {
throw new Error("Please set your ALCHEMY_KEY in a .env file");
} else {
alchemyKey = process.env.ALCHEMY_KEY;
}
let etherscanKey: string;
if (!process.env.ETHERSCAN_API_KEY) {
throw new Error("Please set your ETHERSCAN_API_KEY in a .env file");
} else {
etherscanKey = process.env.ETHERSCAN_API_KEY;
}
const config: HardhatUserConfig = {
defaultNetwork: "hardhat",
networks: {
hardhat: {
forking: {
// url: alchemy.mainnet + alchemyKey,
url: alchemy.polygon + alchemyKey,
// enabled: true,
}
},
// mainnet: {
// accounts: [adminPrivateKey],
// gasPrice: 50 * 10 ** 9, // 50 gwei
// url: alchemy.mainnet + alchemyKey,
// timeout: 200000,
// },
polygon: {
accounts: [process.env.ADMIN_PRIVATE_KEY],
url: alchemy.polygon + alchemyKey,
timeout: 200000,
},
arbitrum: {
accounts: [process.env.ADMIN_PRIVATE_KEY],
url: alchemy.arbitrum + alchemyKey,
// timeout: 200000,
},
optimism: {
accounts: [process.env.ADMIN_PRIVATE_KEY],
// gasPrice: 5 * 10 ** 9, // 5 gwei
url: alchemy.optimism + alchemyKey,
// timeout: 200000,
},
// goerli: {
// accounts: [adminPrivateKey],
// url: alchemy.goerli + alchemyKey,
// timeout: 200000
// }
},
paths: {
artifacts: "./artifacts",
cache: "./cache",
sources: "./contracts",
tests: "./test",
},
solidity: {
version: "0.7.6",
settings: {
metadata: {
// Not including the metadata hash
// https://github.com/paulrberg/solidity-template/issues/31
bytecodeHash: "none",
},
// You should disable the optimizer when debugging
// https://hardhat.org/hardhat-network/#solidity-optimizer-support
optimizer: {
enabled: true,
runs: 7777,
},
},
},
etherscan: {
apiKey: etherscanKey
},
contractSizer: {
alphaSort: true,
runOnCompile: true,
},
typechain: {
outDir: "typechain",
target: "ethers-v5"
}
};
export default config;