-
Notifications
You must be signed in to change notification settings - Fork 39
/
hardhat.config.ts
512 lines (471 loc) · 15.3 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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
import 'dotenv/config';
import "@nomicfoundation/hardhat-verify";
import '@nomiclabs/hardhat-waffle';
import '@typechain/hardhat';
import 'hardhat-contract-sizer';
import 'hardhat-gas-reporter';
import 'hardhat-watcher';
import { HardhatUserConfig, task, types } from 'hardhat/config';
import 'solidity-coverage';
import {
setStages,
set1155Stages,
setMintable,
deploy,
deploy1155,
deployClone,
setBaseURI,
setCrossmintAddress,
mint,
ownerMint,
setGlobalWalletLimit,
setMaxMintableSupply,
deployBA,
setTimestampExpirySeconds,
transferOwnership,
setStartAndEndTimeUnixSeconds,
setMinContributionInWei,
sendRefund,
sendRefundBatch,
sendTokensAndRefund,
sendTokensAndRefundBatch,
getMinContributionInWei,
getStartTimeBA,
getEndTimeBA,
getPrice,
setPrice,
deployOwnedRegistrant,
getContractCodehash,
deploy721BatchTransfer,
send721Batch,
freezeTrading,
thawTrading,
cleanWhitelist,
ownerMint1155,
} from './scripts';
import { deployCloneFactory } from './scripts/deployCloneFactory';
const config: HardhatUserConfig = {
solidity: {
version: '0.8.20',
settings: {
viaIR: true,
optimizer: {
enabled: true,
runs: 20,
details: {
yulDetails: {
optimizerSteps: "dhfoD[xarrscLMcCTU]uljmul",
},
},
},
},
},
contractSizer: {
alphaSort: true,
disambiguatePaths: false,
runOnCompile: true,
strict: true,
},
paths: {
artifacts: './artifacts',
cache: './cache',
sources: './contracts',
tests: './test',
},
networks: {
hardhat: {
accounts: {
accountsBalance: '1000000000000000000000'
}
},
apechain: {
url: 'https://apechain.calderachain.xyz/http',
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
base: {
url: process.env.BASE_URL || '',
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
ropsten: {
url: process.env.ROPSTEN_URL || '',
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
goerli: {
url:
process.env.GOERLI_URL || 'https://eth-goerli.api.onfinality.io/public',
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
sepolia: {
url: process.env.SEPOLIA_URL || 'https://rpc.sepolia.org',
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
mainnet: {
url: process.env.MAINNET_URL || '',
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
mumbai: {
url: process.env.MUMBAI_URL || 'https://rpc-mumbai.maticvigil.com/',
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
polygon: {
url: process.env.POLYGON_URL || '',
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
fuji: {
url: process.env.FUJI_URL || 'https://api.avax-test.network/ext/bc/C/rpc',
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
},
gasReporter: {
enabled: process.env.REPORT_GAS !== undefined,
currency: 'USD',
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
customChains: [
{
network: "apechain",
chainId: 33139,
urls: {
apiURL: "https://api.apescan.io/api",
browserURL: "https://apescan.io/"
}
}
]
},
sourcify: {
enabled: true
}
};
task('setStages', 'Set stages for ERC721M')
.addParam('contract', 'contract address')
.addParam('stages', 'stages json file')
.addOptionalParam('gaspricegwei', 'Set gas price in Gwei')
.addOptionalParam(
'gaslimit',
'Set maximum gas units to spend on transaction',
500000,
types.int,
)
.setAction(setStages);
task('set1155Stages', 'Set stages for ERC721M')
.addParam('contract', 'contract address')
.addParam('stages', 'stages json file')
.addOptionalParam('gaspricegwei', 'Set gas price in Gwei')
.addOptionalParam(
'gaslimit',
'Set maximum gas units to spend on transaction',
500000,
types.int,
)
.setAction(set1155Stages);
task('setMintable', 'Set mintable state for ERC721M')
.addParam('contract', 'contract address')
.addParam('mintable', 'mintable state', 'true', types.boolean)
.setAction(setMintable);
task('deploy', 'Deploy ERC721M')
.addParam('name', 'name')
.addParam('symbol', 'symbol')
.addParam('maxsupply', 'max supply')
.addParam('tokenurisuffix', 'token uri suffix', '.json')
.addParam('globalwalletlimit', 'global wallet limit', '0')
.addParam('timestampexpiryseconds', 'timestamp expiry in seconds', '300')
.addOptionalParam(
'cosigner',
'cosigner address (0x00...000 if not using cosign)',
'0x0000000000000000000000000000000000000000',
)
.addOptionalParam(
'mintcurrency',
'ERC-20 contract address (if minting with ERC-20)',
'0x0000000000000000000000000000000000000000',
)
.addOptionalParam(
'fundreceiver',
'The treasury wallet to receive mint fund',
)
.addParam<boolean>(
'useoperatorfilterer',
'whether or not to use operator filterer, used with legacy 721M contract',
false,
types.boolean,
)
.addParam<boolean>(
'openedition',
'whether or not a open edition mint (unlimited supply, 999,999,999)',
false,
types.boolean,
)
.addOptionalParam<boolean>(
'useerc721c',
'whether or not to use ERC721C',
true,
types.boolean,
)
.addOptionalParam<boolean>(
'useerc2198',
'whether or not to use ERC2198',
true,
types.boolean,
)
.addOptionalParam(
'erc2198royaltyreceiver',
'erc2198 royalty receiver address',
)
.addOptionalParam(
'erc2198royaltyfeenumerator',
'erc2198 royalty fee numerator',
)
.addOptionalParam('gaspricegwei', 'Set gas price in Gwei')
.addOptionalParam('gaslimit', 'Set maximum gas units to spend on transaction')
.setAction(async (tasksArgs, hre) => {
console.log('Cleaning...');
await hre.run('clean');
console.log('Compiling...');
await hre.run('compile');
console.log('Deploying...');
await deploy(tasksArgs, hre);
});
task('deploy1155', 'Deploy ERC1155M')
.addParam('name', 'name')
.addParam('symbol', 'symbol')
.addParam('uri', 'token uri')
.addParam('maxsupply', 'max supply')
.addParam('globalwalletlimit', 'global wallet limit')
.addParam('timestampexpiryseconds', 'timestamp expiry in seconds', '300')
.addOptionalParam(
'cosigner',
'cosigner address (0x00...000 if not using cosign)',
'0x0000000000000000000000000000000000000000',
)
.addOptionalParam(
'mintcurrency',
'ERC-20 contract address (if minting with ERC-20)',
'0x0000000000000000000000000000000000000000',
)
.addOptionalParam(
'fundreceiver',
'The treasury wallet to receive mint fund',
)
.addParam<boolean>(
'openedition',
'whether or not a open edition mint (unlimited supply, 999,999,999)',
false,
types.boolean,
)
.addOptionalParam(
'erc2198royaltyreceiver',
'erc2198 royalty receiver address',
)
.addOptionalParam(
'erc2198royaltyfeenumerator',
'erc2198 royalty fee numerator',
)
.addOptionalParam('gaspricegwei', 'Set gas price in Gwei')
.addOptionalParam('gaslimit', 'Set maximum gas units to spend on transaction')
.setAction(async (tasksArgs, hre) => {
console.log('Cleaning...');
await hre.run('clean');
console.log('Compiling...');
await hre.run('compile');
console.log('Deploying...');
await deploy1155(tasksArgs, hre);
});
task('setBaseURI', 'Set the base uri')
.addParam('uri', 'uri')
.addParam('contract', 'contract address')
.addOptionalParam('gaspricegwei', 'Set gas price in Gwei')
.addOptionalParam(
'gaslimit',
'Set maximum gas units to spend on transaction',
500000,
types.int,
)
.setAction(setBaseURI);
task('setCrossmintAddress', 'Set crossmint address')
.addParam('contract', 'contract address')
.addParam('crossmintaddress', 'new crossmint address')
.setAction(setCrossmintAddress);
task('mint', 'Mint token(s)')
.addParam('contract', 'contract address')
.addParam('qty', 'quantity to mint', '1')
.addParam('minttime', 'time of the mint')
.setAction(mint);
task('ownerMint', 'Mint token(s) as owner for ERC721M')
.addParam('contract', 'contract address')
.addParam('qty', 'quantity to mint', '1')
.addOptionalParam('to', 'recipient address')
.addOptionalParam('gaspricegwei', 'Set gas price in Gwei')
.addOptionalParam('gaslimit', 'Set maximum gas units to spend on transaction')
.setAction(ownerMint);
task('ownerMint1155', 'Mint token(s) as owner for ERC1155M')
.addParam('contract', 'contract address')
.addOptionalParam('to', 'recipient address')
.addParam('id', 'tokenId to mint', '0')
.addParam('qty', 'quantity to mint', '1')
.addOptionalParam('gaspricegwei', 'Set gas price in Gwei')
.addOptionalParam('gaslimit', 'Set maximum gas units to spend on transaction')
.setAction(ownerMint1155);
task('setGlobalWalletLimit', 'Set the global wallet limit')
.addParam('contract', 'contract address')
.addParam('limit', 'global wallet limit (0 for no global limit)')
.setAction(setGlobalWalletLimit);
task('setMaxMintableSupply', 'set max mintable supply')
.addParam('contract', 'contract address')
.addParam('supply', 'new supply')
.setAction(setMaxMintableSupply);
task('deployBA', 'Deploy BucketAuction')
.addParam('name', 'name')
.addParam('symbol', 'symbol')
.addParam('maxsupply', 'max supply')
.addParam('tokenurisuffix', 'token uri suffix', '.json')
.addParam('globalwalletlimit', 'global wallet limit')
.addOptionalParam(
'cosigner',
'cosigner address (0x00...000 if not using cosign)',
'0x0000000000000000000000000000000000000000',
)
.addParam(
'mincontributioninwei',
'The minimum contribution in wei required only for the AuctionBucket',
)
.addParam('auctionstarttime', 'The start time of the bucket auction')
.addParam('auctionendtime', 'The end time of the bucket auction')
.setAction(deployBA);
task('setTimestampExpirySeconds', 'Set the timestamp expiry seconds')
.addParam('contract', 'contract address')
.addParam('timestampexpiryseconds', 'timestamp expiry in seconds')
.setAction(setTimestampExpirySeconds);
task('transferOwnership', 'transfer contract ownership')
.addParam('contract', 'contract address')
.addParam('owner', 'new owner address')
.setAction(transferOwnership);
task(
'setStartAndEndTimeUnixSeconds',
'set the start and end time for bucket auction',
)
.addParam('contract', 'contract address')
.addParam('starttime', 'start time of the bucket auction')
.addParam('endtime', 'end time of the bucket auction')
.setAction(setStartAndEndTimeUnixSeconds);
task('setMinContributionInWei', 'set the min contribution in wei for BA')
.addParam('contract', 'contract address')
.addParam('mincontributioninwei', 'min contribution in wei')
.setAction(setMinContributionInWei);
task('sendRefund', 'send refund to the specified address for BA')
.addParam('contract', 'contract address')
.addParam('to', 'address to refund')
.setAction(sendRefund);
task('sendRefundBatch', 'send refund to the specified addresses for BA')
.addParam('contract', 'contract address')
.addParam(
'addresses',
'path to the json file with an array of addresses to refund',
)
.setAction(sendRefundBatch);
task(
'sendTokensAndRefund',
'send tokens and refund the remaining to the specified address for BA',
)
.addParam('contract', 'contract address')
.addParam('to', 'address to refund')
.setAction(sendTokensAndRefund);
task(
'sendTokensAndRefundBatch',
'send tokens and refund to the specified addresses for BA',
)
.addParam('contract', 'contract address')
.addParam(
'addresses',
'path to the json file with an array of addresses to refund',
)
.setAction(sendTokensAndRefundBatch);
task('getMinContributionInWei', 'get the min contribution in wei for BA')
.addParam('contract', 'contract address')
.setAction(getMinContributionInWei);
task('getStartTimeBA', 'get the start time of BA')
.addParam('contract', 'contract address')
.setAction(getStartTimeBA);
task('getEndTimeBA', 'get the end time of BA')
.addParam('contract', 'contract address')
.setAction(getEndTimeBA);
task('getPrice', 'get the price set for BA')
.addParam('contract', 'contract address')
.setAction(getPrice);
task('setPrice', 'set the price set for BA')
.addParam('contract', 'contract address')
.addParam('priceinwei', 'price in wei')
.setAction(setPrice);
task('deployOwnedRegistrant', 'Deploy OwnedRegistrant')
.addParam(
'newowner',
'new owner address',
'0x0000000000000000000000000000000000000000',
)
.setAction(deployOwnedRegistrant);
task('getContractCodehash', 'Get the code hash of a contract')
.addParam('contract', 'contract address')
.setAction(getContractCodehash);
task('deploy721BatchTransfer', 'Deploy ERC721BatchTransfer').setAction(
deploy721BatchTransfer,
);
task('send721Batch', 'Send ERC721 tokens in batch')
.addParam('contract', 'contract address')
.addOptionalParam(
'transferfile',
'path to the file with the transfer details',
)
.addOptionalParam('to', 'recipient address (if not using transferFile)')
.addOptionalParam(
'tokenids',
'token ids (if not using transferFile), separate with comma',
)
.setAction(send721Batch);
task('freezeTrading', 'Freeze trading for 721Cv2')
.addParam('contract', 'contract address')
.addOptionalParam('validator', 'security validator')
.addOptionalParam('level', 'security level')
.addOptionalParam('whitelistid', 'whitelist id')
.addOptionalParam('permittedreceiverid', 'permitted receiver list id')
.setAction(freezeTrading);
task('thawTrading', 'Thaw trading for 721Cv2')
.addParam('contract', 'contract address')
.setAction(thawTrading);
task('cleanWhitelist', 'Clean up whitelist')
.addOptionalParam('whitelistpath', 'plain whitelist path')
.addOptionalParam('variablewalletlimitpath', 'variable wallet limit whitelist path')
.setAction(cleanWhitelist)
task('deployCloneFactory', 'Deploy 721CMRoyalties clone factory')
.addOptionalParam('gaspricegwei', 'Set gas price in Gwei')
.addOptionalParam('gaslimit', 'Set maximum gas units to spend on transaction')
.setAction(deployCloneFactory)
task('deployClone', 'Create 721CMRoyalties cline')
.addParam('name', 'name')
.addParam('symbol', 'symbol')
.addParam('maxsupply', 'max supply')
.addParam('tokenurisuffix', 'token uri suffix', '.json')
.addParam('globalwalletlimit', 'global wallet limit', '0')
.addParam('timestampexpiryseconds', 'timestamp expiry in seconds', '300')
.addParam('mintcurrency','ERC-20 contract address. 0x0 if using native token','0x0000000000000000000000000000000000000000')
.addParam('fundreceiver', 'The treasury wallet to receive mint fund')
.addParam('royaltyreceiver', 'erc2198 royalty receiver address')
.addParam('royaltyfeenumerator', 'erc2198 royalty fee numerator')
.addParam<boolean>(
'openedition',
'whether or not a open edition mint (unlimited supply, 999,999,999)',
false,
types.boolean,
)
.addOptionalParam('gaspricegwei', 'Set gas price in Gwei')
.addOptionalParam('gaslimit', 'Set maximum gas units to spend on transaction')
.setAction(deployClone);
export default config;