@zoralabs/protocol-deployments 0.3.2 → 0.3.4-PRE.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +48 -43
- package/CHANGELOG.md +12 -0
- package/dist/encoding.d.ts +15 -0
- package/dist/encoding.d.ts.map +1 -0
- package/dist/generated/wagmi.d.ts +237 -16
- package/dist/generated/wagmi.d.ts.map +1 -1
- package/dist/index.cjs +84 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +80 -4
- package/dist/index.js.map +1 -1
- package/json/1155.json +212 -0
- package/json/mints.json +46 -0
- package/package.json +22 -14
- package/src/encoding.ts +6 -0
- package/src/generated/wagmi.ts +107 -2
- package/src/index.ts +1 -0
- package/wagmi.config.ts +383 -0
- package/LICENSE +0 -21
package/wagmi.config.ts
ADDED
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import { ContractConfig, defineConfig } from "@wagmi/cli";
|
|
2
|
+
import { Abi, zeroAddress } from "viem";
|
|
3
|
+
import { readdirSync, readFileSync } from "fs";
|
|
4
|
+
import * as abis from "@zoralabs/zora-1155-contracts";
|
|
5
|
+
import {
|
|
6
|
+
zoraSparks1155ABI,
|
|
7
|
+
zoraSparksManagerImplABI,
|
|
8
|
+
sparksEthUnwrapperAndCallerABI,
|
|
9
|
+
iUnwrapAndForwardActionABI,
|
|
10
|
+
zoraMints1155ABI,
|
|
11
|
+
zoraMintsManagerImplABI,
|
|
12
|
+
sponsoredSparksSpenderABI,
|
|
13
|
+
iSponsoredSparksSpenderActionABI,
|
|
14
|
+
} from "@zoralabs/sparks-contracts";
|
|
15
|
+
import {
|
|
16
|
+
erc20ZABI,
|
|
17
|
+
zoraTimedSaleStrategyImplABI,
|
|
18
|
+
royaltiesABI,
|
|
19
|
+
secondarySwapABI,
|
|
20
|
+
iwethABI,
|
|
21
|
+
} from "@zoralabs/erc20z";
|
|
22
|
+
import { iPremintDefinitionsABI } from "@zoralabs/zora-1155-contracts";
|
|
23
|
+
import { zora } from "viem/chains";
|
|
24
|
+
|
|
25
|
+
type Address = `0x${string}`;
|
|
26
|
+
|
|
27
|
+
type Addresses = {
|
|
28
|
+
[contractName: string]: {
|
|
29
|
+
address: {
|
|
30
|
+
[chainId: number]: Address;
|
|
31
|
+
};
|
|
32
|
+
abi: Abi;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const timedSaleStrategyErrors = zoraTimedSaleStrategyImplABI.filter(
|
|
37
|
+
(x) => x.type === "error",
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const zora1155Errors = [
|
|
41
|
+
...abis.zoraCreator1155ImplABI.filter((x) => x.type === "error"),
|
|
42
|
+
...timedSaleStrategyErrors,
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
type AbiAndAddresses = {
|
|
46
|
+
abi: Abi;
|
|
47
|
+
address: Record<number, Address>;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const addAddress = <
|
|
51
|
+
T extends Record<string, AbiAndAddresses>,
|
|
52
|
+
K extends Record<string, Address>,
|
|
53
|
+
>({
|
|
54
|
+
contractName,
|
|
55
|
+
abi,
|
|
56
|
+
addresses,
|
|
57
|
+
storedConfigs,
|
|
58
|
+
configKey,
|
|
59
|
+
}: {
|
|
60
|
+
abi: Abi;
|
|
61
|
+
contractName: string;
|
|
62
|
+
configKey: keyof K;
|
|
63
|
+
addresses: T;
|
|
64
|
+
storedConfigs: {
|
|
65
|
+
chainId: number;
|
|
66
|
+
config: K;
|
|
67
|
+
}[];
|
|
68
|
+
}) => {
|
|
69
|
+
// @ts-ignore
|
|
70
|
+
addresses[contractName] = {
|
|
71
|
+
address: {},
|
|
72
|
+
abi,
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
for (const storedConfig of storedConfigs) {
|
|
76
|
+
const address = storedConfig.config[configKey] as Address | undefined;
|
|
77
|
+
if (address && address !== zeroAddress)
|
|
78
|
+
addresses[contractName]!.address[storedConfig.chainId] = address;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const toConfig = (
|
|
83
|
+
addresses: Record<string, AbiAndAddresses>,
|
|
84
|
+
): ContractConfig[] => {
|
|
85
|
+
return Object.entries(addresses).map(([contractName, config]) => ({
|
|
86
|
+
abi: config.abi,
|
|
87
|
+
name: contractName,
|
|
88
|
+
address: config.address,
|
|
89
|
+
}));
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const get1155Contracts = (): ContractConfig[] => {
|
|
93
|
+
const addresses: Addresses = {};
|
|
94
|
+
|
|
95
|
+
const addressesFiles = readdirSync("../1155-deployments/addresses");
|
|
96
|
+
|
|
97
|
+
const protocolRewardsConfig = JSON.parse(
|
|
98
|
+
readFileSync("../protocol-rewards/deterministicConfig.json", "utf-8"),
|
|
99
|
+
) as {
|
|
100
|
+
expectedAddress: Address;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const storedConfigs = addressesFiles.map((file) => {
|
|
104
|
+
const protocolRewardsAddress = protocolRewardsConfig.expectedAddress;
|
|
105
|
+
return {
|
|
106
|
+
chainId: parseInt(file.split(".")[0]),
|
|
107
|
+
config: {
|
|
108
|
+
...(JSON.parse(
|
|
109
|
+
readFileSync(`../1155-deployments/addresses/${file}`, "utf-8"),
|
|
110
|
+
) as {
|
|
111
|
+
FIXED_PRICE_SALE_STRATEGY: Address;
|
|
112
|
+
MERKLE_MINT_SALE_STRATEGY: Address;
|
|
113
|
+
REDEEM_MINTER_FACTORY: Address;
|
|
114
|
+
"1155_IMPL": Address;
|
|
115
|
+
FACTORY_IMPL: Address;
|
|
116
|
+
FACTORY_PROXY: Address;
|
|
117
|
+
PREMINTER_PROXY?: Address;
|
|
118
|
+
ERC20_MINTER?: Address;
|
|
119
|
+
UPGRADE_GATE?: Address;
|
|
120
|
+
}),
|
|
121
|
+
PROTOCOL_REWARDS: protocolRewardsAddress,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
addAddress({
|
|
127
|
+
contractName: "ZoraCreatorFixedPriceSaleStrategy",
|
|
128
|
+
abi: abis.zoraCreatorFixedPriceSaleStrategyABI,
|
|
129
|
+
addresses,
|
|
130
|
+
configKey: "FIXED_PRICE_SALE_STRATEGY",
|
|
131
|
+
storedConfigs: storedConfigs,
|
|
132
|
+
});
|
|
133
|
+
addAddress({
|
|
134
|
+
contractName: "ZoraCreatorMerkleMinterStrategy",
|
|
135
|
+
abi: abis.zoraCreatorMerkleMinterStrategyABI,
|
|
136
|
+
configKey: "MERKLE_MINT_SALE_STRATEGY",
|
|
137
|
+
addresses,
|
|
138
|
+
storedConfigs: storedConfigs,
|
|
139
|
+
});
|
|
140
|
+
addAddress({
|
|
141
|
+
contractName: "ZoraCreator1155FactoryImpl",
|
|
142
|
+
configKey: "FACTORY_PROXY",
|
|
143
|
+
abi: [...abis.zoraCreator1155FactoryImplABI, ...zora1155Errors],
|
|
144
|
+
addresses,
|
|
145
|
+
storedConfigs,
|
|
146
|
+
});
|
|
147
|
+
addAddress({
|
|
148
|
+
contractName: "ZoraCreatorRedeemMinterFactory",
|
|
149
|
+
configKey: "REDEEM_MINTER_FACTORY",
|
|
150
|
+
abi: abis.zoraCreatorRedeemMinterFactoryABI,
|
|
151
|
+
addresses,
|
|
152
|
+
storedConfigs,
|
|
153
|
+
});
|
|
154
|
+
addAddress({
|
|
155
|
+
contractName: "ZoraCreator1155PremintExecutorImpl",
|
|
156
|
+
configKey: "PREMINTER_PROXY",
|
|
157
|
+
abi: abis.zoraCreator1155PremintExecutorImplABI,
|
|
158
|
+
addresses,
|
|
159
|
+
storedConfigs,
|
|
160
|
+
});
|
|
161
|
+
addAddress({
|
|
162
|
+
contractName: "ProtocolRewards",
|
|
163
|
+
configKey: "PROTOCOL_REWARDS",
|
|
164
|
+
abi: abis.protocolRewardsABI,
|
|
165
|
+
addresses,
|
|
166
|
+
storedConfigs,
|
|
167
|
+
});
|
|
168
|
+
addAddress({
|
|
169
|
+
contractName: "ERC20Minter",
|
|
170
|
+
configKey: "ERC20_MINTER",
|
|
171
|
+
abi: abis.erc20MinterABI,
|
|
172
|
+
addresses,
|
|
173
|
+
storedConfigs,
|
|
174
|
+
});
|
|
175
|
+
addAddress({
|
|
176
|
+
contractName: "UpgradeGate",
|
|
177
|
+
configKey: "UPGRADE_GATE",
|
|
178
|
+
abi: abis.upgradeGateABI,
|
|
179
|
+
addresses,
|
|
180
|
+
storedConfigs,
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
return [
|
|
184
|
+
...toConfig(addresses),
|
|
185
|
+
{
|
|
186
|
+
abi: [...abis.zoraCreator1155ImplABI, ...timedSaleStrategyErrors],
|
|
187
|
+
name: "ZoraCreator1155Impl",
|
|
188
|
+
},
|
|
189
|
+
];
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const getSharedAddresses = () => {
|
|
193
|
+
const addresses: Addresses = {};
|
|
194
|
+
const addressesFiles = readdirSync("../shared-contracts/chainConfigs");
|
|
195
|
+
|
|
196
|
+
const storedConfigs = addressesFiles.map((file) => {
|
|
197
|
+
return {
|
|
198
|
+
chainId: parseInt(file.split(".")[0]),
|
|
199
|
+
config: JSON.parse(
|
|
200
|
+
readFileSync(`../shared-contracts/chainConfigs/${file}`, "utf-8"),
|
|
201
|
+
) as {
|
|
202
|
+
WETH: Address;
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
addAddress({
|
|
208
|
+
abi: iwethABI,
|
|
209
|
+
addresses,
|
|
210
|
+
configKey: "WETH",
|
|
211
|
+
contractName: "WETH",
|
|
212
|
+
storedConfigs,
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
return toConfig(addresses);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const getSparksAddresses = () => {
|
|
219
|
+
const chainIds = [7777777, 999999999];
|
|
220
|
+
|
|
221
|
+
const sparksProxyConfig = JSON.parse(
|
|
222
|
+
readFileSync(
|
|
223
|
+
"../sparks-deployments/deterministicConfig/sparksProxy/params.json",
|
|
224
|
+
"utf-8",
|
|
225
|
+
),
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
const mintsProxyConfig = JSON.parse(
|
|
229
|
+
readFileSync(
|
|
230
|
+
"../sparks-deployments/deterministicConfig/mintsProxy/params.json",
|
|
231
|
+
"utf-8",
|
|
232
|
+
),
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
const mintsEthUnwrapperAndCallerAddress = JSON.parse(
|
|
236
|
+
readFileSync("../sparks-deployments/addresses/999999999.json", "utf-8"),
|
|
237
|
+
).MINTS_ETH_UNWRAPPER_AND_CALLER as Address;
|
|
238
|
+
|
|
239
|
+
const sparksManagerAddress = sparksProxyConfig.manager
|
|
240
|
+
.deployedAddress as Address;
|
|
241
|
+
const zoraSparks1155Address = sparksProxyConfig.sparks1155
|
|
242
|
+
.deployedAddress as Address;
|
|
243
|
+
|
|
244
|
+
return {
|
|
245
|
+
sparksManager: Object.fromEntries(
|
|
246
|
+
chainIds.map((chainId) => [chainId, sparksManagerAddress]),
|
|
247
|
+
),
|
|
248
|
+
sparks1155: Object.fromEntries(
|
|
249
|
+
chainIds.map((chainId) => [chainId, zoraSparks1155Address as Address]),
|
|
250
|
+
),
|
|
251
|
+
|
|
252
|
+
mintsEthUnwrapperAndCaller: Object.fromEntries(
|
|
253
|
+
chainIds.map((chainId) => [chainId, mintsEthUnwrapperAndCallerAddress]),
|
|
254
|
+
),
|
|
255
|
+
// deprecated mints contracts
|
|
256
|
+
mintsManager: Object.fromEntries(
|
|
257
|
+
chainIds.map((chainId) => [
|
|
258
|
+
chainId,
|
|
259
|
+
mintsProxyConfig.manager.deployedAddress as Address,
|
|
260
|
+
]),
|
|
261
|
+
),
|
|
262
|
+
mints1155: Object.fromEntries(
|
|
263
|
+
chainIds.map((chainId) => [
|
|
264
|
+
chainId,
|
|
265
|
+
mintsProxyConfig.mints1155.deployedAddress as Address,
|
|
266
|
+
]),
|
|
267
|
+
),
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
const sparksAddresses = getSparksAddresses();
|
|
272
|
+
|
|
273
|
+
const getErc20zContracts = (): ContractConfig[] => {
|
|
274
|
+
const addresses: Addresses = {};
|
|
275
|
+
|
|
276
|
+
const addressesFiles = readdirSync("../erc20z/addresses");
|
|
277
|
+
|
|
278
|
+
const storedConfigs = addressesFiles.map((file) => {
|
|
279
|
+
return {
|
|
280
|
+
chainId: parseInt(file.split(".")[0]),
|
|
281
|
+
config: {
|
|
282
|
+
...(JSON.parse(
|
|
283
|
+
readFileSync(`../erc20z/addresses/${file}`, "utf-8"),
|
|
284
|
+
) as {
|
|
285
|
+
SWAP_HELPER: Address;
|
|
286
|
+
ERC20Z: Address;
|
|
287
|
+
NONFUNGIBLE_POSITION_MANAGER: Address;
|
|
288
|
+
ROYALTIES: Address;
|
|
289
|
+
SALE_STRATEGY: Address;
|
|
290
|
+
SALE_STRATEGY_IMPL: Address;
|
|
291
|
+
WETH: Address;
|
|
292
|
+
}),
|
|
293
|
+
},
|
|
294
|
+
};
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
addAddress({
|
|
298
|
+
abi: royaltiesABI,
|
|
299
|
+
addresses,
|
|
300
|
+
configKey: "ROYALTIES",
|
|
301
|
+
contractName: "ERC20ZRoyalties",
|
|
302
|
+
storedConfigs,
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
addAddress({
|
|
306
|
+
abi: zoraTimedSaleStrategyImplABI,
|
|
307
|
+
addresses,
|
|
308
|
+
configKey: "SALE_STRATEGY",
|
|
309
|
+
contractName: "zoraTimedSaleStrategy",
|
|
310
|
+
storedConfigs,
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
addAddress({
|
|
314
|
+
abi: secondarySwapABI,
|
|
315
|
+
addresses,
|
|
316
|
+
configKey: "SWAP_HELPER",
|
|
317
|
+
contractName: "SecondarySwap",
|
|
318
|
+
storedConfigs,
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
return [
|
|
322
|
+
...toConfig(addresses),
|
|
323
|
+
{
|
|
324
|
+
abi: erc20ZABI,
|
|
325
|
+
name: "ERC20Z",
|
|
326
|
+
},
|
|
327
|
+
];
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
export default defineConfig({
|
|
331
|
+
out: "./src/generated/wagmi.ts",
|
|
332
|
+
contracts: [
|
|
333
|
+
...get1155Contracts(),
|
|
334
|
+
...getErc20zContracts(),
|
|
335
|
+
...getSharedAddresses(),
|
|
336
|
+
{
|
|
337
|
+
abi: zoraSparksManagerImplABI,
|
|
338
|
+
name: "ZoraSparksManagerImpl",
|
|
339
|
+
address: sparksAddresses.sparksManager,
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
abi: zoraSparks1155ABI,
|
|
343
|
+
name: "ZoraSparks1155",
|
|
344
|
+
address: sparksAddresses.sparks1155,
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
abi: sparksEthUnwrapperAndCallerABI,
|
|
348
|
+
name: "MintsEthUnwrapperAndCaller",
|
|
349
|
+
address: sparksAddresses.mintsEthUnwrapperAndCaller,
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
abi: iUnwrapAndForwardActionABI,
|
|
353
|
+
name: "IUnwrapAndForwardAction",
|
|
354
|
+
},
|
|
355
|
+
// legacy mints contracts
|
|
356
|
+
{
|
|
357
|
+
abi: zoraMints1155ABI,
|
|
358
|
+
name: "ZoraMints1155",
|
|
359
|
+
address: sparksAddresses.mints1155,
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
abi: zoraMintsManagerImplABI,
|
|
363
|
+
name: "ZoraMintsManagerImpl",
|
|
364
|
+
address: sparksAddresses.mintsManager,
|
|
365
|
+
},
|
|
366
|
+
// end legacy mints contract
|
|
367
|
+
{
|
|
368
|
+
abi: iPremintDefinitionsABI,
|
|
369
|
+
name: "IPremintDefinitions",
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
abi: sponsoredSparksSpenderABI,
|
|
373
|
+
name: "SponsoredSparksSpender",
|
|
374
|
+
address: {
|
|
375
|
+
[zora.id]: "0x29b75AbA7dc7FE26d90CD96fbB390B26e04C4EB2",
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
abi: iSponsoredSparksSpenderActionABI,
|
|
380
|
+
name: "ISponsoredSparksSpenderAction",
|
|
381
|
+
},
|
|
382
|
+
],
|
|
383
|
+
});
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 Zora Labs
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|