forked from storyprotocol/protocol-core-v1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.ts
128 lines (122 loc) · 3.32 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
import "@nomicfoundation/hardhat-ethers"
import "@nomicfoundation/hardhat-foundry"
import "@nomicfoundation/hardhat-verify"
import "@tenderly/hardhat-tenderly"
import { TenderlyConfig } from "@tenderly/hardhat-tenderly/dist/tenderly/types"
import * as tdly from "@tenderly/hardhat-tenderly" // also import tdly for setup, in addition to global import above
import "@typechain/hardhat"
// import "@openzeppelin/hardhat-upgrades"
import "hardhat-gas-reporter"
import "hardhat-deploy"
import { HardhatConfig, HardhatUserConfig } from "hardhat/types"
import "hardhat-contract-sizer" // npx hardhat size-contracts
import "solidity-coverage"
import "solidity-docgen"
require("dotenv").config()
//
// NOTE:
// To load the correct .env, you must run this at the root folder (where hardhat.config is located)
//
const MAINNET_URL = process.env.MAINNET_URL || "https://eth-mainnet"
const MAINNET_PRIVATEKEY = process.env.MAINNET_PRIVATEKEY || "0xkey"
const SEPOLIA_URL = process.env.SEPOLIA_URL || "https://eth-sepolia"
const SEPOLIA_PRIVATEKEY = process.env.SEPOLIA_PRIVATEKEY || "0xkey"
const TENDERLY_URL = process.env.TENDERLY_URL || "https://eth-tenderly"
const TENDERLY_PRIVATEKEY = process.env.TENDERLY_PRIVATEKEY || "0xkey"
const USE_TENDERLY = process.env.USE_TENDERLY === "true"
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY || "key"
const COINMARKETCAP_API_KEY = process.env.COINMARKETCAP_API_KEY || "key"
if (USE_TENDERLY) {
tdly.setup({
automaticVerifications: true,
})
}
/** @type import('hardhat/config').HardhatUserConfig */
const config: HardhatUserConfig = {
solidity: {
compilers: [
{
version: "0.8.23",
},
],
settings: {
optimizer: {
enabled: true,
runs: 2000,
},
},
},
paths: {
sources: "./contracts",
tests: "./test",
cache: "./cache",
artifacts: "./artifacts",
},
defaultNetwork: "tenderly",
networks: {
hardhat: {
chainId: 31337,
},
localhost: {
chainId: 31337,
url: "http://127.0.0.1:8545/",
},
mainnet: {
chainId: 1,
url: MAINNET_URL || "",
accounts: [MAINNET_PRIVATEKEY],
},
...(USE_TENDERLY
? {
tenderly: {
chainId: 11155111,
url: TENDERLY_URL || "",
accounts: [TENDERLY_PRIVATEKEY],
},
}
: {
sepolia: {
chainId: 11155111,
url: SEPOLIA_URL || "",
accounts: [SEPOLIA_PRIVATEKEY],
},
}),
},
// @ts-ignore
namedAccounts: {
deployer: {
default: 0, // here this will by default take the first account as deployer
},
},
gasReporter: {
enabled: process.env.REPORT_GAS !== undefined,
outputFile: "gas-report.txt",
noColors: true,
currency: "USD",
coinmarketcap: COINMARKETCAP_API_KEY,
},
mocha: {
timeout: 20_000,
},
etherscan: {
apiKey: ETHERSCAN_API_KEY,
},
...(USE_TENDERLY
? {
tenderly: {
project: process.env.TENDERLY_PROJECT_SLUG || "",
username: process.env.TENDERLY_USERNAME || "",
privateVerification: process.env.TENDERLY_PRIVATE_VERIFICATION === "true",
} as TenderlyConfig,
}
: {}),
typechain: {
outDir: "typechain",
target: "ethers-v6",
},
docgen: {
outputDir: "./docs",
pages: "files"
}
}
export default config