-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhardhat.config.ts
71 lines (65 loc) · 2.18 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
import '@nomiclabs/hardhat-ethers';
import 'hardhat-abi-exporter';
import 'hardhat-diamond-abi';
// Must be registered after hardhat-diamond-abi
import '@typechain/hardhat';
import 'hardhat-contract-sizer';
import { HardhatUserConfig } from 'hardhat/config';
import * as diamondUtils from './utils/diamond';
import './scripts/deploy';
require('dotenv').config();
const { DEPLOYER_PRIVATE_KEY } = process.env;
const config: HardhatUserConfig = {
defaultNetwork: 'hardhat',
solidity: {
version: '0.8.17',
settings: {
optimizer: {
enabled: true,
runs: 1000,
},
},
},
contractSizer: {
alphaSort: true,
runOnCompile: false,
disambiguatePaths: false,
},
networks: {
localhost: {
url: 'http://localhost:8545/',
accounts: {
// Same mnemonic used in the .env.example
mnemonic: 'change typical hire slam amateur loan grid fix drama electric seed label',
},
chainId: 31337,
},
polygon: {
url: process.env.POLYGON_RPC_URL ?? 'https://polygon-rpc.com',
accounts: [DEPLOYER_PRIVATE_KEY!],
gasMultiplier: 1.5,
chainId: 137,
},
},
diamondAbi: {
// This plugin will combine all ABIs from any Smart Contract with `Facet` in the name or path and output it as `Snowball.json`
name: 'Snowball',
include: ['Facet'],
// We explicitly set `strict` to `true` because we want to validate our facets don't accidentally provide overlapping functions
strict: true,
// We use our diamond utils to filter some functions we ignore from the combined ABI
filter(abiElement: unknown, index: number, abi: unknown[], fullyQualifiedName: string) {
// Events can be defined in internal libraries or multiple facets and look like duplicates
if (diamondUtils.isOverlappingEvent(abiElement)) {
return false;
}
// Errors can be defined in internal libraries or multiple facets and look like duplicates
if (diamondUtils.isOverlappingError(abiElement)) {
return false;
}
const signature = diamondUtils.toSignature(abiElement);
return diamondUtils.isIncluded(fullyQualifiedName, signature);
},
},
};
export default config;