clanker-sdk 4.0.0 → 4.0.2

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/dist/cli/cli.js CHANGED
@@ -22,6 +22,168 @@ var init_esm_shims = __esm({
22
22
  }
23
23
  });
24
24
 
25
+ // src/utils/validation-schema.ts
26
+ import { z } from "zod";
27
+ import { isAddress, isHex } from "viem";
28
+ var isHexRefinement, isAddressRefinement, clankerConfigSchema, tokenConfigSchema, vaultConfigSchema, poolConfigSchema, initialBuyConfigSchema, rewardsConfigSchema, deploymentConfigSchema;
29
+ var init_validation_schema = __esm({
30
+ "src/utils/validation-schema.ts"() {
31
+ "use strict";
32
+ init_esm_shims();
33
+ init_validation();
34
+ isHexRefinement = (val) => isHex(val);
35
+ isAddressRefinement = (val) => isAddress(val);
36
+ clankerConfigSchema = z.object({
37
+ publicClient: z.any({ message: "Public client is required" }),
38
+ wallet: z.any().optional()
39
+ });
40
+ tokenConfigSchema = z.object({
41
+ name: z.string().min(1, "Name is required"),
42
+ symbol: z.string().min(1, "Symbol is required"),
43
+ image: z.string().optional(),
44
+ metadata: z.object({
45
+ description: z.string().optional(),
46
+ socialMediaUrls: z.array(z.string()).optional(),
47
+ auditUrls: z.array(z.string()).optional()
48
+ }).optional(),
49
+ context: z.object({
50
+ interface: z.string().optional(),
51
+ platform: z.string().optional(),
52
+ messageId: z.string().optional(),
53
+ id: z.string().optional()
54
+ }).optional(),
55
+ vault: z.object({
56
+ percentage: z.number().min(0).max(100).refine((val) => isValidBps(percentageToBps(val)), {
57
+ message: "Invalid vault percentage"
58
+ }),
59
+ lockupDuration: z.number().min(0),
60
+ vestingDuration: z.number().min(0)
61
+ }).optional(),
62
+ airdrop: z.object({
63
+ merkleRoot: z.string().refine(isHexRefinement),
64
+ lockupDuration: z.number().min(0),
65
+ vestingDuration: z.number().min(0),
66
+ entries: z.array(
67
+ z.object({
68
+ account: z.string().refine(isAddressRefinement),
69
+ amount: z.bigint().min(0n)
70
+ })
71
+ ),
72
+ percentage: z.number().min(0).max(1e4).refine(isValidBps, {
73
+ message: "Invalid airdrop percentage in basis points"
74
+ })
75
+ }).optional(),
76
+ devBuy: z.object({
77
+ ethAmount: z.string().optional()
78
+ }).optional(),
79
+ rewardsConfig: z.object({
80
+ creatorReward: z.number().min(0).max(1e4).refine(isValidBps, {
81
+ message: "Invalid creator reward in basis points"
82
+ }),
83
+ creatorAdmin: z.string().refine(isAddressRefinement),
84
+ creatorRewardRecipient: z.string().refine(isAddressRefinement),
85
+ interfaceAdmin: z.string().refine(isAddressRefinement),
86
+ interfaceRewardRecipient: z.string().refine(isAddressRefinement),
87
+ additionalRewardRecipients: z.array(z.string().refine(isAddressRefinement)).optional()
88
+ })
89
+ });
90
+ vaultConfigSchema = z.object({
91
+ vaultPercentage: z.number().min(0).max(100, "Vault percentage must be between 0 and 100"),
92
+ vaultDuration: z.bigint()
93
+ }).refine(
94
+ (data) => {
95
+ return data.vaultPercentage === 0 || data.vaultPercentage > 0 && data.vaultDuration > 0n;
96
+ },
97
+ {
98
+ message: "Vault duration must be greater than 0 when vault percentage is greater than 0",
99
+ path: ["vaultDuration"]
100
+ }
101
+ );
102
+ poolConfigSchema = z.object({
103
+ pairedToken: z.string().refine(isAddressRefinement, {
104
+ message: "Paired token must be a valid Ethereum address"
105
+ }),
106
+ initialMarketCapInPairedToken: z.bigint().gt(0n, "Initial market cap must be greater than 0"),
107
+ initialMarketCap: z.string().optional(),
108
+ tickIfToken0IsNewToken: z.number()
109
+ });
110
+ initialBuyConfigSchema = z.object({
111
+ pairedTokenPoolFee: z.number(),
112
+ pairedTokenSwapAmountOutMinimum: z.bigint(),
113
+ ethAmount: z.bigint().optional()
114
+ });
115
+ rewardsConfigSchema = z.object({
116
+ creatorReward: z.bigint().gte(0n, "Creator reward must be greater than or equal to 0"),
117
+ creatorAdmin: z.string().refine(isAddressRefinement, {
118
+ message: "Creator admin must be a valid Ethereum address"
119
+ }),
120
+ creatorRewardRecipient: z.string().refine(isAddressRefinement, {
121
+ message: "Creator reward recipient must be a valid Ethereum address"
122
+ }),
123
+ interfaceAdmin: z.string().refine(isAddressRefinement, {
124
+ message: "Interface admin must be a valid Ethereum address"
125
+ }),
126
+ interfaceRewardRecipient: z.string().refine(isAddressRefinement, {
127
+ message: "Interface reward recipient must be a valid Ethereum address"
128
+ })
129
+ });
130
+ deploymentConfigSchema = z.object({
131
+ tokenConfig: tokenConfigSchema,
132
+ vaultConfig: vaultConfigSchema.optional(),
133
+ poolConfig: poolConfigSchema,
134
+ initialBuyConfig: initialBuyConfigSchema.optional(),
135
+ rewardsConfig: rewardsConfigSchema
136
+ });
137
+ }
138
+ });
139
+
140
+ // src/utils/validation.ts
141
+ function isValidBps(value) {
142
+ return value >= 0 && value <= 1e4;
143
+ }
144
+ function percentageToBps(percentage) {
145
+ return Math.round(percentage * 100);
146
+ }
147
+ function validateConfig(config2) {
148
+ if (typeof config2 === "object" && config2 !== null && "name" in config2 && "symbol" in config2) {
149
+ return tokenConfigSchema.safeParse(config2);
150
+ }
151
+ if (typeof config2 === "object" && config2 !== null && "tokenConfig" in config2 && "poolConfig" in config2 && "rewardsConfig" in config2) {
152
+ return deploymentConfigSchema.safeParse(config2);
153
+ }
154
+ if (typeof config2 === "object" && config2 !== null && "vaultPercentage" in config2 && "vaultDuration" in config2) {
155
+ return vaultConfigSchema.safeParse(config2);
156
+ }
157
+ if (typeof config2 === "object" && config2 !== null && "pairedToken" in config2 && "initialMarketCapInPairedToken" in config2) {
158
+ return poolConfigSchema.safeParse(config2);
159
+ }
160
+ if (typeof config2 === "object" && config2 !== null && "creatorReward" in config2 && "creatorAdmin" in config2 && "creatorRewardRecipient" in config2) {
161
+ return rewardsConfigSchema.safeParse(config2);
162
+ }
163
+ if (typeof config2 === "object" && config2 !== null && "pairedTokenPoolFee" in config2 && "pairedTokenSwapAmountOutMinimum" in config2) {
164
+ return initialBuyConfigSchema.safeParse(config2);
165
+ }
166
+ if (typeof config2 === "object" && config2 !== null && "publicClient" in config2) {
167
+ return clankerConfigSchema.safeParse(config2);
168
+ }
169
+ return {
170
+ success: false,
171
+ error: {
172
+ message: "Unknown configuration type",
173
+ format: () => ({
174
+ _errors: ["Unable to determine configuration type for validation"]
175
+ })
176
+ }
177
+ };
178
+ }
179
+ var init_validation = __esm({
180
+ "src/utils/validation.ts"() {
181
+ "use strict";
182
+ init_esm_shims();
183
+ init_validation_schema();
184
+ }
185
+ });
186
+
25
187
  // src/abi/v3.1/Clanker.ts
26
188
  var Clanker_v3_1_abi;
