-
Notifications
You must be signed in to change notification settings - Fork 1
/
hardhat.config.ts
230 lines (213 loc) · 6.25 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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
import * as dotenv from "dotenv";
import { HardhatUserConfig, extendEnvironment } from "hardhat/config";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import "@nomiclabs/hardhat-ethers";
import "@nomicfoundation/hardhat-toolbox";
import "@nomicfoundation/hardhat-chai-matchers";
import "@openzeppelin/hardhat-upgrades";
import "hardhat-dependency-compiler";
import "hardhat-contract-sizer";
import { deployments, RigsDeployment, RigsDeployments } from "./deployments";
dotenv.config();
const config: HardhatUserConfig = {
solidity: {
version: "0.8.19",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
dependencyCompiler: {
paths: [
"@openzeppelin/contracts/finance/PaymentSplitter.sol",
// For testing purposes
"@tableland/evm/contracts/TablelandTables.sol",
"@tableland/evm/contracts/test/TestAllowAllTablelandController.sol",
"@tableland/evm/contracts/test/TestERC721Enumerable.sol",
"@tableland/evm/contracts/test/TestSQLHelpers.sol",
],
},
contractSizer: {
alphaSort: true,
disambiguatePaths: false,
runOnCompile: false,
strict: true,
only: [],
},
gasReporter: {
enabled: process.env.REPORT_GAS !== undefined,
currency: "USD",
},
etherscan: {
apiKey: {
// ethereum
mainnet: process.env.ETHERSCAN_API_KEY || "",
goerli: process.env.ETHERSCAN_API_KEY || "",
// arbitrum
arbitrumOne: process.env.ARBISCAN_API_KEY || "",
// polygon
polygonMumbai: process.env.POLYSCAN_API_KEY || "",
},
},
networks: {
// mainnets
ethereum: {
url: `https://eth-mainnet.g.alchemy.com/v2/${
process.env.ETHEREUM_API_KEY ?? ""
}`,
accounts:
process.env.ETHEREUM_PRIVATE_KEY !== undefined
? [process.env.ETHEREUM_PRIVATE_KEY]
: [],
},
arbitrum: {
url: `https://arb-mainnet.g.alchemy.com/v2/${
process.env.ARBITRUM_API_KEY ?? ""
}`,
accounts:
process.env.ARBITRUM_PRIVATE_KEY !== undefined
? [process.env.ARBITRUM_PRIVATE_KEY]
: [],
},
filecoin: {
url: `https://rpc.ankr.com/filecoin/${
process.env.FILECOIN_API_KEY ?? ""
}`,
accounts:
process.env.FILECOIN_PRIVATE_KEY !== undefined
? [process.env.FILECOIN_PRIVATE_KEY]
: [],
},
// testnets
"ethereum-goerli": {
url: `https://eth-goerli.g.alchemy.com/v2/${
process.env.ETHEREUM_GOERLI_API_KEY ?? ""
}`,
accounts:
process.env.ETHEREUM_GOERLI_PRIVATE_KEY !== undefined
? [process.env.ETHEREUM_GOERLI_PRIVATE_KEY]
: [],
},
"polygon-mumbai": {
url: `https://polygon-mumbai.g.alchemy.com/v2/${
process.env.POLYGON_MUMBAI_API_KEY ?? ""
}`,
accounts:
process.env.POLYGON_MUMBAI_PRIVATE_KEY !== undefined
? [process.env.POLYGON_MUMBAI_PRIVATE_KEY]
: [],
},
// devnets
hardhat: {
mining: {
auto: !(process.env.HARDHAT_DISABLE_AUTO_MINING === "true"),
interval: [100, 3000],
},
},
},
config: {
args: {
name: "Tableland Rigs",
description:
"A 3k generative NFT built from 1,074 handcrafted works of art for the builders and creatives of cyberspace.",
image:
"https://bafybeidmvuy43bsfla4ewabfegdf6k3vqmjlapn7ojsv5fczpym3lpazzu.ipfs.dweb.link/rigs.png",
externalLink: "https://tableland.xyz/rigs",
sellerFeeBasisPoints: 500,
feeRecipient: "0xEC19654b1c1DfAc2427F06D0fcA991f43C6b1281",
admin: "0x472028E35b69d92caaF804fA32c9D7AcD673AA37",
maxSupply: 3000,
etherPrice: "0.05",
mintPhase: "public",
tables: {
localhost: {
tablelandPrivateKey: process.env.LOCAL_TABLELAND_PRIVATE_KEY,
},
testnet: {
tablelandPrivateKey: process.env.POLYGON_MUMBAI_PRIVATE_KEY,
tablelandProviderUrl: `https://polygon-mumbai.g.alchemy.com/v2/${
process.env.POLYGON_MUMBAI_API_KEY ?? ""
}`,
},
mainnet: {
tablelandPrivateKey: process.env.ARBITRUM_PRIVATE_KEY,
tablelandProviderUrl: `https://arb-mainnet.g.alchemy.com/v2/${
process.env.ARBITRUM_API_KEY ?? ""
}`,
},
},
royaltyReceivers: [
"0x12fC004d3bA84dF22ebfdE93A7a0B87267b06ACb",
"0xEC19654b1c1DfAc2427F06D0fcA991f43C6b1281",
],
royaltyReceiverShares: [2, 3],
allowlistFiles: ["../allowlists/main_allowlist.csv"],
waitlistFiles: ["../allowlists/main_waitlist.csv"],
waitlistSize: 100,
},
deployments,
},
};
interface RigsTablesConfig {
tablelandPrivateKey: string | undefined;
tablelandProviderUrl?: string;
}
interface RigsConfig {
// rigs info
name: string;
description: string;
image: string;
externalLink: string;
sellerFeeBasisPoints: number;
feeRecipient: string;
admin: string;
// mint phase
mintPhase: "closed" | "allowlist" | "waitlist" | "public";
// rigs tables
tables: {
localhost: RigsTablesConfig;
testnet: RigsTablesConfig;
mainnet: RigsTablesConfig;
};
// rigs args
maxSupply: number;
etherPrice: string;
// royalty splitter args
royaltyReceivers: string[];
royaltyReceiverShares: number[];
// whitelists
allowlistFiles: string[];
waitlistFiles: string[];
waitlistSize: number;
}
interface RigsNetworkConfig {
args: RigsConfig;
deployments: RigsDeployments;
}
declare module "hardhat/types/config" {
// eslint-disable-next-line no-unused-vars
interface HardhatUserConfig {
config: RigsNetworkConfig;
}
}
declare module "hardhat/types/runtime" {
// eslint-disable-next-line no-unused-vars
interface HardhatRuntimeEnvironment {
rigsConfig: RigsConfig;
rigsDeployment: RigsDeployment;
mainnet: boolean;
}
}
extendEnvironment((hre: HardhatRuntimeEnvironment) => {
// Get configs for user-selected network
const config = hre.userConfig.config;
hre.rigsConfig = config.args;
// Hack to account for the fact that the voting registry is on arbitrum
const network =
hre.network.name === "arbitrum" ? "ethereum" : hre.network.name;
hre.rigsDeployment = (config.deployments as any)[network];
hre.mainnet = network === "ethereum";
});
export default config;