-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
hardhat.config.ts
220 lines (210 loc) · 6.63 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
import { task } from 'hardhat/config';
import '@nomicfoundation/hardhat-chai-matchers';
import 'hardhat-diamond-abi';
import '@nomicfoundation/hardhat-toolbox';
import 'hardhat-abi-exporter';
import { toSignature, isIncluded } from './scripts/diamond';
import { cutFacets, replaceFacet } from './scripts/libraries/diamond';
import 'hardhat-gas-reporter';
// import * as ipfsUtils from "./utils/ipfs";
// import fs from "fs";
import 'hardhat-contract-sizer';
import 'hardhat-deploy';
import 'hardhat-tracer';
import 'solidity-docgen';
import './playbook/initializeDomain';
import './playbook/createGame';
task('accounts', 'Prints the list of accounts', async (taskArgs, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(account.address);
}
});
// task("upload2IPFS", "Uploads files to ipfs")
// .addParam("path", "file path")
// .setAction(async (taskArgs) => {
// const data = fs.readFileSync(taskArgs.path);
// await ipfsUtils.upload2IPFS(data);
// });
// task("uploadDir2IPFS", "Uploads directory to ipfs")
// .addParam("path", "path")
// .setAction(async (taskArgs) => {
// await ipfsUtils.uploadDir2IPFS(taskArgs.path);
// });
task('replaceFacet', 'Upgrades facet')
.addParam('facet', 'facet')
.addParam('address', 'contract address')
.setAction(async (taskArgs, hre) => {
const accounts = await hre.ethers.getSigners();
const response = await replaceFacet(taskArgs.address, taskArgs.facet, accounts[0]);
});
task('addFacet', 'adds a facet')
.addParam('facet', 'facet')
.addParam('address', 'contract address')
.setAction(async (taskArgs, hre) => {
const Facet = await hre.ethers.getContractFactory(taskArgs.facet);
const accounts = await hre.ethers.getSigners();
const facet = await Facet.deploy();
await facet.deployed();
const response = await cutFacets({
facets: [facet],
diamondAddress: taskArgs.address,
signer: accounts[0],
});
});
// task("PublishIPNS", "Publishes IPNS with new pointer")
// .addParam("value")
// .setAction(async (taskArgs) => {
// await ipfsUtils.publish(`${taskArgs.value}`);
// });
export default {
docgen: {
outputDir: './docs/contracts',
pages: 'files',
templates: 'docs/templates',
sourcesDir: './src',
pageExtension: '.md',
exclude: ['mocks', 'initializers', 'vendor', 'modifiers', 'fixtures'],
},
gasReporter: {
currency: 'EUR',
gasPrice: 21,
token: 'MATIC',
gasPriceApi: 'https://api.polygonscan.com/api?module=proxy&action=eth_gasPrice',
enabled: false,
coinmarketcap: process.env.COINMARKETCAP_KEY,
},
namedAccounts: {
deployer: {
hardhat: '0xF52E5dF676f51E410c456CC34360cA6F27959420',
anvil: '0x6Cf8d74C7875de8C2FfB09228F4bf2A21b25e583',
default: '0xF52E5dF676f51E410c456CC34360cA6F27959420', //TODO this must be set for networks
},
owner: {
default: '0x520E00225C4a43B6c55474Db44a4a44199b4c3eE',
anvil: '0x507c2d32185667156de5B4C440FEEf3800078bDb',
},
registrar: {
localhost: '0xaA63aA2D921F23f204B6Bcb43c2844Fb83c82eb9',
},
defaultPlayer: {
localhost: '0xF52E5dF676f51E410c456CC34360cA6F27959420',
},
},
mocha: {
timeout: 400000,
},
defaultNetwork: 'hardhat',
networks: {
hardhat: {
accounts: {
mnemonic: 'casual vacant letter raw trend tool vacant opera buzz jaguar bridge myself',
}, // ONLY LOCAL
forking: {
url: process.env.FORK_RPC_URL ?? '',
blockNumber: 257223284, // works for arbitrum, change for others
},
},
mumbai: {
url: 'https://matic-mumbai.chainstacklabs.com',
accounts: process.env.PRIVATE_KEY && [process.env.PRIVATE_KEY],
},
matic: {
url: process.env.RPC_URL ?? '',
accounts: process.env.PRIVATE_KEY && [process.env.PRIVATE_KEY],
},
ganache: {
url: process.env.GANACHE_RPC_URL ?? '',
accounts: process.env.PRIVATE_KEY && [process.env.PRIVATE_KEY],
},
goerli: {
url: process.env.RPC_URL ?? '',
accounts: process.env.PRIVATE_KEY && [process.env.PRIVATE_KEY],
},
localhost: {
url: 'http://127.0.0.1:8545',
accounts: {
mnemonic: 'casual vacant letter raw trend tool vacant opera buzz jaguar bridge myself',
}, // ONLY LOCAL
},
anvil: {
url: process.env.ANVIL_RPC_URL ?? '',
accounts: {
mnemonic: process.env.ANVIL_MNEMONIC ?? 'x',
},
},
},
paths: {
sources: './src',
},
solidity: {
compilers: [
{
version: '0.8.20',
settings: {
optimizer: {
enabled: true,
runs: 2000,
},
},
},
{
version: '0.8.17',
settings: {
optimizer: {
enabled: true,
runs: 2000,
},
},
},
],
},
diamondAbi: [
{
// (required) The name of your Diamond ABI
name: 'MultipassDiamond',
include: ['DNSFacet', 'OwnershipFacet', 'DiamondLoupeFacet', 'EIP712InspectorFacet'],
// 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) {
// const changes = new diamondUtils.DiamondChanges();
const signature = toSignature(abiElement);
return isIncluded(fullyQualifiedName, signature);
},
},
{
name: 'RankifyDiamondInstance',
include: [
'DiamondLoupeFacet',
'EIP712InspectorFacet',
'OwnershipFacet',
'RankifyInstanceMainFacet',
'RankifyInstanceRequirementsFacet',
'RankifyInstanceGameMastersFacet',
'RankifyInstanceGameOwnersFacet',
],
strict: true,
filter(abiElement: unknown, index: number, abi: unknown[], fullyQualifiedName: string) {
const signature = toSignature(abiElement);
return isIncluded(fullyQualifiedName, signature);
},
},
],
typechain: {
outDir: 'types',
target: 'ethers-v5',
alwaysGenerateOverloads: true, // should overloads with full signatures like deposit(uint256) be generated always, even if there are no overloads?
// externalArtifacts: ["externalArtifacts/*.json"], // optional array of glob patterns with external artifacts to process (for example external libs from node_modules)
},
abiExporter: {
path: './abi',
runOnCompile: true,
clear: true,
format: 'json',
// flat: true,
// only: [":ERC20$"],
spacing: 2,
pretty: false,
},
};