27
189
  var init_Clanker = __esm({
@@ -59,8 +221,18 @@ var init_Clanker = __esm({
59
221
  {
60
222
  anonymous: false,
61
223
  inputs: [
62
- { indexed: false, internalType: "address", name: "oldClankerDeployer", type: "address" },
63
- { indexed: false, internalType: "address", name: "newClankerDeployer", type: "address" }
224
+ {
225
+ indexed: false,
226
+ internalType: "address",
227
+ name: "oldClankerDeployer",
228
+ type: "address"
229
+ },
230
+ {
231
+ indexed: false,
232
+ internalType: "address",
233
+ name: "newClankerDeployer",
234
+ type: "address"
235
+ }
64
236
  ],
65
237
  name: "ClankerDeployerUpdated",
66
238
  type: "event"
@@ -68,8 +240,18 @@ var init_Clanker = __esm({
68
240
  {
69
241
  anonymous: false,
70
242
  inputs: [
71
- { indexed: false, internalType: "address", name: "oldLocker", type: "address" },
72
- { indexed: false, internalType: "address", name: "newLocker", type: "address" }
243
+ {
244
+ indexed: false,
245
+ internalType: "address",
246
+ name: "oldLocker",
247
+ type: "address"
248
+ },
249
+ {
250
+ indexed: false,
251
+ internalType: "address",
252
+ name: "newLocker",
253
+ type: "address"
254
+ }
73
255
  ],
74
256
  name: "LiquidityLockerUpdated",
75
257
  type: "event"
@@ -77,8 +259,18 @@ var init_Clanker = __esm({
77
259
  {
78
260
  anonymous: false,
79
261
  inputs: [
80
- { indexed: true, internalType: "address", name: "previousOwner", type: "address" },
81
- { indexed: true, internalType: "address", name: "newOwner", type: "address" }
262
+ {
263
+ indexed: true,
264
+ internalType: "address",
265
+ name: "previousOwner",
266
+ type: "address"
267
+ },
268
+ {
269
+ indexed: true,
270
+ internalType: "address",
271
+ name: "newOwner",
272
+ type: "address"
273
+ }
82
274
  ],
83
275
  name: "OwnershipTransferred",
84
276
  type: "event"
@@ -86,7 +278,12 @@ var init_Clanker = __esm({
86
278
  {
87
279
  anonymous: false,
88
280
  inputs: [
89
- { indexed: false, internalType: "address", name: "admin", type: "address" },
281
+ {
282
+ indexed: false,
283
+ internalType: "address",
284
+ name: "admin",
285
+ type: "address"
286
+ },
90
287
  { indexed: false, internalType: "bool", name: "isAdmin", type: "bool" }
91
288
  ],
92
289
  name: "SetAdmin",
@@ -94,37 +291,99 @@ var init_Clanker = __esm({
94
291
  },
95
292
  {
96
293
  anonymous: false,
97
- inputs: [{ indexed: false, internalType: "bool", name: "deprecated", type: "bool" }],
294
+ inputs: [
295
+ {
296
+ indexed: false,
297
+ internalType: "bool",
298
+ name: "deprecated",
299
+ type: "bool"
300
+ }
301
+ ],
98
302
  name: "SetDeprecated",
99
303
  type: "event"
100
304
  },
101
305
  {
102
306
  anonymous: false,
103
307
  inputs: [
104
- { indexed: true, internalType: "address", name: "tokenAddress", type: "address" },
105
- { indexed: true, internalType: "address", name: "creatorAdmin", type: "address" },
106
- { indexed: true, internalType: "address", name: "interfaceAdmin", type: "address" },
107
- { indexed: false, internalType: "address", name: "creatorRewardRecipient", type: "address" },
308
+ {
309
+ indexed: true,
310
+ internalType: "address",
311
+ name: "tokenAddress",
312
+ type: "address"
313
+ },
314
+ {
315
+ indexed: true,
316
+ internalType: "address",
317
+ name: "creatorAdmin",
318
+ type: "address"
319
+ },
320
+ {
321
+ indexed: true,
322
+ internalType: "address",
323
+ name: "interfaceAdmin",
324
+ type: "address"
325
+ },
326
+ {
327
+ indexed: false,
328
+ internalType: "address",
329
+ name: "creatorRewardRecipient",
330
+ type: "address"
331
+ },
108
332
  {
109
333
  indexed: false,
110
334
  internalType: "address",
111
335
  name: "interfaceRewardRecipient",
112
336
  type: "address"
113
337
  },
114
- { indexed: false, internalType: "uint256", name: "positionId", type: "uint256" },
338
+ {
339
+ indexed: false,
340
+ internalType: "uint256",
341
+ name: "positionId",
342
+ type: "uint256"
343
+ },
115
344
  { indexed: false, internalType: "string", name: "name", type: "string" },
116
- { indexed: false, internalType: "string", name: "symbol", type: "string" },
345
+ {
346
+ indexed: false,
347
+ internalType: "string",
348
+ name: "symbol",
349
+ type: "string"
350
+ },
117
351
  {
118
352
  indexed: false,
119
353
  internalType: "int24",
120
354
  name: "startingTickIfToken0IsNewToken",
121
355
  type: "int24"
122
356
  },
123
- { indexed: false, internalType: "string", name: "metadata", type: "string" },
124
- { indexed: false, internalType: "uint256", name: "amountTokensBought", type: "uint256" },
125
- { indexed: false, internalType: "uint256", name: "vaultDuration", type: "uint256" },
126
- { indexed: false, internalType: "uint8", name: "vaultPercentage", type: "uint8" },
127
- { indexed: false, internalType: "address", name: "msgSender", type: "address" }
357
+ {
358
+ indexed: false,
359
+ internalType: "string",
360
+ name: "metadata",
361
+ type: "string"
362
+ },
363
+ {
364
+ indexed: false,
365
+ internalType: "uint256",
366
+ name: "amountTokensBought",
367
+ type: "uint256"
368
+ },
369
+ {
370
+ indexed: false,
371
+ internalType: "uint256",
372
+ name: "vaultDuration",
373
+ type: "uint256"
374
+ },
375
+ {
376
+ indexed: false,
377
+ internalType: "uint8",
378
+ name: "vaultPercentage",
379
+ type: "uint8"
380
+ },
381
+ {
382
+ indexed: false,
383
+ internalType: "address",
384
+ name: "msgSender",
385
+ type: "address"
386
+ }
128
387
  ],
129
388
  name: "TokenCreated",
130
389
  type: "event"
@@ -132,8 +391,18 @@ var init_Clanker = __esm({
132
391
  {
133
392
  anonymous: false,
134
393
  inputs: [
135
- { indexed: false, internalType: "address", name: "oldVault", type: "address" },
136
- { indexed: false, internalType: "address", name: "newVault", type: "address" }
394
+ {
395
+ indexed: false,
396
+ internalType: "address",
397
+ name: "oldVault",
398
+ type: "address"
399
+ },
400
+ {
401
+ indexed: false,
402
+ internalType: "address",
403
+ name: "newVault",
404
+ type: "address"
405
+ }
137
406
  ],
138
407
  name: "VaultUpdated",
139
408
  type: "event"
@@ -206,7 +475,11 @@ var init_Clanker = __esm({
206
475
  { internalType: "string", name: "image", type: "string" },
207
476
  { internalType: "string", name: "metadata", type: "string" },
208
477
  { internalType: "string", name: "context", type: "string" },
209
- { internalType: "uint256", name: "originatingChainId", type: "uint256" }
478
+ {
479
+ internalType: "uint256",
480
+ name: "originatingChainId",
481
+ type: "uint256"
482
+ }
210
483
  ],
211
484
  internalType: "struct IClanker.TokenConfig",
212
485
  name: "tokenConfig",
@@ -215,7 +488,11 @@ var init_Clanker = __esm({
215
488
  {
216
489
  components: [
217
490
  { internalType: "uint8", name: "vaultPercentage", type: "uint8" },
218
- { internalType: "uint256", name: "vaultDuration", type: "uint256" }
491
+ {
492
+ internalType: "uint256",
493
+ name: "vaultDuration",
494
+ type: "uint256"
495
+ }
219
496
  ],
220
497
  internalType: "struct IClanker.VaultConfig",
221
498
  name: "vaultConfig",
@@ -224,7 +501,11 @@ var init_Clanker = __esm({
224
501
  {
225
502
  components: [
226
503
  { internalType: "address", name: "pairedToken", type: "address" },
227
- { internalType: "int24", name: "tickIfToken0IsNewToken", type: "int24" }
504
+ {
505
+ internalType: "int24",
506
+ name: "tickIfToken0IsNewToken",
507
+ type: "int24"
508
+ }
228
509
  ],
229
510
  internalType: "struct IClanker.PoolConfig",
230
511
  name: "poolConfig",
@@ -232,8 +513,16 @@ var init_Clanker = __esm({
232
513
  },
233
514
  {
234
515
  components: [
235
- { internalType: "uint24", name: "pairedTokenPoolFee", type: "uint24" },
236
- { internalType: "uint256", name: "pairedTokenSwapAmountOutMinimum", type: "uint256" }
516
+ {
517
+ internalType: "uint24",
518
+ name: "pairedTokenPoolFee",
519
+ type: "uint24"
520
+ },
521
+ {
522
+ internalType: "uint256",
523
+ name: "pairedTokenSwapAmountOutMinimum",
524
+ type: "uint256"
525
+ }
237
526
  ],
238
527
  internalType: "struct IClanker.InitialBuyConfig",
239
528
  name: "initialBuyConfig",
@@ -241,11 +530,31 @@ var init_Clanker = __esm({
241
530
  },
242
531
  {
243
532
  components: [
244
- { internalType: "uint256", name: "creatorReward", type: "uint256" },
245
- { internalType: "address", name: "creatorAdmin", type: "address" },
246
- { internalType: "address", name: "creatorRewardRecipient", type: "address" },
247
- { internalType: "address", name: "interfaceAdmin", type: "address" },
248
- { internalType: "address", name: "interfaceRewardRecipient", type: "address" }
533
+ {
534
+ internalType: "uint256",
535
+ name: "creatorReward",
536
+ type: "uint256"
537
+ },
538
+ {
539
+ internalType: "address",
540
+ name: "creatorAdmin",
541
+ type: "address"
542
+ },
543
+ {
544
+ internalType: "address",
545
+ name: "creatorRewardRecipient",
546
+ type: "address"
547
+ },
548
+ {
549
+ internalType: "address",
550
+ name: "interfaceAdmin",
551
+ type: "address"
552
+ },
553
+ {
554
+ internalType: "address",
555
+ name: "interfaceRewardRecipient",
556
+ type: "address"
557
+ }
249
558
  ],
250
559
  internalType: "struct IClanker.RewardsConfig",
251
560
  name: "rewardsConfig",
@@ -277,7 +586,11 @@ var init_Clanker = __esm({
277
586
  { internalType: "string", name: "image", type: "string" },
278
587
  { internalType: "string", name: "metadata", type: "string" },
279
588
  { internalType: "string", name: "context", type: "string" },
280
- { internalType: "uint256", name: "originatingChainId", type: "uint256" }
589
+ {
590
+ internalType: "uint256",
591
+ name: "originatingChainId",
592
+ type: "uint256"
593
+ }
281
594
  ],
282
595
  internalType: "struct IClanker.TokenConfig",
283
596
  name: "tokenConfig",
@@ -286,7 +599,11 @@ var init_Clanker = __esm({
286
599
  {
287
600
  components: [
288
601
  { internalType: "uint8", name: "vaultPercentage", type: "uint8" },
289
- { internalType: "uint256", name: "vaultDuration", type: "uint256" }
602
+ {
603
+ internalType: "uint256",
604
+ name: "vaultDuration",
605
+ type: "uint256"
606
+ }
290
607
  ],
291
608
  internalType: "struct IClanker.VaultConfig",
292
609
  name: "vaultConfig",
@@ -295,7 +612,11 @@ var init_Clanker = __esm({
295
612
  {
296
613
  components: [
297
614
  { internalType: "address", name: "pairedToken", type: "address" },
298
- { internalType: "int24", name: "tickIfToken0IsNewToken", type: "int24" }
615
+ {
616
+ internalType: "int24",
617
+ name: "tickIfToken0IsNewToken",
618
+ type: "int24"
619
+ }
299
620
  ],
300
621
  internalType: "struct IClanker.PoolConfig",
301
622
  name: "poolConfig",
@@ -303,8 +624,16 @@ var init_Clanker = __esm({
303
624
  },
304
625
  {
305
626
  components: [
306
- { internalType: "uint24", name: "pairedTokenPoolFee", type: "uint24" },
307
- { internalType: "uint256", name: "pairedTokenSwapAmountOutMinimum", type: "uint256" }
627
+ {
628
+ internalType: "uint24",
629
+ name: "pairedTokenPoolFee",
630
+ type: "uint24"
631
+ },
632
+ {
633
+ internalType: "uint256",
634
+ name: "pairedTokenSwapAmountOutMinimum",
635
+ type: "uint256"
636
+ }
308
637
  ],
309
638
  internalType: "struct IClanker.InitialBuyConfig",
310
639
  name: "initialBuyConfig",
@@ -312,11 +641,31 @@ var init_Clanker = __esm({
312
641
  },
313
642
  {
314
643
  components: [
315
- { internalType: "uint256", name: "creatorReward", type: "uint256" },
316
- { internalType: "address", name: "creatorAdmin", type: "address" },
317
- { internalType: "address", name: "creatorRewardRecipient", type: "address" },
318
- { internalType: "address", name: "interfaceAdmin", type: "address" },
319
- { internalType: "address", name: "interfaceRewardRecipient", type: "address" }
644
+ {
645
+ internalType: "uint256",
646
+ name: "creatorReward",
647
+ type: "uint256"
648
+ },
649
+ {
650
+ internalType: "address",
651
+ name: "creatorAdmin",
652
+ type: "address"
653
+ },
654
+ {
655
+ internalType: "address",
656
+ name: "creatorRewardRecipient",
657
+ type: "address"
658
+ },
659
+ {
660
+ internalType: "address",
661
+ name: "interfaceAdmin",
662
+ type: "address"
663
+ },
664
+ {
665
+ internalType: "address",
666
+ name: "interfaceRewardRecipient",
667
+ type: "address"
668
+ }
320
669
  ],
321
670
  internalType: "struct IClanker.RewardsConfig",
322
671
  name: "rewardsConfig",
@@ -347,7 +696,11 @@ var init_Clanker = __esm({
347
696
  { internalType: "string", name: "image", type: "string" },
348
697
  { internalType: "string", name: "metadata", type: "string" },
349
698
  { internalType: "string", name: "context", type: "string" },
350
- { internalType: "uint256", name: "originatingChainId", type: "uint256" }
699
+ {
700
+ internalType: "uint256",
701
+ name: "originatingChainId",
702
+ type: "uint256"
703
+ }
351
704
  ],
352
705
  internalType: "struct IClanker.TokenConfig",
353
706
  name: "tokenConfig",
@@ -427,7 +780,13 @@ var init_Clanker = __esm({
427
780
  {
428
781
  inputs: [],
429
782
  name: "positionManager",
430
- outputs: [{ internalType: "contract INonfungiblePositionManager", name: "", type: "address" }],
783
+ outputs: [
784
+ {
785
+ internalType: "contract INonfungiblePositionManager",
786
+ name: "",
787
+ type: "address"
788
+ }
789
+ ],
431
790
  stateMutability: "view",
432
791
  type: "function"
433
792
  },
@@ -522,153 +881,15 @@ var init_Clanker = __esm({
522
881
  }
523
882
  });
524
883
 
525
- // src/utils/validation-schema.ts
526
- import { z } from "zod";
527
- import { isAddress, isHex } from "viem";
528
- var isAddressRefinement, clankerConfigSchema, tokenConfigSchema, vaultConfigSchema, poolConfigSchema, initialBuyConfigSchema, rewardsConfigSchema, deploymentConfigSchema;
529
- var init_validation_schema = __esm({
530
- "src/utils/validation-schema.ts"() {
531
- "use strict";
532
- init_esm_shims();
533
- isAddressRefinement = (val) => isAddress(val);
534
- clankerConfigSchema = z.object({
535
- publicClient: z.any({ message: "Public client is required" }),
536
- wallet: z.any().optional()
537
- });
538
- tokenConfigSchema = z.object({
539
- name: z.string().min(1, "Name is required"),
540
- symbol: z.string().min(1, "Symbol is required"),
541
- image: z.string().optional(),
542
- metadata: z.object({
543
- description: z.string().optional(),
544
- socialMediaUrls: z.array(z.string()).optional(),
545
- auditUrls: z.array(z.string()).optional()
546
- }).optional(),
547
- context: z.object({
548
- interface: z.string().optional(),
549
- platform: z.string().optional(),
550
- messageId: z.string().optional(),
551
- id: z.string().optional()
552
- }).optional(),
553
- pool: z.object({
554
- quoteToken: z.string().refine(isAddressRefinement).optional(),
555
- initialMarketCap: z.string().optional()
556
- }).optional(),
557
- vault: z.object({
558
- percentage: z.number().optional(),
559
- durationInDays: z.number().optional()
560
- }).optional(),
561
- devBuy: z.object({
562
- ethAmount: z.string().optional(),
563
- maxSlippage: z.number().optional()
564
- }).optional(),
565
- rewardsConfig: z.object({
566
- creatorReward: z.number().optional(),
567
- creatorAdmin: z.string().refine(isAddressRefinement).optional(),
568
- creatorRewardRecipient: z.string().refine(isAddressRefinement).optional(),
569
- interfaceAdmin: z.string().refine(isAddressRefinement).optional(),
570
- interfaceRewardRecipient: z.string().refine(isAddressRefinement).optional()
571
- }).optional()
572
- });
573
- vaultConfigSchema = z.object({
574
- vaultPercentage: z.number().min(0).max(100, "Vault percentage must be between 0 and 100"),
575
- vaultDuration: z.bigint()
576
- }).refine(
577
- (data) => {
578
- return data.vaultPercentage === 0 || data.vaultPercentage > 0 && data.vaultDuration > 0n;
579
- },
580
- {
581
- message: "Vault duration must be greater than 0 when vault percentage is greater than 0",
582
- path: ["vaultDuration"]
583
- }
584
- );
585
- poolConfigSchema = z.object({
586
- pairedToken: z.string().refine(isAddressRefinement, {
587
- message: "Paired token must be a valid Ethereum address"
588
- }),
589
- initialMarketCapInPairedToken: z.bigint().gt(0n, "Initial market cap must be greater than 0"),
590
- initialMarketCap: z.string().optional(),
591
- tickIfToken0IsNewToken: z.number()
592
- });
593
- initialBuyConfigSchema = z.object({
594
- pairedTokenPoolFee: z.number(),
595
- pairedTokenSwapAmountOutMinimum: z.bigint(),
596
- ethAmount: z.bigint().optional()
597
- });
598
- rewardsConfigSchema = z.object({
599
- creatorReward: z.bigint().gte(0n, "Creator reward must be greater than or equal to 0"),
600
- creatorAdmin: z.string().refine(isAddressRefinement, {
601
- message: "Creator admin must be a valid Ethereum address"
602
- }),
603
- creatorRewardRecipient: z.string().refine(isAddressRefinement, {
604
- message: "Creator reward recipient must be a valid Ethereum address"
605
- }),
606
- interfaceAdmin: z.string().refine(isAddressRefinement, {
607
- message: "Interface admin must be a valid Ethereum address"
608
- }),
609
- interfaceRewardRecipient: z.string().refine(isAddressRefinement, {
610
- message: "Interface reward recipient must be a valid Ethereum address"
611
- })
612
- });
613
- deploymentConfigSchema = z.object({
614
- tokenConfig: tokenConfigSchema,
615
- vaultConfig: vaultConfigSchema.optional(),
616
- poolConfig: poolConfigSchema,
617
- initialBuyConfig: initialBuyConfigSchema.optional(),
618
- rewardsConfig: rewardsConfigSchema
619
- });
620
- }
621
- });
622
-
623
- // src/utils/validation.ts
624
- function validateConfig(config2) {
625
- if (typeof config2 === "object" && config2 !== null && "name" in config2 && "symbol" in config2) {
626
- return tokenConfigSchema.safeParse(config2);
627
- }
628
- if (typeof config2 === "object" && config2 !== null && "tokenConfig" in config2 && "poolConfig" in config2 && "rewardsConfig" in config2) {
629
- return deploymentConfigSchema.safeParse(config2);
630
- }
631
- if (typeof config2 === "object" && config2 !== null && "vaultPercentage" in config2 && "vaultDuration" in config2) {
632
- return vaultConfigSchema.safeParse(config2);
633
- }
634
- if (typeof config2 === "object" && config2 !== null && "pairedToken" in config2 && "initialMarketCapInPairedToken" in config2) {
635
- return poolConfigSchema.safeParse(config2);
636
- }
637
- if (typeof config2 === "object" && config2 !== null && "creatorReward" in config2 && "creatorAdmin" in config2 && "creatorRewardRecipient" in config2) {
638
- return rewardsConfigSchema.safeParse(config2);
639
- }
640
- if (typeof config2 === "object" && config2 !== null && "pairedTokenPoolFee" in config2 && "pairedTokenSwapAmountOutMinimum" in config2) {
641
- return initialBuyConfigSchema.safeParse(config2);
642
- }
643
- if (typeof config2 === "object" && config2 !== null && "publicClient" in config2) {
644
- return clankerConfigSchema.safeParse(config2);
645
- }
646
- return {
647
- success: false,
648
- error: {
649
- message: "Unknown configuration type",
650
- format: () => ({
651
- _errors: ["Unable to determine configuration type for validation"]
652
- })
653
- }
654
- };
655
- }
656
- var init_validation = __esm({
657
- "src/utils/validation.ts"() {
658
- "use strict";
659
- init_esm_shims();
660
- init_validation_schema();
661
- }
662
- });
663
-
664
- // src/constants.ts
665
- import { base, baseSepolia } from "viem/chains";
666
- var CLANKER_FACTORY_V3_1, WETH_ADDRESS, DEGEN_ADDRESS, NATIVE_ADDRESS, CLANKER_ADDRESS, ANON_ADDRESS, HIGHER_ADDRESS, CB_BTC_ADDRESS, A0X_ADDRESS, SUPPORTED_CHAINS, DEFAULT_SUPPLY;
667
- var init_constants = __esm({
668
- "src/constants.ts"() {
884
+ // src/constants.ts
885
+ import { base, baseSepolia } from "viem/chains";
886
+ var CLANKER_FACTORY_V3_1, CLANKER_FACTORY_V4, WETH_ADDRESS, DEGEN_ADDRESS, NATIVE_ADDRESS, CLANKER_ADDRESS, ANON_ADDRESS, HIGHER_ADDRESS, CB_BTC_ADDRESS, A0X_ADDRESS, SUPPORTED_CHAINS, DEFAULT_SUPPLY, CLANKER_VAULT_ADDRESS, CLANKER_AIRDROP_ADDRESS, CLANKER_DEVBUY_ADDRESS, CLANKER_MEV_MODULE_ADDRESS, CLANKER_HOOK_STATIC_FEE_ADDRESS, CLANKER_HOOK_DYNAMIC_FEE_ADDRESS;
887
+ var init_constants = __esm({
888
+ "src/constants.ts"() {
669
889
  "use strict";
670
890
  init_esm_shims();
671
891
  CLANKER_FACTORY_V3_1 = "0x2A787b2362021cC3eEa3C24C4748a6cD5B687382";
892
+ CLANKER_FACTORY_V4 = "0xeBA5bCE4a0e62e8D374fa46c6914D8d8c70619f6";
672
893
  WETH_ADDRESS = "0x4200000000000000000000000000000000000006";
673
894
  DEGEN_ADDRESS = "0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed";
674
895
  NATIVE_ADDRESS = "0x20DD04c17AFD5c9a8b3f2cdacaa8Ee7907385BEF";
@@ -679,6 +900,12 @@ var init_constants = __esm({
679
900
  A0X_ADDRESS = "0x820C5F0fB255a1D18fd0eBB0F1CCefbC4D546dA7";
680
901
  SUPPORTED_CHAINS = [base.id, baseSepolia.id];
681
902
  DEFAULT_SUPPLY = 100000000000000000000000000000n;
903
+ CLANKER_VAULT_ADDRESS = "0xfed01720E35FA0977254414B7245f9b78D87c76b";
904
+ CLANKER_AIRDROP_ADDRESS = "0x21a7499803E679DBb444e06bC77E2c107e94961F";
905
+ CLANKER_DEVBUY_ADDRESS = "0x685DfF86292744500E624c629E91E20dd68D9908";
906
+ CLANKER_MEV_MODULE_ADDRESS = "0x9037603A27aCf7c70A2A531B60cCc48eCD154fB3";
907
+ CLANKER_HOOK_STATIC_FEE_ADDRESS = "0x3227d5AA27FC55AB4d4f8A9733959B265aBDa8cC";
908
+ CLANKER_HOOK_DYNAMIC_FEE_ADDRESS = "0x03c8FDe0d02D1f42B73127D9EC18A5a48853a8cC";
682
909
  }
683
910
  });
684
911
 
@@ -1059,8 +1286,18 @@ var init_Clanker3 = __esm({
1059
1286
  {
1060
1287
  anonymous: false,
1061
1288
  inputs: [
1062
- { indexed: true, internalType: "address", name: "previousOwner", type: "address" },
1063
- { indexed: true, internalType: "address", name: "newOwner", type: "address" }
1289
+ {
1290
+ indexed: true,
1291
+ internalType: "address",
1292
+ name: "previousOwner",
1293
+ type: "address"
1294
+ },
1295
+ {
1296
+ indexed: true,
1297
+ internalType: "address",
1298
+ name: "newOwner",
1299
+ type: "address"
1300
+ }
1064
1301
  ],
1065
1302
  name: "OwnershipTransferred",
1066
1303
  type: "event"
@@ -1068,15 +1305,50 @@ var init_Clanker3 = __esm({
1068
1305
  {
1069
1306
  anonymous: false,
1070
1307
  inputs: [
1071
- { indexed: false, internalType: "address", name: "tokenAddress", type: "address" },
1072
- { indexed: false, internalType: "uint256", name: "lpNftId", type: "uint256" },
1073
- { indexed: false, internalType: "address", name: "deployer", type: "address" },
1308
+ {
1309
+ indexed: false,
1310
+ internalType: "address",
1311
+ name: "tokenAddress",
1312
+ type: "address"
1313
+ },
1314
+ {
1315
+ indexed: false,
1316
+ internalType: "uint256",
1317
+ name: "lpNftId",
1318
+ type: "uint256"
1319
+ },
1320
+ {
1321
+ indexed: false,
1322
+ internalType: "address",
1323
+ name: "deployer",
1324
+ type: "address"
1325
+ },
1074
1326
  { indexed: false, internalType: "uint256", name: "fid", type: "uint256" },
1075
1327
  { indexed: false, internalType: "string", name: "name", type: "string" },
1076
- { indexed: false, internalType: "string", name: "symbol", type: "string" },
1077
- { indexed: false, internalType: "uint256", name: "supply", type: "uint256" },
1078
- { indexed: false, internalType: "address", name: "lockerAddress", type: "address" },
1079
- { indexed: false, internalType: "string", name: "castHash", type: "string" }
1328
+ {
1329
+ indexed: false,
1330
+ internalType: "string",
1331
+ name: "symbol",
1332
+ type: "string"
1333
+ },
1334
+ {
1335
+ indexed: false,
1336
+ internalType: "uint256",
1337
+ name: "supply",
1338
+ type: "uint256"
1339
+ },
1340
+ {
1341
+ indexed: false,
1342
+ internalType: "address",
1343
+ name: "lockerAddress",
1344
+ type: "address"
1345
+ },
1346
+ {
1347
+ indexed: false,
1348
+ internalType: "string",
1349
+ name: "castHash",
1350
+ type: "string"
1351
+ }
1080
1352
  ],
1081
1353
  name: "TokenCreated",
1082
1354
  type: "event"
@@ -1175,7 +1447,13 @@ var init_Clanker3 = __esm({
1175
1447
  {
1176
1448
  inputs: [],
1177
1449
  name: "positionManager",
1178
- outputs: [{ internalType: "contract INonfungiblePositionManager", name: "", type: "address" }],
1450
+ outputs: [
1451
+ {
1452
+ internalType: "contract INonfungiblePositionManager",
1453
+ name: "",
1454
+ type: "address"
1455
+ }
1456
+ ],
1179
1457
  stateMutability: "view",
1180
1458
  type: "function"
1181
1459
  },
@@ -1352,8 +1630,18 @@ var init_Clanker4 = __esm({
1352
1630
  {
1353
1631
  anonymous: false,
1354
1632
  inputs: [
1355
- { indexed: true, internalType: "address", name: "previousOwner", type: "address" },
1356
- { indexed: true, internalType: "address", name: "newOwner", type: "address" }
1633
+ {
1634
+ indexed: true,
1635
+ internalType: "address",
1636
+ name: "previousOwner",
1637
+ type: "address"
1638
+ },
1639
+ {
1640
+ indexed: true,
1641
+ internalType: "address",
1642
+ name: "newOwner",
1643
+ type: "address"
1644
+ }
1357
1645
  ],
1358
1646
  name: "OwnershipTransferred",
1359
1647
  type: "event"
@@ -1361,15 +1649,50 @@ var init_Clanker4 = __esm({
1361
1649
  {
1362
1650
  anonymous: false,
1363
1651
  inputs: [
1364
- { indexed: false, internalType: "address", name: "tokenAddress", type: "address" },
1365
- { indexed: false, internalType: "uint256", name: "positionId", type: "uint256" },
1366
- { indexed: false, internalType: "address", name: "deployer", type: "address" },
1652
+ {
1653
+ indexed: false,
1654
+ internalType: "address",
1655
+ name: "tokenAddress",
1656
+ type: "address"
1657
+ },
1658
+ {
1659
+ indexed: false,
1660
+ internalType: "uint256",
1661
+ name: "positionId",
1662
+ type: "uint256"
1663
+ },
1664
+ {
1665
+ indexed: false,
1666
+ internalType: "address",
1667
+ name: "deployer",
1668
+ type: "address"
1669
+ },
1367
1670
  { indexed: false, internalType: "uint256", name: "fid", type: "uint256" },
1368
1671
  { indexed: false, internalType: "string", name: "name", type: "string" },
1369
- { indexed: false, internalType: "string", name: "symbol", type: "string" },
1370
- { indexed: false, internalType: "uint256", name: "supply", type: "uint256" },
1371
- { indexed: false, internalType: "address", name: "lockerAddress", type: "address" },
1372
- { indexed: false, internalType: "string", name: "castHash", type: "string" }
1672
+ {
1673
+ indexed: false,
1674
+ internalType: "string",
1675
+ name: "symbol",
1676
+ type: "string"
1677
+ },
1678
+ {
1679
+ indexed: false,
1680
+ internalType: "uint256",
1681
+ name: "supply",
1682
+ type: "uint256"
1683
+ },
1684
+ {
1685
+ indexed: false,
1686
+ internalType: "address",
1687
+ name: "lockerAddress",
1688
+ type: "address"
1689
+ },
1690
+ {
1691
+ indexed: false,
1692
+ internalType: "string",
1693
+ name: "castHash",
1694
+ type: "string"
1695
+ }
1373
1696
  ],
1374
1697
  name: "TokenCreated",
1375
1698
  type: "event"
@@ -1478,7 +1801,13 @@ var init_Clanker4 = __esm({
1478
1801
  {
1479
1802
  inputs: [],
1480
1803
  name: "positionManager",
1481
- outputs: [{ internalType: "contract INonfungiblePositionManager", name: "", type: "address" }],
1804
+ outputs: [
1805
+ {
1806
+ internalType: "contract INonfungiblePositionManager",
1807
+ name: "",
1808
+ type: "address"
1809
+ }
1810
+ ],
1482
1811
  stateMutability: "view",
1483
1812
  type: "function"
1484
1813
  },
@@ -1610,8 +1939,18 @@ var init_Clanker5 = __esm({
1610
1939
  {
1611
1940
  anonymous: false,
1612
1941
  inputs: [
1613
- { indexed: true, internalType: "address", name: "previousOwner", type: "address" },
1614
- { indexed: true, internalType: "address", name: "newOwner", type: "address" }
1942
+ {
1943
+ indexed: true,
1944
+ internalType: "address",
1945
+ name: "previousOwner",
1946
+ type: "address"
1947
+ },
1948
+ {
1949
+ indexed: true,
1950
+ internalType: "address",
1951
+ name: "newOwner",
1952
+ type: "address"
1953
+ }
1615
1954
  ],
1616
1955
  name: "OwnershipTransferred",
1617
1956
  type: "event"
@@ -1619,15 +1958,45 @@ var init_Clanker5 = __esm({
1619
1958
  {
1620
1959
  anonymous: false,
1621
1960
  inputs: [
1622
- { indexed: false, internalType: "address", name: "tokenAddress", type: "address" },
1623
- { indexed: false, internalType: "uint256", name: "positionId", type: "uint256" },
1624
- { indexed: false, internalType: "address", name: "deployer", type: "address" },
1625
- { indexed: false, internalType: "uint256", name: "fid", type: "uint256" },
1626
- { indexed: false, internalType: "string", name: "name", type: "string" },
1627
- { indexed: false, internalType: "string", name: "symbol", type: "string" },
1628
- { indexed: false, internalType: "uint256", name: "supply", type: "uint256" },
1629
- { indexed: false, internalType: "string", name: "castHash", type: "string" }
1630
- ],
1961
+ {
1962
+ indexed: false,
1963
+ internalType: "address",
1964
+ name: "tokenAddress",
1965
+ type: "address"
1966
+ },
1967
+ {
1968
+ indexed: false,
1969
+ internalType: "uint256",
1970
+ name: "positionId",
1971
+ type: "uint256"
1972
+ },
1973
+ {
1974
+ indexed: false,
1975
+ internalType: "address",
1976
+ name: "deployer",
1977
+ type: "address"
1978
+ },
1979
+ { indexed: false, internalType: "uint256", name: "fid", type: "uint256" },
1980
+ { indexed: false, internalType: "string", name: "name", type: "string" },
1981
+ {
1982
+ indexed: false,
1983
+ internalType: "string",
1984
+ name: "symbol",
1985
+ type: "string"
1986
+ },
1987
+ {
1988
+ indexed: false,
1989
+ internalType: "uint256",
1990
+ name: "supply",
1991
+ type: "uint256"
1992
+ },
1993
+ {
1994
+ indexed: false,
1995
+ internalType: "string",
1996
+ name: "castHash",
1997
+ type: "string"
1998
+ }
1999
+ ],
1631
2000
  name: "TokenCreated",
1632
2001
  type: "event"
1633
2002
  },
@@ -1787,7 +2156,13 @@ var init_Clanker5 = __esm({
1787
2156
  {
1788
2157
  inputs: [],
1789
2158
  name: "positionManager",
1790
- outputs: [{ internalType: "contract INonfungiblePositionManager", name: "", type: "address" }],
2159
+ outputs: [
2160
+ {
2161
+ internalType: "contract INonfungiblePositionManager",
2162
+ name: "",
2163
+ type: "address"
2164
+ }
2165
+ ],
1791
2166
  stateMutability: "view",
1792
2167
  type: "function"
1793
2168
  },
@@ -1921,7 +2296,11 @@ var init_ClankerToken = __esm({
1921
2296
  { name: "image_", type: "string", internalType: "string" },
1922
2297
  { name: "metadata_", type: "string", internalType: "string" },
1923
2298
  { name: "context_", type: "string", internalType: "string" },
1924
- { name: "initialSupplyChainId_", type: "uint256", internalType: "uint256" }
2299
+ {
2300
+ name: "initialSupplyChainId_",
2301
+ type: "uint256",
2302
+ internalType: "uint256"
2303
+ }
1925
2304
  ],
1926
2305
  stateMutability: "nonpayable"
1927
2306
  },
@@ -2242,9 +2621,24 @@ var init_ClankerToken = __esm({
2242
2621
  type: "event",
2243
2622
  name: "Approval",
2244
2623
  inputs: [
2245
- { name: "owner", type: "address", indexed: true, internalType: "address" },
2246
- { name: "spender", type: "address", indexed: true, internalType: "address" },
2247
- { name: "value", type: "uint256", indexed: false, internalType: "uint256" }
2624
+ {
2625
+ name: "owner",
2626
+ type: "address",
2627
+ indexed: true,
2628
+ internalType: "address"
2629
+ },
2630
+ {
2631
+ name: "spender",
2632
+ type: "address",
2633
+ indexed: true,
2634
+ internalType: "address"
2635
+ },
2636
+ {
2637
+ name: "value",
2638
+ type: "uint256",
2639
+ indexed: false,
2640
+ internalType: "uint256"
2641
+ }
2248
2642
  ],
2249
2643
  anonymous: false
2250
2644
  },
@@ -2253,8 +2647,18 @@ var init_ClankerToken = __esm({
2253
2647
  name: "CrosschainBurn",
2254
2648
  inputs: [
2255
2649
  { name: "from", type: "address", indexed: true, internalType: "address" },
2256
- { name: "amount", type: "uint256", indexed: false, internalType: "uint256" },
2257
- { name: "sender", type: "address", indexed: true, internalType: "address" }
2650
+ {
2651
+ name: "amount",
2652
+ type: "uint256",
2653
+ indexed: false,
2654
+ internalType: "uint256"
2655
+ },
2656
+ {
2657
+ name: "sender",
2658
+ type: "address",
2659
+ indexed: true,
2660
+ internalType: "address"
2661
+ }
2258
2662
  ],
2259
2663
  anonymous: false
2260
2664
  },
@@ -2263,8 +2667,18 @@ var init_ClankerToken = __esm({
2263
2667
  name: "CrosschainMint",
2264
2668
  inputs: [
2265
2669
  { name: "to", type: "address", indexed: true, internalType: "address" },
2266
- { name: "amount", type: "uint256", indexed: false, internalType: "uint256" },
2267
- { name: "sender", type: "address", indexed: true, internalType: "address" }
2670
+ {
2671
+ name: "amount",
2672
+ type: "uint256",
2673
+ indexed: false,
2674
+ internalType: "uint256"
2675
+ },
2676
+ {
2677
+ name: "sender",
2678
+ type: "address",
2679
+ indexed: true,
2680
+ internalType: "address"
2681
+ }
2268
2682
  ],
2269
2683
  anonymous: false
2270
2684
  },
@@ -2272,9 +2686,24 @@ var init_ClankerToken = __esm({
2272
2686
  type: "event",
2273
2687
  name: "DelegateChanged",
2274
2688
  inputs: [
2275
- { name: "delegator", type: "address", indexed: true, internalType: "address" },
2276
- { name: "fromDelegate", type: "address", indexed: true, internalType: "address" },
2277
- { name: "toDelegate", type: "address", indexed: true, internalType: "address" }
2689
+ {
2690
+ name: "delegator",
2691
+ type: "address",
2692
+ indexed: true,
2693
+ internalType: "address"
2694
+ },
2695
+ {
2696
+ name: "fromDelegate",
2697
+ type: "address",
2698
+ indexed: true,
2699
+ internalType: "address"
2700
+ },
2701
+ {
2702
+ name: "toDelegate",
2703
+ type: "address",
2704
+ indexed: true,
2705
+ internalType: "address"
2706
+ }
2278
2707
  ],
2279
2708
  anonymous: false
2280
2709
  },
@@ -2282,9 +2711,24 @@ var init_ClankerToken = __esm({
2282
2711
  type: "event",
2283
2712
  name: "DelegateVotesChanged",
2284
2713
  inputs: [
2285
- { name: "delegate", type: "address", indexed: true, internalType: "address" },
2286
- { name: "previousVotes", type: "uint256", indexed: false, internalType: "uint256" },
2287
- { name: "newVotes", type: "uint256", indexed: false, internalType: "uint256" }
2714
+ {
2715
+ name: "delegate",
2716
+ type: "address",
2717
+ indexed: true,
2718
+ internalType: "address"
2719
+ },
2720
+ {
2721
+ name: "previousVotes",
2722
+ type: "uint256",
2723
+ indexed: false,
2724
+ internalType: "uint256"
2725
+ },
2726
+ {
2727
+ name: "newVotes",
2728
+ type: "uint256",
2729
+ indexed: false,
2730
+ internalType: "uint256"
2731
+ }
2288
2732
  ],
2289
2733
  anonymous: false
2290
2734
  },
@@ -2295,7 +2739,12 @@ var init_ClankerToken = __esm({
2295
2739
  inputs: [
2296
2740
  { name: "from", type: "address", indexed: true, internalType: "address" },
2297
2741
  { name: "to", type: "address", indexed: true, internalType: "address" },
2298
- { name: "value", type: "uint256", indexed: false, internalType: "uint256" }
2742
+ {
2743
+ name: "value",
2744
+ type: "uint256",
2745
+ indexed: false,
2746
+ internalType: "uint256"
2747
+ }
2299
2748
  ],
2300
2749
  anonymous: false
2301
2750
  },
@@ -2303,8 +2752,18 @@ var init_ClankerToken = __esm({
2303
2752
  type: "event",
2304
2753
  name: "Verified",
2305
2754
  inputs: [
2306
- { name: "admin", type: "address", indexed: true, internalType: "address" },
2307
- { name: "token", type: "address", indexed: true, internalType: "address" }
2755
+ {
2756
+ name: "admin",
2757
+ type: "address",
2758
+ indexed: true,
2759
+ internalType: "address"
2760
+ },
2761
+ {
2762
+ name: "token",
2763
+ type: "address",
2764
+ indexed: true,
2765
+ internalType: "address"
2766
+ }
2308
2767
  ],
2309
2768
  anonymous: false
2310
2769
  },
@@ -2431,7 +2890,11 @@ var init_ClankerToken = __esm({
2431
2890
  { name: "image_", type: "string", internalType: "string" },
2432
2891
  { name: "metadata_", type: "string", internalType: "string" },
2433
2892
  { name: "context_", type: "string", internalType: "string" },
2434
- { name: "initialSupplyChainId_", type: "uint256", internalType: "uint256" }
2893
+ {
2894
+ name: "initialSupplyChainId_",
2895
+ type: "uint256",
2896
+ internalType: "uint256"
2897
+ }
2435
2898
  ],
2436
2899
  stateMutability: "nonpayable"
2437
2900
  },
@@ -2741,14 +3204,35 @@ var init_ClankerToken = __esm({
2741
3204
  outputs: [],
2742
3205
  stateMutability: "nonpayable"
2743
3206
  },
2744
- { type: "function", name: "verify", inputs: [], outputs: [], stateMutability: "nonpayable" },
3207
+ {
3208
+ type: "function",
3209
+ name: "verify",
3210
+ inputs: [],
3211
+ outputs: [],
3212
+ stateMutability: "nonpayable"
3213
+ },
2745
3214
  {
2746
3215
  type: "event",
2747
3216
  name: "Approval",
2748
3217
  inputs: [
2749
- { name: "owner", type: "address", indexed: true, internalType: "address" },
2750
- { name: "spender", type: "address", indexed: true, internalType: "address" },
2751
- { name: "value", type: "uint256", indexed: false, internalType: "uint256" }
3218
+ {
3219
+ name: "owner",
3220
+ type: "address",
3221
+ indexed: true,
3222
+ internalType: "address"
3223
+ },
3224
+ {
3225
+ name: "spender",
3226
+ type: "address",
3227
+ indexed: true,
3228
+ internalType: "address"
3229
+ },
3230
+ {
3231
+ name: "value",
3232
+ type: "uint256",
3233
+ indexed: false,
3234
+ internalType: "uint256"
3235
+ }
2752
3236
  ],
2753
3237
  anonymous: false
2754
3238
  },
@@ -2757,8 +3241,18 @@ var init_ClankerToken = __esm({
2757
3241
  name: "CrosschainBurn",
2758
3242
  inputs: [
2759
3243
  { name: "from", type: "address", indexed: true, internalType: "address" },
2760
- { name: "amount", type: "uint256", indexed: false, internalType: "uint256" },
2761
- { name: "sender", type: "address", indexed: true, internalType: "address" }
3244
+ {
3245
+ name: "amount",
3246
+ type: "uint256",
3247
+ indexed: false,
3248
+ internalType: "uint256"
3249
+ },
3250
+ {
3251
+ name: "sender",
3252
+ type: "address",
3253
+ indexed: true,
3254
+ internalType: "address"
3255
+ }
2762
3256
  ],
2763
3257
  anonymous: false
2764
3258
  },
@@ -2767,8 +3261,18 @@ var init_ClankerToken = __esm({
2767
3261
  name: "CrosschainMint",
2768
3262
  inputs: [
2769
3263
  { name: "to", type: "address", indexed: true, internalType: "address" },
2770
- { name: "amount", type: "uint256", indexed: false, internalType: "uint256" },
2771
- { name: "sender", type: "address", indexed: true, internalType: "address" }
3264
+ {
3265
+ name: "amount",
3266
+ type: "uint256",
3267
+ indexed: false,
3268
+ internalType: "uint256"
3269
+ },
3270
+ {
3271
+ name: "sender",
3272
+ type: "address",
3273
+ indexed: true,
3274
+ internalType: "address"
3275
+ }
2772
3276
  ],
2773
3277
  anonymous: false
2774
3278
  },
@@ -2776,9 +3280,24 @@ var init_ClankerToken = __esm({
2776
3280
  type: "event",
2777
3281
  name: "DelegateChanged",
2778
3282
  inputs: [
2779
- { name: "delegator", type: "address", indexed: true, internalType: "address" },
2780
- { name: "fromDelegate", type: "address", indexed: true, internalType: "address" },
2781
- { name: "toDelegate", type: "address", indexed: true, internalType: "address" }
3283
+ {
3284
+ name: "delegator",
3285
+ type: "address",
3286
+ indexed: true,
3287
+ internalType: "address"
3288
+ },
3289
+ {
3290
+ name: "fromDelegate",
3291
+ type: "address",
3292
+ indexed: true,
3293
+ internalType: "address"
3294
+ },
3295
+ {
3296
+ name: "toDelegate",
3297
+ type: "address",
3298
+ indexed: true,
3299
+ internalType: "address"
3300
+ }
2782
3301
  ],
2783
3302
  anonymous: false
2784
3303
  },
@@ -2786,9 +3305,24 @@ var init_ClankerToken = __esm({
2786
3305
  type: "event",
2787
3306
  name: "DelegateVotesChanged",
2788
3307
  inputs: [
2789
- { name: "delegate", type: "address", indexed: true, internalType: "address" },
2790
- { name: "previousVotes", type: "uint256", indexed: false, internalType: "uint256" },
2791
- { name: "newVotes", type: "uint256", indexed: false, internalType: "uint256" }
3308
+ {
3309
+ name: "delegate",
3310
+ type: "address",
3311
+ indexed: true,
3312
+ internalType: "address"
3313
+ },
3314
+ {
3315
+ name: "previousVotes",
3316
+ type: "uint256",
3317
+ indexed: false,
3318
+ internalType: "uint256"
3319
+ },
3320
+ {
3321
+ name: "newVotes",
3322
+ type: "uint256",
3323
+ indexed: false,
3324
+ internalType: "uint256"
3325
+ }
2792
3326
  ],
2793
3327
  anonymous: false
2794
3328
  },
@@ -2799,7 +3333,12 @@ var init_ClankerToken = __esm({
2799
3333
  inputs: [
2800
3334
  { name: "from", type: "address", indexed: true, internalType: "address" },
2801
3335
  { name: "to", type: "address", indexed: true, internalType: "address" },
2802
- { name: "value", type: "uint256", indexed: false, internalType: "uint256" }
3336
+ {
3337
+ name: "value",
3338
+ type: "uint256",
3339
+ indexed: false,
3340
+ internalType: "uint256"
3341
+ }
2803
3342
  ],
2804
3343
  anonymous: false
2805
3344
  },
@@ -2812,15 +3351,32 @@ var init_ClankerToken = __esm({
2812
3351
  {
2813
3352
  type: "event",
2814
3353
  name: "UpdateMetadata",
2815
- inputs: [{ name: "metadata", type: "string", indexed: false, internalType: "string" }],
3354
+ inputs: [
3355
+ {
3356
+ name: "metadata",
3357
+ type: "string",
3358
+ indexed: false,
3359
+ internalType: "string"
3360
+ }
3361
+ ],
2816
3362
  anonymous: false
2817
3363
  },
2818
3364
  {
2819
3365
  type: "event",
2820
3366
  name: "Verified",
2821
3367
  inputs: [
2822
- { name: "admin", type: "address", indexed: true, internalType: "address" },
2823
- { name: "token", type: "address", indexed: true, internalType: "address" }
3368
+ {
3369
+ name: "admin",
3370
+ type: "address",
3371
+ indexed: true,
3372
+ internalType: "address"
3373
+ },
3374
+ {
3375
+ name: "token",
3376
+ type: "address",
3377
+ indexed: true,
3378
+ internalType: "address"
3379
+ }
2824
3380
  ],
2825
3381
  anonymous: false
2826
3382
  },
@@ -3007,16 +3563,7 @@ async function buildTransaction({
3007
3563
  };
3008
3564
  const admin = validateAddress(formData.creatorRewardsAdmin, requestorAddress);
3009
3565
  const { token: expectedAddress, salt } = await findVanityAddress(
3010
- [
3011
- name,
3012
- symbol,
3013
- DEFAULT_SUPPLY,
3014
- admin,
3015
- imageUrl || "",
3016
- metadata,
3017
- socialContext,
3018
- BigInt(chainId)
3019
- ],
3566
+ [name, symbol, DEFAULT_SUPPLY, admin, imageUrl || "", metadata, socialContext, BigInt(chainId)],
3020
3567
  admin,
3021
3568
  "0x4b07",
3022
3569
  {
@@ -3048,161 +3595,1393 @@ async function buildTransaction({
3048
3595
  },
3049
3596
  rewardsConfig: {
3050
3597
  creatorReward: BigInt(Number(formData.creatorReward || 40)),
3051
- creatorAdmin: validateAddress(
3052
- formData.creatorRewardsAdmin,
3053
- requestorAddress
3054
- ),
3055
- creatorRewardRecipient: validateAddress(
3056
- formData.creatorRewardsRecipient,
3057
- requestorAddress
3058
- ),
3059
- interfaceAdmin: validateAddress(
3060
- formData.interfaceAdmin,
3061
- requestorAddress
3062
- ),
3598
+ creatorAdmin: validateAddress(formData.creatorRewardsAdmin, requestorAddress),
3599
+ creatorRewardRecipient: validateAddress(formData.creatorRewardsRecipient, requestorAddress),
3600
+ interfaceAdmin: validateAddress(formData.interfaceAdmin, requestorAddress),
3063
3601
  interfaceRewardRecipient: validateAddress(
3064
3602
  formData.interfaceRewardRecipient,
3065
3603
  requestorAddress
3066
3604
  )
3067
- }
3068
- };
3069
- try {
3070
- const deployCalldata = encodeFunctionData({
3071
- abi: Clanker_v3_1_abi,
3072
- functionName: "deployToken",
3073
- args: [tokenConfig]
3074
- });
3605
+ }
3606
+ };
3607
+ try {
3608
+ const deployCalldata = encodeFunctionData({
3609
+ abi: Clanker_v3_1_abi,
3610
+ functionName: "deployToken",
3611
+ args: [tokenConfig]
3612
+ });
3613
+ return {
3614
+ transaction: {
3615
+ to: CLANKER_FACTORY_V3_1,
3616
+ data: deployCalldata
3617
+ },
3618
+ expectedAddress
3619
+ };
3620
+ } catch (error) {
3621
+ console.error("Error encoding function data:", error);
3622
+ console.error("Problematic deployArgs:", tokenConfig);
3623
+ throw new Error(`Failed to encode function data: ${error.message}`);
3624
+ }
3625
+ }
3626
+ var init_buildTransaction = __esm({
3627
+ "src/services/buildTransaction.ts"() {
3628
+ "use strict";
3629
+ init_esm_shims();
3630
+ init_constants();
3631
+ init_Clanker();
3632
+ init_unix_timestamp();
3633
+ init_vanityAddress();
3634
+ }
3635
+ });
3636
+
3637
+ // src/utils/desired-price.ts
3638
+ var getDesiredPriceAndPairAddress;
3639
+ var init_desired_price = __esm({
3640
+ "src/utils/desired-price.ts"() {
3641
+ "use strict";
3642
+ init_esm_shims();
3643
+ init_constants();
3644
+ getDesiredPriceAndPairAddress = (pair, marketCap = "10") => {
3645
+ let desiredPrice = 1e-10;
3646
+ let pairAddress = WETH_ADDRESS;
3647
+ if (pair === "WETH") {
3648
+ desiredPrice = Number(marketCap) * 1e-11;
3649
+ }
3650
+ if (pair === "DEGEN") {
3651
+ desiredPrice = 666666667e-14;
3652
+ pairAddress = DEGEN_ADDRESS;
3653
+ } else if (pair === "CLANKER") {
3654
+ const clankerPrice = 20;
3655
+ const desiredMarketCap = 1e4;
3656
+ const totalSupplyDesired = 1e11;
3657
+ const howManyClankerForDesiredMarketCap = desiredMarketCap / clankerPrice;
3658
+ const pricePerTokenInClanker = howManyClankerForDesiredMarketCap / totalSupplyDesired;
3659
+ desiredPrice = pricePerTokenInClanker;
3660
+ pairAddress = CLANKER_ADDRESS;
3661
+ } else if (pair === "ANON") {
3662
+ const anonPrice = 1e-3;
3663
+ const desiredMarketCap = 1e4;
3664
+ const totalSupplyDesired = 1e11;
3665
+ const howManyAnonForDesiredMarketCap = desiredMarketCap / anonPrice;
3666
+ const pricePerTokenInAnon = howManyAnonForDesiredMarketCap / totalSupplyDesired;
3667
+ desiredPrice = pricePerTokenInAnon;
3668
+ pairAddress = ANON_ADDRESS;
3669
+ } else if (pair === "HIGHER") {
3670
+ const higherPrice = 8e-3;
3671
+ const desiredMarketCap = 1e4;
3672
+ const totalSupplyDesired = 1e11;
3673
+ const howManyHigherForDesiredMarketCap = desiredMarketCap / higherPrice;
3674
+ const pricePerTokenInHigher = howManyHigherForDesiredMarketCap / totalSupplyDesired;
3675
+ desiredPrice = pricePerTokenInHigher;
3676
+ pairAddress = HIGHER_ADDRESS;
3677
+ } else if (pair === "BTC") {
3678
+ const cbBtcPrice = 105e3;
3679
+ const desiredMarketCap = 1e4;
3680
+ const totalSupplyDesired = 1e11;
3681
+ const howManyCBBTCForDesiredMarketCap = desiredMarketCap / cbBtcPrice;
3682
+ const pricePerTokenInCbBtc = howManyCBBTCForDesiredMarketCap / totalSupplyDesired / 10 ** 10;
3683
+ desiredPrice = pricePerTokenInCbBtc;
3684
+ pairAddress = CB_BTC_ADDRESS;
3685
+ } else if (pair === "NATIVE") {
3686
+ const nativePrice = 4e-5;
3687
+ const desiredMarketCap = 1e4;
3688
+ const totalSupplyDesired = 1e11;
3689
+ const howManyNativeForDesiredMarketCap = desiredMarketCap / nativePrice;
3690
+ const pricePerTokenInNative = howManyNativeForDesiredMarketCap / totalSupplyDesired;
3691
+ desiredPrice = pricePerTokenInNative;
3692
+ pairAddress = NATIVE_ADDRESS;
3693
+ } else if (pair === "A0x") {
3694
+ const a0xPrice = 73e-8;
3695
+ const desiredMarketCap = 5e3;
3696
+ const totalSupplyDesired = 1e11;
3697
+ const howManyA0xForDesiredMarketCap = desiredMarketCap / a0xPrice;
3698
+ const pricePerTokenInA0x = howManyA0xForDesiredMarketCap / totalSupplyDesired;
3699
+ desiredPrice = pricePerTokenInA0x;
3700
+ pairAddress = A0X_ADDRESS;
3701
+ } else if (pair === "WMON") {
3702
+ desiredPrice = Number(marketCap) * 1e-11;
3703
+ pairAddress = "0x760AfE86e5de5fa0Ee542fc7B7B713e1c5425701";
3704
+ }
3705
+ return { desiredPrice, pairAddress };
3706
+ };
3707
+ }
3708
+ });
3709
+
3710
+ // src/services/desiredPrice.ts
3711
+ import { monadTestnet as monadTestnet2 } from "viem/chains";
3712
+ var getTokenPairByAddress;
3713
+ var init_desiredPrice = __esm({
3714
+ "src/services/desiredPrice.ts"() {
3715
+ "use strict";
3716
+ init_esm_shims();
3717
+ init_constants();
3718
+ getTokenPairByAddress = (address) => {
3719
+ if (address === WETH_ADDRESS) {
3720
+ return "WETH";
3721
+ }
3722
+ if (address === DEGEN_ADDRESS) {
3723
+ return "DEGEN";
3724
+ }
3725
+ if (address === NATIVE_ADDRESS) {
3726
+ return "NATIVE";
3727
+ }
3728
+ if (address === CLANKER_ADDRESS) {
3729
+ return "CLANKER";
3730
+ }
3731
+ if (address === ANON_ADDRESS) {
3732
+ return "ANON";
3733
+ }
3734
+ if (address === HIGHER_ADDRESS) {
3735
+ return "HIGHER";
3736
+ }
3737
+ if (address === CB_BTC_ADDRESS) {
3738
+ return "BTC";
3739
+ }
3740
+ if (address === A0X_ADDRESS) {
3741
+ return "A0x";
3742
+ }
3743
+ return "WETH";
3744
+ };
3745
+ }
3746
+ });
3747
+
3748
+ // src/deployment/v3.ts
3749
+ import { parseEventLogs } from "viem";
3750
+ async function deployTokenV3(cfg, wallet, publicClient) {
3751
+ if (!wallet?.account) {
3752
+ throw new Error("Wallet account required for deployToken");
3753
+ }
3754
+ if (!cfg.name || !cfg.symbol) {
3755
+ throw new Error("Token name and symbol are required");
3756
+ }
3757
+ const poolConfig = {
3758
+ quoteToken: cfg.pool?.quoteToken || "0x4200000000000000000000000000000000000006",
3759
+ // Default to WETH
3760
+ initialMarketCap: cfg.pool?.initialMarketCap || "10"
3761
+ // Default to 10 ETH
3762
+ };
3763
+ const { desiredPrice, pairAddress } = getDesiredPriceAndPairAddress(
3764
+ getTokenPairByAddress(poolConfig.quoteToken),
3765
+ poolConfig.initialMarketCap
3766
+ );
3767
+ const vestingUnlockDate = cfg.vault?.durationInDays ? BigInt(Math.floor(Date.now() / 1e3) + cfg.vault.durationInDays * 24 * 60 * 60) : BigInt(0);
3768
+ const socialLinks = cfg.metadata?.socialMediaUrls ?? [];
3769
+ const telegramLink = socialLinks.find((url) => url.includes("t.me")) || "";
3770
+ const xLink = socialLinks.find((url) => url.includes("twitter.com") || url.includes("x.com")) || "";
3771
+ const websiteLink = socialLinks.find(
3772
+ (url) => !url.includes("t.me") && !url.includes("twitter.com") && !url.includes("x.com")
3773
+ ) || "";
3774
+ const tx = await buildTransaction({
3775
+ deployerAddress: wallet.account.address,
3776
+ formData: {
3777
+ name: cfg.name,
3778
+ symbol: cfg.symbol,
3779
+ imageUrl: cfg.image || "",
3780
+ description: cfg.metadata?.description || "",
3781
+ devBuyAmount: cfg.devBuy?.ethAmount ? parseFloat(cfg.devBuy.ethAmount) : 0,
3782
+ lockupPercentage: cfg.vault?.percentage || 0,
3783
+ vestingUnlockDate,
3784
+ enableDevBuy: !!cfg.devBuy?.ethAmount,
3785
+ enableLockup: !!cfg.vault?.percentage,
3786
+ feeRecipient: cfg.rewardsConfig?.creatorRewardRecipient || "",
3787
+ telegramLink,
3788
+ websiteLink,
3789
+ xLink,
3790
+ marketCap: poolConfig.initialMarketCap,
3791
+ farcasterLink: "",
3792
+ pairedToken: pairAddress,
3793
+ creatorRewardsRecipient: cfg.rewardsConfig?.creatorRewardRecipient || "",
3794
+ creatorRewardsAdmin: cfg.rewardsConfig?.creatorAdmin || "",
3795
+ interfaceAdmin: cfg.rewardsConfig?.interfaceAdmin || "",
3796
+ creatorReward: cfg.rewardsConfig?.creatorReward || 0,
3797
+ interfaceRewardRecipient: cfg.rewardsConfig?.interfaceRewardRecipient || "",
3798
+ image: null
3799
+ },
3800
+ chainId: publicClient.chain?.id || 8453,
3801
+ clankerMetadata: {
3802
+ description: cfg.metadata?.description || "",
3803
+ socialMediaUrls: cfg.metadata?.socialMediaUrls ?? [],
3804
+ auditUrls: cfg.metadata?.auditUrls ?? []
3805
+ },
3806
+ clankerSocialContext: {
3807
+ interface: cfg.context?.interface || "SDK",
3808
+ platform: cfg.context?.platform || "",
3809
+ messageId: cfg.context?.messageId || "",
3810
+ id: cfg.context?.id || ""
3811
+ },
3812
+ desiredPrice
3813
+ });
3814
+ console.log("tx", tx);
3815
+ const hash = await wallet.sendTransaction({
3816
+ ...tx.transaction,
3817
+ account: wallet.account,
3818
+ chain: publicClient.chain
3819
+ });
3820
+ console.log("hash", hash);
3821
+ const receipt = await publicClient.waitForTransactionReceipt({ hash });
3822
+ const [log] = parseEventLogs({
3823
+ abi: Clanker_v3_1_abi,
3824
+ eventName: "TokenCreated",
3825
+ logs: receipt.logs
3826
+ });
3827
+ if (!log) {
3828
+ throw new Error("No deployment event found");
3829
+ }
3830
+ return log.args.tokenAddress;
3831
+ }
3832
+ var init_v3 = __esm({
3833
+ "src/deployment/v3.ts"() {
3834
+ "use strict";
3835
+ init_esm_shims();
3836
+ init_Clanker();
3837
+ init_buildTransaction();
3838
+ init_desired_price();
3839
+ init_desiredPrice();
3840
+ }
3841
+ });
3842
+
3843
+ // src/abi/v4/Clanker.ts
3844
+ var Clanker_v4_abi;
3845
+ var init_Clanker6 = __esm({
3846
+ "src/abi/v4/Clanker.ts"() {
3847
+ "use strict";
3848
+ init_esm_shims();
3849
+ Clanker_v4_abi = [
3850
+ {
3851
+ type: "constructor",
3852
+ inputs: [
3853
+ {
3854
+ name: "owner_",
3855
+ type: "address",
3856
+ internalType: "address"
3857
+ }
3858
+ ],
3859
+ stateMutability: "nonpayable"
3860
+ },
3861
+ {
3862
+ type: "function",
3863
+ name: "BPS",
3864
+ inputs: [],
3865
+ outputs: [
3866
+ {
3867
+ name: "",
3868
+ type: "uint256",
3869
+ internalType: "uint256"
3870
+ }
3871
+ ],
3872
+ stateMutability: "view"
3873
+ },
3874
+ {
3875
+ type: "function",
3876
+ name: "MAX_EXTENSIONS",
3877
+ inputs: [],
3878
+ outputs: [
3879
+ {
3880
+ name: "",
3881
+ type: "uint256",
3882
+ internalType: "uint256"
3883
+ }
3884
+ ],
3885
+ stateMutability: "view"
3886
+ },
3887
+ {
3888
+ type: "function",
3889
+ name: "MAX_EXTENSION_BPS",
3890
+ inputs: [],
3891
+ outputs: [
3892
+ {
3893
+ name: "",
3894
+ type: "uint16",
3895
+ internalType: "uint16"
3896
+ }
3897
+ ],
3898
+ stateMutability: "view"
3899
+ },
3900
+ {
3901
+ type: "function",
3902
+ name: "TOKEN_SUPPLY",
3903
+ inputs: [],
3904
+ outputs: [
3905
+ {
3906
+ name: "",
3907
+ type: "uint256",
3908
+ internalType: "uint256"
3909
+ }
3910
+ ],
3911
+ stateMutability: "view"
3912
+ },
3913
+ {
3914
+ type: "function",
3915
+ name: "admins",
3916
+ inputs: [
3917
+ {
3918
+ name: "",
3919
+ type: "address",
3920
+ internalType: "address"
3921
+ }
3922
+ ],
3923
+ outputs: [
3924
+ {
3925
+ name: "",
3926
+ type: "bool",
3927
+ internalType: "bool"
3928
+ }
3929
+ ],
3930
+ stateMutability: "view"
3931
+ },
3932
+ {
3933
+ type: "function",
3934
+ name: "claimTeamFees",
3935
+ inputs: [
3936
+ {
3937
+ name: "token",
3938
+ type: "address",
3939
+ internalType: "address"
3940
+ }
3941
+ ],
3942
+ outputs: [],
3943
+ stateMutability: "nonpayable"
3944
+ },
3945
+ {
3946
+ type: "function",
3947
+ name: "deployToken",
3948
+ inputs: [
3949
+ {
3950
+ name: "deploymentConfig",
3951
+ type: "tuple",
3952
+ internalType: "struct IClanker.DeploymentConfig",
3953
+ components: [
3954
+ {
3955
+ name: "tokenConfig",
3956
+ type: "tuple",
3957
+ internalType: "struct IClanker.TokenConfig",
3958
+ components: [
3959
+ {
3960
+ name: "tokenAdmin",
3961
+ type: "address",
3962
+ internalType: "address"
3963
+ },
3964
+ {
3965
+ name: "name",
3966
+ type: "string",
3967
+ internalType: "string"
3968
+ },
3969
+ {
3970
+ name: "symbol",
3971
+ type: "string",
3972
+ internalType: "string"
3973
+ },
3974
+ {
3975
+ name: "salt",
3976
+ type: "bytes32",
3977
+ internalType: "bytes32"
3978
+ },
3979
+ {
3980
+ name: "image",
3981
+ type: "string",
3982
+ internalType: "string"
3983
+ },
3984
+ {
3985
+ name: "metadata",
3986
+ type: "string",
3987
+ internalType: "string"
3988
+ },
3989
+ {
3990
+ name: "context",
3991
+ type: "string",
3992
+ internalType: "string"
3993
+ },
3994
+ {
3995
+ name: "originatingChainId",
3996
+ type: "uint256",
3997
+ internalType: "uint256"
3998
+ }
3999
+ ]
4000
+ },
4001
+ {
4002
+ name: "poolConfig",
4003
+ type: "tuple",
4004
+ internalType: "struct IClanker.PoolConfig",
4005
+ components: [
4006
+ {
4007
+ name: "hook",
4008
+ type: "address",
4009
+ internalType: "address"
4010
+ },
4011
+ {
4012
+ name: "pairedToken",
4013
+ type: "address",
4014
+ internalType: "address"
4015
+ },
4016
+ {
4017
+ name: "tickIfToken0IsClanker",
4018
+ type: "int24",
4019
+ internalType: "int24"
4020
+ },
4021
+ {
4022
+ name: "tickSpacing",
4023
+ type: "int24",
4024
+ internalType: "int24"
4025
+ },
4026
+ {
4027
+ name: "poolData",
4028
+ type: "bytes",
4029
+ internalType: "bytes"
4030
+ }
4031
+ ]
4032
+ },
4033
+ {
4034
+ name: "lockerConfig",
4035
+ type: "tuple",
4036
+ internalType: "struct IClanker.LockerConfig",
4037
+ components: [
4038
+ {
4039
+ name: "rewardAdmins",
4040
+ type: "address[]",
4041
+ internalType: "address[]"
4042
+ },
4043
+ {
4044
+ name: "rewardRecipients",
4045
+ type: "address[]",
4046
+ internalType: "address[]"
4047
+ },
4048
+ {
4049
+ name: "rewardBps",
4050
+ type: "uint16[]",
4051
+ internalType: "uint16[]"
4052
+ },
4053
+ {
4054
+ name: "tickLower",
4055
+ type: "int24[]",
4056
+ internalType: "int24[]"
4057
+ },
4058
+ {
4059
+ name: "tickUpper",
4060
+ type: "int24[]",
4061
+ internalType: "int24[]"
4062
+ },
4063
+ {
4064
+ name: "positionBps",
4065
+ type: "uint16[]",
4066
+ internalType: "uint16[]"
4067
+ }
4068
+ ]
4069
+ },
4070
+ {
4071
+ name: "mevModuleConfig",
4072
+ type: "tuple",
4073
+ internalType: "struct IClanker.MevModuleConfig",
4074
+ components: [
4075
+ {
4076
+ name: "mevModule",
4077
+ type: "address",
4078
+ internalType: "address"
4079
+ },
4080
+ {
4081
+ name: "mevModuleData",
4082
+ type: "bytes",
4083
+ internalType: "bytes"
4084
+ }
4085
+ ]
4086
+ },
4087
+ {
4088
+ name: "extensionConfigs",
4089
+ type: "tuple[]",
4090
+ internalType: "struct IClanker.ExtensionConfig[]",
4091
+ components: [
4092
+ {
4093
+ name: "extension",
4094
+ type: "address",
4095
+ internalType: "address"
4096
+ },
4097
+ {
4098
+ name: "msgValue",
4099
+ type: "uint256",
4100
+ internalType: "uint256"
4101
+ },
4102
+ {
4103
+ name: "extensionBps",
4104
+ type: "uint16",
4105
+ internalType: "uint16"
4106
+ },
4107
+ {
4108
+ name: "extensionData",
4109
+ type: "bytes",
4110
+ internalType: "bytes"
4111
+ }
4112
+ ]
4113
+ }
4114
+ ]
4115
+ }
4116
+ ],
4117
+ outputs: [
4118
+ {
4119
+ name: "tokenAddress",
4120
+ type: "address",
4121
+ internalType: "address"
4122
+ }
4123
+ ],
4124
+ stateMutability: "payable"
4125
+ },
4126
+ {
4127
+ type: "function",
4128
+ name: "deployTokenZeroSupply",
4129
+ inputs: [
4130
+ {
4131
+ name: "tokenConfig",
4132
+ type: "tuple",
4133
+ internalType: "struct IClanker.TokenConfig",
4134
+ components: [
4135
+ {
4136
+ name: "tokenAdmin",
4137
+ type: "address",
4138
+ internalType: "address"
4139
+ },
4140
+ {
4141
+ name: "name",
4142
+ type: "string",
4143
+ internalType: "string"
4144
+ },
4145
+ {
4146
+ name: "symbol",
4147
+ type: "string",
4148
+ internalType: "string"
4149
+ },
4150
+ {
4151
+ name: "salt",
4152
+ type: "bytes32",
4153
+ internalType: "bytes32"
4154
+ },
4155
+ {
4156
+ name: "image",
4157
+ type: "string",
4158
+ internalType: "string"
4159
+ },
4160
+ {
4161
+ name: "metadata",
4162
+ type: "string",
4163
+ internalType: "string"
4164
+ },
4165
+ {
4166
+ name: "context",
4167
+ type: "string",
4168
+ internalType: "string"
4169
+ },
4170
+ {
4171
+ name: "originatingChainId",
4172
+ type: "uint256",
4173
+ internalType: "uint256"
4174
+ }
4175
+ ]
4176
+ }
4177
+ ],
4178
+ outputs: [
4179
+ {
4180
+ name: "tokenAddress",
4181
+ type: "address",
4182
+ internalType: "address"
4183
+ }
4184
+ ],
4185
+ stateMutability: "nonpayable"
4186
+ },
4187
+ {
4188
+ type: "function",
4189
+ name: "deploymentInfoForToken",
4190
+ inputs: [
4191
+ {
4192
+ name: "token",
4193
+ type: "address",
4194
+ internalType: "address"
4195
+ }
4196
+ ],
4197
+ outputs: [
4198
+ {
4199
+ name: "token",
4200
+ type: "address",
4201
+ internalType: "address"
4202
+ },
4203
+ {
4204
+ name: "hook",
4205
+ type: "address",
4206
+ internalType: "address"
4207
+ }
4208
+ ],
4209
+ stateMutability: "view"
4210
+ },
4211
+ {
4212
+ type: "function",
4213
+ name: "deprecated",
4214
+ inputs: [],
4215
+ outputs: [
4216
+ {
4217
+ name: "",
4218
+ type: "bool",
4219
+ internalType: "bool"
4220
+ }
4221
+ ],
4222
+ stateMutability: "view"
4223
+ },
4224
+ {
4225
+ type: "function",
4226
+ name: "initialize",
4227
+ inputs: [
4228
+ {
4229
+ name: "locker_",
4230
+ type: "address",
4231
+ internalType: "address"
4232
+ },
4233
+ {
4234
+ name: "teamFeeRecipient_",
4235
+ type: "address",
4236
+ internalType: "address"
4237
+ }
4238
+ ],
4239
+ outputs: [],
4240
+ stateMutability: "nonpayable"
4241
+ },
4242
+ {
4243
+ type: "function",
4244
+ name: "owner",
4245
+ inputs: [],
4246
+ outputs: [
4247
+ {
4248
+ name: "",
4249
+ type: "address",
4250
+ internalType: "address"
4251
+ }
4252
+ ],
4253
+ stateMutability: "view"
4254
+ },
4255
+ {
4256
+ type: "function",
4257
+ name: "renounceOwnership",
4258
+ inputs: [],
4259
+ outputs: [],
4260
+ stateMutability: "nonpayable"
4261
+ },
4262
+ {
4263
+ type: "function",
4264
+ name: "setAdmin",
4265
+ inputs: [
4266
+ {
4267
+ name: "admin",
4268
+ type: "address",
4269
+ internalType: "address"
4270
+ },
4271
+ {
4272
+ name: "enabled",
4273
+ type: "bool",
4274
+ internalType: "bool"
4275
+ }
4276
+ ],
4277
+ outputs: [],
4278
+ stateMutability: "nonpayable"
4279
+ },
4280
+ {
4281
+ type: "function",
4282
+ name: "setDeprecated",
4283
+ inputs: [
4284
+ {
4285
+ name: "deprecated_",
4286
+ type: "bool",
4287
+ internalType: "bool"
4288
+ }
4289
+ ],
4290
+ outputs: [],
4291
+ stateMutability: "nonpayable"
4292
+ },
4293
+ {
4294
+ type: "function",
4295
+ name: "setExtension",
4296
+ inputs: [
4297
+ {
4298
+ name: "extension",
4299
+ type: "address",
4300
+ internalType: "address"
4301
+ },
4302
+ {
4303
+ name: "enabled",
4304
+ type: "bool",
4305
+ internalType: "bool"
4306
+ }
4307
+ ],
4308
+ outputs: [],
4309
+ stateMutability: "nonpayable"
4310
+ },
4311
+ {
4312
+ type: "function",
4313
+ name: "setHook",
4314
+ inputs: [
4315
+ {
4316
+ name: "hook",
4317
+ type: "address",
4318
+ internalType: "address"
4319
+ },
4320
+ {
4321
+ name: "enabled",
4322
+ type: "bool",
4323
+ internalType: "bool"
4324
+ }
4325
+ ],
4326
+ outputs: [],
4327
+ stateMutability: "nonpayable"
4328
+ },
4329
+ {
4330
+ type: "function",
4331
+ name: "setMevModule",
4332
+ inputs: [
4333
+ {
4334
+ name: "mevModule",
4335
+ type: "address",
4336
+ internalType: "address"
4337
+ },
4338
+ {
4339
+ name: "enabled",
4340
+ type: "bool",
4341
+ internalType: "bool"
4342
+ }
4343
+ ],
4344
+ outputs: [],
4345
+ stateMutability: "nonpayable"
4346
+ },
4347
+ {
4348
+ type: "function",
4349
+ name: "setTeamFeeRecipient",
4350
+ inputs: [
4351
+ {
4352
+ name: "teamFeeRecipient_",
4353
+ type: "address",
4354
+ internalType: "address"
4355
+ }
4356
+ ],
4357
+ outputs: [],
4358
+ stateMutability: "nonpayable"
4359
+ },
4360
+ {
4361
+ type: "function",
4362
+ name: "teamFeeRecipient",
4363
+ inputs: [],
4364
+ outputs: [
4365
+ {
4366
+ name: "",
4367
+ type: "address",
4368
+ internalType: "address"
4369
+ }
4370
+ ],
4371
+ stateMutability: "view"
4372
+ },
4373
+ {
4374
+ type: "function",
4375
+ name: "transferOwnership",
4376
+ inputs: [
4377
+ {
4378
+ name: "newOwner",
4379
+ type: "address",
4380
+ internalType: "address"
4381
+ }
4382
+ ],
4383
+ outputs: [],
4384
+ stateMutability: "nonpayable"
4385
+ },
4386
+ {
4387
+ type: "event",
4388
+ name: "ClaimTeamFees",
4389
+ inputs: [
4390
+ {
4391
+ name: "token",
4392
+ type: "address",
4393
+ indexed: true,
4394
+ internalType: "address"
4395
+ },
4396
+ {
4397
+ name: "recipient",
4398
+ type: "address",
4399
+ indexed: true,
4400
+ internalType: "address"
4401
+ },
4402
+ {
4403
+ name: "amount",
4404
+ type: "uint256",
4405
+ indexed: false,
4406
+ internalType: "uint256"
4407
+ }
4408
+ ],
4409
+ anonymous: false
4410
+ },
4411
+ {
4412
+ type: "event",
4413
+ name: "ExtensionTriggered",
4414
+ inputs: [
4415
+ {
4416
+ name: "extension",
4417
+ type: "address",
4418
+ indexed: false,
4419
+ internalType: "address"
4420
+ },
4421
+ {
4422
+ name: "extensionSupply",
4423
+ type: "uint256",
4424
+ indexed: false,
4425
+ internalType: "uint256"
4426
+ },
4427
+ {
4428
+ name: "msgValue",
4429
+ type: "uint256",
4430
+ indexed: false,
4431
+ internalType: "uint256"
4432
+ }
4433
+ ],
4434
+ anonymous: false
4435
+ },
4436
+ {
4437
+ type: "event",
4438
+ name: "OwnershipTransferred",
4439
+ inputs: [
4440
+ {
4441
+ name: "previousOwner",
4442
+ type: "address",
4443
+ indexed: true,
4444
+ internalType: "address"
4445
+ },
4446
+ {
4447
+ name: "newOwner",
4448
+ type: "address",
4449
+ indexed: true,
4450
+ internalType: "address"
4451
+ }
4452
+ ],
4453
+ anonymous: false
4454
+ },
4455
+ {
4456
+ type: "event",
4457
+ name: "SetAdmin",
4458
+ inputs: [
4459
+ {
4460
+ name: "admin",
4461
+ type: "address",
4462
+ indexed: true,
4463
+ internalType: "address"
4464
+ },
4465
+ {
4466
+ name: "enabled",
4467
+ type: "bool",
4468
+ indexed: false,
4469
+ internalType: "bool"
4470
+ }
4471
+ ],
4472
+ anonymous: false
4473
+ },
4474
+ {
4475
+ type: "event",
4476
+ name: "SetDeprecated",
4477
+ inputs: [
4478
+ {
4479
+ name: "deprecated",
4480
+ type: "bool",
4481
+ indexed: false,
4482
+ internalType: "bool"
4483
+ }
4484
+ ],
4485
+ anonymous: false
4486
+ },
4487
+ {
4488
+ type: "event",
4489
+ name: "SetExtension",
4490
+ inputs: [
4491
+ {
4492
+ name: "extension",
4493
+ type: "address",
4494
+ indexed: false,
4495
+ internalType: "address"
4496
+ },
4497
+ {
4498
+ name: "enabled",
4499
+ type: "bool",
4500
+ indexed: false,
4501
+ internalType: "bool"
4502
+ }
4503
+ ],
4504
+ anonymous: false
4505
+ },
4506
+ {
4507
+ type: "event",
4508
+ name: "SetHook",
4509
+ inputs: [
4510
+ {
4511
+ name: "hook",
4512
+ type: "address",
4513
+ indexed: false,
4514
+ internalType: "address"
4515
+ },
4516
+ {
4517
+ name: "enabled",
4518
+ type: "bool",
4519
+ indexed: false,
4520
+ internalType: "bool"
4521
+ }
4522
+ ],
4523
+ anonymous: false
4524
+ },
4525
+ {
4526
+ type: "event",
4527
+ name: "SetMevModule",
4528
+ inputs: [
4529
+ {
4530
+ name: "mevModule",
4531
+ type: "address",
4532
+ indexed: false,
4533
+ internalType: "address"
4534
+ },
4535
+ {
4536
+ name: "enabled",
4537
+ type: "bool",
4538
+ indexed: false,
4539
+ internalType: "bool"
4540
+ }
4541
+ ],
4542
+ anonymous: false
4543
+ },
4544
+ {
4545
+ type: "event",
4546
+ name: "SetTeamFeeRecipient",
4547
+ inputs: [
4548
+ {
4549
+ name: "oldTeamFeeRecipient",
4550
+ type: "address",
4551
+ indexed: false,
4552
+ internalType: "address"
4553
+ },
4554
+ {
4555
+ name: "newTeamFeeRecipient",
4556
+ type: "address",
4557
+ indexed: false,
4558
+ internalType: "address"
4559
+ }
4560
+ ],
4561
+ anonymous: false
4562
+ },
4563
+ {
4564
+ type: "event",
4565
+ name: "TokenCreated",
4566
+ inputs: [
4567
+ {
4568
+ name: "msgSender",
4569
+ type: "address",
4570
+ indexed: false,
4571
+ internalType: "address"
4572
+ },
4573
+ {
4574
+ name: "tokenAddress",
4575
+ type: "address",
4576
+ indexed: true,
4577
+ internalType: "address"
4578
+ },
4579
+ {
4580
+ name: "tokenAdmin",
4581
+ type: "address",
4582
+ indexed: true,
4583
+ internalType: "address"
4584
+ },
4585
+ {
4586
+ name: "tokenImage",
4587
+ type: "string",
4588
+ indexed: false,
4589
+ internalType: "string"
4590
+ },
4591
+ {
4592
+ name: "tokenName",
4593
+ type: "string",
4594
+ indexed: false,
4595
+ internalType: "string"
4596
+ },
4597
+ {
4598
+ name: "tokenSymbol",
4599
+ type: "string",
4600
+ indexed: false,
4601
+ internalType: "string"
4602
+ },
4603
+ {
4604
+ name: "tokenMetadata",
4605
+ type: "string",
4606
+ indexed: false,
4607
+ internalType: "string"
4608
+ },
4609
+ {
4610
+ name: "tokenContext",
4611
+ type: "string",
4612
+ indexed: false,
4613
+ internalType: "string"
4614
+ },
4615
+ {
4616
+ name: "startingTick",
4617
+ type: "int24",
4618
+ indexed: false,
4619
+ internalType: "int24"
4620
+ },
4621
+ {
4622
+ name: "poolHook",
4623
+ type: "address",
4624
+ indexed: false,
4625
+ internalType: "address"
4626
+ },
4627
+ {
4628
+ name: "poolId",
4629
+ type: "bytes32",
4630
+ indexed: false,
4631
+ internalType: "PoolId"
4632
+ },
4633
+ {
4634
+ name: "pairedToken",
4635
+ type: "address",
4636
+ indexed: false,
4637
+ internalType: "address"
4638
+ },
4639
+ {
4640
+ name: "mevModule",
4641
+ type: "address",
4642
+ indexed: false,
4643
+ internalType: "address"
4644
+ },
4645
+ {
4646
+ name: "extensionsSupply",
4647
+ type: "uint256",
4648
+ indexed: false,
4649
+ internalType: "uint256"
4650
+ },
4651
+ {
4652
+ name: "extensions",
4653
+ type: "address[]",
4654
+ indexed: false,
4655
+ internalType: "address[]"
4656
+ }
4657
+ ],
4658
+ anonymous: false
4659
+ },
4660
+ {
4661
+ type: "error",
4662
+ name: "AlreadyInitialized",
4663
+ inputs: []
4664
+ },
4665
+ {
4666
+ type: "error",
4667
+ name: "Deprecated",
4668
+ inputs: []
4669
+ },
4670
+ {
4671
+ type: "error",
4672
+ name: "ExtensionMsgValueMismatch",
4673
+ inputs: []
4674
+ },
4675
+ {
4676
+ type: "error",
4677
+ name: "ExtensionNotEnabled",
4678
+ inputs: []
4679
+ },
4680
+ {
4681
+ type: "error",
4682
+ name: "HookNotEnabled",
4683
+ inputs: []
4684
+ },
4685
+ {
4686
+ type: "error",
4687
+ name: "InvalidExtension",
4688
+ inputs: []
4689
+ },
4690
+ {
4691
+ type: "error",
4692
+ name: "InvalidHook",
4693
+ inputs: []
4694
+ },
4695
+ {
4696
+ type: "error",
4697
+ name: "InvalidLocker",
4698
+ inputs: []
4699
+ },
4700
+ {
4701
+ type: "error",
4702
+ name: "InvalidMevModule",
4703
+ inputs: []
4704
+ },
4705
+ {
4706
+ type: "error",
4707
+ name: "MaxExtensionBpsExceeded",
4708
+ inputs: []
4709
+ },
4710
+ {
4711
+ type: "error",
4712
+ name: "MaxExtensionsExceeded",
4713
+ inputs: []
4714
+ },
4715
+ {
4716
+ type: "error",
4717
+ name: "MevModuleNotEnabled",
4718
+ inputs: []
4719
+ },
4720
+ {
4721
+ type: "error",
4722
+ name: "NotFound",
4723
+ inputs: []
4724
+ },
4725
+ {
4726
+ type: "error",
4727
+ name: "OnlyNonOriginatingChains",
4728
+ inputs: []
4729
+ },
4730
+ {
4731
+ type: "error",
4732
+ name: "OnlyOriginatingChain",
4733
+ inputs: []
4734
+ },
4735
+ {
4736
+ type: "error",
4737
+ name: "OwnableInvalidOwner",
4738
+ inputs: [
4739
+ {
4740
+ name: "owner",
4741
+ type: "address",
4742
+ internalType: "address"
4743
+ }
4744
+ ]
4745
+ },
4746
+ {
4747
+ type: "error",
4748
+ name: "OwnableUnauthorizedAccount",
4749
+ inputs: [
4750
+ {
4751
+ name: "account",
4752
+ type: "address",
4753
+ internalType: "address"
4754
+ }
4755
+ ]
4756
+ },
4757
+ {
4758
+ type: "error",
4759
+ name: "ReentrancyGuardReentrantCall",
4760
+ inputs: []
4761
+ },
4762
+ {
4763
+ type: "error",
4764
+ name: "Unauthorized",
4765
+ inputs: []
4766
+ }
4767
+ ];
4768
+ }
4769
+ });
4770
+
4771
+ // src/types/fee.ts
4772
+ import { encodeAbiParameters } from "viem";
4773
+ function encodeFeeConfig(config2) {
4774
+ if (config2.type === "static") {
4775
+ return {
4776
+ hook: CLANKER_HOOK_STATIC_FEE_ADDRESS,
4777
+ poolData: encodeAbiParameters(
4778
+ [{ type: "uint24" }, { type: "uint24" }],
4779
+ [config2.fee, config2.fee]
4780
+ )
4781
+ };
4782
+ } else {
3075
4783
  return {
3076
- transaction: {
3077
- to: CLANKER_FACTORY_V3_1,
3078
- data: deployCalldata
3079
- },
3080
- expectedAddress
4784
+ hook: CLANKER_HOOK_DYNAMIC_FEE_ADDRESS,
4785
+ poolData: encodeAbiParameters(
4786
+ [
4787
+ { type: "uint24", name: "baseFee" },
4788
+ { type: "uint24", name: "maxLpFee" },
4789
+ { type: "uint256", name: "referenceTickFilterPeriod" },
4790
+ { type: "uint256", name: "resetPeriod" },
4791
+ { type: "int24", name: "resetTickFilter" },
4792
+ { type: "uint256", name: "feeControlNumerator" },
4793
+ { type: "uint24", name: "decayFilterBps" }
4794
+ ],
4795
+ [
4796
+ config2.baseFee,
4797
+ config2.maxLpFee,
4798
+ BigInt(config2.referenceTickFilterPeriod),
4799
+ BigInt(config2.resetPeriod),
4800
+ config2.resetTickFilter,
4801
+ BigInt(config2.feeControlNumerator),
4802
+ config2.decayFilterBps
4803
+ ]
4804
+ )
3081
4805
  };
3082
- } catch (error) {
3083
- console.error("Error encoding function data:", error);
3084
- console.error("Problematic deployArgs:", tokenConfig);
3085
- throw new Error(`Failed to encode function data: ${error.message}`);
3086
4806
  }
3087
4807
  }
3088
- var init_buildTransaction = __esm({
3089
- "src/services/buildTransaction.ts"() {
4808
+ var init_fee = __esm({
4809
+ "src/types/fee.ts"() {
3090
4810
  "use strict";
3091
4811
  init_esm_shims();
3092
4812
  init_constants();
3093
- init_Clanker();
3094
- init_unix_timestamp();
3095
- init_vanityAddress();
3096
4813
  }
3097
4814
  });
3098
4815
 
3099
- // src/utils/desired-price.ts
3100
- var getDesiredPriceAndPairAddress;
3101
- var init_desired_price = __esm({
3102
- "src/utils/desired-price.ts"() {
3103
- "use strict";
3104
- init_esm_shims();
3105
- init_constants();
3106
- getDesiredPriceAndPairAddress = (pair, marketCap = "10") => {
3107
- let desiredPrice = 1e-10;
3108
- let pairAddress = WETH_ADDRESS;
3109
- if (pair === "WETH") {
3110
- desiredPrice = Number(marketCap) * 1e-11;
3111
- }
3112
- if (pair === "DEGEN") {
3113
- desiredPrice = 666666667e-14;
3114
- pairAddress = DEGEN_ADDRESS;
3115
- } else if (pair === "CLANKER") {
3116
- const clankerPrice = 20;
3117
- const desiredMarketCap = 1e4;
3118
- const totalSupplyDesired = 1e11;
3119
- const howManyClankerForDesiredMarketCap = desiredMarketCap / clankerPrice;
3120
- const pricePerTokenInClanker = howManyClankerForDesiredMarketCap / totalSupplyDesired;
3121
- desiredPrice = pricePerTokenInClanker;
3122
- pairAddress = CLANKER_ADDRESS;
3123
- } else if (pair === "ANON") {
3124
- const anonPrice = 1e-3;
3125
- const desiredMarketCap = 1e4;
3126
- const totalSupplyDesired = 1e11;
3127
- const howManyAnonForDesiredMarketCap = desiredMarketCap / anonPrice;
3128
- const pricePerTokenInAnon = howManyAnonForDesiredMarketCap / totalSupplyDesired;
3129
- desiredPrice = pricePerTokenInAnon;
3130
- pairAddress = ANON_ADDRESS;
3131
- } else if (pair === "HIGHER") {
3132
- const higherPrice = 8e-3;
3133
- const desiredMarketCap = 1e4;
3134
- const totalSupplyDesired = 1e11;
3135
- const howManyHigherForDesiredMarketCap = desiredMarketCap / higherPrice;
3136
- const pricePerTokenInHigher = howManyHigherForDesiredMarketCap / totalSupplyDesired;
3137
- desiredPrice = pricePerTokenInHigher;
3138
- pairAddress = HIGHER_ADDRESS;
3139
- } else if (pair === "BTC") {
3140
- const cbBtcPrice = 105e3;
3141
- const desiredMarketCap = 1e4;
3142
- const totalSupplyDesired = 1e11;
3143
- const howManyCBBTCForDesiredMarketCap = desiredMarketCap / cbBtcPrice;
3144
- const pricePerTokenInCbBtc = howManyCBBTCForDesiredMarketCap / totalSupplyDesired / 10 ** 10;
3145
- desiredPrice = pricePerTokenInCbBtc;
3146
- pairAddress = CB_BTC_ADDRESS;
3147
- } else if (pair === "NATIVE") {
3148
- const nativePrice = 4e-5;
3149
- const desiredMarketCap = 1e4;
3150
- const totalSupplyDesired = 1e11;
3151
- const howManyNativeForDesiredMarketCap = desiredMarketCap / nativePrice;
3152
- const pricePerTokenInNative = howManyNativeForDesiredMarketCap / totalSupplyDesired;
3153
- desiredPrice = pricePerTokenInNative;
3154
- pairAddress = NATIVE_ADDRESS;
3155
- } else if (pair === "A0x") {
3156
- const a0xPrice = 73e-8;
3157
- const desiredMarketCap = 5e3;
3158
- const totalSupplyDesired = 1e11;
3159
- const howManyA0xForDesiredMarketCap = desiredMarketCap / a0xPrice;
3160
- const pricePerTokenInA0x = howManyA0xForDesiredMarketCap / totalSupplyDesired;
3161
- desiredPrice = pricePerTokenInA0x;
3162
- pairAddress = A0X_ADDRESS;
3163
- } else if (pair === "WMON") {
3164
- desiredPrice = Number(marketCap) * 1e-11;
3165
- pairAddress = "0x760AfE86e5de5fa0Ee542fc7B7B713e1c5425701";
3166
- }
3167
- return { desiredPrice, pairAddress };
3168
- };
4816
+ // src/deployment/v4.ts
4817
+ import {
4818
+ encodeAbiParameters as encodeAbiParameters2,
4819
+ encodeFunctionData as encodeFunctionData2,
4820
+ parseEventLogs as parseEventLogs2
4821
+ } from "viem";
4822
+ async function deployTokenV4(cfg, wallet, publicClient) {
4823
+ const account = wallet?.account;
4824
+ const CHAIN_ID = publicClient.chain?.id;
4825
+ if (!account) {
4826
+ throw new Error("Wallet account required for deployToken");
3169
4827
  }
3170
- });
3171
-
3172
- // src/services/desiredPrice.ts
3173
- import { monadTestnet as monadTestnet2 } from "viem/chains";
3174
- var getTokenPairByAddress;
3175
- var init_desiredPrice = __esm({
3176
- "src/services/desiredPrice.ts"() {
4828
+ const feeConfig = cfg.feeConfig || { type: "static", fee: 500 };
4829
+ const { hook, poolData } = encodeFeeConfig(feeConfig);
4830
+ const deploymentConfig = {
4831
+ tokenConfig: {
4832
+ tokenAdmin: account.address,
4833
+ name: cfg.name,
4834
+ symbol: cfg.symbol,
4835
+ salt: "0x0000000000000000000000000000000000000000000000000000000000000000",
4836
+ image: cfg.image || "",
4837
+ metadata: cfg.metadata ? JSON.stringify(cfg.metadata) : "",
4838
+ context: cfg.context ? JSON.stringify(cfg.context) : "",
4839
+ originatingChainId: BigInt(CHAIN_ID || 84532)
4840
+ },
4841
+ lockerConfig: {
4842
+ rewardAdmins: [
4843
+ cfg.rewardsConfig?.creatorAdmin || account.address,
4844
+ ...cfg.rewardsConfig?.additionalRewardAdmins || []
4845
+ ],
4846
+ rewardRecipients: [
4847
+ cfg.rewardsConfig?.creatorRewardRecipient || account.address,
4848
+ ...cfg.rewardsConfig?.additionalRewardRecipients || []
4849
+ ],
4850
+ rewardBps: [
4851
+ cfg.rewardsConfig?.creatorReward || 1e4,
4852
+ ...cfg.rewardsConfig?.additionalRewardBps || []
4853
+ ],
4854
+ tickLower: [-230400],
4855
+ tickUpper: [230400],
4856
+ positionBps: [1e4]
4857
+ },
4858
+ poolConfig: {
4859
+ hook,
4860
+ pairedToken: "0x4200000000000000000000000000000000000006",
4861
+ tickIfToken0IsClanker: -230400,
4862
+ tickSpacing: 200,
4863
+ poolData
4864
+ },
4865
+ mevModuleConfig: {
4866
+ mevModule: CLANKER_MEV_MODULE_ADDRESS,
4867
+ mevModuleData: "0x"
4868
+ },
4869
+ extensionConfigs: [
4870
+ // vaulting extension
4871
+ ...cfg.vault?.percentage ? [
4872
+ {
4873
+ extension: CLANKER_VAULT_ADDRESS,
4874
+ msgValue: 0n,
4875
+ extensionBps: cfg.vault.percentage * 100,
4876
+ extensionData: encodeAbiParameters2(
4877
+ [{ type: "address" }, { type: "uint256" }, { type: "uint256" }],
4878
+ [
4879
+ account.address,
4880
+ BigInt(cfg.vault?.lockupDuration || 0),
4881
+ BigInt(cfg.vault?.vestingDuration || 0)
4882
+ ]
4883
+ )
4884
+ }
4885
+ ] : [],
4886
+ // airdrop extension
4887
+ ...cfg.airdrop ? [
4888
+ {
4889
+ extension: CLANKER_AIRDROP_ADDRESS,
4890
+ msgValue: 0n,
4891
+ extensionBps: cfg.airdrop.percentage,
4892
+ extensionData: encodeAbiParameters2(
4893
+ [{ type: "bytes32" }, { type: "uint256" }, { type: "uint256" }],
4894
+ [
4895
+ cfg.airdrop.merkleRoot,
4896
+ BigInt(cfg.airdrop.lockupDuration),
4897
+ BigInt(cfg.airdrop.vestingDuration)
4898
+ ]
4899
+ )
4900
+ }
4901
+ ] : [],
4902
+ // devBuy extension
4903
+ ...cfg.devBuy && cfg.devBuy.ethAmount !== "0" ? [
4904
+ {
4905
+ extension: CLANKER_DEVBUY_ADDRESS,
4906
+ msgValue: BigInt(parseFloat(cfg.devBuy.ethAmount) * 1e18),
4907
+ extensionBps: 0,
4908
+ extensionData: encodeAbiParameters2(
4909
+ [
4910
+ {
4911
+ type: "tuple",
4912
+ components: [
4913
+ { type: "address", name: "currency0" },
4914
+ { type: "address", name: "currency1" },
4915
+ { type: "uint24", name: "fee" },
4916
+ { type: "int24", name: "tickSpacing" },
4917
+ { type: "address", name: "hooks" }
4918
+ ]
4919
+ },
4920
+ { type: "uint128" },
4921
+ { type: "address" }
4922
+ ],
4923
+ [
4924
+ {
4925
+ currency0: "0x4200000000000000000000000000000000000006",
4926
+ // WETH
4927
+ currency1: account.address,
4928
+ // Token being deployed
4929
+ fee: 3e3,
4930
+ tickSpacing: 60,
4931
+ hooks: "0x0000000000000000000000000000000000000000"
4932
+ },
4933
+ BigInt(0),
4934
+ account.address
4935
+ ]
4936
+ )
4937
+ }
4938
+ ] : []
4939
+ ]
4940
+ };
4941
+ const deployCalldata = encodeFunctionData2({
4942
+ abi: Clanker_v4_abi,
4943
+ functionName: "deployToken",
4944
+ args: [deploymentConfig]
4945
+ });
4946
+ console.log("Deployment config:", JSON.stringify(deploymentConfig, bigIntReplacer, 2));
4947
+ const tx = await wallet.sendTransaction({
4948
+ to: CLANKER_FACTORY_V4,
4949
+ data: deployCalldata,
4950
+ account,
4951
+ chain: publicClient.chain,
4952
+ value: cfg.devBuy && cfg.devBuy.ethAmount !== "0" ? BigInt(parseFloat(cfg.devBuy.ethAmount) * 1e18) : BigInt(0)
4953
+ });
4954
+ console.log("Transaction hash:", tx);
4955
+ const receipt = await publicClient.waitForTransactionReceipt({
4956
+ hash: tx
4957
+ });
4958
+ const logs = parseEventLogs2({
4959
+ abi: Clanker_v4_abi,
4960
+ eventName: "TokenCreated",
4961
+ logs: receipt.logs
4962
+ });
4963
+ if (!logs || logs.length === 0) {
4964
+ throw new Error("No deployment event found");
4965
+ }
4966
+ const log = logs[0];
4967
+ if (!("args" in log) || !("tokenAddress" in log.args)) {
4968
+ throw new Error("Invalid event log format");
4969
+ }
4970
+ return log.args.tokenAddress;
4971
+ }
4972
+ var bigIntReplacer;
4973
+ var init_v4 = __esm({
4974
+ "src/deployment/v4.ts"() {
3177
4975
  "use strict";
3178
4976
  init_esm_shims();
4977
+ init_Clanker6();
3179
4978
  init_constants();
3180
- getTokenPairByAddress = (address) => {
3181
- if (address === WETH_ADDRESS) {
3182
- return "WETH";
3183
- }
3184
- if (address === DEGEN_ADDRESS) {
3185
- return "DEGEN";
3186
- }
3187
- if (address === NATIVE_ADDRESS) {
3188
- return "NATIVE";
3189
- }
3190
- if (address === CLANKER_ADDRESS) {
3191
- return "CLANKER";
3192
- }
3193
- if (address === ANON_ADDRESS) {
3194
- return "ANON";
3195
- }
3196
- if (address === HIGHER_ADDRESS) {
3197
- return "HIGHER";
3198
- }
3199
- if (address === CB_BTC_ADDRESS) {
3200
- return "BTC";
3201
- }
3202
- if (address === A0X_ADDRESS) {
3203
- return "A0x";
4979
+ init_fee();
4980
+ bigIntReplacer = (_key, value) => {
4981
+ if (typeof value === "bigint") {
4982
+ return value.toString();
3204
4983
  }
3205
- return "WETH";
4984
+ return value;
3206
4985
  };
3207
4986
  }
3208
4987
  });
@@ -3224,6 +5003,14 @@ var init_config = __esm({
3224
5003
  }
3225
5004
  });
3226
5005
 
5006
+ // src/types/v4.ts
5007
+ var init_v42 = __esm({
5008
+ "src/types/v4.ts"() {
5009
+ "use strict";
5010
+ init_esm_shims();
5011
+ }
5012
+ });
5013
+
3227
5014
  // src/types/index.ts
3228
5015
  var init_types = __esm({
3229
5016
  "src/types/index.ts"() {
@@ -3233,26 +5020,84 @@ var init_types = __esm({
3233
5020
  init_config();
3234
5021
  init_validation();
3235
5022
  init_validation_schema();
5023
+ init_v42();
5024
+ }
5025
+ });
5026
+
5027
+ // src/extensions/IClankerExtension.ts
5028
+ var init_IClankerExtension = __esm({
5029
+ "src/extensions/IClankerExtension.ts"() {
5030
+ "use strict";
5031
+ init_esm_shims();
5032
+ }
5033
+ });
5034
+
5035
+ // src/extensions/VaultExtension.ts
5036
+ import { encodeAbiParameters as encodeAbiParameters3 } from "viem";
5037
+ var init_VaultExtension = __esm({
5038
+ "src/extensions/VaultExtension.ts"() {
5039
+ "use strict";
5040
+ init_esm_shims();
5041
+ init_constants();
5042
+ }
5043
+ });
5044
+
5045
+ // src/utils/merkleTree.ts
5046
+ import { StandardMerkleTree } from "@openzeppelin/merkle-tree";
5047
+ import { encodeAbiParameters as encodeAbiParameters4 } from "viem";
5048
+ var init_merkleTree = __esm({
5049
+ "src/utils/merkleTree.ts"() {
5050
+ "use strict";
5051
+ init_esm_shims();
5052
+ }
5053
+ });
5054
+
5055
+ // src/extensions/AirdropExtension.ts
5056
+ import { encodeAbiParameters as encodeAbiParameters5 } from "viem";
5057
+ var init_AirdropExtension = __esm({
5058
+ "src/extensions/AirdropExtension.ts"() {
5059
+ "use strict";
5060
+ init_esm_shims();
5061
+ init_constants();
5062
+ init_merkleTree();
5063
+ }
5064
+ });
5065
+
5066
+ // src/extensions/DevBuyExtension.ts
5067
+ import { encodeAbiParameters as encodeAbiParameters6 } from "viem";
5068
+ var init_DevBuyExtension = __esm({
5069
+ "src/extensions/DevBuyExtension.ts"() {
5070
+ "use strict";
5071
+ init_esm_shims();
5072
+ init_constants();
5073
+ }
5074
+ });
5075
+
5076
+ // src/extensions/index.ts
5077
+ var init_extensions = __esm({
5078
+ "src/extensions/index.ts"() {
5079
+ "use strict";
5080
+ init_esm_shims();
5081
+ init_IClankerExtension();
5082
+ init_VaultExtension();
5083
+ init_AirdropExtension();
5084
+ init_DevBuyExtension();
3236
5085
  }
3237
5086
  });
3238
5087
 
3239
5088
  // src/index.ts
3240
- import {
3241
- parseEventLogs
3242
- } from "viem";
3243
5089
  var Clanker;
3244
5090
  var init_index = __esm({
3245
5091
  "src/index.ts"() {
3246
5092
  "use strict";
3247
5093
  init_esm_shims();
3248
- init_Clanker();
3249
5094
  init_validation();
3250
- init_buildTransaction();
3251
- init_desired_price();
3252
- init_desiredPrice();
5095
+ init_v3();
5096
+ init_v4();
3253
5097
  init_types();
3254
5098
  init_validation();
3255
5099
  init_vanityAddress();
5100
+ init_extensions();
3256
5101
  Clanker = class {
3257
5102
  wallet;
3258
5103
  publicClient;
@@ -3267,107 +5112,26 @@ var init_index = __esm({
3267
5112
  this.publicClient = config2.publicClient;
3268
5113
  }
3269
5114
  /**
3270
- * Deploy a token with an optional vanity address
3271
- * If no salt is provided, a vanity address with suffix '0x4b07' will be used
3272
- *
3273
- * @param cfg Token configuration
3274
- * @param options Optional parameters for deployment
5115
+ * Deploy a token using the V4 protocol
5116
+ * @param cfg Token configuration for V4 deployment
3275
5117
  * @returns The address of the deployed token
3276
5118
  */
3277
- async deployToken(cfg) {
3278
- if (!this.wallet?.account) {
3279
- throw new Error("Wallet account required for deployToken");
5119
+ async deployTokenV4(cfg) {
5120
+ if (!this.wallet) {
5121
+ throw new Error("Wallet client required for deployment");
3280
5122
  }
3281
- if (!cfg.name || !cfg.symbol) {
3282
- throw new Error("Token name and symbol are required");
3283
- }
3284
- const validationResult = validateConfig(cfg);
3285
- if (!validationResult.success) {
3286
- throw new Error(
3287
- `Invalid token configuration: ${JSON.stringify(validationResult.error?.format())}`
3288
- );
3289
- }
3290
- const poolConfig = {
3291
- quoteToken: cfg.pool?.quoteToken || "0x4200000000000000000000000000000000000006",
3292
- // Default to WETH
3293
- initialMarketCap: cfg.pool?.initialMarketCap || "10"
3294
- // Default to 10 ETH
3295
- };
3296
- const { desiredPrice, pairAddress } = getDesiredPriceAndPairAddress(
3297
- getTokenPairByAddress(poolConfig.quoteToken),
3298
- poolConfig.initialMarketCap
3299
- );
3300
- const vestingUnlockDate = cfg.vault?.durationInDays ? BigInt(
3301
- Math.floor(Date.now() / 1e3) + cfg.vault.durationInDays * 24 * 60 * 60
3302
- ) : BigInt(0);
3303
- const socialLinks = cfg.metadata?.socialMediaUrls ?? [];
3304
- const telegramLink = socialLinks.find((url) => url.includes("t.me")) || "";
3305
- const xLink = socialLinks.find(
3306
- (url) => url.includes("twitter.com") || url.includes("x.com")
3307
- ) || "";
3308
- const websiteLink = socialLinks.find(
3309
- (url) => !url.includes("t.me") && !url.includes("twitter.com") && !url.includes("x.com")
3310
- ) || "";
3311
- const clankerMetadata = {
3312
- description: cfg.metadata?.description || "",
3313
- socialMediaUrls: cfg.metadata?.socialMediaUrls ?? [],
3314
- auditUrls: cfg.metadata?.auditUrls ?? []
3315
- };
3316
- const clankerSocialContext = {
3317
- interface: cfg.context?.interface || "SDK",
3318
- platform: cfg.context?.platform || "",
3319
- messageId: cfg.context?.messageId || "",
3320
- id: cfg.context?.id || ""
3321
- };
3322
- const tx = await buildTransaction({
3323
- deployerAddress: this.wallet.account.address,
3324
- formData: {
3325
- name: cfg.name,
3326
- symbol: cfg.symbol,
3327
- imageUrl: cfg.image || "",
3328
- description: cfg.metadata?.description || "",
3329
- devBuyAmount: cfg.devBuy?.ethAmount ? parseFloat(cfg.devBuy.ethAmount) : 0,
3330
- lockupPercentage: cfg.vault?.percentage || 0,
3331
- vestingUnlockDate,
3332
- enableDevBuy: !!cfg.devBuy?.ethAmount,
3333
- enableLockup: !!cfg.vault?.percentage,
3334
- feeRecipient: cfg.rewardsConfig?.creatorRewardRecipient || "",
3335
- telegramLink,
3336
- websiteLink,
3337
- xLink,
3338
- marketCap: poolConfig.initialMarketCap,
3339
- farcasterLink: "",
3340
- pairedToken: pairAddress,
3341
- creatorRewardsRecipient: cfg.rewardsConfig?.creatorRewardRecipient || "",
3342
- creatorRewardsAdmin: cfg.rewardsConfig?.creatorAdmin || "",
3343
- interfaceAdmin: cfg.rewardsConfig?.interfaceAdmin || "",
3344
- creatorReward: cfg.rewardsConfig?.creatorReward || 0,
3345
- interfaceRewardRecipient: cfg.rewardsConfig?.interfaceRewardRecipient || "",
3346
- image: null
3347
- },
3348
- chainId: this.publicClient.chain?.id || 8453,
3349
- clankerMetadata,
3350
- clankerSocialContext,
3351
- desiredPrice
3352
- });
3353
- console.log("tx", tx);
3354
- const hash = await this.wallet.sendTransaction({
3355
- ...tx.transaction,
3356
- account: this.wallet.account,
3357
- chain: this.publicClient.chain
3358
- });
3359
- console.log("hash", hash);
3360
- const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
3361
- const [log] = parseEventLogs({
3362
- abi: Clanker_v3_1_abi,
3363
- eventName: "TokenCreated",
3364
- logs: receipt.logs
3365
- });
3366
- if (!log) {
3367
- throw new Error("No deployment event found");
5123
+ return deployTokenV4(cfg, this.wallet, this.publicClient);
5124
+ }
5125
+ /**
5126
+ * Deploy a token using the V3 protocol
5127
+ * @param cfg Token configuration for V3 deployment
5128
+ * @returns The address of the deployed token
5129
+ */
5130
+ async deployToken(cfg) {
5131
+ if (!this.wallet) {
5132
+ throw new Error("Wallet client required for deployment");
3368
5133
  }
3369
- const tokenAddress = log.args.tokenAddress;
3370
- return tokenAddress;
5134
+ return deployTokenV3(cfg, this.wallet, this.publicClient);
3371
5135
  }
3372
5136
  };
3373
5137
  }
@@ -3379,11 +5143,7 @@ __export(create_clanker_exports, {
3379
5143
  default: () => create_clanker_default
3380
5144
  });
3381
5145
  import inquirer from "inquirer";
3382
- import {
3383
- createPublicClient,
3384
- createWalletClient,
3385
- http
3386
- } from "viem";
5146
+ import { createPublicClient, createWalletClient, http } from "viem";
3387
5147
  import { privateKeyToAccount } from "viem/accounts";
3388
5148
  import { base as base2 } from "viem/chains";
3389
5149
  import * as dotenv from "dotenv";
@@ -3394,6 +5154,7 @@ async function createClanker() {
3394
5154
  const PRIVATE_KEY = process.env.PRIVATE_KEY;
3395
5155
  const FACTORY_ADDRESS = process.env.FACTORY_ADDRESS;
3396
5156
  const RPC_URL = process.env.RPC_URL;
5157
+ const account = privateKeyToAccount(PRIVATE_KEY);
3397
5158
  function toHexAddress(address) {
3398
5159
  if (!address) return void 0;
3399
5160
  return address.toLowerCase();
@@ -3416,9 +5177,7 @@ FACTORY_ADDRESS=factory_contract_address_here
3416
5177
  Optional:
3417
5178
  RPC_URL=your_custom_rpc_url (if not provided, will use default Base RPC)
3418
5179
  `);
3419
- console.log(
3420
- "\nMake sure to include the 0x prefix for addresses and private keys."
3421
- );
5180
+ console.log("\nMake sure to include the 0x prefix for addresses and private keys.");
3422
5181
  console.log("Never share or commit your private key!\n");
3423
5182
  return false;
3424
5183
  }
@@ -3449,15 +5208,13 @@ RPC_URL=your_custom_rpc_url (if not provided, will use default Base RPC)
3449
5208
  };
3450
5209
  const validateSymbol = (input) => {
3451
5210
  if (!input) return "Symbol cannot be empty";
3452
- if (!/^[a-zA-Z0-9]+$/.test(input))
3453
- return "Symbol must contain only letters and numbers";
5211
+ if (!/^[a-zA-Z0-9]+$/.test(input)) return "Symbol must contain only letters and numbers";
3454
5212
  if (input.length > 20) return "Symbol must be 20 characters or less";
3455
5213
  return true;
3456
5214
  };
3457
5215
  const validateIpfsUri = (input) => {
3458
5216
  if (!input) return "Image URI cannot be empty";
3459
- if (!input.startsWith("ipfs://"))
3460
- return "Image URI must start with ipfs://";
5217
+ if (!input.startsWith("ipfs://")) return "Image URI must start with ipfs://";
3461
5218
  return true;
3462
5219
  };
3463
5220
  const validateAmount = (input) => {
@@ -3467,8 +5224,7 @@ RPC_URL=your_custom_rpc_url (if not provided, will use default Base RPC)
3467
5224
  };
3468
5225
  const validateHexString = (input) => {
3469
5226
  if (!input) return true;
3470
- if (!/^0x[a-fA-F0-9]+$/.test(input))
3471
- return "Must be a valid hex string starting with 0x";
5227
+ if (!/^0x[a-fA-F0-9]+$/.test(input)) return "Must be a valid hex string starting with 0x";
3472
5228
  return true;
3473
5229
  };
3474
5230
  const validateSlippage = (input) => {
@@ -3480,8 +5236,7 @@ RPC_URL=your_custom_rpc_url (if not provided, will use default Base RPC)
3480
5236
  const validateVaultPercentage = (input) => {
3481
5237
  const num = Number(input);
3482
5238
  if (isNaN(num)) return "Must be a number";
3483
- if (num < 0 || num > 30)
3484
- return "Vault percentage must be between 0 and 30%";
5239
+ if (num < 0 || num > 30) return "Vault percentage must be between 0 and 30%";
3485
5240
  return true;
3486
5241
  };
3487
5242
  const validateVaultDuration = (input) => {
@@ -3738,14 +5493,10 @@ RPC_URL=your_custom_rpc_url (if not provided, will use default Base RPC)
3738
5493
  const vaultPercentage = answers.vaultConfig.vaultPercentage === "CUSTOM" ? parseInt(answers.customVaultPercentage || "0", 10) : parseInt(answers.vaultConfig.vaultPercentage, 10);
3739
5494
  const vaultDuration = answers.vaultConfig.durationInDays === "CUSTOM" ? parseInt(answers.customVaultDuration || "31", 10) : parseInt(answers.vaultConfig.durationInDays, 10);
3740
5495
  const socialMediaUrls = [];
3741
- if (answers.metadata.telegram)
3742
- socialMediaUrls.push(answers.metadata.telegram);
3743
- if (answers.metadata.website)
3744
- socialMediaUrls.push(answers.metadata.website);
3745
- if (answers.metadata.twitter)
3746
- socialMediaUrls.push(answers.metadata.twitter);
3747
- if (answers.metadata.farcaster)
3748
- socialMediaUrls.push(answers.metadata.farcaster);
5496
+ if (answers.metadata.telegram) socialMediaUrls.push(answers.metadata.telegram);
5497
+ if (answers.metadata.website) socialMediaUrls.push(answers.metadata.website);
5498
+ if (answers.metadata.twitter) socialMediaUrls.push(answers.metadata.twitter);
5499
+ if (answers.metadata.farcaster) socialMediaUrls.push(answers.metadata.farcaster);
3749
5500
  const metadata = {
3750
5501
  description: answers.metadata.description,
3751
5502
  socialMediaUrls,
@@ -3760,30 +5511,15 @@ RPC_URL=your_custom_rpc_url (if not provided, will use default Base RPC)
3760
5511
  },
3761
5512
  rewardsConfig: {
3762
5513
  creatorReward: answers.rewardsConfig.creatorReward === "CUSTOM" ? Number(answers.rewardsConfig.customCreatorReward) : Number(answers.rewardsConfig.creatorReward),
3763
- ...answers.rewardsConfig.creatorAdmin ? {
3764
- creatorAdmin: toHexAddress(answers.rewardsConfig.creatorAdmin)
3765
- } : {},
3766
- ...answers.rewardsConfig.creatorRewardRecipient ? {
3767
- creatorRewardRecipient: toHexAddress(
3768
- answers.rewardsConfig.creatorRewardRecipient
3769
- )
3770
- } : {},
3771
- ...answers.rewardsConfig.interfaceAdmin ? {
3772
- interfaceAdmin: toHexAddress(
3773
- answers.rewardsConfig.interfaceAdmin
3774
- )
3775
- } : {},
3776
- ...answers.rewardsConfig.interfaceRewardRecipient ? {
3777
- interfaceRewardRecipient: toHexAddress(
3778
- answers.rewardsConfig.interfaceRewardRecipient
3779
- )
3780
- } : {}
5514
+ creatorAdmin: toHexAddress(answers.rewardsConfig.creatorAdmin || account.address),
5515
+ creatorRewardRecipient: toHexAddress(answers.rewardsConfig.creatorRewardRecipient || account.address),
5516
+ interfaceAdmin: toHexAddress(answers.rewardsConfig.interfaceAdmin || account.address),
5517
+ interfaceRewardRecipient: toHexAddress(answers.rewardsConfig.interfaceRewardRecipient || account.address)
3781
5518
  }
3782
5519
  };
3783
5520
  }
3784
5521
  async function deployToken(answers) {
3785
5522
  try {
3786
- const account = privateKeyToAccount(PRIVATE_KEY);
3787
5523
  const transport = RPC_URL ? http(RPC_URL) : http();
3788
5524
  const publicClient = createPublicClient({
3789
5525
  chain: base2,
@@ -3821,10 +5557,7 @@ RPC_URL=your_custom_rpc_url (if not provided, will use default Base RPC)
3821
5557
  },
3822
5558
  vault: answers.vaultConfig.vaultPercentage !== "0" ? {
3823
5559
  percentage: parseInt(answers.vaultConfig.vaultPercentage, 10),
3824
- durationInDays: parseInt(
3825
- answers.vaultConfig.durationInDays,
3826
- 10
3827
- )
5560
+ durationInDays: parseInt(answers.vaultConfig.durationInDays, 10)
3828
5561
  } : void 0,
3829
5562
  devBuy: answers.devBuy.ethAmount !== "0" ? {
3830
5563
  ethAmount: answers.devBuy.ethAmount,
@@ -3832,22 +5565,10 @@ RPC_URL=your_custom_rpc_url (if not provided, will use default Base RPC)
3832
5565
  } : void 0,
3833
5566
  rewardsConfig: {
3834
5567
  creatorReward: answers.rewardsConfig.creatorReward === "CUSTOM" ? Number(answers.rewardsConfig.customCreatorReward) : Number(answers.rewardsConfig.creatorReward),
3835
- ...answers.rewardsConfig.creatorAdmin && {
3836
- creatorAdmin: toHexAddress(answers.rewardsConfig.creatorAdmin)
3837
- },
3838
- ...answers.rewardsConfig.creatorRewardRecipient && {
3839
- creatorRewardRecipient: toHexAddress(
3840
- answers.rewardsConfig.creatorRewardRecipient
3841
- )
3842
- },
3843
- ...answers.rewardsConfig.interfaceAdmin && {
3844
- interfaceAdmin: toHexAddress(answers.rewardsConfig.interfaceAdmin)
3845
- },
3846
- ...answers.rewardsConfig.interfaceRewardRecipient && {
3847
- interfaceRewardRecipient: toHexAddress(
3848
- answers.rewardsConfig.interfaceRewardRecipient
3849
- )
3850
- }
5568
+ creatorAdmin: toHexAddress(answers.rewardsConfig.creatorAdmin || account.address),
5569
+ creatorRewardRecipient: toHexAddress(answers.rewardsConfig.creatorRewardRecipient || account.address),
5570
+ interfaceAdmin: toHexAddress(answers.rewardsConfig.interfaceAdmin || account.address),
5571
+ interfaceRewardRecipient: toHexAddress(answers.rewardsConfig.interfaceRewardRecipient || account.address)
3851
5572
  }
3852
5573
  };
3853
5574
  const tokenValidation = validateConfig(tokenConfig);
@@ -3864,9 +5585,7 @@ RPC_URL=your_custom_rpc_url (if not provided, will use default Base RPC)
3864
5585
  console.log(`\u{1F4CD} Token address: ${tokenAddress}`);
3865
5586
  console.log("\n\u{1F310} View on:");
3866
5587
  console.log(`Basescan: https://basescan.org/token/${tokenAddress}`);
3867
- console.log(
3868
- `Clanker World: https://clanker.world/clanker/${tokenAddress}`
3869
- );
5588
+ console.log(`Clanker World: https://clanker.world/clanker/${tokenAddress}`);
3870
5589
  return tokenAddress;
3871
5590
  } catch (error) {
3872
5591
  console.error(