@zoralabs/protocol-deployments 0.0.12 → 0.0.13
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 +24 -25
- package/CHANGELOG.md +10 -0
- package/README.md +2 -8
- package/dist/{package/chainConfigs.d.ts → chainConfigs.d.ts} +4 -3
- package/dist/chainConfigs.d.ts.map +1 -0
- package/dist/deployment.d.ts.map +1 -0
- package/dist/index.cjs +88 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +84 -53
- package/dist/index.js.map +1 -1
- package/dist/{package/wagmiGenerated.d.ts → wagmiGenerated.d.ts} +118 -44
- package/dist/{package/wagmiGenerated.d.ts.map → wagmiGenerated.d.ts.map} +1 -1
- package/package.json +9 -21
- package/{script → scripts}/bundle-chainConfigs.mjs +9 -7
- package/tsconfig.json +1 -1
- package/tsup.config.ts +5 -5
- package/wagmi.config.ts +31 -9
- package/.env.anvil +0 -2
- package/addresses/1.json +0 -13
- package/addresses/10.json +0 -13
- package/addresses/11155111.json +0 -13
- package/addresses/420.json +0 -13
- package/addresses/424.json +0 -11
- package/addresses/5.json +0 -14
- package/addresses/58008.json +0 -11
- package/addresses/7777777.json +0 -13
- package/addresses/8453.json +0 -13
- package/addresses/84531.json +0 -14
- package/addresses/999.json +0 -13
- package/addresses/999999999.json +0 -14
- package/chainConfigs/1.json +0 -5
- package/chainConfigs/10.json +0 -5
- package/chainConfigs/11155111.json +0 -5
- package/chainConfigs/420.json +0 -5
- package/chainConfigs/424.json +0 -5
- package/chainConfigs/5.json +0 -5
- package/chainConfigs/58008.json +0 -4
- package/chainConfigs/7777777.json +0 -5
- package/chainConfigs/8453.json +0 -5
- package/chainConfigs/84531.json +0 -5
- package/chainConfigs/999.json +0 -5
- package/chainConfigs/999999999.json +0 -5
- package/deterministicConfig/factoryProxy/params.json +0 -10
- package/deterministicConfig/factoryProxy/signatures.json +0 -14
- package/deterministicConfig/premintExecutorProxy/params.json +0 -10
- package/deterministicConfig/premintExecutorProxy/signatures.json +0 -12
- package/deterministicConfig/upgradeGate/params.json +0 -7
- package/deterministicConfig/upgradeGate/signatures.json +0 -14
- package/dist/package/batchPublish.test.d.ts +0 -452
- package/dist/package/batchPublish.test.d.ts.map +0 -1
- package/dist/package/chainConfigs.d.ts.map +0 -1
- package/dist/package/deployment.d.ts.map +0 -1
- package/dist/package/index.d.ts.map +0 -1
- package/dist/script/copy-deployed-contracts.d.ts +0 -2
- package/dist/script/copy-deployed-contracts.d.ts.map +0 -1
- package/dist/script/signDeploymentTransactions.d.ts +0 -2
- package/dist/script/signDeploymentTransactions.d.ts.map +0 -1
- package/foundry.toml +0 -41
- package/package/batchPublish.test.ts +0 -327
- package/package/wagmiGenerated.ts +0 -3657
- package/remappings.txt +0 -9
- package/script/CalculateDeterministicParams.s.sol +0 -84
- package/script/DeployMintersAndImplementations.s.sol +0 -29
- package/script/DeployNew1155Impl.s.sol +0 -24
- package/script/DeployNewImplementation.s.sol +0 -26
- package/script/DeployPreminterImpl.s.sol +0 -23
- package/script/DeployProxiesToNewChain.s.sol +0 -50
- package/script/DeployTestContracts.s.sol +0 -35
- package/script/DeployUpgradeGate.s.sol +0 -27
- package/script/Upgrade.s.sol +0 -83
- package/script/UpgradePreminter.s.sol +0 -34
- package/script/copy-deployed-contracts.ts +0 -86
- package/script/signDeploymentTransactions.ts +0 -302
- package/src/DeploymentConfig.sol +0 -124
- package/src/DeploymentTestingUtils.sol +0 -166
- package/src/DeterministicDeployerScript.sol +0 -249
- package/src/DeterministicProxyDeployer.sol +0 -139
- package/src/IImmutableCreate2Factory.sol +0 -59
- package/src/Zora1155PremintFixtures.sol +0 -75
- package/src/ZoraDeployerBase.sol +0 -144
- package/src/ZoraDeployerUtils.sol +0 -212
- package/test/NewFactoryProxyDeployer.t.sol +0 -127
- package/test/UpgradesTest.t.sol +0 -222
- package/test/ZoraCreator1155Factory_Fork.t.sol +0 -149
- package/test/ZoraCreator1155PremintExecutorForkTest.t.sol +0 -205
- /package/dist/{package/deployment.d.ts → deployment.d.ts} +0 -0
- /package/dist/{package/index.d.ts → index.d.ts} +0 -0
- /package/{package → src}/deployment.ts +0 -0
- /package/{package → src}/index.ts +0 -0
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
http,
|
|
3
|
-
createWalletClient,
|
|
4
|
-
createPublicClient,
|
|
5
|
-
encodeFunctionData,
|
|
6
|
-
TransactionReceipt,
|
|
7
|
-
decodeEventLog,
|
|
8
|
-
encodeAbiParameters,
|
|
9
|
-
parseEther,
|
|
10
|
-
createTestClient,
|
|
11
|
-
} from "viem";
|
|
12
|
-
import { foundry, zora } from "viem/chains";
|
|
13
|
-
import { describe, it, expect } from "vitest";
|
|
14
|
-
import {
|
|
15
|
-
zoraCreator1155FactoryImplConfig,
|
|
16
|
-
zoraCreatorFixedPriceSaleStrategyABI,
|
|
17
|
-
} from "./wagmiGenerated";
|
|
18
|
-
import { zoraCreator1155ImplABI } from "@zoralabs/zora-1155-contracts";
|
|
19
|
-
|
|
20
|
-
const walletClient = createWalletClient({
|
|
21
|
-
chain: foundry,
|
|
22
|
-
transport: http(),
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export const walletClientWithAccount = createWalletClient({
|
|
26
|
-
chain: foundry,
|
|
27
|
-
transport: http(),
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const testClient = createTestClient({
|
|
31
|
-
chain: foundry,
|
|
32
|
-
mode: "anvil",
|
|
33
|
-
transport: http(),
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const publicClient = createPublicClient({
|
|
37
|
-
chain: foundry,
|
|
38
|
-
transport: http(),
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
type Address = `0x${string}`;
|
|
42
|
-
|
|
43
|
-
// JSON-RPC Account
|
|
44
|
-
const [creatorAccount, collectorAccount] =
|
|
45
|
-
(await walletClient.getAddresses()) as [Address, Address, Address];
|
|
46
|
-
|
|
47
|
-
const factoryProxyAddress = zoraCreator1155FactoryImplConfig.address[
|
|
48
|
-
zora.id
|
|
49
|
-
].toLowerCase() as `0x${string}`;
|
|
50
|
-
|
|
51
|
-
const AddressZero = "0x0000000000000000000000000000000000000000";
|
|
52
|
-
|
|
53
|
-
type CreateTokenParams = {
|
|
54
|
-
fixedPriceStrategyAddress: `0x${string}`;
|
|
55
|
-
maxSupply: bigint;
|
|
56
|
-
nextTokenId: bigint;
|
|
57
|
-
price: bigint;
|
|
58
|
-
saleEnd?: bigint;
|
|
59
|
-
saleStart?: bigint;
|
|
60
|
-
mintLimit?: bigint;
|
|
61
|
-
tokenURI: string;
|
|
62
|
-
royaltyBPS: number;
|
|
63
|
-
royaltyRecipient: `0x${string}`;
|
|
64
|
-
autoSupplyInterval: number;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
function constructCreate1155Calls({
|
|
68
|
-
fixedPriceStrategyAddress,
|
|
69
|
-
maxSupply,
|
|
70
|
-
mintLimit,
|
|
71
|
-
nextTokenId,
|
|
72
|
-
price,
|
|
73
|
-
saleEnd,
|
|
74
|
-
saleStart,
|
|
75
|
-
tokenURI,
|
|
76
|
-
royaltyBPS,
|
|
77
|
-
royaltyRecipient,
|
|
78
|
-
autoSupplyInterval,
|
|
79
|
-
}: CreateTokenParams): `0x${string}`[] {
|
|
80
|
-
if (!royaltyRecipient) {
|
|
81
|
-
royaltyRecipient = AddressZero;
|
|
82
|
-
autoSupplyInterval = 0;
|
|
83
|
-
}
|
|
84
|
-
const verifyTokenIdExpected = encodeFunctionData({
|
|
85
|
-
abi: zoraCreator1155ImplABI,
|
|
86
|
-
functionName: "assumeLastTokenIdMatches",
|
|
87
|
-
args: [nextTokenId - 1n],
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
const setupNewToken = encodeFunctionData({
|
|
91
|
-
abi: zoraCreator1155ImplABI,
|
|
92
|
-
functionName: "setupNewToken",
|
|
93
|
-
args: [tokenURI, maxSupply],
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
let royaltyConfig = null;
|
|
97
|
-
if (royaltyBPS > 0 && royaltyRecipient != AddressZero) {
|
|
98
|
-
royaltyConfig = encodeFunctionData({
|
|
99
|
-
abi: zoraCreator1155ImplABI,
|
|
100
|
-
functionName: "updateRoyaltiesForToken",
|
|
101
|
-
args: [
|
|
102
|
-
nextTokenId,
|
|
103
|
-
{
|
|
104
|
-
royaltyBPS,
|
|
105
|
-
royaltyRecipient,
|
|
106
|
-
royaltyMintSchedule: autoSupplyInterval,
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const contractCalls = [
|
|
113
|
-
verifyTokenIdExpected,
|
|
114
|
-
setupNewToken,
|
|
115
|
-
royaltyConfig,
|
|
116
|
-
].filter((item) => item !== null) as `0x${string}`[];
|
|
117
|
-
|
|
118
|
-
if (typeof price !== "undefined") {
|
|
119
|
-
const fixedPriceApproval = encodeFunctionData({
|
|
120
|
-
abi: zoraCreator1155ImplABI,
|
|
121
|
-
functionName: "addPermission",
|
|
122
|
-
args: [
|
|
123
|
-
nextTokenId,
|
|
124
|
-
fixedPriceStrategyAddress,
|
|
125
|
-
2n ** 2n, // PERMISSION_BIT_MINTER
|
|
126
|
-
],
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
const saleData = encodeFunctionData({
|
|
130
|
-
abi: zoraCreatorFixedPriceSaleStrategyABI,
|
|
131
|
-
functionName: "setSale",
|
|
132
|
-
args: [
|
|
133
|
-
nextTokenId,
|
|
134
|
-
{
|
|
135
|
-
pricePerToken: price,
|
|
136
|
-
saleStart: saleStart || 0n,
|
|
137
|
-
saleEnd: saleEnd || 0n,
|
|
138
|
-
maxTokensPerAddress: mintLimit || 0n,
|
|
139
|
-
fundsRecipient: AddressZero,
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
const callSale = encodeFunctionData({
|
|
145
|
-
abi: zoraCreator1155ImplABI,
|
|
146
|
-
functionName: "callSale",
|
|
147
|
-
args: [nextTokenId, fixedPriceStrategyAddress, saleData],
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
return [...contractCalls, fixedPriceApproval, callSale] as `0x${string}`[];
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return contractCalls;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function parseCreate1155Receipt(receipt: TransactionReceipt): {
|
|
157
|
-
contractAddress?: `0x${string}`;
|
|
158
|
-
tokenId?: bigint;
|
|
159
|
-
} {
|
|
160
|
-
const parsedLog = receipt.logs
|
|
161
|
-
.map((log) => {
|
|
162
|
-
try {
|
|
163
|
-
return decodeEventLog({
|
|
164
|
-
abi: zoraCreator1155ImplABI,
|
|
165
|
-
...log,
|
|
166
|
-
});
|
|
167
|
-
} catch (e) {
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
})
|
|
171
|
-
.filter(Boolean);
|
|
172
|
-
|
|
173
|
-
const updatedTokenEvents = parsedLog.filter(
|
|
174
|
-
(log) => log?.eventName === "UpdatedToken",
|
|
175
|
-
);
|
|
176
|
-
const lastUpdatedTokenEvent =
|
|
177
|
-
updatedTokenEvents[updatedTokenEvents.length - 1];
|
|
178
|
-
|
|
179
|
-
let tokenId;
|
|
180
|
-
let contractAddress;
|
|
181
|
-
|
|
182
|
-
// @ts-ignore
|
|
183
|
-
if (lastUpdatedTokenEvent?.args?.tokenId) {
|
|
184
|
-
// @ts-ignore
|
|
185
|
-
tokenId = lastUpdatedTokenEvent?.args?.tokenId as bigint;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// @ts-ignore
|
|
189
|
-
if (receipt.logs?.[0].address) {
|
|
190
|
-
contractAddress = receipt.logs?.[0].address as `0x${string}`;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
return { tokenId, contractAddress };
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
describe("Zora1155", () => {
|
|
197
|
-
it(
|
|
198
|
-
"can batch publish tokens",
|
|
199
|
-
async () => {
|
|
200
|
-
const fixedPriceMinterAddress = await publicClient.readContract({
|
|
201
|
-
abi: zoraCreator1155FactoryImplConfig.abi,
|
|
202
|
-
address: factoryProxyAddress,
|
|
203
|
-
functionName: "fixedPriceMinter",
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
const contractAdmin = creatorAccount;
|
|
207
|
-
const contractUri = "ipfs://contracturl";
|
|
208
|
-
const contractName = "my contract";
|
|
209
|
-
|
|
210
|
-
// setup token creation parameters, assuming that
|
|
211
|
-
// they have auto incrementing ids
|
|
212
|
-
const createToken1Params: CreateTokenParams = {
|
|
213
|
-
maxSupply: 100n,
|
|
214
|
-
mintLimit: 100n,
|
|
215
|
-
nextTokenId: 1n,
|
|
216
|
-
tokenURI: "ipfs://token1",
|
|
217
|
-
fixedPriceStrategyAddress: fixedPriceMinterAddress,
|
|
218
|
-
autoSupplyInterval: 10,
|
|
219
|
-
price: parseEther("0.05"),
|
|
220
|
-
royaltyBPS: 10,
|
|
221
|
-
royaltyRecipient: creatorAccount,
|
|
222
|
-
saleStart: 0n,
|
|
223
|
-
saleEnd: 10000000000000n,
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
const createToken2Params: CreateTokenParams = {
|
|
227
|
-
...createToken1Params,
|
|
228
|
-
tokenURI: "ipfs://token2",
|
|
229
|
-
nextTokenId: 2n,
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
const createToken3Params: CreateTokenParams = {
|
|
233
|
-
...createToken1Params,
|
|
234
|
-
tokenURI: "ipfs://token3",
|
|
235
|
-
nextTokenId: 3n,
|
|
236
|
-
price: parseEther("0.0001"),
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
// build setup actions to create tokens when contract is created
|
|
240
|
-
const setupActions = [
|
|
241
|
-
...constructCreate1155Calls(createToken1Params),
|
|
242
|
-
...constructCreate1155Calls(createToken2Params),
|
|
243
|
-
...constructCreate1155Calls(createToken3Params),
|
|
244
|
-
];
|
|
245
|
-
|
|
246
|
-
// have the factory create the contract
|
|
247
|
-
const createContractCall = await walletClient.writeContract({
|
|
248
|
-
abi: zoraCreator1155FactoryImplConfig.abi,
|
|
249
|
-
address: zoraCreator1155FactoryImplConfig.address[zora.id],
|
|
250
|
-
functionName: "createContract",
|
|
251
|
-
args: [
|
|
252
|
-
contractUri,
|
|
253
|
-
contractName,
|
|
254
|
-
{
|
|
255
|
-
royaltyBPS: 10,
|
|
256
|
-
royaltyMintSchedule: 5,
|
|
257
|
-
royaltyRecipient: creatorAccount,
|
|
258
|
-
},
|
|
259
|
-
contractAdmin,
|
|
260
|
-
setupActions,
|
|
261
|
-
],
|
|
262
|
-
account: creatorAccount,
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
const receipt = await publicClient.waitForTransactionReceipt({
|
|
266
|
-
hash: createContractCall,
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
expect(receipt.status).toBe("success");
|
|
270
|
-
|
|
271
|
-
// parse the receipt to get the contract address and last token id
|
|
272
|
-
const { contractAddress, tokenId: lastTokenId } =
|
|
273
|
-
parseCreate1155Receipt(receipt);
|
|
274
|
-
|
|
275
|
-
// now try to mint a token
|
|
276
|
-
const quantityToMint = 2n;
|
|
277
|
-
|
|
278
|
-
const encodedParams = encodeAbiParameters(
|
|
279
|
-
[{ type: "address", name: "address" }],
|
|
280
|
-
[collectorAccount],
|
|
281
|
-
);
|
|
282
|
-
|
|
283
|
-
const zoraMintFee = parseEther("0.000777");
|
|
284
|
-
|
|
285
|
-
const valueToSend =
|
|
286
|
-
(BigInt(zoraMintFee) + createToken3Params.price) * quantityToMint;
|
|
287
|
-
|
|
288
|
-
// make sure the collector has enough balance
|
|
289
|
-
await testClient.setBalance({
|
|
290
|
-
address: collectorAccount,
|
|
291
|
-
value: parseEther("100"),
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
const mintCall = await walletClient.writeContract({
|
|
295
|
-
abi: zoraCreator1155ImplABI,
|
|
296
|
-
address: contractAddress!,
|
|
297
|
-
functionName: "mint",
|
|
298
|
-
account: collectorAccount,
|
|
299
|
-
args: [
|
|
300
|
-
fixedPriceMinterAddress,
|
|
301
|
-
lastTokenId!,
|
|
302
|
-
quantityToMint,
|
|
303
|
-
[AddressZero, AddressZero],
|
|
304
|
-
encodedParams,
|
|
305
|
-
],
|
|
306
|
-
value: valueToSend,
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
expect(
|
|
310
|
-
(await publicClient.waitForTransactionReceipt({ hash: mintCall }))
|
|
311
|
-
.status,
|
|
312
|
-
).toBe("success");
|
|
313
|
-
|
|
314
|
-
// check balance of token
|
|
315
|
-
const tokenBalance = await publicClient.readContract({
|
|
316
|
-
abi: zoraCreator1155ImplABI,
|
|
317
|
-
address: contractAddress!,
|
|
318
|
-
functionName: "balanceOf",
|
|
319
|
-
args: [collectorAccount, lastTokenId!],
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
expect(tokenBalance).toBe(quantityToMint);
|
|
323
|
-
},
|
|
324
|
-
// 10 second timeout
|
|
325
|
-
10 * 1000,
|
|
326
|
-
);
|
|
327
|
-
});
|