-
Notifications
You must be signed in to change notification settings - Fork 2
/
hardhat.config.ts
86 lines (80 loc) · 1.82 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
import "@nomicfoundation/hardhat-chai-matchers"
import "@nomicfoundation/hardhat-toolbox"
import "@openzeppelin/hardhat-upgrades"
import { config as dotenvConfig } from "dotenv"
import type { HardhatUserConfig } from "hardhat/config"
import { resolve, join } from "path"
const dotenvConfigPath: string = process.env.DOTENV_CONFIG_PATH || join(__dirname, ".env")
dotenvConfig({ path: resolve(__dirname, dotenvConfigPath) })
const etherscanApiKey = process.env.ETHERSCAN_API_KEY
const account = process.env.PRIVATE_KEY
const RPC = process.env.POLYGON_RPC_URL
let config: HardhatUserConfig
if (!process.env.CI) {
if (!etherscanApiKey) throw new Error("Hardhat_Config: etherscan api key is not defined.")
if (!account) throw new Error("Hardhat_Config: account is not defined.")
if (!RPC) throw new Error("Hardhat_Config: RPC is not defined.")
config = {
defaultNetwork: "hardhat",
solidity: "0.8.20",
networks: {
hardhat: {
allowUnlimitedContractSize: false,
},
amoy: {
url: RPC,
accounts: [account],
},
},
etherscan: {
apiKey: {
mumbai: etherscanApiKey,
},
},
gasReporter: {
currency: "USD",
enabled: true,
excludeContracts: [],
src: "./contracts",
},
typechain: {
outDir: "src/types",
},
mocha: {
timeout: 100000000,
},
paths: {
artifacts: "./artifacts",
cache: "./cache",
sources: "./contracts",
},
}
} else {
config = {
defaultNetwork: "hardhat",
solidity: "0.8.20",
networks: {
hardhat: {
allowUnlimitedContractSize: false,
},
},
gasReporter: {
currency: "USD",
enabled: true,
excludeContracts: [],
src: "./contracts",
},
typechain: {
outDir: "src/types",
},
mocha: {
timeout: 100000000,
},
paths: {
artifacts: "./artifacts",
cache: "./cache",
sources: "./contracts",
},
}
}
export default config