@net-protocol/score 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,2120 @@
1
+ import { readContract } from 'viem/actions';
2
+ import { getPublicClient } from '@net-protocol/core';
3
+ import { decodeAbiParameters, keccak256, encodePacked, getAddress, encodeAbiParameters } from 'viem';
4
+ import { getStorageKeyBytes } from '@net-protocol/storage';
5
+
6
+ // src/client/ScoreClient.ts
7
+
8
+ // src/abis/score.json
9
+ var score_default = [
10
+ {
11
+ type: "function",
12
+ name: "appKeyScores",
13
+ inputs: [
14
+ { name: "", type: "address", internalType: "address" },
15
+ { name: "", type: "bytes32", internalType: "bytes32" }
16
+ ],
17
+ outputs: [{ name: "", type: "int256", internalType: "int256" }],
18
+ stateMutability: "view"
19
+ },
20
+ {
21
+ type: "function",
22
+ name: "appStrategyKeyScores",
23
+ inputs: [
24
+ { name: "", type: "address", internalType: "address" },
25
+ { name: "", type: "address", internalType: "address" },
26
+ { name: "", type: "bytes32", internalType: "bytes32" }
27
+ ],
28
+ outputs: [{ name: "", type: "int256", internalType: "int256" }],
29
+ stateMutability: "view"
30
+ },
31
+ {
32
+ type: "function",
33
+ name: "appStrategyTotalScores",
34
+ inputs: [
35
+ { name: "", type: "address", internalType: "address" },
36
+ { name: "", type: "address", internalType: "address" }
37
+ ],
38
+ outputs: [{ name: "", type: "int256", internalType: "int256" }],
39
+ stateMutability: "view"
40
+ },
41
+ {
42
+ type: "function",
43
+ name: "appStrategyUserKeyScores",
44
+ inputs: [
45
+ { name: "", type: "address", internalType: "address" },
46
+ { name: "", type: "address", internalType: "address" },
47
+ { name: "", type: "address", internalType: "address" },
48
+ { name: "", type: "bytes32", internalType: "bytes32" }
49
+ ],
50
+ outputs: [{ name: "", type: "int256", internalType: "int256" }],
51
+ stateMutability: "view"
52
+ },
53
+ {
54
+ type: "function",
55
+ name: "appTotalScores",
56
+ inputs: [{ name: "", type: "address", internalType: "address" }],
57
+ outputs: [{ name: "", type: "int256", internalType: "int256" }],
58
+ stateMutability: "view"
59
+ },
60
+ {
61
+ type: "function",
62
+ name: "appUserKeyScores",
63
+ inputs: [
64
+ { name: "", type: "address", internalType: "address" },
65
+ { name: "", type: "address", internalType: "address" },
66
+ { name: "", type: "bytes32", internalType: "bytes32" }
67
+ ],
68
+ outputs: [{ name: "", type: "int256", internalType: "int256" }],
69
+ stateMutability: "view"
70
+ },
71
+ {
72
+ type: "function",
73
+ name: "appUserTotalScores",
74
+ inputs: [
75
+ { name: "", type: "address", internalType: "address" },
76
+ { name: "", type: "address", internalType: "address" }
77
+ ],
78
+ outputs: [{ name: "", type: "int256", internalType: "int256" }],
79
+ stateMutability: "view"
80
+ },
81
+ {
82
+ type: "function",
83
+ name: "execute",
84
+ inputs: [
85
+ {
86
+ name: "strategy",
87
+ type: "address",
88
+ internalType: "contract IScoreStrategy"
89
+ },
90
+ {
91
+ name: "params",
92
+ type: "tuple",
93
+ internalType: "struct Score.ScoreParams",
94
+ components: [
95
+ {
96
+ name: "scoreKey",
97
+ type: "bytes32",
98
+ internalType: "bytes32"
99
+ },
100
+ {
101
+ name: "scoreDelta",
102
+ type: "int256",
103
+ internalType: "int256"
104
+ },
105
+ {
106
+ name: "originalSender",
107
+ type: "address",
108
+ internalType: "address"
109
+ },
110
+ {
111
+ name: "scoreStoredContext",
112
+ type: "bytes",
113
+ internalType: "bytes"
114
+ },
115
+ {
116
+ name: "scoreUnstoredContext",
117
+ type: "bytes",
118
+ internalType: "bytes"
119
+ }
120
+ ]
121
+ }
122
+ ],
123
+ outputs: [],
124
+ stateMutability: "payable"
125
+ },
126
+ {
127
+ type: "function",
128
+ name: "getAppKeyScores",
129
+ inputs: [
130
+ { name: "app", type: "address", internalType: "address" },
131
+ {
132
+ name: "scoreKeys",
133
+ type: "bytes32[]",
134
+ internalType: "bytes32[]"
135
+ }
136
+ ],
137
+ outputs: [
138
+ { name: "counts", type: "int256[]", internalType: "int256[]" }
139
+ ],
140
+ stateMutability: "view"
141
+ },
142
+ {
143
+ type: "function",
144
+ name: "getAppStrategyKeyScores",
145
+ inputs: [
146
+ { name: "app", type: "address", internalType: "address" },
147
+ { name: "strategy", type: "address", internalType: "address" },
148
+ {
149
+ name: "scoreKeys",
150
+ type: "bytes32[]",
151
+ internalType: "bytes32[]"
152
+ }
153
+ ],
154
+ outputs: [
155
+ { name: "counts", type: "int256[]", internalType: "int256[]" }
156
+ ],
157
+ stateMutability: "view"
158
+ },
159
+ {
160
+ type: "function",
161
+ name: "getAppStrategyTotalScores",
162
+ inputs: [
163
+ { name: "apps", type: "address[]", internalType: "address[]" },
164
+ { name: "strategy", type: "address", internalType: "address" }
165
+ ],
166
+ outputs: [
167
+ { name: "totals", type: "int256[]", internalType: "int256[]" }
168
+ ],
169
+ stateMutability: "view"
170
+ },
171
+ {
172
+ type: "function",
173
+ name: "getAppStrategyUserKeyScores",
174
+ inputs: [
175
+ { name: "app", type: "address", internalType: "address" },
176
+ { name: "strategy", type: "address", internalType: "address" },
177
+ { name: "user", type: "address", internalType: "address" },
178
+ {
179
+ name: "scoreKeys",
180
+ type: "bytes32[]",
181
+ internalType: "bytes32[]"
182
+ }
183
+ ],
184
+ outputs: [
185
+ { name: "counts", type: "int256[]", internalType: "int256[]" }
186
+ ],
187
+ stateMutability: "view"
188
+ },
189
+ {
190
+ type: "function",
191
+ name: "getAppTotalScores",
192
+ inputs: [
193
+ { name: "apps", type: "address[]", internalType: "address[]" }
194
+ ],
195
+ outputs: [
196
+ { name: "totals", type: "int256[]", internalType: "int256[]" }
197
+ ],
198
+ stateMutability: "view"
199
+ },
200
+ {
201
+ type: "function",
202
+ name: "getAppUserKeyScores",
203
+ inputs: [
204
+ { name: "app", type: "address", internalType: "address" },
205
+ { name: "user", type: "address", internalType: "address" },
206
+ {
207
+ name: "scoreKeys",
208
+ type: "bytes32[]",
209
+ internalType: "bytes32[]"
210
+ }
211
+ ],
212
+ outputs: [
213
+ { name: "counts", type: "int256[]", internalType: "int256[]" }
214
+ ],
215
+ stateMutability: "view"
216
+ },
217
+ {
218
+ type: "function",
219
+ name: "getAppUserTotalScores",
220
+ inputs: [
221
+ { name: "apps", type: "address[]", internalType: "address[]" },
222
+ { name: "user", type: "address", internalType: "address" }
223
+ ],
224
+ outputs: [
225
+ { name: "totals", type: "int256[]", internalType: "int256[]" }
226
+ ],
227
+ stateMutability: "view"
228
+ },
229
+ {
230
+ type: "function",
231
+ name: "getMultiAppMultiStrategyKeyScores",
232
+ inputs: [
233
+ { name: "apps", type: "address[]", internalType: "address[]" },
234
+ {
235
+ name: "strategies",
236
+ type: "address[]",
237
+ internalType: "address[]"
238
+ },
239
+ {
240
+ name: "scoreKeys",
241
+ type: "bytes32[]",
242
+ internalType: "bytes32[]"
243
+ }
244
+ ],
245
+ outputs: [
246
+ {
247
+ name: "counts",
248
+ type: "int256[][][]",
249
+ internalType: "int256[][][]"
250
+ }
251
+ ],
252
+ stateMutability: "view"
253
+ },
254
+ {
255
+ type: "function",
256
+ name: "getMultiAppMultiUserStrategyKeyScores",
257
+ inputs: [
258
+ { name: "apps", type: "address[]", internalType: "address[]" },
259
+ { name: "strategy", type: "address", internalType: "address" },
260
+ { name: "users", type: "address[]", internalType: "address[]" },
261
+ {
262
+ name: "scoreKeys",
263
+ type: "bytes32[]",
264
+ internalType: "bytes32[]"
265
+ }
266
+ ],
267
+ outputs: [
268
+ {
269
+ name: "counts",
270
+ type: "int256[][][]",
271
+ internalType: "int256[][][]"
272
+ }
273
+ ],
274
+ stateMutability: "view"
275
+ },
276
+ {
277
+ type: "function",
278
+ name: "getMultiAppStrategyKeyScores",
279
+ inputs: [
280
+ { name: "apps", type: "address[]", internalType: "address[]" },
281
+ { name: "strategy", type: "address", internalType: "address" },
282
+ {
283
+ name: "scoreKeys",
284
+ type: "bytes32[]",
285
+ internalType: "bytes32[]"
286
+ }
287
+ ],
288
+ outputs: [
289
+ { name: "counts", type: "int256[][]", internalType: "int256[][]" }
290
+ ],
291
+ stateMutability: "view"
292
+ },
293
+ {
294
+ type: "function",
295
+ name: "getMultiAppStrategyUserKeyScores",
296
+ inputs: [
297
+ { name: "apps", type: "address[]", internalType: "address[]" },
298
+ { name: "strategy", type: "address", internalType: "address" },
299
+ { name: "user", type: "address", internalType: "address" },
300
+ {
301
+ name: "scoreKeys",
302
+ type: "bytes32[]",
303
+ internalType: "bytes32[]"
304
+ }
305
+ ],
306
+ outputs: [
307
+ { name: "counts", type: "int256[][]", internalType: "int256[][]" }
308
+ ],
309
+ stateMutability: "view"
310
+ },
311
+ {
312
+ type: "function",
313
+ name: "getMultiAppUserKeyScores",
314
+ inputs: [
315
+ { name: "apps", type: "address[]", internalType: "address[]" },
316
+ { name: "user", type: "address", internalType: "address" },
317
+ {
318
+ name: "scoreKeys",
319
+ type: "bytes32[]",
320
+ internalType: "bytes32[]"
321
+ }
322
+ ],
323
+ outputs: [
324
+ { name: "counts", type: "int256[][]", internalType: "int256[][]" }
325
+ ],
326
+ stateMutability: "view"
327
+ },
328
+ {
329
+ type: "function",
330
+ name: "getMultiStrategyKeyScores",
331
+ inputs: [
332
+ {
333
+ name: "strategies",
334
+ type: "address[]",
335
+ internalType: "address[]"
336
+ },
337
+ {
338
+ name: "scoreKeys",
339
+ type: "bytes32[]",
340
+ internalType: "bytes32[]"
341
+ }
342
+ ],
343
+ outputs: [
344
+ { name: "counts", type: "int256[]", internalType: "int256[]" }
345
+ ],
346
+ stateMutability: "view"
347
+ },
348
+ {
349
+ type: "function",
350
+ name: "getMultiStrategyUserKeyScores",
351
+ inputs: [
352
+ {
353
+ name: "strategies",
354
+ type: "address[]",
355
+ internalType: "address[]"
356
+ },
357
+ { name: "user", type: "address", internalType: "address" },
358
+ {
359
+ name: "scoreKeys",
360
+ type: "bytes32[]",
361
+ internalType: "bytes32[]"
362
+ }
363
+ ],
364
+ outputs: [
365
+ { name: "counts", type: "int256[][]", internalType: "int256[][]" }
366
+ ],
367
+ stateMutability: "view"
368
+ },
369
+ {
370
+ type: "function",
371
+ name: "getMultiUserAppStrategyKeyScores",
372
+ inputs: [
373
+ { name: "app", type: "address", internalType: "address" },
374
+ { name: "strategy", type: "address", internalType: "address" },
375
+ { name: "users", type: "address[]", internalType: "address[]" },
376
+ {
377
+ name: "scoreKeys",
378
+ type: "bytes32[]",
379
+ internalType: "bytes32[]"
380
+ }
381
+ ],
382
+ outputs: [
383
+ { name: "counts", type: "int256[][]", internalType: "int256[][]" }
384
+ ],
385
+ stateMutability: "view"
386
+ },
387
+ {
388
+ type: "function",
389
+ name: "getMultiUserStrategyKeyScores",
390
+ inputs: [
391
+ { name: "strategy", type: "address", internalType: "address" },
392
+ { name: "users", type: "address[]", internalType: "address[]" },
393
+ {
394
+ name: "scoreKeys",
395
+ type: "bytes32[]",
396
+ internalType: "bytes32[]"
397
+ }
398
+ ],
399
+ outputs: [
400
+ { name: "counts", type: "int256[][]", internalType: "int256[][]" }
401
+ ],
402
+ stateMutability: "view"
403
+ },
404
+ {
405
+ type: "function",
406
+ name: "getStrategyKeyScores",
407
+ inputs: [
408
+ { name: "strategy", type: "address", internalType: "address" },
409
+ {
410
+ name: "scoreKeys",
411
+ type: "bytes32[]",
412
+ internalType: "bytes32[]"
413
+ }
414
+ ],
415
+ outputs: [
416
+ { name: "counts", type: "int256[]", internalType: "int256[]" }
417
+ ],
418
+ stateMutability: "view"
419
+ },
420
+ {
421
+ type: "function",
422
+ name: "getStrategyTotalScores",
423
+ inputs: [
424
+ {
425
+ name: "strategies",
426
+ type: "address[]",
427
+ internalType: "address[]"
428
+ }
429
+ ],
430
+ outputs: [
431
+ { name: "totals", type: "int256[]", internalType: "int256[]" }
432
+ ],
433
+ stateMutability: "view"
434
+ },
435
+ {
436
+ type: "function",
437
+ name: "getStrategyUserKeyScores",
438
+ inputs: [
439
+ { name: "strategy", type: "address", internalType: "address" },
440
+ { name: "user", type: "address", internalType: "address" },
441
+ {
442
+ name: "scoreKeys",
443
+ type: "bytes32[]",
444
+ internalType: "bytes32[]"
445
+ }
446
+ ],
447
+ outputs: [
448
+ { name: "counts", type: "int256[]", internalType: "int256[]" }
449
+ ],
450
+ stateMutability: "view"
451
+ },
452
+ {
453
+ type: "function",
454
+ name: "getStrategyUserTotalScores",
455
+ inputs: [
456
+ {
457
+ name: "strategies",
458
+ type: "address[]",
459
+ internalType: "address[]"
460
+ },
461
+ { name: "user", type: "address", internalType: "address" }
462
+ ],
463
+ outputs: [
464
+ { name: "totals", type: "int256[]", internalType: "int256[]" }
465
+ ],
466
+ stateMutability: "view"
467
+ },
468
+ {
469
+ type: "function",
470
+ name: "strategyKeyScores",
471
+ inputs: [
472
+ { name: "", type: "address", internalType: "address" },
473
+ { name: "", type: "bytes32", internalType: "bytes32" }
474
+ ],
475
+ outputs: [{ name: "", type: "int256", internalType: "int256" }],
476
+ stateMutability: "view"
477
+ },
478
+ {
479
+ type: "function",
480
+ name: "strategyTotalScores",
481
+ inputs: [{ name: "", type: "address", internalType: "address" }],
482
+ outputs: [{ name: "", type: "int256", internalType: "int256" }],
483
+ stateMutability: "view"
484
+ },
485
+ {
486
+ type: "function",
487
+ name: "strategyUserKeyScores",
488
+ inputs: [
489
+ { name: "", type: "address", internalType: "address" },
490
+ { name: "", type: "address", internalType: "address" },
491
+ { name: "", type: "bytes32", internalType: "bytes32" }
492
+ ],
493
+ outputs: [{ name: "", type: "int256", internalType: "int256" }],
494
+ stateMutability: "view"
495
+ },
496
+ {
497
+ type: "function",
498
+ name: "strategyUserTotalScores",
499
+ inputs: [
500
+ { name: "", type: "address", internalType: "address" },
501
+ { name: "", type: "address", internalType: "address" }
502
+ ],
503
+ outputs: [{ name: "", type: "int256", internalType: "int256" }],
504
+ stateMutability: "view"
505
+ },
506
+ {
507
+ type: "function",
508
+ name: "totalCalls",
509
+ inputs: [],
510
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
511
+ stateMutability: "view"
512
+ },
513
+ {
514
+ type: "event",
515
+ name: "ScoreUpdated",
516
+ inputs: [
517
+ {
518
+ name: "user",
519
+ type: "address",
520
+ indexed: true,
521
+ internalType: "address"
522
+ },
523
+ {
524
+ name: "app",
525
+ type: "address",
526
+ indexed: true,
527
+ internalType: "address"
528
+ },
529
+ {
530
+ name: "strategy",
531
+ type: "address",
532
+ indexed: true,
533
+ internalType: "address"
534
+ },
535
+ {
536
+ name: "scoreDelta",
537
+ type: "int256",
538
+ indexed: false,
539
+ internalType: "int256"
540
+ },
541
+ {
542
+ name: "scoreKey",
543
+ type: "bytes32",
544
+ indexed: false,
545
+ internalType: "bytes32"
546
+ }
547
+ ],
548
+ anonymous: false
549
+ },
550
+ { type: "error", name: "ReentrancyGuardReentrantCall", inputs: [] },
551
+ {
552
+ type: "error",
553
+ name: "StringsInsufficientHexLength",
554
+ inputs: [
555
+ { name: "value", type: "uint256", internalType: "uint256" },
556
+ { name: "length", type: "uint256", internalType: "uint256" }
557
+ ]
558
+ },
559
+ { type: "error", name: "ZeroScoreDelta", inputs: [] }
560
+ ];
561
+
562
+ // src/abis/upvote-app.json
563
+ var upvote_app_default = [
564
+ { type: "constructor", inputs: [], stateMutability: "nonpayable" },
565
+ {
566
+ type: "function",
567
+ name: "CORE_CONTRACT",
568
+ inputs: [],
569
+ outputs: [
570
+ { name: "", type: "address", internalType: "contract Score" }
571
+ ],
572
+ stateMutability: "view"
573
+ },
574
+ {
575
+ type: "function",
576
+ name: "LEGACY_CONTRACT",
577
+ inputs: [],
578
+ outputs: [
579
+ {
580
+ name: "",
581
+ type: "address",
582
+ internalType: "contract ILegacyUpvoteContract"
583
+ }
584
+ ],
585
+ stateMutability: "view"
586
+ },
587
+ {
588
+ type: "function",
589
+ name: "getUpvotesWithLegacy",
590
+ inputs: [
591
+ {
592
+ name: "upvoteKeys",
593
+ type: "bytes32[]",
594
+ internalType: "bytes32[]"
595
+ },
596
+ {
597
+ name: "strategies",
598
+ type: "address[]",
599
+ internalType: "address[]"
600
+ }
601
+ ],
602
+ outputs: [
603
+ { name: "counts", type: "uint256[]", internalType: "uint256[]" }
604
+ ],
605
+ stateMutability: "view"
606
+ },
607
+ {
608
+ type: "function",
609
+ name: "name",
610
+ inputs: [],
611
+ outputs: [{ name: "", type: "string", internalType: "string" }],
612
+ stateMutability: "pure"
613
+ },
614
+ {
615
+ type: "function",
616
+ name: "owner",
617
+ inputs: [],
618
+ outputs: [{ name: "", type: "address", internalType: "address" }],
619
+ stateMutability: "view"
620
+ },
621
+ {
622
+ type: "function",
623
+ name: "renounceOwnership",
624
+ inputs: [],
625
+ outputs: [],
626
+ stateMutability: "nonpayable"
627
+ },
628
+ {
629
+ type: "function",
630
+ name: "transferOwnership",
631
+ inputs: [
632
+ { name: "newOwner", type: "address", internalType: "address" }
633
+ ],
634
+ outputs: [],
635
+ stateMutability: "nonpayable"
636
+ },
637
+ {
638
+ type: "function",
639
+ name: "upvote",
640
+ inputs: [
641
+ {
642
+ name: "strategy",
643
+ type: "address",
644
+ internalType: "contract IScoreStrategy"
645
+ },
646
+ { name: "scoreKey", type: "bytes32", internalType: "bytes32" },
647
+ { name: "scoreDelta", type: "uint256", internalType: "uint256" },
648
+ {
649
+ name: "scoreStoredContext",
650
+ type: "bytes",
651
+ internalType: "bytes"
652
+ },
653
+ {
654
+ name: "scoreUnstoredContext",
655
+ type: "bytes",
656
+ internalType: "bytes"
657
+ }
658
+ ],
659
+ outputs: [],
660
+ stateMutability: "payable"
661
+ },
662
+ {
663
+ type: "function",
664
+ name: "withdrawETH",
665
+ inputs: [{ name: "to", type: "address", internalType: "address" }],
666
+ outputs: [],
667
+ stateMutability: "nonpayable"
668
+ },
669
+ {
670
+ type: "function",
671
+ name: "withdrawErc20",
672
+ inputs: [
673
+ { name: "to", type: "address", internalType: "address" },
674
+ { name: "token", type: "address", internalType: "address" },
675
+ { name: "amount", type: "uint256", internalType: "uint256" }
676
+ ],
677
+ outputs: [],
678
+ stateMutability: "nonpayable"
679
+ },
680
+ {
681
+ type: "event",
682
+ name: "OwnershipTransferred",
683
+ inputs: [
684
+ {
685
+ name: "previousOwner",
686
+ type: "address",
687
+ indexed: true,
688
+ internalType: "address"
689
+ },
690
+ {
691
+ name: "newOwner",
692
+ type: "address",
693
+ indexed: true,
694
+ internalType: "address"
695
+ }
696
+ ],
697
+ anonymous: false
698
+ },
699
+ {
700
+ type: "error",
701
+ name: "OwnableInvalidOwner",
702
+ inputs: [
703
+ { name: "owner", type: "address", internalType: "address" }
704
+ ]
705
+ },
706
+ {
707
+ type: "error",
708
+ name: "OwnableUnauthorizedAccount",
709
+ inputs: [
710
+ { name: "account", type: "address", internalType: "address" }
711
+ ]
712
+ },
713
+ { type: "error", name: "WithdrawFailed", inputs: [] }
714
+ ];
715
+
716
+ // src/abis/upvote-storage-app.json
717
+ var upvote_storage_app_default = [
718
+ { type: "constructor", inputs: [], stateMutability: "nonpayable" },
719
+ {
720
+ type: "function",
721
+ name: "CORE_CONTRACT",
722
+ inputs: [],
723
+ outputs: [
724
+ { name: "", type: "address", internalType: "contract Score" }
725
+ ],
726
+ stateMutability: "view"
727
+ },
728
+ {
729
+ type: "function",
730
+ name: "name",
731
+ inputs: [],
732
+ outputs: [{ name: "", type: "string", internalType: "string" }],
733
+ stateMutability: "pure"
734
+ },
735
+ {
736
+ type: "function",
737
+ name: "owner",
738
+ inputs: [],
739
+ outputs: [{ name: "", type: "address", internalType: "address" }],
740
+ stateMutability: "view"
741
+ },
742
+ {
743
+ type: "function",
744
+ name: "renounceOwnership",
745
+ inputs: [],
746
+ outputs: [],
747
+ stateMutability: "nonpayable"
748
+ },
749
+ {
750
+ type: "function",
751
+ name: "transferOwnership",
752
+ inputs: [
753
+ { name: "newOwner", type: "address", internalType: "address" }
754
+ ],
755
+ outputs: [],
756
+ stateMutability: "nonpayable"
757
+ },
758
+ {
759
+ type: "function",
760
+ name: "upvote",
761
+ inputs: [
762
+ {
763
+ name: "strategy",
764
+ type: "address",
765
+ internalType: "contract IScoreStrategy"
766
+ },
767
+ {
768
+ name: "storageOperatorAddress",
769
+ type: "address",
770
+ internalType: "address"
771
+ },
772
+ { name: "storageKey", type: "bytes32", internalType: "bytes32" },
773
+ { name: "scoreDelta", type: "uint256", internalType: "uint256" },
774
+ {
775
+ name: "scoreUnstoredContext",
776
+ type: "bytes",
777
+ internalType: "bytes"
778
+ }
779
+ ],
780
+ outputs: [],
781
+ stateMutability: "payable"
782
+ },
783
+ {
784
+ type: "function",
785
+ name: "withdrawETH",
786
+ inputs: [{ name: "to", type: "address", internalType: "address" }],
787
+ outputs: [],
788
+ stateMutability: "nonpayable"
789
+ },
790
+ {
791
+ type: "function",
792
+ name: "withdrawErc20",
793
+ inputs: [
794
+ { name: "to", type: "address", internalType: "address" },
795
+ { name: "token", type: "address", internalType: "address" },
796
+ { name: "amount", type: "uint256", internalType: "uint256" }
797
+ ],
798
+ outputs: [],
799
+ stateMutability: "nonpayable"
800
+ },
801
+ {
802
+ type: "event",
803
+ name: "OwnershipTransferred",
804
+ inputs: [
805
+ {
806
+ name: "previousOwner",
807
+ type: "address",
808
+ indexed: true,
809
+ internalType: "address"
810
+ },
811
+ {
812
+ name: "newOwner",
813
+ type: "address",
814
+ indexed: true,
815
+ internalType: "address"
816
+ }
817
+ ],
818
+ anonymous: false
819
+ },
820
+ {
821
+ type: "error",
822
+ name: "OwnableInvalidOwner",
823
+ inputs: [
824
+ { name: "owner", type: "address", internalType: "address" }
825
+ ]
826
+ },
827
+ {
828
+ type: "error",
829
+ name: "OwnableUnauthorizedAccount",
830
+ inputs: [
831
+ { name: "account", type: "address", internalType: "address" }
832
+ ]
833
+ },
834
+ { type: "error", name: "WithdrawFailed", inputs: [] }
835
+ ];
836
+
837
+ // src/abis/pure-alpha-strategy.json
838
+ var pure_alpha_strategy_default = [
839
+ { type: "constructor", inputs: [], stateMutability: "nonpayable" },
840
+ { type: "receive", stateMutability: "payable" },
841
+ {
842
+ type: "function",
843
+ name: "executeScoreStrategy",
844
+ inputs: [
845
+ {
846
+ name: "params",
847
+ type: "tuple",
848
+ internalType: "struct IScoreStrategy.ScoreStrategyParams",
849
+ components: [
850
+ {
851
+ name: "scoreKey",
852
+ type: "bytes32",
853
+ internalType: "bytes32"
854
+ },
855
+ {
856
+ name: "scoreDelta",
857
+ type: "int256",
858
+ internalType: "int256"
859
+ },
860
+ {
861
+ name: "originalSender",
862
+ type: "address",
863
+ internalType: "address"
864
+ },
865
+ {
866
+ name: "appAddress",
867
+ type: "address",
868
+ internalType: "address"
869
+ },
870
+ {
871
+ name: "scoreStoredContext",
872
+ type: "bytes",
873
+ internalType: "bytes"
874
+ },
875
+ {
876
+ name: "scoreUnstoredContext",
877
+ type: "bytes",
878
+ internalType: "bytes"
879
+ }
880
+ ]
881
+ }
882
+ ],
883
+ outputs: [
884
+ { name: "metadata", type: "bytes", internalType: "bytes" }
885
+ ],
886
+ stateMutability: "payable"
887
+ },
888
+ {
889
+ type: "function",
890
+ name: "feeBps",
891
+ inputs: [],
892
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
893
+ stateMutability: "view"
894
+ },
895
+ {
896
+ type: "function",
897
+ name: "owner",
898
+ inputs: [],
899
+ outputs: [{ name: "", type: "address", internalType: "address" }],
900
+ stateMutability: "view"
901
+ },
902
+ {
903
+ type: "function",
904
+ name: "renounceOwnership",
905
+ inputs: [],
906
+ outputs: [],
907
+ stateMutability: "nonpayable"
908
+ },
909
+ {
910
+ type: "function",
911
+ name: "setFeeBps",
912
+ inputs: [
913
+ { name: "newFeeBps", type: "uint256", internalType: "uint256" }
914
+ ],
915
+ outputs: [],
916
+ stateMutability: "nonpayable"
917
+ },
918
+ {
919
+ type: "function",
920
+ name: "setUpvotePrice",
921
+ inputs: [
922
+ {
923
+ name: "newUpvotePrice",
924
+ type: "uint256",
925
+ internalType: "uint256"
926
+ }
927
+ ],
928
+ outputs: [],
929
+ stateMutability: "nonpayable"
930
+ },
931
+ {
932
+ type: "function",
933
+ name: "transferOwnership",
934
+ inputs: [
935
+ { name: "newOwner", type: "address", internalType: "address" }
936
+ ],
937
+ outputs: [],
938
+ stateMutability: "nonpayable"
939
+ },
940
+ {
941
+ type: "function",
942
+ name: "upvotePrice",
943
+ inputs: [],
944
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
945
+ stateMutability: "view"
946
+ },
947
+ {
948
+ type: "function",
949
+ name: "withdrawETH",
950
+ inputs: [{ name: "to", type: "address", internalType: "address" }],
951
+ outputs: [],
952
+ stateMutability: "nonpayable"
953
+ },
954
+ {
955
+ type: "function",
956
+ name: "withdrawErc20",
957
+ inputs: [
958
+ { name: "to", type: "address", internalType: "address" },
959
+ { name: "token", type: "address", internalType: "address" },
960
+ { name: "amount", type: "uint256", internalType: "uint256" }
961
+ ],
962
+ outputs: [],
963
+ stateMutability: "nonpayable"
964
+ },
965
+ {
966
+ type: "event",
967
+ name: "OwnershipTransferred",
968
+ inputs: [
969
+ {
970
+ name: "previousOwner",
971
+ type: "address",
972
+ indexed: true,
973
+ internalType: "address"
974
+ },
975
+ {
976
+ name: "newOwner",
977
+ type: "address",
978
+ indexed: true,
979
+ internalType: "address"
980
+ }
981
+ ],
982
+ anonymous: false
983
+ },
984
+ {
985
+ type: "error",
986
+ name: "IncorrectEthAmount",
987
+ inputs: [
988
+ { name: "sent", type: "uint256", internalType: "uint256" },
989
+ { name: "expected", type: "uint256", internalType: "uint256" }
990
+ ]
991
+ },
992
+ { type: "error", name: "NegativeUpvotesNotSupported", inputs: [] },
993
+ { type: "error", name: "NoTokensToWithdraw", inputs: [] },
994
+ {
995
+ type: "error",
996
+ name: "OwnableInvalidOwner",
997
+ inputs: [
998
+ { name: "owner", type: "address", internalType: "address" }
999
+ ]
1000
+ },
1001
+ {
1002
+ type: "error",
1003
+ name: "OwnableUnauthorizedAccount",
1004
+ inputs: [
1005
+ { name: "account", type: "address", internalType: "address" }
1006
+ ]
1007
+ },
1008
+ { type: "error", name: "ReentrancyGuardReentrantCall", inputs: [] },
1009
+ {
1010
+ type: "error",
1011
+ name: "Slot0ReadFailed",
1012
+ inputs: [{ name: "pool", type: "address", internalType: "address" }]
1013
+ },
1014
+ {
1015
+ type: "error",
1016
+ name: "UnauthorizedCaller",
1017
+ inputs: [
1018
+ { name: "caller", type: "address", internalType: "address" },
1019
+ { name: "expected", type: "address", internalType: "address" }
1020
+ ]
1021
+ },
1022
+ { type: "error", name: "WithdrawFailed", inputs: [] }
1023
+ ];
1024
+
1025
+ // src/abis/univ234-pools-strategy.json
1026
+ var univ234_pools_strategy_default = [
1027
+ { type: "constructor", inputs: [], stateMutability: "nonpayable" },
1028
+ { type: "receive", stateMutability: "payable" },
1029
+ {
1030
+ type: "function",
1031
+ name: "executeScoreStrategy",
1032
+ inputs: [
1033
+ {
1034
+ name: "params",
1035
+ type: "tuple",
1036
+ internalType: "struct IScoreStrategy.ScoreStrategyParams",
1037
+ components: [
1038
+ {
1039
+ name: "scoreKey",
1040
+ type: "bytes32",
1041
+ internalType: "bytes32"
1042
+ },
1043
+ {
1044
+ name: "scoreDelta",
1045
+ type: "int256",
1046
+ internalType: "int256"
1047
+ },
1048
+ {
1049
+ name: "originalSender",
1050
+ type: "address",
1051
+ internalType: "address"
1052
+ },
1053
+ {
1054
+ name: "appAddress",
1055
+ type: "address",
1056
+ internalType: "address"
1057
+ },
1058
+ {
1059
+ name: "scoreStoredContext",
1060
+ type: "bytes",
1061
+ internalType: "bytes"
1062
+ },
1063
+ {
1064
+ name: "scoreUnstoredContext",
1065
+ type: "bytes",
1066
+ internalType: "bytes"
1067
+ }
1068
+ ]
1069
+ }
1070
+ ],
1071
+ outputs: [
1072
+ { name: "metadata", type: "bytes", internalType: "bytes" }
1073
+ ],
1074
+ stateMutability: "payable"
1075
+ },
1076
+ {
1077
+ type: "function",
1078
+ name: "feeBps",
1079
+ inputs: [],
1080
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
1081
+ stateMutability: "view"
1082
+ },
1083
+ {
1084
+ type: "function",
1085
+ name: "owner",
1086
+ inputs: [],
1087
+ outputs: [{ name: "", type: "address", internalType: "address" }],
1088
+ stateMutability: "view"
1089
+ },
1090
+ {
1091
+ type: "function",
1092
+ name: "renounceOwnership",
1093
+ inputs: [],
1094
+ outputs: [],
1095
+ stateMutability: "nonpayable"
1096
+ },
1097
+ {
1098
+ type: "function",
1099
+ name: "setFeeBps",
1100
+ inputs: [
1101
+ { name: "newFeeBps", type: "uint256", internalType: "uint256" }
1102
+ ],
1103
+ outputs: [],
1104
+ stateMutability: "nonpayable"
1105
+ },
1106
+ {
1107
+ type: "function",
1108
+ name: "setUpvotePrice",
1109
+ inputs: [
1110
+ {
1111
+ name: "newUpvotePrice",
1112
+ type: "uint256",
1113
+ internalType: "uint256"
1114
+ }
1115
+ ],
1116
+ outputs: [],
1117
+ stateMutability: "nonpayable"
1118
+ },
1119
+ {
1120
+ type: "function",
1121
+ name: "transferOwnership",
1122
+ inputs: [
1123
+ { name: "newOwner", type: "address", internalType: "address" }
1124
+ ],
1125
+ outputs: [],
1126
+ stateMutability: "nonpayable"
1127
+ },
1128
+ {
1129
+ type: "function",
1130
+ name: "upvotePrice",
1131
+ inputs: [],
1132
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
1133
+ stateMutability: "view"
1134
+ },
1135
+ {
1136
+ type: "function",
1137
+ name: "withdrawETH",
1138
+ inputs: [{ name: "to", type: "address", internalType: "address" }],
1139
+ outputs: [],
1140
+ stateMutability: "nonpayable"
1141
+ },
1142
+ {
1143
+ type: "function",
1144
+ name: "withdrawErc20",
1145
+ inputs: [
1146
+ { name: "to", type: "address", internalType: "address" },
1147
+ { name: "token", type: "address", internalType: "address" },
1148
+ { name: "amount", type: "uint256", internalType: "uint256" }
1149
+ ],
1150
+ outputs: [],
1151
+ stateMutability: "nonpayable"
1152
+ },
1153
+ {
1154
+ type: "event",
1155
+ name: "OwnershipTransferred",
1156
+ inputs: [
1157
+ {
1158
+ name: "previousOwner",
1159
+ type: "address",
1160
+ indexed: true,
1161
+ internalType: "address"
1162
+ },
1163
+ {
1164
+ name: "newOwner",
1165
+ type: "address",
1166
+ indexed: true,
1167
+ internalType: "address"
1168
+ }
1169
+ ],
1170
+ anonymous: false
1171
+ },
1172
+ {
1173
+ type: "error",
1174
+ name: "IncorrectEthAmount",
1175
+ inputs: [
1176
+ { name: "sent", type: "uint256", internalType: "uint256" },
1177
+ { name: "expected", type: "uint256", internalType: "uint256" }
1178
+ ]
1179
+ },
1180
+ {
1181
+ type: "error",
1182
+ name: "InvalidPoolKeyForRouting",
1183
+ inputs: [
1184
+ { name: "fee", type: "uint24", internalType: "uint24" },
1185
+ { name: "tickSpacing", type: "int24", internalType: "int24" },
1186
+ { name: "hooks", type: "address", internalType: "address" }
1187
+ ]
1188
+ },
1189
+ {
1190
+ type: "error",
1191
+ name: "InvalidTokenPair",
1192
+ inputs: [
1193
+ { name: "tokenIn", type: "address", internalType: "address" },
1194
+ { name: "tokenOut", type: "address", internalType: "address" }
1195
+ ]
1196
+ },
1197
+ { type: "error", name: "NegativeUpvotesNotSupported", inputs: [] },
1198
+ { type: "error", name: "NoTokensToWithdraw", inputs: [] },
1199
+ {
1200
+ type: "error",
1201
+ name: "OwnableInvalidOwner",
1202
+ inputs: [
1203
+ { name: "owner", type: "address", internalType: "address" }
1204
+ ]
1205
+ },
1206
+ {
1207
+ type: "error",
1208
+ name: "OwnableUnauthorizedAccount",
1209
+ inputs: [
1210
+ { name: "account", type: "address", internalType: "address" }
1211
+ ]
1212
+ },
1213
+ {
1214
+ type: "error",
1215
+ name: "PoolNotFound",
1216
+ inputs: [
1217
+ { name: "tokenA", type: "address", internalType: "address" },
1218
+ { name: "tokenB", type: "address", internalType: "address" },
1219
+ { name: "feeTier", type: "uint24", internalType: "uint24" }
1220
+ ]
1221
+ },
1222
+ { type: "error", name: "ReentrancyGuardReentrantCall", inputs: [] },
1223
+ {
1224
+ type: "error",
1225
+ name: "Slot0ReadFailed",
1226
+ inputs: [{ name: "pool", type: "address", internalType: "address" }]
1227
+ },
1228
+ {
1229
+ type: "error",
1230
+ name: "StringsInsufficientHexLength",
1231
+ inputs: [
1232
+ { name: "value", type: "uint256", internalType: "uint256" },
1233
+ { name: "length", type: "uint256", internalType: "uint256" }
1234
+ ]
1235
+ },
1236
+ {
1237
+ type: "error",
1238
+ name: "UnauthorizedCaller",
1239
+ inputs: [
1240
+ { name: "caller", type: "address", internalType: "address" },
1241
+ { name: "expected", type: "address", internalType: "address" }
1242
+ ]
1243
+ },
1244
+ { type: "error", name: "WithdrawFailed", inputs: [] }
1245
+ ];
1246
+
1247
+ // src/abis/dynamic-split-strategy.json
1248
+ var dynamic_split_strategy_default = [
1249
+ {
1250
+ type: "constructor",
1251
+ inputs: [],
1252
+ stateMutability: "nonpayable"
1253
+ },
1254
+ {
1255
+ type: "receive",
1256
+ stateMutability: "payable"
1257
+ },
1258
+ {
1259
+ type: "function",
1260
+ name: "executeScoreStrategy",
1261
+ inputs: [
1262
+ {
1263
+ name: "params",
1264
+ type: "tuple",
1265
+ internalType: "struct IScoreStrategy.ScoreStrategyParams",
1266
+ components: [
1267
+ {
1268
+ name: "scoreKey",
1269
+ type: "bytes32",
1270
+ internalType: "bytes32"
1271
+ },
1272
+ {
1273
+ name: "scoreDelta",
1274
+ type: "int256",
1275
+ internalType: "int256"
1276
+ },
1277
+ {
1278
+ name: "originalSender",
1279
+ type: "address",
1280
+ internalType: "address"
1281
+ },
1282
+ {
1283
+ name: "appAddress",
1284
+ type: "address",
1285
+ internalType: "address"
1286
+ },
1287
+ {
1288
+ name: "scoreStoredContext",
1289
+ type: "bytes",
1290
+ internalType: "bytes"
1291
+ },
1292
+ {
1293
+ name: "scoreUnstoredContext",
1294
+ type: "bytes",
1295
+ internalType: "bytes"
1296
+ }
1297
+ ]
1298
+ }
1299
+ ],
1300
+ outputs: [
1301
+ {
1302
+ name: "metadata",
1303
+ type: "bytes",
1304
+ internalType: "bytes"
1305
+ }
1306
+ ],
1307
+ stateMutability: "payable"
1308
+ },
1309
+ {
1310
+ type: "function",
1311
+ name: "feeBps",
1312
+ inputs: [],
1313
+ outputs: [
1314
+ {
1315
+ name: "",
1316
+ type: "uint256",
1317
+ internalType: "uint256"
1318
+ }
1319
+ ],
1320
+ stateMutability: "view"
1321
+ },
1322
+ {
1323
+ type: "function",
1324
+ name: "owner",
1325
+ inputs: [],
1326
+ outputs: [
1327
+ {
1328
+ name: "",
1329
+ type: "address",
1330
+ internalType: "address"
1331
+ }
1332
+ ],
1333
+ stateMutability: "view"
1334
+ },
1335
+ {
1336
+ type: "function",
1337
+ name: "renounceOwnership",
1338
+ inputs: [],
1339
+ outputs: [],
1340
+ stateMutability: "nonpayable"
1341
+ },
1342
+ {
1343
+ type: "function",
1344
+ name: "setFeeBps",
1345
+ inputs: [
1346
+ {
1347
+ name: "newFeeBps",
1348
+ type: "uint256",
1349
+ internalType: "uint256"
1350
+ }
1351
+ ],
1352
+ outputs: [],
1353
+ stateMutability: "nonpayable"
1354
+ },
1355
+ {
1356
+ type: "function",
1357
+ name: "setTokenSplitBps",
1358
+ inputs: [
1359
+ {
1360
+ name: "newTokenSplitBps",
1361
+ type: "uint256",
1362
+ internalType: "uint256"
1363
+ }
1364
+ ],
1365
+ outputs: [],
1366
+ stateMutability: "nonpayable"
1367
+ },
1368
+ {
1369
+ type: "function",
1370
+ name: "setUpvotePrice",
1371
+ inputs: [
1372
+ {
1373
+ name: "newUpvotePrice",
1374
+ type: "uint256",
1375
+ internalType: "uint256"
1376
+ }
1377
+ ],
1378
+ outputs: [],
1379
+ stateMutability: "nonpayable"
1380
+ },
1381
+ {
1382
+ type: "function",
1383
+ name: "tokenSplitBps",
1384
+ inputs: [],
1385
+ outputs: [
1386
+ {
1387
+ name: "",
1388
+ type: "uint256",
1389
+ internalType: "uint256"
1390
+ }
1391
+ ],
1392
+ stateMutability: "view"
1393
+ },
1394
+ {
1395
+ type: "function",
1396
+ name: "transferOwnership",
1397
+ inputs: [
1398
+ {
1399
+ name: "newOwner",
1400
+ type: "address",
1401
+ internalType: "address"
1402
+ }
1403
+ ],
1404
+ outputs: [],
1405
+ stateMutability: "nonpayable"
1406
+ },
1407
+ {
1408
+ type: "function",
1409
+ name: "upvotePrice",
1410
+ inputs: [],
1411
+ outputs: [
1412
+ {
1413
+ name: "",
1414
+ type: "uint256",
1415
+ internalType: "uint256"
1416
+ }
1417
+ ],
1418
+ stateMutability: "view"
1419
+ },
1420
+ {
1421
+ type: "function",
1422
+ name: "withdrawETH",
1423
+ inputs: [
1424
+ {
1425
+ name: "to",
1426
+ type: "address",
1427
+ internalType: "address"
1428
+ }
1429
+ ],
1430
+ outputs: [],
1431
+ stateMutability: "nonpayable"
1432
+ },
1433
+ {
1434
+ type: "function",
1435
+ name: "withdrawErc20",
1436
+ inputs: [
1437
+ {
1438
+ name: "to",
1439
+ type: "address",
1440
+ internalType: "address"
1441
+ },
1442
+ {
1443
+ name: "token",
1444
+ type: "address",
1445
+ internalType: "address"
1446
+ },
1447
+ {
1448
+ name: "amount",
1449
+ type: "uint256",
1450
+ internalType: "uint256"
1451
+ }
1452
+ ],
1453
+ outputs: [],
1454
+ stateMutability: "nonpayable"
1455
+ },
1456
+ {
1457
+ type: "event",
1458
+ name: "OwnershipTransferred",
1459
+ inputs: [
1460
+ {
1461
+ name: "previousOwner",
1462
+ type: "address",
1463
+ indexed: true,
1464
+ internalType: "address"
1465
+ },
1466
+ {
1467
+ name: "newOwner",
1468
+ type: "address",
1469
+ indexed: true,
1470
+ internalType: "address"
1471
+ }
1472
+ ],
1473
+ anonymous: false
1474
+ },
1475
+ {
1476
+ type: "error",
1477
+ name: "IncorrectEthAmount",
1478
+ inputs: [
1479
+ {
1480
+ name: "sent",
1481
+ type: "uint256",
1482
+ internalType: "uint256"
1483
+ },
1484
+ {
1485
+ name: "expected",
1486
+ type: "uint256",
1487
+ internalType: "uint256"
1488
+ }
1489
+ ]
1490
+ },
1491
+ {
1492
+ type: "error",
1493
+ name: "InvalidFeeBps",
1494
+ inputs: [
1495
+ {
1496
+ name: "bps",
1497
+ type: "uint256",
1498
+ internalType: "uint256"
1499
+ }
1500
+ ]
1501
+ },
1502
+ {
1503
+ type: "error",
1504
+ name: "InvalidPoolKeyForRouting",
1505
+ inputs: [
1506
+ {
1507
+ name: "fee",
1508
+ type: "uint24",
1509
+ internalType: "uint24"
1510
+ },
1511
+ {
1512
+ name: "tickSpacing",
1513
+ type: "int24",
1514
+ internalType: "int24"
1515
+ },
1516
+ {
1517
+ name: "hooks",
1518
+ type: "address",
1519
+ internalType: "address"
1520
+ }
1521
+ ]
1522
+ },
1523
+ {
1524
+ type: "error",
1525
+ name: "InvalidTokenPair",
1526
+ inputs: [
1527
+ {
1528
+ name: "tokenIn",
1529
+ type: "address",
1530
+ internalType: "address"
1531
+ },
1532
+ {
1533
+ name: "tokenOut",
1534
+ type: "address",
1535
+ internalType: "address"
1536
+ }
1537
+ ]
1538
+ },
1539
+ {
1540
+ type: "error",
1541
+ name: "InvalidTokenSplitBps",
1542
+ inputs: [
1543
+ {
1544
+ name: "bps",
1545
+ type: "uint256",
1546
+ internalType: "uint256"
1547
+ }
1548
+ ]
1549
+ },
1550
+ {
1551
+ type: "error",
1552
+ name: "NegativeUpvotesNotSupported",
1553
+ inputs: []
1554
+ },
1555
+ {
1556
+ type: "error",
1557
+ name: "NoTokensToWithdraw",
1558
+ inputs: []
1559
+ },
1560
+ {
1561
+ type: "error",
1562
+ name: "OwnableInvalidOwner",
1563
+ inputs: [
1564
+ {
1565
+ name: "owner",
1566
+ type: "address",
1567
+ internalType: "address"
1568
+ }
1569
+ ]
1570
+ },
1571
+ {
1572
+ type: "error",
1573
+ name: "OwnableUnauthorizedAccount",
1574
+ inputs: [
1575
+ {
1576
+ name: "account",
1577
+ type: "address",
1578
+ internalType: "address"
1579
+ }
1580
+ ]
1581
+ },
1582
+ {
1583
+ type: "error",
1584
+ name: "PoolNotFound",
1585
+ inputs: [
1586
+ {
1587
+ name: "tokenA",
1588
+ type: "address",
1589
+ internalType: "address"
1590
+ },
1591
+ {
1592
+ name: "tokenB",
1593
+ type: "address",
1594
+ internalType: "address"
1595
+ },
1596
+ {
1597
+ name: "feeTier",
1598
+ type: "uint24",
1599
+ internalType: "uint24"
1600
+ }
1601
+ ]
1602
+ },
1603
+ {
1604
+ type: "error",
1605
+ name: "ReentrancyGuardReentrantCall",
1606
+ inputs: []
1607
+ },
1608
+ {
1609
+ type: "error",
1610
+ name: "Slot0ReadFailed",
1611
+ inputs: [
1612
+ {
1613
+ name: "pool",
1614
+ type: "address",
1615
+ internalType: "address"
1616
+ }
1617
+ ]
1618
+ },
1619
+ {
1620
+ type: "error",
1621
+ name: "StringsInsufficientHexLength",
1622
+ inputs: [
1623
+ {
1624
+ name: "value",
1625
+ type: "uint256",
1626
+ internalType: "uint256"
1627
+ },
1628
+ {
1629
+ name: "length",
1630
+ type: "uint256",
1631
+ internalType: "uint256"
1632
+ }
1633
+ ]
1634
+ },
1635
+ {
1636
+ type: "error",
1637
+ name: "UnauthorizedCaller",
1638
+ inputs: [
1639
+ {
1640
+ name: "caller",
1641
+ type: "address",
1642
+ internalType: "address"
1643
+ },
1644
+ {
1645
+ name: "expected",
1646
+ type: "address",
1647
+ internalType: "address"
1648
+ }
1649
+ ]
1650
+ },
1651
+ {
1652
+ type: "error",
1653
+ name: "WithdrawFailed",
1654
+ inputs: []
1655
+ }
1656
+ ];
1657
+
1658
+ // src/constants.ts
1659
+ var SCORE_CONTRACT = {
1660
+ address: "0x0000000fa09b022e5616e5a173b4b67fa2fbcf28",
1661
+ abi: score_default
1662
+ };
1663
+ var UPVOTE_APP = {
1664
+ address: "0x00000001f0b8173316a016a5067ad74e8cea47bf",
1665
+ abi: upvote_app_default
1666
+ };
1667
+ var UPVOTE_STORAGE_APP = {
1668
+ address: "0x000000060CEB69D023227DF64CfB75eC37c75B62",
1669
+ abi: upvote_storage_app_default
1670
+ };
1671
+ var PURE_ALPHA_STRATEGY = {
1672
+ address: "0x00000001b1bcdeddeafd5296aaf4f3f3e21ae876",
1673
+ abi: pure_alpha_strategy_default
1674
+ };
1675
+ var UNIV234_POOLS_STRATEGY = {
1676
+ address: "0x000000063f84e07a3e7a7ee578b42704ee6d22c9",
1677
+ abi: univ234_pools_strategy_default
1678
+ };
1679
+ var DYNAMIC_SPLIT_STRATEGY = {
1680
+ address: "0x0000000869160f0b2a213adefb46a7ea7e62ac7a",
1681
+ abi: dynamic_split_strategy_default
1682
+ };
1683
+ var ALL_STRATEGY_ADDRESSES = [
1684
+ UNIV234_POOLS_STRATEGY.address,
1685
+ PURE_ALPHA_STRATEGY.address,
1686
+ DYNAMIC_SPLIT_STRATEGY.address
1687
+ ];
1688
+ var LEGACY_UPVOTE_V1_ADDRESS = "0x0ada882dbbdc12388a1f9ca85d2d847088f747df";
1689
+ var LEGACY_UPVOTE_V2_ADDRESS = "0x9027dcad0a3dca5835895e14fbc022a1e5ea909b";
1690
+ var SUPPORTED_SCORE_CHAINS = [8453];
1691
+ var encodeUpvoteKey = (tokenAddress) => {
1692
+ return `0x${BigInt(`0x${tokenAddress.slice(2)}`).toString(16).padStart(64, "0")}`;
1693
+ };
1694
+ function tokenAddressToUpvoteKeyString(tokenAddress) {
1695
+ const lower = tokenAddress.toLowerCase();
1696
+ const withoutPrefix = lower.slice(2);
1697
+ const stripped = withoutPrefix.replace(/^0+/, "") || "0";
1698
+ return "0x" + stripped;
1699
+ }
1700
+ function isStrategyMessage(topic) {
1701
+ return topic.startsWith("s") && topic.length > 43;
1702
+ }
1703
+ function isUserUpvoteMessage(topic) {
1704
+ return topic.startsWith("t");
1705
+ }
1706
+ function extractStrategyAddress(topic) {
1707
+ try {
1708
+ if (topic.startsWith("t")) {
1709
+ return topic.slice(1);
1710
+ }
1711
+ if (topic.startsWith("s")) {
1712
+ return topic.slice(1, 43);
1713
+ }
1714
+ if (topic.startsWith("t-")) {
1715
+ return topic.slice(2);
1716
+ }
1717
+ const parts = topic.split("-");
1718
+ if (parts.length >= 2) {
1719
+ return parts[0];
1720
+ }
1721
+ return "";
1722
+ } catch {
1723
+ return "";
1724
+ }
1725
+ }
1726
+ function isPureAlphaStrategy(strategyAddress) {
1727
+ return strategyAddress.toLowerCase() === PURE_ALPHA_STRATEGY.address.toLowerCase();
1728
+ }
1729
+ function isUniv234PoolsStrategy(strategyAddress) {
1730
+ return strategyAddress.toLowerCase() === UNIV234_POOLS_STRATEGY.address.toLowerCase();
1731
+ }
1732
+ function isDynamicSplitStrategy(strategyAddress) {
1733
+ return strategyAddress.toLowerCase() === DYNAMIC_SPLIT_STRATEGY.address.toLowerCase();
1734
+ }
1735
+ var decodeStrategyMetadata = (metadata, strategyAddress) => {
1736
+ try {
1737
+ if (isPureAlphaStrategy(strategyAddress)) {
1738
+ const [alphaAmount, alphaWethPrice, wethUsdcPrice, userAlphaBalance] = decodeAbiParameters(
1739
+ [
1740
+ { type: "uint256" },
1741
+ { type: "uint256" },
1742
+ { type: "uint256" },
1743
+ { type: "uint256" }
1744
+ ],
1745
+ metadata
1746
+ );
1747
+ return {
1748
+ alphaAmount,
1749
+ alphaWethPrice,
1750
+ wethUsdcPrice,
1751
+ userAlphaBalance
1752
+ };
1753
+ } else if (isUniv234PoolsStrategy(strategyAddress) || isDynamicSplitStrategy(strategyAddress)) {
1754
+ const [
1755
+ tokenAmount,
1756
+ tokenWethPrice,
1757
+ wethUsdcPrice,
1758
+ alphaWethPrice,
1759
+ userTokenBalance
1760
+ ] = decodeAbiParameters(
1761
+ [
1762
+ { type: "uint256" },
1763
+ { type: "uint256" },
1764
+ { type: "uint256" },
1765
+ { type: "uint256" },
1766
+ { type: "uint256" }
1767
+ ],
1768
+ metadata
1769
+ );
1770
+ return {
1771
+ tokenAmount,
1772
+ tokenWethPrice,
1773
+ wethUsdcPrice,
1774
+ alphaWethPrice,
1775
+ userTokenBalance
1776
+ };
1777
+ } else {
1778
+ return null;
1779
+ }
1780
+ } catch {
1781
+ return null;
1782
+ }
1783
+ };
1784
+ var decodeUpvoteStorageBlob = (value) => {
1785
+ try {
1786
+ const [
1787
+ scoreKey,
1788
+ scoreDelta,
1789
+ originalSender,
1790
+ appAddress,
1791
+ strategyAddress,
1792
+ timestamp,
1793
+ scoreStoredContext,
1794
+ scoreUnstoredContext,
1795
+ metadata
1796
+ ] = decodeAbiParameters(
1797
+ [
1798
+ { type: "bytes32" },
1799
+ { type: "int256" },
1800
+ { type: "address" },
1801
+ { type: "address" },
1802
+ { type: "address" },
1803
+ { type: "uint256" },
1804
+ { type: "bytes" },
1805
+ { type: "bytes" },
1806
+ { type: "bytes" }
1807
+ ],
1808
+ value
1809
+ );
1810
+ const decodedMetadata = decodeStrategyMetadata(
1811
+ metadata,
1812
+ strategyAddress
1813
+ );
1814
+ return {
1815
+ scoreKey,
1816
+ scoreDelta: Number(scoreDelta),
1817
+ originalSender,
1818
+ appAddress,
1819
+ strategyAddress,
1820
+ timestamp: Number(timestamp),
1821
+ scoreStoredContext,
1822
+ scoreUnstoredContext,
1823
+ decodedMetadata
1824
+ };
1825
+ } catch {
1826
+ return null;
1827
+ }
1828
+ };
1829
+ var selectStrategy = (poolKey) => {
1830
+ if (!poolKey || !isValidPoolKey(poolKey)) {
1831
+ return PURE_ALPHA_STRATEGY.address;
1832
+ }
1833
+ return DYNAMIC_SPLIT_STRATEGY.address;
1834
+ };
1835
+ function isValidPoolKey(poolKey) {
1836
+ return poolKey.fee !== void 0 || poolKey.tickSpacing !== void 0 || poolKey.currency0 !== void 0;
1837
+ }
1838
+ function decodeUpvoteMessage(msg) {
1839
+ try {
1840
+ if (msg.topic === "t") {
1841
+ if (!msg.data || msg.data === "0x" || msg.data.length < 32) {
1842
+ return null;
1843
+ }
1844
+ try {
1845
+ const [
1846
+ numUpvotesDecoded,
1847
+ tokenWethPrice,
1848
+ wethUsdcPrice,
1849
+ alphaWethPrice,
1850
+ userTokenBalance
1851
+ ] = decodeAbiParameters(
1852
+ [
1853
+ { type: "uint256" },
1854
+ { type: "uint256" },
1855
+ { type: "uint256" },
1856
+ { type: "uint256" },
1857
+ { type: "uint256" }
1858
+ ],
1859
+ msg.data
1860
+ );
1861
+ return {
1862
+ scoreDelta: Number(numUpvotesDecoded),
1863
+ tokenWethPrice: Number(tokenWethPrice),
1864
+ wethUsdcPrice: Number(wethUsdcPrice),
1865
+ alphaWethPrice: Number(alphaWethPrice),
1866
+ userTokenBalance: Number(userTokenBalance),
1867
+ tokenAddress: msg.text,
1868
+ messageType: "legacy"
1869
+ };
1870
+ } catch {
1871
+ return null;
1872
+ }
1873
+ } else if (msg.topic.startsWith("0x") && msg.topic.length === 42 || msg.topic.startsWith("p-")) {
1874
+ const [
1875
+ numUpvotesDecoded,
1876
+ tokenWethPrice,
1877
+ wethUsdcPrice,
1878
+ alphaWethPrice,
1879
+ userTokenBalance
1880
+ ] = decodeAbiParameters(
1881
+ [
1882
+ { type: "uint256" },
1883
+ { type: "uint256" },
1884
+ { type: "uint256" },
1885
+ { type: "uint256" },
1886
+ { type: "uint256" }
1887
+ ],
1888
+ msg.data
1889
+ );
1890
+ return {
1891
+ scoreDelta: Number(numUpvotesDecoded),
1892
+ tokenWethPrice: Number(tokenWethPrice),
1893
+ wethUsdcPrice: Number(wethUsdcPrice),
1894
+ alphaWethPrice: Number(alphaWethPrice),
1895
+ userTokenBalance: Number(userTokenBalance),
1896
+ tokenAddress: msg.topic,
1897
+ messageType: "legacy"
1898
+ };
1899
+ } else if (msg.topic.startsWith("app-") && msg.topic.endsWith("-first")) {
1900
+ const topicParts = msg.topic.split("-");
1901
+ if (topicParts.length === 3) {
1902
+ return {
1903
+ appAddress: topicParts[1],
1904
+ messageType: "app-first"
1905
+ };
1906
+ } else if (topicParts.length === 5 && topicParts[2] === "strategy") {
1907
+ return {
1908
+ appAddress: topicParts[1],
1909
+ strategyAddress: topicParts[3],
1910
+ messageType: "app-strategy-first"
1911
+ };
1912
+ } else if (topicParts.length === 5 && topicParts[2] === "user") {
1913
+ return {
1914
+ appAddress: topicParts[1],
1915
+ userAddress: topicParts[3],
1916
+ tokenAddress: msg.text,
1917
+ messageType: "app-user-first"
1918
+ };
1919
+ } else if (topicParts.length === 7 && topicParts[2] === "strategy" && topicParts[4] === "user") {
1920
+ return {
1921
+ appAddress: topicParts[1],
1922
+ strategyAddress: topicParts[3],
1923
+ userAddress: topicParts[5],
1924
+ tokenAddress: msg.text,
1925
+ messageType: "app-strategy-user-first"
1926
+ };
1927
+ }
1928
+ }
1929
+ return null;
1930
+ } catch {
1931
+ return null;
1932
+ }
1933
+ }
1934
+
1935
+ // src/utils/scoreKeyUtils.ts
1936
+ var getTokenScoreKey = (tokenAddress) => {
1937
+ return encodeUpvoteKey(tokenAddress);
1938
+ };
1939
+ var getStorageScoreKey = (operatorAddress, storageKey) => {
1940
+ const bytes32Key = getStorageKeyBytes(storageKey);
1941
+ return keccak256(
1942
+ encodePacked(
1943
+ ["bytes32", "address"],
1944
+ [bytes32Key, operatorAddress]
1945
+ )
1946
+ );
1947
+ };
1948
+ var getFeedContentKey = (message) => {
1949
+ return keccak256(
1950
+ encodePacked(
1951
+ ["address", "string", "address", "uint256", "string", "bytes"],
1952
+ [
1953
+ message.app,
1954
+ message.topic,
1955
+ message.sender,
1956
+ message.timestamp,
1957
+ message.text,
1958
+ message.data
1959
+ ]
1960
+ )
1961
+ );
1962
+ };
1963
+ var getScoreKey = (item) => {
1964
+ switch (item.type) {
1965
+ case "token":
1966
+ return getTokenScoreKey(item.tokenAddress);
1967
+ case "storage":
1968
+ return getStorageScoreKey(item.operatorAddress, item.storageKey);
1969
+ case "feed": {
1970
+ const contentKey = getFeedContentKey(item.message);
1971
+ return getStorageScoreKey(
1972
+ item.message.sender,
1973
+ contentKey
1974
+ );
1975
+ }
1976
+ }
1977
+ };
1978
+ var isTokenScoreKey = (scoreKey) => {
1979
+ return scoreKey.startsWith("0x000000000000000000000000");
1980
+ };
1981
+ var extractTokenAddressFromScoreKey = (scoreKey) => {
1982
+ if (!isTokenScoreKey(scoreKey)) {
1983
+ return null;
1984
+ }
1985
+ const tokenAddress = `0x${scoreKey.slice(26)}`;
1986
+ if (tokenAddress.startsWith("0x") && tokenAddress.length === 42) {
1987
+ try {
1988
+ return getAddress(tokenAddress);
1989
+ } catch {
1990
+ return null;
1991
+ }
1992
+ }
1993
+ return null;
1994
+ };
1995
+ var getStorageUpvoteContext = (operatorAddress, storageKey) => {
1996
+ const bytes32Key = getStorageKeyBytes(storageKey);
1997
+ return encodeAbiParameters(
1998
+ [{ type: "bytes32" }, { type: "address" }],
1999
+ [bytes32Key, operatorAddress]
2000
+ );
2001
+ };
2002
+
2003
+ // src/client/ScoreClient.ts
2004
+ var ScoreClient = class {
2005
+ constructor(params) {
2006
+ this.client = getPublicClient({
2007
+ chainId: params.chainId,
2008
+ rpcUrl: params.overrides?.rpcUrls
2009
+ });
2010
+ this.scoreAddress = params.overrides?.scoreAddress ?? SCORE_CONTRACT.address;
2011
+ this.upvoteAppAddress = params.overrides?.upvoteAppAddress ?? UPVOTE_APP.address;
2012
+ }
2013
+ /**
2014
+ * Get upvote counts for score keys via UpvoteApp.getUpvotesWithLegacy.
2015
+ * Returns an array of counts, one per score key.
2016
+ */
2017
+ async getUpvotesWithLegacy({
2018
+ scoreKeys,
2019
+ strategies = ALL_STRATEGY_ADDRESSES
2020
+ }) {
2021
+ const data = await readContract(this.client, {
2022
+ address: this.upvoteAppAddress,
2023
+ abi: UPVOTE_APP.abi,
2024
+ functionName: "getUpvotesWithLegacy",
2025
+ args: [scoreKeys, strategies]
2026
+ });
2027
+ if (Array.isArray(data)) {
2028
+ return data.map(Number);
2029
+ }
2030
+ return [];
2031
+ }
2032
+ /**
2033
+ * Get upvote counts for ScoreItem array.
2034
+ * Converts items to score keys, then calls getUpvotesWithLegacy.
2035
+ */
2036
+ async getUpvotesForItems({
2037
+ items,
2038
+ strategies
2039
+ }) {
2040
+ const scoreKeys = items.map((item) => getScoreKey(item));
2041
+ return this.getUpvotesWithLegacy({ scoreKeys, strategies });
2042
+ }
2043
+ /**
2044
+ * Read scores for keys from a specific strategy on the Score contract.
2045
+ * Uses the batch getAppStrategyKeyScores function for efficiency.
2046
+ */
2047
+ async getStrategyKeyScores({
2048
+ strategy,
2049
+ scoreKeys
2050
+ }) {
2051
+ const data = await readContract(this.client, {
2052
+ address: this.scoreAddress,
2053
+ abi: SCORE_CONTRACT.abi,
2054
+ functionName: "getAppStrategyKeyScores",
2055
+ args: [this.upvoteAppAddress, strategy, scoreKeys]
2056
+ });
2057
+ if (Array.isArray(data)) {
2058
+ return data.map(Number);
2059
+ }
2060
+ return [];
2061
+ }
2062
+ /**
2063
+ * Read scores for keys from a specific app on the Score contract.
2064
+ * Uses the batch getAppKeyScores function for efficiency.
2065
+ */
2066
+ async getAppKeyScores({
2067
+ app,
2068
+ scoreKeys
2069
+ }) {
2070
+ const data = await readContract(this.client, {
2071
+ address: this.scoreAddress,
2072
+ abi: SCORE_CONTRACT.abi,
2073
+ functionName: "getAppKeyScores",
2074
+ args: [app, scoreKeys]
2075
+ });
2076
+ if (Array.isArray(data)) {
2077
+ return data.map(Number);
2078
+ }
2079
+ return [];
2080
+ }
2081
+ };
2082
+ var encodePoolKey = (poolKey) => {
2083
+ if (!poolKey || !isValidPoolKey2(poolKey)) {
2084
+ return "0x";
2085
+ }
2086
+ try {
2087
+ return encodeAbiParameters(
2088
+ [
2089
+ {
2090
+ type: "tuple",
2091
+ components: [
2092
+ { name: "currency0", type: "address" },
2093
+ { name: "currency1", type: "address" },
2094
+ { name: "fee", type: "uint24" },
2095
+ { name: "tickSpacing", type: "int24" },
2096
+ { name: "hooks", type: "address" }
2097
+ ]
2098
+ }
2099
+ ],
2100
+ [
2101
+ {
2102
+ currency0: poolKey.currency0,
2103
+ currency1: poolKey.currency1,
2104
+ fee: poolKey.fee,
2105
+ tickSpacing: poolKey.tickSpacing,
2106
+ hooks: poolKey.hooks
2107
+ }
2108
+ ]
2109
+ );
2110
+ } catch {
2111
+ return "0x";
2112
+ }
2113
+ };
2114
+ function isValidPoolKey2(poolKey) {
2115
+ return poolKey.fee !== void 0 || poolKey.tickSpacing !== void 0 || poolKey.currency0 !== void 0;
2116
+ }
2117
+
2118
+ export { ALL_STRATEGY_ADDRESSES, DYNAMIC_SPLIT_STRATEGY, LEGACY_UPVOTE_V1_ADDRESS, LEGACY_UPVOTE_V2_ADDRESS, PURE_ALPHA_STRATEGY, SCORE_CONTRACT, SUPPORTED_SCORE_CHAINS, ScoreClient, UNIV234_POOLS_STRATEGY, UPVOTE_APP, UPVOTE_STORAGE_APP, decodeStrategyMetadata, decodeUpvoteMessage, decodeUpvoteStorageBlob, encodePoolKey, encodeUpvoteKey, extractStrategyAddress, extractTokenAddressFromScoreKey, getFeedContentKey, getScoreKey, getStorageScoreKey, getStorageUpvoteContext, getTokenScoreKey, isDynamicSplitStrategy, isPureAlphaStrategy, isStrategyMessage, isTokenScoreKey, isUniv234PoolsStrategy, isUserUpvoteMessage, selectStrategy, tokenAddressToUpvoteKeyString };
2119
+ //# sourceMappingURL=index.mjs.map
2120
+ //# sourceMappingURL=index.mjs.map