-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathhardhat.config.ts
126 lines (118 loc) · 3.12 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
import { config as dotEnvConfig } from "dotenv";
dotEnvConfig();
import { HttpNetworkUserConfig, HardhatUserConfig } from "hardhat/types/config";
import "@nomicfoundation/hardhat-verify";
import "@typechain/hardhat";
import "hardhat-deploy";
import "@nomiclabs/hardhat-ethers";
import "hardhat-contract-sizer";
import "@nomicfoundation/hardhat-foundry";
import "solidity-docgen";
const {
ALCHEMY_TOKEN_MAINNET,
ALCHEMY_TOKEN_POLYGON,
DEPLOYER_PRIVATE_KEY,
ETHERSCAN_API_KEY,
POLYGONSCAN_API_KEY,
ARBITRUM_API_KEY,
BASE_API_KEY,
} = process.env;
const sharedNetworkConfig: HttpNetworkUserConfig = {};
// public address 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
// randomly generated for test purposes, do not use for actual deployment!
const DEFAULT_DEPLOYER_PRIVATE_KEY = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";
sharedNetworkConfig.accounts = [DEPLOYER_PRIVATE_KEY || DEFAULT_DEPLOYER_PRIVATE_KEY];
const namedAccounts: any = {
deployer: {
default: 0, // use the first account (index = 0).
},
};
const defaultContractSettings = {
version: "0.8.21",
settings: {
optimizer: {
enabled: true,
runs: 10000000,
},
},
};
const config = {
defaultNetwork: "hardhat",
solidity: {
compilers: [defaultContractSettings],
overrides: {
"contracts/periphery/resolvers/dex/main.sol": {
...defaultContractSettings,
settings: {
...defaultContractSettings.settings,
optimizer: {
...defaultContractSettings.settings.optimizer,
runs: 1000,
},
},
},
},
},
networks: {
hardhat: {
forking: {
// @dev uncomment whatever network you want to fork
//
// ETH MAINNET
// url: "https://eth-mainnet.g.alchemy.com/v2/" + ALCHEMY_TOKEN_MAINNET,
// blockNumber: 18827888,
//
// POLYGON
// url: "https://polygon-mainnet.g.alchemy.com/v2/" + ALCHEMY_TOKEN_POLYGON,
// blockNumber: 51352596, // e.g. on Polygon
//
url: "https://rpc.ankr.com/eth",
enabled: true,
},
},
localhost: {},
mainnet: {
...sharedNetworkConfig,
url: "https://rpc.ankr.com/eth",
},
arbitrum: {
...sharedNetworkConfig,
url: "https://rpc.ankr.com/arbitrum",
},
base: {
...sharedNetworkConfig,
url: "https://rpc.ankr.com/base",
},
polygon: {
...sharedNetworkConfig,
url: "https://rpc.ankr.com/polygon",
gasPrice: 85_000_000_000,
},
},
etherscan: {
// blockchain explorers api keys from .env
apiKey: {
mainnet: ETHERSCAN_API_KEY || "",
polygon: POLYGONSCAN_API_KEY || "",
arbitrumOne: ARBITRUM_API_KEY || "",
base: BASE_API_KEY || "",
},
customChains: [
{
network: "base",
chainId: 8453,
urls: {
apiURL: "https://api.basescan.org/api",
browserURL: "https://basescan.org/",
},
},
],
},
namedAccounts,
docgen: {
outputDir: "./docs/contracts/src/contracts",
exclude: ["protocols/flashloan"],
pages: "files",
},
};
export default config;