-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathhardhat.config.ts
192 lines (182 loc) · 4.84 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
import "dotenv/config";
import {HardhatUserConfig} from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "@nomiclabs/hardhat-solhint";
import "hardhat-deploy";
import "@openzeppelin/hardhat-upgrades";
import "hardhat-contract-sizer";
import "hardhat-gas-reporter";
import "hardhat-storage-layout";
import "hardhat-abi-exporter";
import "solidity-coverage";
import {ethers, parseUnits} from "ethers";
import {HardhatNetworkAccountUserConfig, SolcUserConfig} from "hardhat/types";
const defaultConfig: SolcUserConfig = {
version: "0.8.28",
settings: {
evmVersion: "cancun",
optimizer: {
enabled: true,
runs: 9999999,
details: {
yul: true
}
},
viaIR: true,
outputSelection: {
"*": {
"*": ["storageLayout"]
}
}
}
};
const mediumRunsConfig: SolcUserConfig = {
...defaultConfig,
settings: {
...defaultConfig.settings,
optimizer: {
...defaultConfig.settings.optimizer,
runs: 5000
}
}
};
const lowRunsConfig: SolcUserConfig = {
...defaultConfig,
settings: {
...defaultConfig.settings,
optimizer: {
...defaultConfig.settings.optimizer,
runs: 1000
}
}
};
const lowestRunsConfig: SolcUserConfig = {
...defaultConfig,
settings: {
...defaultConfig.settings,
optimizer: {
...defaultConfig.settings.optimizer,
runs: 320
}
}
};
const privateKey = process.env.PRIVATE_KEY as string;
const privateKey1 = process.env.PRIVATE_KEY1 as string;
const hardhatAccounts: HardhatNetworkAccountUserConfig[] = [
{
privateKey,
balance: ethers.parseEther("100000").toString()
},
{
privateKey: privateKey1,
balance: ethers.parseEther("100000").toString()
}
];
const config: HardhatUserConfig = {
solidity: {
compilers: [defaultConfig, mediumRunsConfig, lowRunsConfig, lowestRunsConfig],
overrides: {
"contracts/Clans/Clans.sol": lowestRunsConfig,
"contracts/Clans/LockedBankVaults.sol": lowRunsConfig,
"contracts/Clans/Territories.sol": mediumRunsConfig,
"contracts/Clans/Raids.sol": lowRunsConfig,
"contracts/PassiveActions.sol": mediumRunsConfig,
"contracts/Players/Players.sol": lowestRunsConfig,
"contracts/Players/PlayersImplMisc.sol": mediumRunsConfig,
"contracts/Players/PlayersImplProcessActions.sol": lowRunsConfig,
"contracts/Players/PlayersImplQueueActions.sol": lowestRunsConfig,
"contracts/Players/PlayersImplRewards.sol": lowestRunsConfig,
"contracts/Promotions.sol": mediumRunsConfig,
"contracts/RandomnessBeacon.sol": lowRunsConfig,
"contracts/ItemNFT.sol": mediumRunsConfig,
"contracts/PetNFT.sol": lowestRunsConfig,
"contracts/PlayerNFT.sol": mediumRunsConfig,
"contracts/Bazaar/OrderBook.sol": lowRunsConfig
}
},
gasReporter: {
enabled: true,
showMethodSig: true
},
networks: {
hardhat: {
gasPrice: 0,
initialBaseFeePerGas: 0,
allowUnlimitedContractSize: true,
accounts: process.env.USE_PRIVATE_KEY === "true" ? hardhatAccounts : {count: 10}
},
sonic: {
url: process.env.SONIC_RPC,
accounts: [process.env.PRIVATE_KEY as string, process.env.PRIVATE_KEY1 as string]
},
"sonic-blaze": {
url: process.env.SONIC_BLAZE_RPC,
accounts: [process.env.PRIVATE_KEY as string, process.env.PRIVATE_KEY1 as string]
},
fantom: {
url: process.env.FANTOM_RPC,
accounts: [process.env.PRIVATE_KEY as string, process.env.PRIVATE_KEY1 as string],
gasPrice: Number(parseUnits("100", "gwei"))
}
},
external: {
contracts: [
{
// Specify the exact path
artifacts: "node_modules/@layerzerolabs/test-devtools-evm-hardhat/artifacts",
deploy: "node_modules/@layerzerolabs/test-devtools-evm-hardhat/deploy"
}
],
deployments: {
hardhat: ["node_modules/@layerzerolabs/test-devtools-evm-hardhat/deployments/hardhat"]
}
},
mocha: {
timeout: 240 * 1000,
slow: 1
},
etherscan: {
apiKey: {
fantom: process.env.ETHERSCAN_API_KEY as string,
sonic: process.env.SONICSCAN_API_KEY as string
},
customChains: [
{
network: "sonic",
chainId: 146,
urls: {
apiURL: "https://api.sonicscan.org/api",
browserURL: "https://sonicscan.org"
}
}
]
},
contractSizer: {
alphaSort: true,
runOnCompile: true,
disambiguatePaths: false,
except: ["test", "@openzeppelin", "@layerzerolabs"]
},
abiExporter: {
path: "./data/abi",
runOnCompile: true,
clear: true,
flat: true,
spacing: 2,
format: "json",
except: [
"/interfaces",
"/test",
"/helper",
"/debug",
"/legacy",
"SamWitchVRFConsumerUpgradeable",
"@openzeppelin",
"@layerzerolabs"
]
},
typechain: {
target: "ethers-v6"
}
};
export default config;