timelock-sdk 0.0.16 → 0.0.18

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.
@@ -1,4652 +0,0 @@
1
- import { getContract } from "viem";
2
- import { monadTestnet } from "viem/chains";
3
- import { SqrtPriceMath, TickMath } from "@uniswap/v3-sdk";
4
- import Big from "big.js";
5
- import JSBI from "jsbi";
6
-
7
- //#region src/abis/erc20.ts
8
- const erc20Abi$1 = [
9
- {
10
- type: "constructor",
11
- inputs: [{
12
- name: "name_",
13
- type: "string",
14
- internalType: "string"
15
- }, {
16
- name: "symbol_",
17
- type: "string",
18
- internalType: "string"
19
- }],
20
- stateMutability: "nonpayable"
21
- },
22
- {
23
- type: "function",
24
- name: "allowance",
25
- inputs: [{
26
- name: "owner",
27
- type: "address",
28
- internalType: "address"
29
- }, {
30
- name: "spender",
31
- type: "address",
32
- internalType: "address"
33
- }],
34
- outputs: [{
35
- name: "",
36
- type: "uint256",
37
- internalType: "uint256"
38
- }],
39
- stateMutability: "view"
40
- },
41
- {
42
- type: "function",
43
- name: "approve",
44
- inputs: [{
45
- name: "spender",
46
- type: "address",
47
- internalType: "address"
48
- }, {
49
- name: "amount",
50
- type: "uint256",
51
- internalType: "uint256"
52
- }],
53
- outputs: [{
54
- name: "",
55
- type: "bool",
56
- internalType: "bool"
57
- }],
58
- stateMutability: "nonpayable"
59
- },
60
- {
61
- type: "function",
62
- name: "balanceOf",
63
- inputs: [{
64
- name: "account",
65
- type: "address",
66
- internalType: "address"
67
- }],
68
- outputs: [{
69
- name: "",
70
- type: "uint256",
71
- internalType: "uint256"
72
- }],
73
- stateMutability: "view"
74
- },
75
- {
76
- type: "function",
77
- name: "decimals",
78
- inputs: [],
79
- outputs: [{
80
- name: "",
81
- type: "uint8",
82
- internalType: "uint8"
83
- }],
84
- stateMutability: "view"
85
- },
86
- {
87
- type: "function",
88
- name: "decreaseAllowance",
89
- inputs: [{
90
- name: "spender",
91
- type: "address",
92
- internalType: "address"
93
- }, {
94
- name: "subtractedValue",
95
- type: "uint256",
96
- internalType: "uint256"
97
- }],
98
- outputs: [{
99
- name: "",
100
- type: "bool",
101
- internalType: "bool"
102
- }],
103
- stateMutability: "nonpayable"
104
- },
105
- {
106
- type: "function",
107
- name: "increaseAllowance",
108
- inputs: [{
109
- name: "spender",
110
- type: "address",
111
- internalType: "address"
112
- }, {
113
- name: "addedValue",
114
- type: "uint256",
115
- internalType: "uint256"
116
- }],
117
- outputs: [{
118
- name: "",
119
- type: "bool",
120
- internalType: "bool"
121
- }],
122
- stateMutability: "nonpayable"
123
- },
124
- {
125
- type: "function",
126
- name: "name",
127
- inputs: [],
128
- outputs: [{
129
- name: "",
130
- type: "string",
131
- internalType: "string"
132
- }],
133
- stateMutability: "view"
134
- },
135
- {
136
- type: "function",
137
- name: "symbol",
138
- inputs: [],
139
- outputs: [{
140
- name: "",
141
- type: "string",
142
- internalType: "string"
143
- }],
144
- stateMutability: "view"
145
- },
146
- {
147
- type: "function",
148
- name: "totalSupply",
149
- inputs: [],
150
- outputs: [{
151
- name: "",
152
- type: "uint256",
153
- internalType: "uint256"
154
- }],
155
- stateMutability: "view"
156
- },
157
- {
158
- type: "function",
159
- name: "transfer",
160
- inputs: [{
161
- name: "to",
162
- type: "address",
163
- internalType: "address"
164
- }, {
165
- name: "amount",
166
- type: "uint256",
167
- internalType: "uint256"
168
- }],
169
- outputs: [{
170
- name: "",
171
- type: "bool",
172
- internalType: "bool"
173
- }],
174
- stateMutability: "nonpayable"
175
- },
176
- {
177
- type: "function",
178
- name: "transferFrom",
179
- inputs: [
180
- {
181
- name: "from",
182
- type: "address",
183
- internalType: "address"
184
- },
185
- {
186
- name: "to",
187
- type: "address",
188
- internalType: "address"
189
- },
190
- {
191
- name: "amount",
192
- type: "uint256",
193
- internalType: "uint256"
194
- }
195
- ],
196
- outputs: [{
197
- name: "",
198
- type: "bool",
199
- internalType: "bool"
200
- }],
201
- stateMutability: "nonpayable"
202
- },
203
- {
204
- type: "event",
205
- name: "Approval",
206
- inputs: [
207
- {
208
- name: "owner",
209
- type: "address",
210
- indexed: true,
211
- internalType: "address"
212
- },
213
- {
214
- name: "spender",
215
- type: "address",
216
- indexed: true,
217
- internalType: "address"
218
- },
219
- {
220
- name: "value",
221
- type: "uint256",
222
- indexed: false,
223
- internalType: "uint256"
224
- }
225
- ],
226
- anonymous: false
227
- },
228
- {
229
- type: "event",
230
- name: "Transfer",
231
- inputs: [
232
- {
233
- name: "from",
234
- type: "address",
235
- indexed: true,
236
- internalType: "address"
237
- },
238
- {
239
- name: "to",
240
- type: "address",
241
- indexed: true,
242
- internalType: "address"
243
- },
244
- {
245
- name: "value",
246
- type: "uint256",
247
- indexed: false,
248
- internalType: "uint256"
249
- }
250
- ],
251
- anonymous: false
252
- }
253
- ];
254
-
255
- //#endregion
256
- //#region src/abis/uniswapV3Pool.ts
257
- const uniswapV3PoolAbi = [
258
- {
259
- type: "function",
260
- name: "burn",
261
- inputs: [
262
- {
263
- name: "tickLower",
264
- type: "int24",
265
- internalType: "int24"
266
- },
267
- {
268
- name: "tickUpper",
269
- type: "int24",
270
- internalType: "int24"
271
- },
272
- {
273
- name: "amount",
274
- type: "uint128",
275
- internalType: "uint128"
276
- }
277
- ],
278
- outputs: [{
279
- name: "amount0",
280
- type: "uint256",
281
- internalType: "uint256"
282
- }, {
283
- name: "amount1",
284
- type: "uint256",
285
- internalType: "uint256"
286
- }],
287
- stateMutability: "nonpayable"
288
- },
289
- {
290
- type: "function",
291
- name: "collect",
292
- inputs: [
293
- {
294
- name: "recipient",
295
- type: "address",
296
- internalType: "address"
297
- },
298
- {
299
- name: "tickLower",
300
- type: "int24",
301
- internalType: "int24"
302
- },
303
- {
304
- name: "tickUpper",
305
- type: "int24",
306
- internalType: "int24"
307
- },
308
- {
309
- name: "amount0Requested",
310
- type: "uint128",
311
- internalType: "uint128"
312
- },
313
- {
314
- name: "amount1Requested",
315
- type: "uint128",
316
- internalType: "uint128"
317
- }
318
- ],
319
- outputs: [{
320
- name: "amount0",
321
- type: "uint128",
322
- internalType: "uint128"
323
- }, {
324
- name: "amount1",
325
- type: "uint128",
326
- internalType: "uint128"
327
- }],
328
- stateMutability: "nonpayable"
329
- },
330
- {
331
- type: "function",
332
- name: "collectProtocol",
333
- inputs: [
334
- {
335
- name: "recipient",
336
- type: "address",
337
- internalType: "address"
338
- },
339
- {
340
- name: "amount0Requested",
341
- type: "uint128",
342
- internalType: "uint128"
343
- },
344
- {
345
- name: "amount1Requested",
346
- type: "uint128",
347
- internalType: "uint128"
348
- }
349
- ],
350
- outputs: [{
351
- name: "amount0",
352
- type: "uint128",
353
- internalType: "uint128"
354
- }, {
355
- name: "amount1",
356
- type: "uint128",
357
- internalType: "uint128"
358
- }],
359
- stateMutability: "nonpayable"
360
- },
361
- {
362
- type: "function",
363
- name: "factory",
364
- inputs: [],
365
- outputs: [{
366
- name: "",
367
- type: "address",
368
- internalType: "address"
369
- }],
370
- stateMutability: "view"
371
- },
372
- {
373
- type: "function",
374
- name: "fee",
375
- inputs: [],
376
- outputs: [{
377
- name: "",
378
- type: "uint24",
379
- internalType: "uint24"
380
- }],
381
- stateMutability: "view"
382
- },
383
- {
384
- type: "function",
385
- name: "feeGrowthGlobal0X128",
386
- inputs: [],
387
- outputs: [{
388
- name: "",
389
- type: "uint256",
390
- internalType: "uint256"
391
- }],
392
- stateMutability: "view"
393
- },
394
- {
395
- type: "function",
396
- name: "feeGrowthGlobal1X128",
397
- inputs: [],
398
- outputs: [{
399
- name: "",
400
- type: "uint256",
401
- internalType: "uint256"
402
- }],
403
- stateMutability: "view"
404
- },
405
- {
406
- type: "function",
407
- name: "flash",
408
- inputs: [
409
- {
410
- name: "recipient",
411
- type: "address",
412
- internalType: "address"
413
- },
414
- {
415
- name: "amount0",
416
- type: "uint256",
417
- internalType: "uint256"
418
- },
419
- {
420
- name: "amount1",
421
- type: "uint256",
422
- internalType: "uint256"
423
- },
424
- {
425
- name: "data",
426
- type: "bytes",
427
- internalType: "bytes"
428
- }
429
- ],
430
- outputs: [],
431
- stateMutability: "nonpayable"
432
- },
433
- {
434
- type: "function",
435
- name: "increaseObservationCardinalityNext",
436
- inputs: [{
437
- name: "observationCardinalityNext",
438
- type: "uint16",
439
- internalType: "uint16"
440
- }],
441
- outputs: [],
442
- stateMutability: "nonpayable"
443
- },
444
- {
445
- type: "function",
446
- name: "initialize",
447
- inputs: [{
448
- name: "sqrtPriceX96",
449
- type: "uint160",
450
- internalType: "uint160"
451
- }],
452
- outputs: [],
453
- stateMutability: "nonpayable"
454
- },
455
- {
456
- type: "function",
457
- name: "liquidity",
458
- inputs: [],
459
- outputs: [{
460
- name: "",
461
- type: "uint128",
462
- internalType: "uint128"
463
- }],
464
- stateMutability: "view"
465
- },
466
- {
467
- type: "function",
468
- name: "maxLiquidityPerTick",
469
- inputs: [],
470
- outputs: [{
471
- name: "",
472
- type: "uint128",
473
- internalType: "uint128"
474
- }],
475
- stateMutability: "view"
476
- },
477
- {
478
- type: "function",
479
- name: "mint",
480
- inputs: [
481
- {
482
- name: "recipient",
483
- type: "address",
484
- internalType: "address"
485
- },
486
- {
487
- name: "tickLower",
488
- type: "int24",
489
- internalType: "int24"
490
- },
491
- {
492
- name: "tickUpper",
493
- type: "int24",
494
- internalType: "int24"
495
- },
496
- {
497
- name: "amount",
498
- type: "uint128",
499
- internalType: "uint128"
500
- },
501
- {
502
- name: "data",
503
- type: "bytes",
504
- internalType: "bytes"
505
- }
506
- ],
507
- outputs: [{
508
- name: "amount0",
509
- type: "uint256",
510
- internalType: "uint256"
511
- }, {
512
- name: "amount1",
513
- type: "uint256",
514
- internalType: "uint256"
515
- }],
516
- stateMutability: "nonpayable"
517
- },
518
- {
519
- type: "function",
520
- name: "observations",
521
- inputs: [{
522
- name: "index",
523
- type: "uint256",
524
- internalType: "uint256"
525
- }],
526
- outputs: [
527
- {
528
- name: "blockTimestamp",
529
- type: "uint32",
530
- internalType: "uint32"
531
- },
532
- {
533
- name: "tickCumulative",
534
- type: "int56",
535
- internalType: "int56"
536
- },
537
- {
538
- name: "secondsPerLiquidityCumulativeX128",
539
- type: "uint160",
540
- internalType: "uint160"
541
- },
542
- {
543
- name: "initialized",
544
- type: "bool",
545
- internalType: "bool"
546
- }
547
- ],
548
- stateMutability: "view"
549
- },
550
- {
551
- type: "function",
552
- name: "observe",
553
- inputs: [{
554
- name: "secondsAgos",
555
- type: "uint32[]",
556
- internalType: "uint32[]"
557
- }],
558
- outputs: [{
559
- name: "tickCumulatives",
560
- type: "int56[]",
561
- internalType: "int56[]"
562
- }, {
563
- name: "secondsPerLiquidityCumulativeX128s",
564
- type: "uint160[]",
565
- internalType: "uint160[]"
566
- }],
567
- stateMutability: "view"
568
- },
569
- {
570
- type: "function",
571
- name: "positions",
572
- inputs: [{
573
- name: "key",
574
- type: "bytes32",
575
- internalType: "bytes32"
576
- }],
577
- outputs: [
578
- {
579
- name: "liquidity",
580
- type: "uint128",
581
- internalType: "uint128"
582
- },
583
- {
584
- name: "feeGrowthInside0LastX128",
585
- type: "uint256",
586
- internalType: "uint256"
587
- },
588
- {
589
- name: "feeGrowthInside1LastX128",
590
- type: "uint256",
591
- internalType: "uint256"
592
- },
593
- {
594
- name: "tokensOwed0",
595
- type: "uint128",
596
- internalType: "uint128"
597
- },
598
- {
599
- name: "tokensOwed1",
600
- type: "uint128",
601
- internalType: "uint128"
602
- }
603
- ],
604
- stateMutability: "view"
605
- },
606
- {
607
- type: "function",
608
- name: "protocolFees",
609
- inputs: [],
610
- outputs: [{
611
- name: "token0",
612
- type: "uint128",
613
- internalType: "uint128"
614
- }, {
615
- name: "token1",
616
- type: "uint128",
617
- internalType: "uint128"
618
- }],
619
- stateMutability: "view"
620
- },
621
- {
622
- type: "function",
623
- name: "setFeeProtocol",
624
- inputs: [{
625
- name: "feeProtocol0",
626
- type: "uint8",
627
- internalType: "uint8"
628
- }, {
629
- name: "feeProtocol1",
630
- type: "uint8",
631
- internalType: "uint8"
632
- }],
633
- outputs: [],
634
- stateMutability: "nonpayable"
635
- },
636
- {
637
- type: "function",
638
- name: "slot0",
639
- inputs: [],
640
- outputs: [
641
- {
642
- name: "sqrtPriceX96",
643
- type: "uint160",
644
- internalType: "uint160"
645
- },
646
- {
647
- name: "tick",
648
- type: "int24",
649
- internalType: "int24"
650
- },
651
- {
652
- name: "observationIndex",
653
- type: "uint16",
654
- internalType: "uint16"
655
- },
656
- {
657
- name: "observationCardinality",
658
- type: "uint16",
659
- internalType: "uint16"
660
- },
661
- {
662
- name: "observationCardinalityNext",
663
- type: "uint16",
664
- internalType: "uint16"
665
- },
666
- {
667
- name: "feeProtocol",
668
- type: "uint8",
669
- internalType: "uint8"
670
- },
671
- {
672
- name: "unlocked",
673
- type: "bool",
674
- internalType: "bool"
675
- }
676
- ],
677
- stateMutability: "view"
678
- },
679
- {
680
- type: "function",
681
- name: "snapshotCumulativesInside",
682
- inputs: [{
683
- name: "tickLower",
684
- type: "int24",
685
- internalType: "int24"
686
- }, {
687
- name: "tickUpper",
688
- type: "int24",
689
- internalType: "int24"
690
- }],
691
- outputs: [
692
- {
693
- name: "tickCumulativeInside",
694
- type: "int56",
695
- internalType: "int56"
696
- },
697
- {
698
- name: "secondsPerLiquidityInsideX128",
699
- type: "uint160",
700
- internalType: "uint160"
701
- },
702
- {
703
- name: "secondsInside",
704
- type: "uint32",
705
- internalType: "uint32"
706
- }
707
- ],
708
- stateMutability: "view"
709
- },
710
- {
711
- type: "function",
712
- name: "swap",
713
- inputs: [
714
- {
715
- name: "recipient",
716
- type: "address",
717
- internalType: "address"
718
- },
719
- {
720
- name: "zeroForOne",
721
- type: "bool",
722
- internalType: "bool"
723
- },
724
- {
725
- name: "amountSpecified",
726
- type: "int256",
727
- internalType: "int256"
728
- },
729
- {
730
- name: "sqrtPriceLimitX96",
731
- type: "uint160",
732
- internalType: "uint160"
733
- },
734
- {
735
- name: "data",
736
- type: "bytes",
737
- internalType: "bytes"
738
- }
739
- ],
740
- outputs: [{
741
- name: "amount0",
742
- type: "int256",
743
- internalType: "int256"
744
- }, {
745
- name: "amount1",
746
- type: "int256",
747
- internalType: "int256"
748
- }],
749
- stateMutability: "nonpayable"
750
- },
751
- {
752
- type: "function",
753
- name: "tickBitmap",
754
- inputs: [{
755
- name: "wordPosition",
756
- type: "int16",
757
- internalType: "int16"
758
- }],
759
- outputs: [{
760
- name: "",
761
- type: "uint256",
762
- internalType: "uint256"
763
- }],
764
- stateMutability: "view"
765
- },
766
- {
767
- type: "function",
768
- name: "tickSpacing",
769
- inputs: [],
770
- outputs: [{
771
- name: "",
772
- type: "int24",
773
- internalType: "int24"
774
- }],
775
- stateMutability: "view"
776
- },
777
- {
778
- type: "function",
779
- name: "ticks",
780
- inputs: [{
781
- name: "tick",
782
- type: "int24",
783
- internalType: "int24"
784
- }],
785
- outputs: [
786
- {
787
- name: "liquidityGross",
788
- type: "uint128",
789
- internalType: "uint128"
790
- },
791
- {
792
- name: "liquidityNet",
793
- type: "int128",
794
- internalType: "int128"
795
- },
796
- {
797
- name: "feeGrowthOutside0X128",
798
- type: "uint256",
799
- internalType: "uint256"
800
- },
801
- {
802
- name: "feeGrowthOutside1X128",
803
- type: "uint256",
804
- internalType: "uint256"
805
- },
806
- {
807
- name: "tickCumulativeOutside",
808
- type: "int56",
809
- internalType: "int56"
810
- },
811
- {
812
- name: "secondsPerLiquidityOutsideX128",
813
- type: "uint160",
814
- internalType: "uint160"
815
- },
816
- {
817
- name: "secondsOutside",
818
- type: "uint32",
819
- internalType: "uint32"
820
- },
821
- {
822
- name: "initialized",
823
- type: "bool",
824
- internalType: "bool"
825
- }
826
- ],
827
- stateMutability: "view"
828
- },
829
- {
830
- type: "function",
831
- name: "token0",
832
- inputs: [],
833
- outputs: [{
834
- name: "",
835
- type: "address",
836
- internalType: "address"
837
- }],
838
- stateMutability: "view"
839
- },
840
- {
841
- type: "function",
842
- name: "token1",
843
- inputs: [],
844
- outputs: [{
845
- name: "",
846
- type: "address",
847
- internalType: "address"
848
- }],
849
- stateMutability: "view"
850
- },
851
- {
852
- type: "event",
853
- name: "Burn",
854
- inputs: [
855
- {
856
- name: "owner",
857
- type: "address",
858
- indexed: true,
859
- internalType: "address"
860
- },
861
- {
862
- name: "tickLower",
863
- type: "int24",
864
- indexed: true,
865
- internalType: "int24"
866
- },
867
- {
868
- name: "tickUpper",
869
- type: "int24",
870
- indexed: true,
871
- internalType: "int24"
872
- },
873
- {
874
- name: "amount",
875
- type: "uint128",
876
- indexed: false,
877
- internalType: "uint128"
878
- },
879
- {
880
- name: "amount0",
881
- type: "uint256",
882
- indexed: false,
883
- internalType: "uint256"
884
- },
885
- {
886
- name: "amount1",
887
- type: "uint256",
888
- indexed: false,
889
- internalType: "uint256"
890
- }
891
- ],
892
- anonymous: false
893
- },
894
- {
895
- type: "event",
896
- name: "Collect",
897
- inputs: [
898
- {
899
- name: "owner",
900
- type: "address",
901
- indexed: true,
902
- internalType: "address"
903
- },
904
- {
905
- name: "recipient",
906
- type: "address",
907
- indexed: false,
908
- internalType: "address"
909
- },
910
- {
911
- name: "tickLower",
912
- type: "int24",
913
- indexed: true,
914
- internalType: "int24"
915
- },
916
- {
917
- name: "tickUpper",
918
- type: "int24",
919
- indexed: true,
920
- internalType: "int24"
921
- },
922
- {
923
- name: "amount0",
924
- type: "uint128",
925
- indexed: false,
926
- internalType: "uint128"
927
- },
928
- {
929
- name: "amount1",
930
- type: "uint128",
931
- indexed: false,
932
- internalType: "uint128"
933
- }
934
- ],
935
- anonymous: false
936
- },
937
- {
938
- type: "event",
939
- name: "CollectProtocol",
940
- inputs: [
941
- {
942
- name: "sender",
943
- type: "address",
944
- indexed: true,
945
- internalType: "address"
946
- },
947
- {
948
- name: "recipient",
949
- type: "address",
950
- indexed: true,
951
- internalType: "address"
952
- },
953
- {
954
- name: "amount0",
955
- type: "uint128",
956
- indexed: false,
957
- internalType: "uint128"
958
- },
959
- {
960
- name: "amount1",
961
- type: "uint128",
962
- indexed: false,
963
- internalType: "uint128"
964
- }
965
- ],
966
- anonymous: false
967
- },
968
- {
969
- type: "event",
970
- name: "Flash",
971
- inputs: [
972
- {
973
- name: "sender",
974
- type: "address",
975
- indexed: true,
976
- internalType: "address"
977
- },
978
- {
979
- name: "recipient",
980
- type: "address",
981
- indexed: true,
982
- internalType: "address"
983
- },
984
- {
985
- name: "amount0",
986
- type: "uint256",
987
- indexed: false,
988
- internalType: "uint256"
989
- },
990
- {
991
- name: "amount1",
992
- type: "uint256",
993
- indexed: false,
994
- internalType: "uint256"
995
- },
996
- {
997
- name: "paid0",
998
- type: "uint256",
999
- indexed: false,
1000
- internalType: "uint256"
1001
- },
1002
- {
1003
- name: "paid1",
1004
- type: "uint256",
1005
- indexed: false,
1006
- internalType: "uint256"
1007
- }
1008
- ],
1009
- anonymous: false
1010
- },
1011
- {
1012
- type: "event",
1013
- name: "IncreaseObservationCardinalityNext",
1014
- inputs: [{
1015
- name: "observationCardinalityNextOld",
1016
- type: "uint16",
1017
- indexed: false,
1018
- internalType: "uint16"
1019
- }, {
1020
- name: "observationCardinalityNextNew",
1021
- type: "uint16",
1022
- indexed: false,
1023
- internalType: "uint16"
1024
- }],
1025
- anonymous: false
1026
- },
1027
- {
1028
- type: "event",
1029
- name: "Initialize",
1030
- inputs: [{
1031
- name: "sqrtPriceX96",
1032
- type: "uint160",
1033
- indexed: false,
1034
- internalType: "uint160"
1035
- }, {
1036
- name: "tick",
1037
- type: "int24",
1038
- indexed: false,
1039
- internalType: "int24"
1040
- }],
1041
- anonymous: false
1042
- },
1043
- {
1044
- type: "event",
1045
- name: "Mint",
1046
- inputs: [
1047
- {
1048
- name: "sender",
1049
- type: "address",
1050
- indexed: false,
1051
- internalType: "address"
1052
- },
1053
- {
1054
- name: "owner",
1055
- type: "address",
1056
- indexed: true,
1057
- internalType: "address"
1058
- },
1059
- {
1060
- name: "tickLower",
1061
- type: "int24",
1062
- indexed: true,
1063
- internalType: "int24"
1064
- },
1065
- {
1066
- name: "tickUpper",
1067
- type: "int24",
1068
- indexed: true,
1069
- internalType: "int24"
1070
- },
1071
- {
1072
- name: "amount",
1073
- type: "uint128",
1074
- indexed: false,
1075
- internalType: "uint128"
1076
- },
1077
- {
1078
- name: "amount0",
1079
- type: "uint256",
1080
- indexed: false,
1081
- internalType: "uint256"
1082
- },
1083
- {
1084
- name: "amount1",
1085
- type: "uint256",
1086
- indexed: false,
1087
- internalType: "uint256"
1088
- }
1089
- ],
1090
- anonymous: false
1091
- },
1092
- {
1093
- type: "event",
1094
- name: "SetFeeProtocol",
1095
- inputs: [
1096
- {
1097
- name: "feeProtocol0Old",
1098
- type: "uint8",
1099
- indexed: false,
1100
- internalType: "uint8"
1101
- },
1102
- {
1103
- name: "feeProtocol1Old",
1104
- type: "uint8",
1105
- indexed: false,
1106
- internalType: "uint8"
1107
- },
1108
- {
1109
- name: "feeProtocol0New",
1110
- type: "uint8",
1111
- indexed: false,
1112
- internalType: "uint8"
1113
- },
1114
- {
1115
- name: "feeProtocol1New",
1116
- type: "uint8",
1117
- indexed: false,
1118
- internalType: "uint8"
1119
- }
1120
- ],
1121
- anonymous: false
1122
- },
1123
- {
1124
- type: "event",
1125
- name: "Swap",
1126
- inputs: [
1127
- {
1128
- name: "sender",
1129
- type: "address",
1130
- indexed: true,
1131
- internalType: "address"
1132
- },
1133
- {
1134
- name: "recipient",
1135
- type: "address",
1136
- indexed: true,
1137
- internalType: "address"
1138
- },
1139
- {
1140
- name: "amount0",
1141
- type: "int256",
1142
- indexed: false,
1143
- internalType: "int256"
1144
- },
1145
- {
1146
- name: "amount1",
1147
- type: "int256",
1148
- indexed: false,
1149
- internalType: "int256"
1150
- },
1151
- {
1152
- name: "sqrtPriceX96",
1153
- type: "uint160",
1154
- indexed: false,
1155
- internalType: "uint160"
1156
- },
1157
- {
1158
- name: "liquidity",
1159
- type: "uint128",
1160
- indexed: false,
1161
- internalType: "uint128"
1162
- },
1163
- {
1164
- name: "tick",
1165
- type: "int24",
1166
- indexed: false,
1167
- internalType: "int24"
1168
- }
1169
- ],
1170
- anonymous: false
1171
- },
1172
- {
1173
- type: "error",
1174
- name: "AI",
1175
- inputs: []
1176
- },
1177
- {
1178
- type: "error",
1179
- name: "AS",
1180
- inputs: []
1181
- },
1182
- {
1183
- type: "error",
1184
- name: "F0",
1185
- inputs: []
1186
- },
1187
- {
1188
- type: "error",
1189
- name: "F1",
1190
- inputs: []
1191
- },
1192
- {
1193
- type: "error",
1194
- name: "IIA",
1195
- inputs: []
1196
- },
1197
- {
1198
- type: "error",
1199
- name: "L",
1200
- inputs: []
1201
- },
1202
- {
1203
- type: "error",
1204
- name: "LOK",
1205
- inputs: []
1206
- },
1207
- {
1208
- type: "error",
1209
- name: "M0",
1210
- inputs: []
1211
- },
1212
- {
1213
- type: "error",
1214
- name: "M1",
1215
- inputs: []
1216
- },
1217
- {
1218
- type: "error",
1219
- name: "TLM",
1220
- inputs: []
1221
- },
1222
- {
1223
- type: "error",
1224
- name: "TLU",
1225
- inputs: []
1226
- },
1227
- {
1228
- type: "error",
1229
- name: "TUM",
1230
- inputs: []
1231
- }
1232
- ];
1233
-
1234
- //#endregion
1235
- //#region src/abis/uniswapMathLens.ts
1236
- const uniswapMathLensAbi = [
1237
- {
1238
- type: "function",
1239
- name: "batchGetAmount0ForLiquidity",
1240
- inputs: [
1241
- {
1242
- name: "sqrtRatioAX96",
1243
- type: "uint160[]",
1244
- internalType: "uint160[]"
1245
- },
1246
- {
1247
- name: "sqrtRatioBX96",
1248
- type: "uint160[]",
1249
- internalType: "uint160[]"
1250
- },
1251
- {
1252
- name: "liquidity",
1253
- type: "uint128[]",
1254
- internalType: "uint128[]"
1255
- }
1256
- ],
1257
- outputs: [{
1258
- name: "amounts0",
1259
- type: "uint256[]",
1260
- internalType: "uint256[]"
1261
- }],
1262
- stateMutability: "pure"
1263
- },
1264
- {
1265
- type: "function",
1266
- name: "batchGetAmount0ForLiquidityTicks",
1267
- inputs: [
1268
- {
1269
- name: "tickA",
1270
- type: "int24[]",
1271
- internalType: "int24[]"
1272
- },
1273
- {
1274
- name: "tickB",
1275
- type: "int24[]",
1276
- internalType: "int24[]"
1277
- },
1278
- {
1279
- name: "liquidity",
1280
- type: "uint128[]",
1281
- internalType: "uint128[]"
1282
- }
1283
- ],
1284
- outputs: [{
1285
- name: "amounts0",
1286
- type: "uint256[]",
1287
- internalType: "uint256[]"
1288
- }],
1289
- stateMutability: "pure"
1290
- },
1291
- {
1292
- type: "function",
1293
- name: "batchGetAmount1ForLiquidity",
1294
- inputs: [
1295
- {
1296
- name: "sqrtRatioAX96",
1297
- type: "uint160[]",
1298
- internalType: "uint160[]"
1299
- },
1300
- {
1301
- name: "sqrtRatioBX96",
1302
- type: "uint160[]",
1303
- internalType: "uint160[]"
1304
- },
1305
- {
1306
- name: "liquidity",
1307
- type: "uint128[]",
1308
- internalType: "uint128[]"
1309
- }
1310
- ],
1311
- outputs: [{
1312
- name: "amounts1",
1313
- type: "uint256[]",
1314
- internalType: "uint256[]"
1315
- }],
1316
- stateMutability: "pure"
1317
- },
1318
- {
1319
- type: "function",
1320
- name: "batchGetAmount1ForLiquidityTicks",
1321
- inputs: [
1322
- {
1323
- name: "tickA",
1324
- type: "int24[]",
1325
- internalType: "int24[]"
1326
- },
1327
- {
1328
- name: "tickB",
1329
- type: "int24[]",
1330
- internalType: "int24[]"
1331
- },
1332
- {
1333
- name: "liquidity",
1334
- type: "uint128[]",
1335
- internalType: "uint128[]"
1336
- }
1337
- ],
1338
- outputs: [{
1339
- name: "amounts1",
1340
- type: "uint256[]",
1341
- internalType: "uint256[]"
1342
- }],
1343
- stateMutability: "pure"
1344
- },
1345
- {
1346
- type: "function",
1347
- name: "batchGetAmountsForLiquidity",
1348
- inputs: [
1349
- {
1350
- name: "sqrtRatioX96",
1351
- type: "uint160[]",
1352
- internalType: "uint160[]"
1353
- },
1354
- {
1355
- name: "sqrtRatioAX96",
1356
- type: "uint160[]",
1357
- internalType: "uint160[]"
1358
- },
1359
- {
1360
- name: "sqrtRatioBX96",
1361
- type: "uint160[]",
1362
- internalType: "uint160[]"
1363
- },
1364
- {
1365
- name: "liquidity",
1366
- type: "uint128[]",
1367
- internalType: "uint128[]"
1368
- }
1369
- ],
1370
- outputs: [{
1371
- name: "amounts0",
1372
- type: "uint256[]",
1373
- internalType: "uint256[]"
1374
- }, {
1375
- name: "amounts1",
1376
- type: "uint256[]",
1377
- internalType: "uint256[]"
1378
- }],
1379
- stateMutability: "pure"
1380
- },
1381
- {
1382
- type: "function",
1383
- name: "batchGetAmountsForLiquidityTicks",
1384
- inputs: [
1385
- {
1386
- name: "tick",
1387
- type: "int24[]",
1388
- internalType: "int24[]"
1389
- },
1390
- {
1391
- name: "tickA",
1392
- type: "int24[]",
1393
- internalType: "int24[]"
1394
- },
1395
- {
1396
- name: "tickB",
1397
- type: "int24[]",
1398
- internalType: "int24[]"
1399
- },
1400
- {
1401
- name: "liquidity",
1402
- type: "uint128[]",
1403
- internalType: "uint128[]"
1404
- }
1405
- ],
1406
- outputs: [{
1407
- name: "amounts0",
1408
- type: "uint256[]",
1409
- internalType: "uint256[]"
1410
- }, {
1411
- name: "amounts1",
1412
- type: "uint256[]",
1413
- internalType: "uint256[]"
1414
- }],
1415
- stateMutability: "pure"
1416
- },
1417
- {
1418
- type: "function",
1419
- name: "batchGetLiquidityForAmount0",
1420
- inputs: [
1421
- {
1422
- name: "sqrtRatioAX96",
1423
- type: "uint160[]",
1424
- internalType: "uint160[]"
1425
- },
1426
- {
1427
- name: "sqrtRatioBX96",
1428
- type: "uint160[]",
1429
- internalType: "uint160[]"
1430
- },
1431
- {
1432
- name: "amount0",
1433
- type: "uint256[]",
1434
- internalType: "uint256[]"
1435
- }
1436
- ],
1437
- outputs: [{
1438
- name: "liquidities",
1439
- type: "uint128[]",
1440
- internalType: "uint128[]"
1441
- }],
1442
- stateMutability: "pure"
1443
- },
1444
- {
1445
- type: "function",
1446
- name: "batchGetLiquidityForAmount0Ticks",
1447
- inputs: [
1448
- {
1449
- name: "tickA",
1450
- type: "int24[]",
1451
- internalType: "int24[]"
1452
- },
1453
- {
1454
- name: "tickB",
1455
- type: "int24[]",
1456
- internalType: "int24[]"
1457
- },
1458
- {
1459
- name: "amount0",
1460
- type: "uint256[]",
1461
- internalType: "uint256[]"
1462
- }
1463
- ],
1464
- outputs: [{
1465
- name: "liquidities",
1466
- type: "uint128[]",
1467
- internalType: "uint128[]"
1468
- }],
1469
- stateMutability: "pure"
1470
- },
1471
- {
1472
- type: "function",
1473
- name: "batchGetLiquidityForAmount1",
1474
- inputs: [
1475
- {
1476
- name: "sqrtRatioAX96",
1477
- type: "uint160[]",
1478
- internalType: "uint160[]"
1479
- },
1480
- {
1481
- name: "sqrtRatioBX96",
1482
- type: "uint160[]",
1483
- internalType: "uint160[]"
1484
- },
1485
- {
1486
- name: "amount1",
1487
- type: "uint256[]",
1488
- internalType: "uint256[]"
1489
- }
1490
- ],
1491
- outputs: [{
1492
- name: "liquidities",
1493
- type: "uint128[]",
1494
- internalType: "uint128[]"
1495
- }],
1496
- stateMutability: "pure"
1497
- },
1498
- {
1499
- type: "function",
1500
- name: "batchGetLiquidityForAmount1Ticks",
1501
- inputs: [
1502
- {
1503
- name: "tickA",
1504
- type: "int24[]",
1505
- internalType: "int24[]"
1506
- },
1507
- {
1508
- name: "tickB",
1509
- type: "int24[]",
1510
- internalType: "int24[]"
1511
- },
1512
- {
1513
- name: "amount1",
1514
- type: "uint256[]",
1515
- internalType: "uint256[]"
1516
- }
1517
- ],
1518
- outputs: [{
1519
- name: "liquidities",
1520
- type: "uint128[]",
1521
- internalType: "uint128[]"
1522
- }],
1523
- stateMutability: "pure"
1524
- },
1525
- {
1526
- type: "function",
1527
- name: "batchGetLiquidityForAmounts",
1528
- inputs: [
1529
- {
1530
- name: "sqrtRatioX96",
1531
- type: "uint160[]",
1532
- internalType: "uint160[]"
1533
- },
1534
- {
1535
- name: "sqrtRatioAX96",
1536
- type: "uint160[]",
1537
- internalType: "uint160[]"
1538
- },
1539
- {
1540
- name: "sqrtRatioBX96",
1541
- type: "uint160[]",
1542
- internalType: "uint160[]"
1543
- },
1544
- {
1545
- name: "amount0",
1546
- type: "uint256[]",
1547
- internalType: "uint256[]"
1548
- },
1549
- {
1550
- name: "amount1",
1551
- type: "uint256[]",
1552
- internalType: "uint256[]"
1553
- }
1554
- ],
1555
- outputs: [{
1556
- name: "liquidities",
1557
- type: "uint128[]",
1558
- internalType: "uint128[]"
1559
- }],
1560
- stateMutability: "pure"
1561
- },
1562
- {
1563
- type: "function",
1564
- name: "batchGetLiquidityForAmountsTicks",
1565
- inputs: [
1566
- {
1567
- name: "tick",
1568
- type: "int24[]",
1569
- internalType: "int24[]"
1570
- },
1571
- {
1572
- name: "tickA",
1573
- type: "int24[]",
1574
- internalType: "int24[]"
1575
- },
1576
- {
1577
- name: "tickB",
1578
- type: "int24[]",
1579
- internalType: "int24[]"
1580
- },
1581
- {
1582
- name: "amount0",
1583
- type: "uint256[]",
1584
- internalType: "uint256[]"
1585
- },
1586
- {
1587
- name: "amount1",
1588
- type: "uint256[]",
1589
- internalType: "uint256[]"
1590
- }
1591
- ],
1592
- outputs: [{
1593
- name: "liquidities",
1594
- type: "uint128[]",
1595
- internalType: "uint128[]"
1596
- }],
1597
- stateMutability: "pure"
1598
- },
1599
- {
1600
- type: "function",
1601
- name: "batchGetPriceAtTick",
1602
- inputs: [{
1603
- name: "ticks",
1604
- type: "int24[]",
1605
- internalType: "int24[]"
1606
- }],
1607
- outputs: [{
1608
- name: "prices",
1609
- type: "uint256[]",
1610
- internalType: "uint256[]"
1611
- }],
1612
- stateMutability: "pure"
1613
- },
1614
- {
1615
- type: "function",
1616
- name: "getAmount0ForLiquidity",
1617
- inputs: [
1618
- {
1619
- name: "sqrtRatioAX96",
1620
- type: "uint160",
1621
- internalType: "uint160"
1622
- },
1623
- {
1624
- name: "sqrtRatioBX96",
1625
- type: "uint160",
1626
- internalType: "uint160"
1627
- },
1628
- {
1629
- name: "liquidity",
1630
- type: "uint128",
1631
- internalType: "uint128"
1632
- }
1633
- ],
1634
- outputs: [{
1635
- name: "amount0",
1636
- type: "uint256",
1637
- internalType: "uint256"
1638
- }],
1639
- stateMutability: "pure"
1640
- },
1641
- {
1642
- type: "function",
1643
- name: "getAmount0ForLiquidityTicks",
1644
- inputs: [
1645
- {
1646
- name: "tickA",
1647
- type: "int24",
1648
- internalType: "int24"
1649
- },
1650
- {
1651
- name: "tickB",
1652
- type: "int24",
1653
- internalType: "int24"
1654
- },
1655
- {
1656
- name: "liquidity",
1657
- type: "uint128",
1658
- internalType: "uint128"
1659
- }
1660
- ],
1661
- outputs: [{
1662
- name: "amount0",
1663
- type: "uint256",
1664
- internalType: "uint256"
1665
- }],
1666
- stateMutability: "pure"
1667
- },
1668
- {
1669
- type: "function",
1670
- name: "getAmount1ForLiquidity",
1671
- inputs: [
1672
- {
1673
- name: "sqrtRatioAX96",
1674
- type: "uint160",
1675
- internalType: "uint160"
1676
- },
1677
- {
1678
- name: "sqrtRatioBX96",
1679
- type: "uint160",
1680
- internalType: "uint160"
1681
- },
1682
- {
1683
- name: "liquidity",
1684
- type: "uint128",
1685
- internalType: "uint128"
1686
- }
1687
- ],
1688
- outputs: [{
1689
- name: "amount1",
1690
- type: "uint256",
1691
- internalType: "uint256"
1692
- }],
1693
- stateMutability: "pure"
1694
- },
1695
- {
1696
- type: "function",
1697
- name: "getAmount1ForLiquidityTicks",
1698
- inputs: [
1699
- {
1700
- name: "tickA",
1701
- type: "int24",
1702
- internalType: "int24"
1703
- },
1704
- {
1705
- name: "tickB",
1706
- type: "int24",
1707
- internalType: "int24"
1708
- },
1709
- {
1710
- name: "liquidity",
1711
- type: "uint128",
1712
- internalType: "uint128"
1713
- }
1714
- ],
1715
- outputs: [{
1716
- name: "amount1",
1717
- type: "uint256",
1718
- internalType: "uint256"
1719
- }],
1720
- stateMutability: "pure"
1721
- },
1722
- {
1723
- type: "function",
1724
- name: "getAmountsForLiquidity",
1725
- inputs: [
1726
- {
1727
- name: "sqrtRatioX96",
1728
- type: "uint160",
1729
- internalType: "uint160"
1730
- },
1731
- {
1732
- name: "sqrtRatioAX96",
1733
- type: "uint160",
1734
- internalType: "uint160"
1735
- },
1736
- {
1737
- name: "sqrtRatioBX96",
1738
- type: "uint160",
1739
- internalType: "uint160"
1740
- },
1741
- {
1742
- name: "liquidity",
1743
- type: "uint128",
1744
- internalType: "uint128"
1745
- }
1746
- ],
1747
- outputs: [{
1748
- name: "amount0",
1749
- type: "uint256",
1750
- internalType: "uint256"
1751
- }, {
1752
- name: "amount1",
1753
- type: "uint256",
1754
- internalType: "uint256"
1755
- }],
1756
- stateMutability: "pure"
1757
- },
1758
- {
1759
- type: "function",
1760
- name: "getAmountsForLiquidityTicks",
1761
- inputs: [
1762
- {
1763
- name: "tick",
1764
- type: "int24",
1765
- internalType: "int24"
1766
- },
1767
- {
1768
- name: "tickA",
1769
- type: "int24",
1770
- internalType: "int24"
1771
- },
1772
- {
1773
- name: "tickB",
1774
- type: "int24",
1775
- internalType: "int24"
1776
- },
1777
- {
1778
- name: "liquidity",
1779
- type: "uint128",
1780
- internalType: "uint128"
1781
- }
1782
- ],
1783
- outputs: [{
1784
- name: "amount0",
1785
- type: "uint256",
1786
- internalType: "uint256"
1787
- }, {
1788
- name: "amount1",
1789
- type: "uint256",
1790
- internalType: "uint256"
1791
- }],
1792
- stateMutability: "pure"
1793
- },
1794
- {
1795
- type: "function",
1796
- name: "getLiquidityForAmount0",
1797
- inputs: [
1798
- {
1799
- name: "sqrtRatioAX96",
1800
- type: "uint160",
1801
- internalType: "uint160"
1802
- },
1803
- {
1804
- name: "sqrtRatioBX96",
1805
- type: "uint160",
1806
- internalType: "uint160"
1807
- },
1808
- {
1809
- name: "amount0",
1810
- type: "uint256",
1811
- internalType: "uint256"
1812
- }
1813
- ],
1814
- outputs: [{
1815
- name: "liquidity",
1816
- type: "uint128",
1817
- internalType: "uint128"
1818
- }],
1819
- stateMutability: "pure"
1820
- },
1821
- {
1822
- type: "function",
1823
- name: "getLiquidityForAmount0Ticks",
1824
- inputs: [
1825
- {
1826
- name: "tickA",
1827
- type: "int24",
1828
- internalType: "int24"
1829
- },
1830
- {
1831
- name: "tickB",
1832
- type: "int24",
1833
- internalType: "int24"
1834
- },
1835
- {
1836
- name: "amount0",
1837
- type: "uint256",
1838
- internalType: "uint256"
1839
- }
1840
- ],
1841
- outputs: [{
1842
- name: "liquidity",
1843
- type: "uint128",
1844
- internalType: "uint128"
1845
- }],
1846
- stateMutability: "pure"
1847
- },
1848
- {
1849
- type: "function",
1850
- name: "getLiquidityForAmount1",
1851
- inputs: [
1852
- {
1853
- name: "sqrtRatioAX96",
1854
- type: "uint160",
1855
- internalType: "uint160"
1856
- },
1857
- {
1858
- name: "sqrtRatioBX96",
1859
- type: "uint160",
1860
- internalType: "uint160"
1861
- },
1862
- {
1863
- name: "amount1",
1864
- type: "uint256",
1865
- internalType: "uint256"
1866
- }
1867
- ],
1868
- outputs: [{
1869
- name: "liquidity",
1870
- type: "uint128",
1871
- internalType: "uint128"
1872
- }],
1873
- stateMutability: "pure"
1874
- },
1875
- {
1876
- type: "function",
1877
- name: "getLiquidityForAmount1Ticks",
1878
- inputs: [
1879
- {
1880
- name: "tickA",
1881
- type: "int24",
1882
- internalType: "int24"
1883
- },
1884
- {
1885
- name: "tickB",
1886
- type: "int24",
1887
- internalType: "int24"
1888
- },
1889
- {
1890
- name: "amount1",
1891
- type: "uint256",
1892
- internalType: "uint256"
1893
- }
1894
- ],
1895
- outputs: [{
1896
- name: "liquidity",
1897
- type: "uint128",
1898
- internalType: "uint128"
1899
- }],
1900
- stateMutability: "pure"
1901
- },
1902
- {
1903
- type: "function",
1904
- name: "getLiquidityForAmounts",
1905
- inputs: [
1906
- {
1907
- name: "sqrtRatioX96",
1908
- type: "uint160",
1909
- internalType: "uint160"
1910
- },
1911
- {
1912
- name: "sqrtRatioAX96",
1913
- type: "uint160",
1914
- internalType: "uint160"
1915
- },
1916
- {
1917
- name: "sqrtRatioBX96",
1918
- type: "uint160",
1919
- internalType: "uint160"
1920
- },
1921
- {
1922
- name: "amount0",
1923
- type: "uint256",
1924
- internalType: "uint256"
1925
- },
1926
- {
1927
- name: "amount1",
1928
- type: "uint256",
1929
- internalType: "uint256"
1930
- }
1931
- ],
1932
- outputs: [{
1933
- name: "liquidity",
1934
- type: "uint128",
1935
- internalType: "uint128"
1936
- }],
1937
- stateMutability: "pure"
1938
- },
1939
- {
1940
- type: "function",
1941
- name: "getLiquidityForAmountsTicks",
1942
- inputs: [
1943
- {
1944
- name: "tick",
1945
- type: "int24",
1946
- internalType: "int24"
1947
- },
1948
- {
1949
- name: "tickA",
1950
- type: "int24",
1951
- internalType: "int24"
1952
- },
1953
- {
1954
- name: "tickB",
1955
- type: "int24",
1956
- internalType: "int24"
1957
- },
1958
- {
1959
- name: "amount0",
1960
- type: "uint256",
1961
- internalType: "uint256"
1962
- },
1963
- {
1964
- name: "amount1",
1965
- type: "uint256",
1966
- internalType: "uint256"
1967
- }
1968
- ],
1969
- outputs: [{
1970
- name: "liquidity",
1971
- type: "uint128",
1972
- internalType: "uint128"
1973
- }],
1974
- stateMutability: "pure"
1975
- },
1976
- {
1977
- type: "function",
1978
- name: "getPriceAtTick",
1979
- inputs: [{
1980
- name: "tick",
1981
- type: "int24",
1982
- internalType: "int24"
1983
- }],
1984
- outputs: [{
1985
- name: "",
1986
- type: "uint256",
1987
- internalType: "uint256"
1988
- }],
1989
- stateMutability: "pure"
1990
- }
1991
- ];
1992
-
1993
- //#endregion
1994
- //#region src/abis/lens.ts
1995
- const lensAbi = [
1996
- {
1997
- type: "function",
1998
- name: "batchGetRefTick",
1999
- inputs: [{
2000
- name: "vault",
2001
- type: "address",
2002
- internalType: "contract TimelockSingleOwnerVault"
2003
- }, {
2004
- name: "tickLower",
2005
- type: "int24[]",
2006
- internalType: "int24[]"
2007
- }],
2008
- outputs: [{
2009
- name: "refTicks",
2010
- type: "int24[]",
2011
- internalType: "int24[]"
2012
- }],
2013
- stateMutability: "view"
2014
- },
2015
- {
2016
- type: "function",
2017
- name: "getAllBlocks",
2018
- inputs: [{
2019
- name: "vault",
2020
- type: "address",
2021
- internalType: "contract TimelockVaultCore"
2022
- }],
2023
- outputs: [{
2024
- name: "blocks",
2025
- type: "tuple[]",
2026
- internalType: "struct TimelockLens.LiquidityBlockData[]",
2027
- components: [
2028
- {
2029
- name: "tickLower",
2030
- type: "int24",
2031
- internalType: "int24"
2032
- },
2033
- {
2034
- name: "tickUpper",
2035
- type: "int24",
2036
- internalType: "int24"
2037
- },
2038
- {
2039
- name: "prevTickLower",
2040
- type: "int24",
2041
- internalType: "int24"
2042
- },
2043
- {
2044
- name: "totalLiquidity",
2045
- type: "uint128",
2046
- internalType: "uint128"
2047
- },
2048
- {
2049
- name: "borrowedLiquidity",
2050
- type: "uint128",
2051
- internalType: "uint128"
2052
- },
2053
- {
2054
- name: "totalAmount0",
2055
- type: "uint256",
2056
- internalType: "uint256"
2057
- },
2058
- {
2059
- name: "totalAmount1",
2060
- type: "uint256",
2061
- internalType: "uint256"
2062
- },
2063
- {
2064
- name: "borrowedAmount0",
2065
- type: "uint256",
2066
- internalType: "uint256"
2067
- },
2068
- {
2069
- name: "borrowedAmount1",
2070
- type: "uint256",
2071
- internalType: "uint256"
2072
- }
2073
- ]
2074
- }],
2075
- stateMutability: "view"
2076
- },
2077
- {
2078
- type: "function",
2079
- name: "getExpiredOptions",
2080
- inputs: [
2081
- {
2082
- name: "market",
2083
- type: "address",
2084
- internalType: "contract TimelockOptionsMarket"
2085
- },
2086
- {
2087
- name: "startId",
2088
- type: "uint256",
2089
- internalType: "uint256"
2090
- },
2091
- {
2092
- name: "limit",
2093
- type: "uint256",
2094
- internalType: "uint256"
2095
- }
2096
- ],
2097
- outputs: [
2098
- {
2099
- name: "expiredOptions",
2100
- type: "tuple[]",
2101
- internalType: "struct TimelockLens.OptionData[]",
2102
- components: [
2103
- {
2104
- name: "optionId",
2105
- type: "uint256",
2106
- internalType: "uint256"
2107
- },
2108
- {
2109
- name: "owner",
2110
- type: "address",
2111
- internalType: "address"
2112
- },
2113
- {
2114
- name: "optionType",
2115
- type: "uint8",
2116
- internalType: "uint8"
2117
- },
2118
- {
2119
- name: "leftTick",
2120
- type: "int24",
2121
- internalType: "int24"
2122
- },
2123
- {
2124
- name: "strikeTick",
2125
- type: "int24",
2126
- internalType: "int24"
2127
- },
2128
- {
2129
- name: "entryTick",
2130
- type: "int24",
2131
- internalType: "int24"
2132
- },
2133
- {
2134
- name: "strikePrice",
2135
- type: "uint256",
2136
- internalType: "uint256"
2137
- },
2138
- {
2139
- name: "entryPrice",
2140
- type: "uint256",
2141
- internalType: "uint256"
2142
- },
2143
- {
2144
- name: "optionAssetBorrowed",
2145
- type: "uint256",
2146
- internalType: "uint256"
2147
- },
2148
- {
2149
- name: "payoutAssetBorrowed",
2150
- type: "uint256",
2151
- internalType: "uint256"
2152
- },
2153
- {
2154
- name: "optionAssetToRepay",
2155
- type: "uint256",
2156
- internalType: "uint256"
2157
- },
2158
- {
2159
- name: "payoutAssetToRepay",
2160
- type: "uint256",
2161
- internalType: "uint256"
2162
- },
2163
- {
2164
- name: "positionSize",
2165
- type: "uint256",
2166
- internalType: "uint256"
2167
- },
2168
- {
2169
- name: "netOptionAssetToRepay",
2170
- type: "uint256",
2171
- internalType: "uint256"
2172
- },
2173
- {
2174
- name: "premiumPaid",
2175
- type: "uint128",
2176
- internalType: "uint128"
2177
- },
2178
- {
2179
- name: "expiresAt",
2180
- type: "uint64",
2181
- internalType: "uint64"
2182
- },
2183
- {
2184
- name: "createdAt",
2185
- type: "uint64",
2186
- internalType: "uint64"
2187
- },
2188
- {
2189
- name: "liquidities",
2190
- type: "uint128[]",
2191
- internalType: "uint128[]"
2192
- }
2193
- ]
2194
- },
2195
- {
2196
- name: "nextStartId",
2197
- type: "uint256",
2198
- internalType: "uint256"
2199
- },
2200
- {
2201
- name: "hasMore",
2202
- type: "bool",
2203
- internalType: "bool"
2204
- }
2205
- ],
2206
- stateMutability: "view"
2207
- },
2208
- {
2209
- type: "function",
2210
- name: "getLiquidityAtTick",
2211
- inputs: [{
2212
- name: "vault",
2213
- type: "address",
2214
- internalType: "contract TimelockSingleOwnerVault"
2215
- }, {
2216
- name: "tickLower",
2217
- type: "int24",
2218
- internalType: "int24"
2219
- }],
2220
- outputs: [{
2221
- name: "totalLiquidity",
2222
- type: "uint128",
2223
- internalType: "uint128"
2224
- }, {
2225
- name: "borrowedLiquidity",
2226
- type: "uint128",
2227
- internalType: "uint128"
2228
- }],
2229
- stateMutability: "view"
2230
- },
2231
- {
2232
- type: "function",
2233
- name: "getMarketData",
2234
- inputs: [{
2235
- name: "market",
2236
- type: "address",
2237
- internalType: "contract TimelockOptionsMarket"
2238
- }],
2239
- outputs: [{
2240
- name: "marketData",
2241
- type: "tuple",
2242
- internalType: "struct TimelockLens.TimelockMarketData",
2243
- components: [
2244
- {
2245
- name: "optionAssetIsToken0",
2246
- type: "bool",
2247
- internalType: "bool"
2248
- },
2249
- {
2250
- name: "vault",
2251
- type: "address",
2252
- internalType: "contract ITimelockVault"
2253
- },
2254
- {
2255
- name: "pool",
2256
- type: "address",
2257
- internalType: "contract IUniswapV3Pool"
2258
- },
2259
- {
2260
- name: "optionAsset",
2261
- type: "address",
2262
- internalType: "address"
2263
- },
2264
- {
2265
- name: "payoutAsset",
2266
- type: "address",
2267
- internalType: "address"
2268
- },
2269
- {
2270
- name: "optionAssetDecimals",
2271
- type: "uint8",
2272
- internalType: "uint8"
2273
- },
2274
- {
2275
- name: "payoutAssetDecimals",
2276
- type: "uint8",
2277
- internalType: "uint8"
2278
- },
2279
- {
2280
- name: "optionAssetSymbol",
2281
- type: "string",
2282
- internalType: "string"
2283
- },
2284
- {
2285
- name: "payoutAssetSymbol",
2286
- type: "string",
2287
- internalType: "string"
2288
- },
2289
- {
2290
- name: "optionAssetName",
2291
- type: "string",
2292
- internalType: "string"
2293
- },
2294
- {
2295
- name: "payoutAssetName",
2296
- type: "string",
2297
- internalType: "string"
2298
- },
2299
- {
2300
- name: "optionsCount",
2301
- type: "uint256",
2302
- internalType: "uint256"
2303
- }
2304
- ]
2305
- }],
2306
- stateMutability: "view"
2307
- },
2308
- {
2309
- type: "function",
2310
- name: "getMaxPositionSize",
2311
- inputs: [
2312
- {
2313
- name: "market",
2314
- type: "address",
2315
- internalType: "contract TimelockOptionsMarket"
2316
- },
2317
- {
2318
- name: "strikeTick",
2319
- type: "int24",
2320
- internalType: "int24"
2321
- },
2322
- {
2323
- name: "maxBorrowableRange",
2324
- type: "int24",
2325
- internalType: "int24"
2326
- }
2327
- ],
2328
- outputs: [{
2329
- name: "maxCallSize",
2330
- type: "uint256",
2331
- internalType: "uint256"
2332
- }, {
2333
- name: "maxPutSize",
2334
- type: "uint256",
2335
- internalType: "uint256"
2336
- }],
2337
- stateMutability: "view"
2338
- },
2339
- {
2340
- type: "function",
2341
- name: "getMaxPositionSizeAtCurrentTick",
2342
- inputs: [{
2343
- name: "market",
2344
- type: "address",
2345
- internalType: "contract TimelockOptionsMarket"
2346
- }, {
2347
- name: "maxBorrowableRange",
2348
- type: "int24",
2349
- internalType: "int24"
2350
- }],
2351
- outputs: [{
2352
- name: "maxCallSize",
2353
- type: "uint256",
2354
- internalType: "uint256"
2355
- }, {
2356
- name: "maxPutSize",
2357
- type: "uint256",
2358
- internalType: "uint256"
2359
- }],
2360
- stateMutability: "view"
2361
- },
2362
- {
2363
- type: "function",
2364
- name: "getOptionData",
2365
- inputs: [{
2366
- name: "market",
2367
- type: "address",
2368
- internalType: "contract TimelockOptionsMarket"
2369
- }, {
2370
- name: "optionId",
2371
- type: "uint256",
2372
- internalType: "uint256"
2373
- }],
2374
- outputs: [{
2375
- name: "",
2376
- type: "tuple",
2377
- internalType: "struct TimelockLens.OptionData",
2378
- components: [
2379
- {
2380
- name: "optionId",
2381
- type: "uint256",
2382
- internalType: "uint256"
2383
- },
2384
- {
2385
- name: "owner",
2386
- type: "address",
2387
- internalType: "address"
2388
- },
2389
- {
2390
- name: "optionType",
2391
- type: "uint8",
2392
- internalType: "uint8"
2393
- },
2394
- {
2395
- name: "leftTick",
2396
- type: "int24",
2397
- internalType: "int24"
2398
- },
2399
- {
2400
- name: "strikeTick",
2401
- type: "int24",
2402
- internalType: "int24"
2403
- },
2404
- {
2405
- name: "entryTick",
2406
- type: "int24",
2407
- internalType: "int24"
2408
- },
2409
- {
2410
- name: "strikePrice",
2411
- type: "uint256",
2412
- internalType: "uint256"
2413
- },
2414
- {
2415
- name: "entryPrice",
2416
- type: "uint256",
2417
- internalType: "uint256"
2418
- },
2419
- {
2420
- name: "optionAssetBorrowed",
2421
- type: "uint256",
2422
- internalType: "uint256"
2423
- },
2424
- {
2425
- name: "payoutAssetBorrowed",
2426
- type: "uint256",
2427
- internalType: "uint256"
2428
- },
2429
- {
2430
- name: "optionAssetToRepay",
2431
- type: "uint256",
2432
- internalType: "uint256"
2433
- },
2434
- {
2435
- name: "payoutAssetToRepay",
2436
- type: "uint256",
2437
- internalType: "uint256"
2438
- },
2439
- {
2440
- name: "positionSize",
2441
- type: "uint256",
2442
- internalType: "uint256"
2443
- },
2444
- {
2445
- name: "netOptionAssetToRepay",
2446
- type: "uint256",
2447
- internalType: "uint256"
2448
- },
2449
- {
2450
- name: "premiumPaid",
2451
- type: "uint128",
2452
- internalType: "uint128"
2453
- },
2454
- {
2455
- name: "expiresAt",
2456
- type: "uint64",
2457
- internalType: "uint64"
2458
- },
2459
- {
2460
- name: "createdAt",
2461
- type: "uint64",
2462
- internalType: "uint64"
2463
- },
2464
- {
2465
- name: "liquidities",
2466
- type: "uint128[]",
2467
- internalType: "uint128[]"
2468
- }
2469
- ]
2470
- }],
2471
- stateMutability: "view"
2472
- },
2473
- {
2474
- type: "function",
2475
- name: "getOptionsData",
2476
- inputs: [{
2477
- name: "market",
2478
- type: "address",
2479
- internalType: "contract TimelockOptionsMarket"
2480
- }, {
2481
- name: "optionIds",
2482
- type: "uint256[]",
2483
- internalType: "uint256[]"
2484
- }],
2485
- outputs: [{
2486
- name: "optionsData",
2487
- type: "tuple[]",
2488
- internalType: "struct TimelockLens.OptionData[]",
2489
- components: [
2490
- {
2491
- name: "optionId",
2492
- type: "uint256",
2493
- internalType: "uint256"
2494
- },
2495
- {
2496
- name: "owner",
2497
- type: "address",
2498
- internalType: "address"
2499
- },
2500
- {
2501
- name: "optionType",
2502
- type: "uint8",
2503
- internalType: "uint8"
2504
- },
2505
- {
2506
- name: "leftTick",
2507
- type: "int24",
2508
- internalType: "int24"
2509
- },
2510
- {
2511
- name: "strikeTick",
2512
- type: "int24",
2513
- internalType: "int24"
2514
- },
2515
- {
2516
- name: "entryTick",
2517
- type: "int24",
2518
- internalType: "int24"
2519
- },
2520
- {
2521
- name: "strikePrice",
2522
- type: "uint256",
2523
- internalType: "uint256"
2524
- },
2525
- {
2526
- name: "entryPrice",
2527
- type: "uint256",
2528
- internalType: "uint256"
2529
- },
2530
- {
2531
- name: "optionAssetBorrowed",
2532
- type: "uint256",
2533
- internalType: "uint256"
2534
- },
2535
- {
2536
- name: "payoutAssetBorrowed",
2537
- type: "uint256",
2538
- internalType: "uint256"
2539
- },
2540
- {
2541
- name: "optionAssetToRepay",
2542
- type: "uint256",
2543
- internalType: "uint256"
2544
- },
2545
- {
2546
- name: "payoutAssetToRepay",
2547
- type: "uint256",
2548
- internalType: "uint256"
2549
- },
2550
- {
2551
- name: "positionSize",
2552
- type: "uint256",
2553
- internalType: "uint256"
2554
- },
2555
- {
2556
- name: "netOptionAssetToRepay",
2557
- type: "uint256",
2558
- internalType: "uint256"
2559
- },
2560
- {
2561
- name: "premiumPaid",
2562
- type: "uint128",
2563
- internalType: "uint128"
2564
- },
2565
- {
2566
- name: "expiresAt",
2567
- type: "uint64",
2568
- internalType: "uint64"
2569
- },
2570
- {
2571
- name: "createdAt",
2572
- type: "uint64",
2573
- internalType: "uint64"
2574
- },
2575
- {
2576
- name: "liquidities",
2577
- type: "uint128[]",
2578
- internalType: "uint128[]"
2579
- }
2580
- ]
2581
- }],
2582
- stateMutability: "view"
2583
- },
2584
- {
2585
- type: "function",
2586
- name: "getPoolData",
2587
- inputs: [{
2588
- name: "pool",
2589
- type: "address",
2590
- internalType: "contract IUniswapV3Pool"
2591
- }],
2592
- outputs: [{
2593
- name: "poolData",
2594
- type: "tuple",
2595
- internalType: "struct TimelockLens.UniswapPoolData",
2596
- components: [
2597
- {
2598
- name: "token0",
2599
- type: "address",
2600
- internalType: "address"
2601
- },
2602
- {
2603
- name: "token1",
2604
- type: "address",
2605
- internalType: "address"
2606
- },
2607
- {
2608
- name: "token0Decimals",
2609
- type: "uint8",
2610
- internalType: "uint8"
2611
- },
2612
- {
2613
- name: "token1Decimals",
2614
- type: "uint8",
2615
- internalType: "uint8"
2616
- },
2617
- {
2618
- name: "token0Symbol",
2619
- type: "string",
2620
- internalType: "string"
2621
- },
2622
- {
2623
- name: "token1Symbol",
2624
- type: "string",
2625
- internalType: "string"
2626
- },
2627
- {
2628
- name: "token0Name",
2629
- type: "string",
2630
- internalType: "string"
2631
- },
2632
- {
2633
- name: "token1Name",
2634
- type: "string",
2635
- internalType: "string"
2636
- },
2637
- {
2638
- name: "tickSpacing",
2639
- type: "int24",
2640
- internalType: "int24"
2641
- },
2642
- {
2643
- name: "fee",
2644
- type: "uint24",
2645
- internalType: "uint24"
2646
- }
2647
- ]
2648
- }],
2649
- stateMutability: "view"
2650
- },
2651
- {
2652
- type: "function",
2653
- name: "getRefTick",
2654
- inputs: [{
2655
- name: "vault",
2656
- type: "address",
2657
- internalType: "contract TimelockSingleOwnerVault"
2658
- }, {
2659
- name: "tickLower",
2660
- type: "int24",
2661
- internalType: "int24"
2662
- }],
2663
- outputs: [{
2664
- name: "refTick",
2665
- type: "int24",
2666
- internalType: "int24"
2667
- }],
2668
- stateMutability: "view"
2669
- },
2670
- {
2671
- type: "function",
2672
- name: "getUserOptions",
2673
- inputs: [
2674
- {
2675
- name: "market",
2676
- type: "address",
2677
- internalType: "contract TimelockOptionsMarket"
2678
- },
2679
- {
2680
- name: "user",
2681
- type: "address",
2682
- internalType: "address"
2683
- },
2684
- {
2685
- name: "startId",
2686
- type: "uint256",
2687
- internalType: "uint256"
2688
- },
2689
- {
2690
- name: "limit",
2691
- type: "uint256",
2692
- internalType: "uint256"
2693
- }
2694
- ],
2695
- outputs: [
2696
- {
2697
- name: "userOptions",
2698
- type: "tuple[]",
2699
- internalType: "struct TimelockLens.OptionData[]",
2700
- components: [
2701
- {
2702
- name: "optionId",
2703
- type: "uint256",
2704
- internalType: "uint256"
2705
- },
2706
- {
2707
- name: "owner",
2708
- type: "address",
2709
- internalType: "address"
2710
- },
2711
- {
2712
- name: "optionType",
2713
- type: "uint8",
2714
- internalType: "uint8"
2715
- },
2716
- {
2717
- name: "leftTick",
2718
- type: "int24",
2719
- internalType: "int24"
2720
- },
2721
- {
2722
- name: "strikeTick",
2723
- type: "int24",
2724
- internalType: "int24"
2725
- },
2726
- {
2727
- name: "entryTick",
2728
- type: "int24",
2729
- internalType: "int24"
2730
- },
2731
- {
2732
- name: "strikePrice",
2733
- type: "uint256",
2734
- internalType: "uint256"
2735
- },
2736
- {
2737
- name: "entryPrice",
2738
- type: "uint256",
2739
- internalType: "uint256"
2740
- },
2741
- {
2742
- name: "optionAssetBorrowed",
2743
- type: "uint256",
2744
- internalType: "uint256"
2745
- },
2746
- {
2747
- name: "payoutAssetBorrowed",
2748
- type: "uint256",
2749
- internalType: "uint256"
2750
- },
2751
- {
2752
- name: "optionAssetToRepay",
2753
- type: "uint256",
2754
- internalType: "uint256"
2755
- },
2756
- {
2757
- name: "payoutAssetToRepay",
2758
- type: "uint256",
2759
- internalType: "uint256"
2760
- },
2761
- {
2762
- name: "positionSize",
2763
- type: "uint256",
2764
- internalType: "uint256"
2765
- },
2766
- {
2767
- name: "netOptionAssetToRepay",
2768
- type: "uint256",
2769
- internalType: "uint256"
2770
- },
2771
- {
2772
- name: "premiumPaid",
2773
- type: "uint128",
2774
- internalType: "uint128"
2775
- },
2776
- {
2777
- name: "expiresAt",
2778
- type: "uint64",
2779
- internalType: "uint64"
2780
- },
2781
- {
2782
- name: "createdAt",
2783
- type: "uint64",
2784
- internalType: "uint64"
2785
- },
2786
- {
2787
- name: "liquidities",
2788
- type: "uint128[]",
2789
- internalType: "uint128[]"
2790
- }
2791
- ]
2792
- },
2793
- {
2794
- name: "nextStartId",
2795
- type: "uint256",
2796
- internalType: "uint256"
2797
- },
2798
- {
2799
- name: "hasMore",
2800
- type: "bool",
2801
- internalType: "bool"
2802
- }
2803
- ],
2804
- stateMutability: "view"
2805
- },
2806
- {
2807
- type: "function",
2808
- name: "getVaultTVL",
2809
- inputs: [{
2810
- name: "vault",
2811
- type: "address",
2812
- internalType: "contract TimelockVaultCore"
2813
- }],
2814
- outputs: [
2815
- {
2816
- name: "totalAmount0",
2817
- type: "uint256",
2818
- internalType: "uint256"
2819
- },
2820
- {
2821
- name: "totalAmount1",
2822
- type: "uint256",
2823
- internalType: "uint256"
2824
- },
2825
- {
2826
- name: "borrowedAmount0",
2827
- type: "uint256",
2828
- internalType: "uint256"
2829
- },
2830
- {
2831
- name: "borrowedAmount1",
2832
- type: "uint256",
2833
- internalType: "uint256"
2834
- },
2835
- {
2836
- name: "tvl0",
2837
- type: "uint256",
2838
- internalType: "uint256"
2839
- },
2840
- {
2841
- name: "tvl1",
2842
- type: "uint256",
2843
- internalType: "uint256"
2844
- }
2845
- ],
2846
- stateMutability: "view"
2847
- }
2848
- ];
2849
-
2850
- //#endregion
2851
- //#region src/abis/singleOwnerVault.ts
2852
- const singleOwnerVaultAbi = [
2853
- {
2854
- type: "constructor",
2855
- inputs: [{
2856
- name: "_pool",
2857
- type: "address",
2858
- internalType: "contract IUniswapV3Pool"
2859
- }, {
2860
- name: "_owner",
2861
- type: "address",
2862
- internalType: "address"
2863
- }],
2864
- stateMutability: "nonpayable"
2865
- },
2866
- {
2867
- type: "function",
2868
- name: "BORROW",
2869
- inputs: [],
2870
- outputs: [{
2871
- name: "",
2872
- type: "uint8",
2873
- internalType: "uint8"
2874
- }],
2875
- stateMutability: "view"
2876
- },
2877
- {
2878
- type: "function",
2879
- name: "BURN",
2880
- inputs: [],
2881
- outputs: [{
2882
- name: "",
2883
- type: "uint8",
2884
- internalType: "uint8"
2885
- }],
2886
- stateMutability: "view"
2887
- },
2888
- {
2889
- type: "function",
2890
- name: "MINT",
2891
- inputs: [],
2892
- outputs: [{
2893
- name: "",
2894
- type: "uint8",
2895
- internalType: "uint8"
2896
- }],
2897
- stateMutability: "view"
2898
- },
2899
- {
2900
- type: "function",
2901
- name: "MIN_DUST_THRESHOLD",
2902
- inputs: [],
2903
- outputs: [{
2904
- name: "",
2905
- type: "uint256",
2906
- internalType: "uint256"
2907
- }],
2908
- stateMutability: "view"
2909
- },
2910
- {
2911
- type: "function",
2912
- name: "REPAY",
2913
- inputs: [],
2914
- outputs: [{
2915
- name: "",
2916
- type: "uint8",
2917
- internalType: "uint8"
2918
- }],
2919
- stateMutability: "view"
2920
- },
2921
- {
2922
- type: "function",
2923
- name: "blocks",
2924
- inputs: [{
2925
- name: "",
2926
- type: "int24",
2927
- internalType: "int24"
2928
- }],
2929
- outputs: [
2930
- {
2931
- name: "tickLower",
2932
- type: "int24",
2933
- internalType: "int24"
2934
- },
2935
- {
2936
- name: "tickUpper",
2937
- type: "int24",
2938
- internalType: "int24"
2939
- },
2940
- {
2941
- name: "prevTickLower",
2942
- type: "int24",
2943
- internalType: "int24"
2944
- },
2945
- {
2946
- name: "totalLiquidity",
2947
- type: "uint128",
2948
- internalType: "uint128"
2949
- },
2950
- {
2951
- name: "borrowedLiquidity",
2952
- type: "uint128",
2953
- internalType: "uint128"
2954
- }
2955
- ],
2956
- stateMutability: "view"
2957
- },
2958
- {
2959
- type: "function",
2960
- name: "blocksCount",
2961
- inputs: [],
2962
- outputs: [{
2963
- name: "",
2964
- type: "uint256",
2965
- internalType: "uint256"
2966
- }],
2967
- stateMutability: "view"
2968
- },
2969
- {
2970
- type: "function",
2971
- name: "borrow",
2972
- inputs: [
2973
- {
2974
- name: "tickLower",
2975
- type: "int24",
2976
- internalType: "int24"
2977
- },
2978
- {
2979
- name: "tickUpper",
2980
- type: "int24",
2981
- internalType: "int24"
2982
- },
2983
- {
2984
- name: "liquidity",
2985
- type: "uint128",
2986
- internalType: "uint128"
2987
- },
2988
- {
2989
- name: "refTick",
2990
- type: "int24",
2991
- internalType: "int24"
2992
- }
2993
- ],
2994
- outputs: [{
2995
- name: "amount0",
2996
- type: "uint256",
2997
- internalType: "uint256"
2998
- }, {
2999
- name: "amount1",
3000
- type: "uint256",
3001
- internalType: "uint256"
3002
- }],
3003
- stateMutability: "nonpayable"
3004
- },
3005
- {
3006
- type: "function",
3007
- name: "borrowerWhitelist",
3008
- inputs: [{
3009
- name: "",
3010
- type: "address",
3011
- internalType: "address"
3012
- }],
3013
- outputs: [{
3014
- name: "",
3015
- type: "bool",
3016
- internalType: "bool"
3017
- }],
3018
- stateMutability: "view"
3019
- },
3020
- {
3021
- type: "function",
3022
- name: "burn",
3023
- inputs: [
3024
- {
3025
- name: "tickLower",
3026
- type: "int24",
3027
- internalType: "int24"
3028
- },
3029
- {
3030
- name: "tickUpper",
3031
- type: "int24",
3032
- internalType: "int24"
3033
- },
3034
- {
3035
- name: "liquidity",
3036
- type: "uint128",
3037
- internalType: "uint128"
3038
- },
3039
- {
3040
- name: "refTick",
3041
- type: "int24",
3042
- internalType: "int24"
3043
- }
3044
- ],
3045
- outputs: [{
3046
- name: "amount0",
3047
- type: "uint256",
3048
- internalType: "uint256"
3049
- }, {
3050
- name: "amount1",
3051
- type: "uint256",
3052
- internalType: "uint256"
3053
- }],
3054
- stateMutability: "nonpayable"
3055
- },
3056
- {
3057
- type: "function",
3058
- name: "collectFees",
3059
- inputs: [{
3060
- name: "tickLower",
3061
- type: "int24",
3062
- internalType: "int24"
3063
- }, {
3064
- name: "tickUpper",
3065
- type: "int24",
3066
- internalType: "int24"
3067
- }],
3068
- outputs: [{
3069
- name: "totalAmount0",
3070
- type: "uint256",
3071
- internalType: "uint256"
3072
- }, {
3073
- name: "totalAmount1",
3074
- type: "uint256",
3075
- internalType: "uint256"
3076
- }],
3077
- stateMutability: "nonpayable"
3078
- },
3079
- {
3080
- type: "function",
3081
- name: "getBlock",
3082
- inputs: [{
3083
- name: "tickLower",
3084
- type: "int24",
3085
- internalType: "int24"
3086
- }, {
3087
- name: "refTick",
3088
- type: "int24",
3089
- internalType: "int24"
3090
- }],
3091
- outputs: [{
3092
- name: "",
3093
- type: "tuple",
3094
- internalType: "struct TimelockVaultCore.LiquidityBlock",
3095
- components: [
3096
- {
3097
- name: "tickLower",
3098
- type: "int24",
3099
- internalType: "int24"
3100
- },
3101
- {
3102
- name: "tickUpper",
3103
- type: "int24",
3104
- internalType: "int24"
3105
- },
3106
- {
3107
- name: "prevTickLower",
3108
- type: "int24",
3109
- internalType: "int24"
3110
- },
3111
- {
3112
- name: "totalLiquidity",
3113
- type: "uint128",
3114
- internalType: "uint128"
3115
- },
3116
- {
3117
- name: "borrowedLiquidity",
3118
- type: "uint128",
3119
- internalType: "uint128"
3120
- }
3121
- ]
3122
- }],
3123
- stateMutability: "view"
3124
- },
3125
- {
3126
- type: "function",
3127
- name: "highestTick",
3128
- inputs: [],
3129
- outputs: [{
3130
- name: "",
3131
- type: "int24",
3132
- internalType: "int24"
3133
- }],
3134
- stateMutability: "view"
3135
- },
3136
- {
3137
- type: "function",
3138
- name: "lowestTick",
3139
- inputs: [],
3140
- outputs: [{
3141
- name: "",
3142
- type: "int24",
3143
- internalType: "int24"
3144
- }],
3145
- stateMutability: "view"
3146
- },
3147
- {
3148
- type: "function",
3149
- name: "mint",
3150
- inputs: [
3151
- {
3152
- name: "tickLower",
3153
- type: "int24",
3154
- internalType: "int24"
3155
- },
3156
- {
3157
- name: "tickUpper",
3158
- type: "int24",
3159
- internalType: "int24"
3160
- },
3161
- {
3162
- name: "liquidity",
3163
- type: "uint128",
3164
- internalType: "uint128"
3165
- },
3166
- {
3167
- name: "refTick",
3168
- type: "int24",
3169
- internalType: "int24"
3170
- }
3171
- ],
3172
- outputs: [{
3173
- name: "amount0",
3174
- type: "uint256",
3175
- internalType: "uint256"
3176
- }, {
3177
- name: "amount1",
3178
- type: "uint256",
3179
- internalType: "uint256"
3180
- }],
3181
- stateMutability: "nonpayable"
3182
- },
3183
- {
3184
- type: "function",
3185
- name: "multicall",
3186
- inputs: [{
3187
- name: "data",
3188
- type: "bytes[]",
3189
- internalType: "bytes[]"
3190
- }],
3191
- outputs: [{
3192
- name: "results",
3193
- type: "bytes[]",
3194
- internalType: "bytes[]"
3195
- }],
3196
- stateMutability: "nonpayable"
3197
- },
3198
- {
3199
- type: "function",
3200
- name: "owner",
3201
- inputs: [],
3202
- outputs: [{
3203
- name: "",
3204
- type: "address",
3205
- internalType: "address"
3206
- }],
3207
- stateMutability: "view"
3208
- },
3209
- {
3210
- type: "function",
3211
- name: "pool",
3212
- inputs: [],
3213
- outputs: [{
3214
- name: "",
3215
- type: "address",
3216
- internalType: "contract IUniswapV3Pool"
3217
- }],
3218
- stateMutability: "view"
3219
- },
3220
- {
3221
- type: "function",
3222
- name: "pool_",
3223
- inputs: [],
3224
- outputs: [{
3225
- name: "",
3226
- type: "address",
3227
- internalType: "contract IUniswapV3Pool"
3228
- }],
3229
- stateMutability: "view"
3230
- },
3231
- {
3232
- type: "function",
3233
- name: "renounceOwnership",
3234
- inputs: [],
3235
- outputs: [],
3236
- stateMutability: "nonpayable"
3237
- },
3238
- {
3239
- type: "function",
3240
- name: "repay",
3241
- inputs: [
3242
- {
3243
- name: "tickLower",
3244
- type: "int24",
3245
- internalType: "int24"
3246
- },
3247
- {
3248
- name: "tickUpper",
3249
- type: "int24",
3250
- internalType: "int24"
3251
- },
3252
- {
3253
- name: "liquidity",
3254
- type: "uint128",
3255
- internalType: "uint128"
3256
- },
3257
- {
3258
- name: "refTick",
3259
- type: "int24",
3260
- internalType: "int24"
3261
- }
3262
- ],
3263
- outputs: [{
3264
- name: "amount0",
3265
- type: "uint256",
3266
- internalType: "uint256"
3267
- }, {
3268
- name: "amount1",
3269
- type: "uint256",
3270
- internalType: "uint256"
3271
- }],
3272
- stateMutability: "nonpayable"
3273
- },
3274
- {
3275
- type: "function",
3276
- name: "tickSpacing",
3277
- inputs: [],
3278
- outputs: [{
3279
- name: "",
3280
- type: "int24",
3281
- internalType: "int24"
3282
- }],
3283
- stateMutability: "view"
3284
- },
3285
- {
3286
- type: "function",
3287
- name: "token0",
3288
- inputs: [],
3289
- outputs: [{
3290
- name: "",
3291
- type: "address",
3292
- internalType: "contract IERC20"
3293
- }],
3294
- stateMutability: "view"
3295
- },
3296
- {
3297
- type: "function",
3298
- name: "token1",
3299
- inputs: [],
3300
- outputs: [{
3301
- name: "",
3302
- type: "address",
3303
- internalType: "contract IERC20"
3304
- }],
3305
- stateMutability: "view"
3306
- },
3307
- {
3308
- type: "function",
3309
- name: "transferOwnership",
3310
- inputs: [{
3311
- name: "newOwner",
3312
- type: "address",
3313
- internalType: "address"
3314
- }],
3315
- outputs: [],
3316
- stateMutability: "nonpayable"
3317
- },
3318
- {
3319
- type: "function",
3320
- name: "uniswapV3MintCallback",
3321
- inputs: [
3322
- {
3323
- name: "amount0",
3324
- type: "uint256",
3325
- internalType: "uint256"
3326
- },
3327
- {
3328
- name: "amount1",
3329
- type: "uint256",
3330
- internalType: "uint256"
3331
- },
3332
- {
3333
- name: "data",
3334
- type: "bytes",
3335
- internalType: "bytes"
3336
- }
3337
- ],
3338
- outputs: [],
3339
- stateMutability: "nonpayable"
3340
- },
3341
- {
3342
- type: "function",
3343
- name: "whitelistBorrower",
3344
- inputs: [{
3345
- name: "borrower",
3346
- type: "address",
3347
- internalType: "address"
3348
- }, {
3349
- name: "status",
3350
- type: "bool",
3351
- internalType: "bool"
3352
- }],
3353
- outputs: [],
3354
- stateMutability: "nonpayable"
3355
- },
3356
- {
3357
- type: "function",
3358
- name: "withdrawTokens",
3359
- inputs: [{
3360
- name: "tokens",
3361
- type: "address[]",
3362
- internalType: "contract IERC20[]"
3363
- }],
3364
- outputs: [],
3365
- stateMutability: "nonpayable"
3366
- },
3367
- {
3368
- type: "event",
3369
- name: "Borrow",
3370
- inputs: [
3371
- {
3372
- name: "user",
3373
- type: "address",
3374
- indexed: false,
3375
- internalType: "address"
3376
- },
3377
- {
3378
- name: "tickLower",
3379
- type: "int24",
3380
- indexed: false,
3381
- internalType: "int24"
3382
- },
3383
- {
3384
- name: "tickUpper",
3385
- type: "int24",
3386
- indexed: false,
3387
- internalType: "int24"
3388
- },
3389
- {
3390
- name: "liquidity",
3391
- type: "uint128",
3392
- indexed: false,
3393
- internalType: "uint128"
3394
- }
3395
- ],
3396
- anonymous: false
3397
- },
3398
- {
3399
- type: "event",
3400
- name: "Burn",
3401
- inputs: [
3402
- {
3403
- name: "user",
3404
- type: "address",
3405
- indexed: false,
3406
- internalType: "address"
3407
- },
3408
- {
3409
- name: "tickLower",
3410
- type: "int24",
3411
- indexed: false,
3412
- internalType: "int24"
3413
- },
3414
- {
3415
- name: "tickUpper",
3416
- type: "int24",
3417
- indexed: false,
3418
- internalType: "int24"
3419
- },
3420
- {
3421
- name: "liquidity",
3422
- type: "uint128",
3423
- indexed: false,
3424
- internalType: "uint128"
3425
- }
3426
- ],
3427
- anonymous: false
3428
- },
3429
- {
3430
- type: "event",
3431
- name: "FeesCollected",
3432
- inputs: [
3433
- {
3434
- name: "feeRecipient",
3435
- type: "address",
3436
- indexed: false,
3437
- internalType: "address"
3438
- },
3439
- {
3440
- name: "amount0",
3441
- type: "uint256",
3442
- indexed: false,
3443
- internalType: "uint256"
3444
- },
3445
- {
3446
- name: "amount1",
3447
- type: "uint256",
3448
- indexed: false,
3449
- internalType: "uint256"
3450
- }
3451
- ],
3452
- anonymous: false
3453
- },
3454
- {
3455
- type: "event",
3456
- name: "Mint",
3457
- inputs: [
3458
- {
3459
- name: "user",
3460
- type: "address",
3461
- indexed: false,
3462
- internalType: "address"
3463
- },
3464
- {
3465
- name: "tickLower",
3466
- type: "int24",
3467
- indexed: false,
3468
- internalType: "int24"
3469
- },
3470
- {
3471
- name: "tickUpper",
3472
- type: "int24",
3473
- indexed: false,
3474
- internalType: "int24"
3475
- },
3476
- {
3477
- name: "liquidity",
3478
- type: "uint128",
3479
- indexed: false,
3480
- internalType: "uint128"
3481
- }
3482
- ],
3483
- anonymous: false
3484
- },
3485
- {
3486
- type: "event",
3487
- name: "OwnershipTransferred",
3488
- inputs: [{
3489
- name: "previousOwner",
3490
- type: "address",
3491
- indexed: true,
3492
- internalType: "address"
3493
- }, {
3494
- name: "newOwner",
3495
- type: "address",
3496
- indexed: true,
3497
- internalType: "address"
3498
- }],
3499
- anonymous: false
3500
- },
3501
- {
3502
- type: "event",
3503
- name: "Repay",
3504
- inputs: [
3505
- {
3506
- name: "user",
3507
- type: "address",
3508
- indexed: false,
3509
- internalType: "address"
3510
- },
3511
- {
3512
- name: "tickLower",
3513
- type: "int24",
3514
- indexed: false,
3515
- internalType: "int24"
3516
- },
3517
- {
3518
- name: "tickUpper",
3519
- type: "int24",
3520
- indexed: false,
3521
- internalType: "int24"
3522
- },
3523
- {
3524
- name: "liquidity",
3525
- type: "uint128",
3526
- indexed: false,
3527
- internalType: "uint128"
3528
- }
3529
- ],
3530
- anonymous: false
3531
- },
3532
- {
3533
- type: "error",
3534
- name: "AddressEmptyCode",
3535
- inputs: [{
3536
- name: "target",
3537
- type: "address",
3538
- internalType: "address"
3539
- }]
3540
- },
3541
- {
3542
- type: "error",
3543
- name: "AmountsMismatch",
3544
- inputs: [
3545
- {
3546
- name: "amount0",
3547
- type: "uint256",
3548
- internalType: "uint256"
3549
- },
3550
- {
3551
- name: "expectedAmount0",
3552
- type: "uint256",
3553
- internalType: "uint256"
3554
- },
3555
- {
3556
- name: "amount1",
3557
- type: "uint256",
3558
- internalType: "uint256"
3559
- },
3560
- {
3561
- name: "expectedAmount1",
3562
- type: "uint256",
3563
- internalType: "uint256"
3564
- }
3565
- ]
3566
- },
3567
- {
3568
- type: "error",
3569
- name: "BorrowerNotWhitelisted",
3570
- inputs: [{
3571
- name: "borrower",
3572
- type: "address",
3573
- internalType: "address"
3574
- }]
3575
- },
3576
- {
3577
- type: "error",
3578
- name: "FailedCall",
3579
- inputs: []
3580
- },
3581
- {
3582
- type: "error",
3583
- name: "InvalidActionType",
3584
- inputs: [{
3585
- name: "actionType",
3586
- type: "uint8",
3587
- internalType: "uint8"
3588
- }]
3589
- },
3590
- {
3591
- type: "error",
3592
- name: "InvalidRefTick",
3593
- inputs: [{
3594
- name: "tickLower",
3595
- type: "int24",
3596
- internalType: "int24"
3597
- }]
3598
- },
3599
- {
3600
- type: "error",
3601
- name: "InvalidTickRange",
3602
- inputs: [{
3603
- name: "tickLower",
3604
- type: "int24",
3605
- internalType: "int24"
3606
- }, {
3607
- name: "tickUpper",
3608
- type: "int24",
3609
- internalType: "int24"
3610
- }]
3611
- },
3612
- {
3613
- type: "error",
3614
- name: "OwnableInvalidOwner",
3615
- inputs: [{
3616
- name: "owner",
3617
- type: "address",
3618
- internalType: "address"
3619
- }]
3620
- },
3621
- {
3622
- type: "error",
3623
- name: "OwnableUnauthorizedAccount",
3624
- inputs: [{
3625
- name: "account",
3626
- type: "address",
3627
- internalType: "address"
3628
- }]
3629
- },
3630
- {
3631
- type: "error",
3632
- name: "ReentrancyGuardReentrantCall",
3633
- inputs: []
3634
- },
3635
- {
3636
- type: "error",
3637
- name: "SafeERC20FailedOperation",
3638
- inputs: [{
3639
- name: "token",
3640
- type: "address",
3641
- internalType: "address"
3642
- }]
3643
- }
3644
- ];
3645
-
3646
- //#endregion
3647
- //#region src/abis/optionsMarket.ts
3648
- const optionsMarketAbi = [
3649
- {
3650
- type: "constructor",
3651
- inputs: [
3652
- {
3653
- name: "_vault",
3654
- type: "address",
3655
- internalType: "contract ITimelockVault"
3656
- },
3657
- {
3658
- name: "_optionPricing",
3659
- type: "address",
3660
- internalType: "contract IOptionPricing"
3661
- },
3662
- {
3663
- name: "_optionAssetIsToken0",
3664
- type: "bool",
3665
- internalType: "bool"
3666
- },
3667
- {
3668
- name: "_swapRouter",
3669
- type: "address",
3670
- internalType: "contract ISwapRouter"
3671
- },
3672
- {
3673
- name: "_quoter",
3674
- type: "address",
3675
- internalType: "contract IQuoter"
3676
- },
3677
- {
3678
- name: "_owner",
3679
- type: "address",
3680
- internalType: "address"
3681
- }
3682
- ],
3683
- stateMutability: "nonpayable"
3684
- },
3685
- {
3686
- type: "function",
3687
- name: "BASIS_POINTS",
3688
- inputs: [],
3689
- outputs: [{
3690
- name: "",
3691
- type: "uint256",
3692
- internalType: "uint256"
3693
- }],
3694
- stateMutability: "view"
3695
- },
3696
- {
3697
- type: "function",
3698
- name: "DUST_THRESHOLD",
3699
- inputs: [],
3700
- outputs: [{
3701
- name: "",
3702
- type: "uint256",
3703
- internalType: "uint256"
3704
- }],
3705
- stateMutability: "view"
3706
- },
3707
- {
3708
- type: "function",
3709
- name: "MAX_STEPS",
3710
- inputs: [],
3711
- outputs: [{
3712
- name: "",
3713
- type: "uint256",
3714
- internalType: "uint256"
3715
- }],
3716
- stateMutability: "view"
3717
- },
3718
- {
3719
- type: "function",
3720
- name: "OPTION_FEE_PERCENT",
3721
- inputs: [],
3722
- outputs: [{
3723
- name: "",
3724
- type: "uint256",
3725
- internalType: "uint256"
3726
- }],
3727
- stateMutability: "view"
3728
- },
3729
- {
3730
- type: "function",
3731
- name: "calculatePremium",
3732
- inputs: [
3733
- {
3734
- name: "optionType",
3735
- type: "uint8",
3736
- internalType: "uint8"
3737
- },
3738
- {
3739
- name: "optionAmount",
3740
- type: "uint256",
3741
- internalType: "uint256"
3742
- },
3743
- {
3744
- name: "strikeTick",
3745
- type: "int24",
3746
- internalType: "int24"
3747
- },
3748
- {
3749
- name: "duration",
3750
- type: "uint64",
3751
- internalType: "uint64"
3752
- }
3753
- ],
3754
- outputs: [{
3755
- name: "",
3756
- type: "uint256",
3757
- internalType: "uint256"
3758
- }],
3759
- stateMutability: "view"
3760
- },
3761
- {
3762
- type: "function",
3763
- name: "exerciseOption",
3764
- inputs: [
3765
- {
3766
- name: "optionId",
3767
- type: "uint256",
3768
- internalType: "uint256"
3769
- },
3770
- {
3771
- name: "liquidities",
3772
- type: "uint128[]",
3773
- internalType: "uint128[]"
3774
- },
3775
- {
3776
- name: "minPayout",
3777
- type: "uint256",
3778
- internalType: "uint256"
3779
- },
3780
- {
3781
- name: "refTick",
3782
- type: "int24",
3783
- internalType: "int24"
3784
- }
3785
- ],
3786
- outputs: [{
3787
- name: "payout",
3788
- type: "uint256",
3789
- internalType: "uint256"
3790
- }],
3791
- stateMutability: "nonpayable"
3792
- },
3793
- {
3794
- type: "function",
3795
- name: "getOption",
3796
- inputs: [{
3797
- name: "optionId",
3798
- type: "uint256",
3799
- internalType: "uint256"
3800
- }],
3801
- outputs: [{
3802
- name: "",
3803
- type: "tuple",
3804
- internalType: "struct TimelockOptionsMarket.OptionData",
3805
- components: [
3806
- {
3807
- name: "owner",
3808
- type: "address",
3809
- internalType: "address"
3810
- },
3811
- {
3812
- name: "optionType",
3813
- type: "uint8",
3814
- internalType: "uint8"
3815
- },
3816
- {
3817
- name: "strikeTick",
3818
- type: "int24",
3819
- internalType: "int24"
3820
- },
3821
- {
3822
- name: "entryTick",
3823
- type: "int24",
3824
- internalType: "int24"
3825
- },
3826
- {
3827
- name: "expiresAt",
3828
- type: "uint64",
3829
- internalType: "uint64"
3830
- },
3831
- {
3832
- name: "createdAt",
3833
- type: "uint64",
3834
- internalType: "uint64"
3835
- },
3836
- {
3837
- name: "premiumPaid",
3838
- type: "uint128",
3839
- internalType: "uint128"
3840
- },
3841
- {
3842
- name: "liquidities",
3843
- type: "uint128[]",
3844
- internalType: "uint128[]"
3845
- }
3846
- ]
3847
- }],
3848
- stateMutability: "view"
3849
- },
3850
- {
3851
- type: "function",
3852
- name: "liquiditiesToAmounts",
3853
- inputs: [
3854
- {
3855
- name: "leftTick",
3856
- type: "int24",
3857
- internalType: "int24"
3858
- },
3859
- {
3860
- name: "liquidities",
3861
- type: "uint128[]",
3862
- internalType: "uint128[]"
3863
- },
3864
- {
3865
- name: "optionType",
3866
- type: "uint8",
3867
- internalType: "uint8"
3868
- }
3869
- ],
3870
- outputs: [
3871
- {
3872
- name: "optionAssetToRepay",
3873
- type: "uint256",
3874
- internalType: "uint256"
3875
- },
3876
- {
3877
- name: "payoutAssetToRepay",
3878
- type: "uint256",
3879
- internalType: "uint256"
3880
- },
3881
- {
3882
- name: "optionAssetBorrowed",
3883
- type: "uint256",
3884
- internalType: "uint256"
3885
- },
3886
- {
3887
- name: "payoutAssetBorrowed",
3888
- type: "uint256",
3889
- internalType: "uint256"
3890
- }
3891
- ],
3892
- stateMutability: "view"
3893
- },
3894
- {
3895
- type: "function",
3896
- name: "maxDuration",
3897
- inputs: [],
3898
- outputs: [{
3899
- name: "",
3900
- type: "uint64",
3901
- internalType: "uint64"
3902
- }],
3903
- stateMutability: "view"
3904
- },
3905
- {
3906
- type: "function",
3907
- name: "maxOptionAmount",
3908
- inputs: [],
3909
- outputs: [{
3910
- name: "",
3911
- type: "uint256",
3912
- internalType: "uint256"
3913
- }],
3914
- stateMutability: "view"
3915
- },
3916
- {
3917
- type: "function",
3918
- name: "minDuration",
3919
- inputs: [],
3920
- outputs: [{
3921
- name: "",
3922
- type: "uint64",
3923
- internalType: "uint64"
3924
- }],
3925
- stateMutability: "view"
3926
- },
3927
- {
3928
- type: "function",
3929
- name: "minOptionAmount",
3930
- inputs: [],
3931
- outputs: [{
3932
- name: "",
3933
- type: "uint256",
3934
- internalType: "uint256"
3935
- }],
3936
- stateMutability: "view"
3937
- },
3938
- {
3939
- type: "function",
3940
- name: "mintOption",
3941
- inputs: [
3942
- {
3943
- name: "optionType",
3944
- type: "uint8",
3945
- internalType: "uint8"
3946
- },
3947
- {
3948
- name: "amount",
3949
- type: "uint256",
3950
- internalType: "uint256"
3951
- },
3952
- {
3953
- name: "strikeTick",
3954
- type: "int24",
3955
- internalType: "int24"
3956
- },
3957
- {
3958
- name: "duration",
3959
- type: "uint64",
3960
- internalType: "uint64"
3961
- },
3962
- {
3963
- name: "maxPremium",
3964
- type: "uint256",
3965
- internalType: "uint256"
3966
- },
3967
- {
3968
- name: "refTick",
3969
- type: "int24",
3970
- internalType: "int24"
3971
- }
3972
- ],
3973
- outputs: [
3974
- {
3975
- name: "optionId",
3976
- type: "uint256",
3977
- internalType: "uint256"
3978
- },
3979
- {
3980
- name: "finalAmount",
3981
- type: "uint256",
3982
- internalType: "uint256"
3983
- },
3984
- {
3985
- name: "totalPremium",
3986
- type: "uint256",
3987
- internalType: "uint256"
3988
- }
3989
- ],
3990
- stateMutability: "nonpayable"
3991
- },
3992
- {
3993
- type: "function",
3994
- name: "nextOptionId",
3995
- inputs: [],
3996
- outputs: [{
3997
- name: "",
3998
- type: "uint256",
3999
- internalType: "uint256"
4000
- }],
4001
- stateMutability: "view"
4002
- },
4003
- {
4004
- type: "function",
4005
- name: "optionAsset",
4006
- inputs: [],
4007
- outputs: [{
4008
- name: "",
4009
- type: "address",
4010
- internalType: "contract IERC20"
4011
- }],
4012
- stateMutability: "view"
4013
- },
4014
- {
4015
- type: "function",
4016
- name: "optionAssetIsToken0",
4017
- inputs: [],
4018
- outputs: [{
4019
- name: "",
4020
- type: "bool",
4021
- internalType: "bool"
4022
- }],
4023
- stateMutability: "view"
4024
- },
4025
- {
4026
- type: "function",
4027
- name: "optionPricing",
4028
- inputs: [],
4029
- outputs: [{
4030
- name: "",
4031
- type: "address",
4032
- internalType: "contract IOptionPricing"
4033
- }],
4034
- stateMutability: "view"
4035
- },
4036
- {
4037
- type: "function",
4038
- name: "owner",
4039
- inputs: [],
4040
- outputs: [{
4041
- name: "",
4042
- type: "address",
4043
- internalType: "address"
4044
- }],
4045
- stateMutability: "view"
4046
- },
4047
- {
4048
- type: "function",
4049
- name: "payoutAsset",
4050
- inputs: [],
4051
- outputs: [{
4052
- name: "",
4053
- type: "address",
4054
- internalType: "contract IERC20"
4055
- }],
4056
- stateMutability: "view"
4057
- },
4058
- {
4059
- type: "function",
4060
- name: "pool",
4061
- inputs: [],
4062
- outputs: [{
4063
- name: "",
4064
- type: "address",
4065
- internalType: "contract IUniswapV3Pool"
4066
- }],
4067
- stateMutability: "view"
4068
- },
4069
- {
4070
- type: "function",
4071
- name: "protocolFees",
4072
- inputs: [],
4073
- outputs: [{
4074
- name: "",
4075
- type: "uint256",
4076
- internalType: "uint256"
4077
- }],
4078
- stateMutability: "view"
4079
- },
4080
- {
4081
- type: "function",
4082
- name: "quoter",
4083
- inputs: [],
4084
- outputs: [{
4085
- name: "",
4086
- type: "address",
4087
- internalType: "contract IQuoter"
4088
- }],
4089
- stateMutability: "view"
4090
- },
4091
- {
4092
- type: "function",
4093
- name: "renounceOwnership",
4094
- inputs: [],
4095
- outputs: [],
4096
- stateMutability: "nonpayable"
4097
- },
4098
- {
4099
- type: "function",
4100
- name: "swapRouter",
4101
- inputs: [],
4102
- outputs: [{
4103
- name: "",
4104
- type: "address",
4105
- internalType: "contract ISwapRouter"
4106
- }],
4107
- stateMutability: "view"
4108
- },
4109
- {
4110
- type: "function",
4111
- name: "tickSpacing",
4112
- inputs: [],
4113
- outputs: [{
4114
- name: "",
4115
- type: "int24",
4116
- internalType: "int24"
4117
- }],
4118
- stateMutability: "view"
4119
- },
4120
- {
4121
- type: "function",
4122
- name: "token0",
4123
- inputs: [],
4124
- outputs: [{
4125
- name: "",
4126
- type: "address",
4127
- internalType: "contract IERC20"
4128
- }],
4129
- stateMutability: "view"
4130
- },
4131
- {
4132
- type: "function",
4133
- name: "token1",
4134
- inputs: [],
4135
- outputs: [{
4136
- name: "",
4137
- type: "address",
4138
- internalType: "contract IERC20"
4139
- }],
4140
- stateMutability: "view"
4141
- },
4142
- {
4143
- type: "function",
4144
- name: "transferOwnership",
4145
- inputs: [{
4146
- name: "newOwner",
4147
- type: "address",
4148
- internalType: "address"
4149
- }],
4150
- outputs: [],
4151
- stateMutability: "nonpayable"
4152
- },
4153
- {
4154
- type: "function",
4155
- name: "updateDurationBounds",
4156
- inputs: [{
4157
- name: "_minDuration",
4158
- type: "uint64",
4159
- internalType: "uint64"
4160
- }, {
4161
- name: "_maxDuration",
4162
- type: "uint64",
4163
- internalType: "uint64"
4164
- }],
4165
- outputs: [],
4166
- stateMutability: "nonpayable"
4167
- },
4168
- {
4169
- type: "function",
4170
- name: "updateOptionAmountBounds",
4171
- inputs: [{
4172
- name: "_minOptionAmount",
4173
- type: "uint256",
4174
- internalType: "uint256"
4175
- }, {
4176
- name: "_maxOptionAmount",
4177
- type: "uint256",
4178
- internalType: "uint256"
4179
- }],
4180
- outputs: [],
4181
- stateMutability: "nonpayable"
4182
- },
4183
- {
4184
- type: "function",
4185
- name: "vault",
4186
- inputs: [],
4187
- outputs: [{
4188
- name: "",
4189
- type: "address",
4190
- internalType: "contract ITimelockVault"
4191
- }],
4192
- stateMutability: "view"
4193
- },
4194
- {
4195
- type: "function",
4196
- name: "withdrawTokens",
4197
- inputs: [{
4198
- name: "tokens",
4199
- type: "address[]",
4200
- internalType: "contract IERC20[]"
4201
- }],
4202
- outputs: [],
4203
- stateMutability: "nonpayable"
4204
- },
4205
- {
4206
- type: "event",
4207
- name: "ExerciseOption",
4208
- inputs: [
4209
- {
4210
- name: "optionId",
4211
- type: "uint256",
4212
- indexed: true,
4213
- internalType: "uint256"
4214
- },
4215
- {
4216
- name: "owner",
4217
- type: "address",
4218
- indexed: true,
4219
- internalType: "address"
4220
- },
4221
- {
4222
- name: "liquidities",
4223
- type: "uint128[]",
4224
- indexed: false,
4225
- internalType: "uint128[]"
4226
- },
4227
- {
4228
- name: "payout",
4229
- type: "uint256",
4230
- indexed: false,
4231
- internalType: "uint256"
4232
- }
4233
- ],
4234
- anonymous: false
4235
- },
4236
- {
4237
- type: "event",
4238
- name: "FeesWithdrawn",
4239
- inputs: [{
4240
- name: "fees0",
4241
- type: "uint256",
4242
- indexed: false,
4243
- internalType: "uint256"
4244
- }, {
4245
- name: "fees1",
4246
- type: "uint256",
4247
- indexed: false,
4248
- internalType: "uint256"
4249
- }],
4250
- anonymous: false
4251
- },
4252
- {
4253
- type: "event",
4254
- name: "MintOption",
4255
- inputs: [
4256
- {
4257
- name: "optionId",
4258
- type: "uint256",
4259
- indexed: true,
4260
- internalType: "uint256"
4261
- },
4262
- {
4263
- name: "buyer",
4264
- type: "address",
4265
- indexed: true,
4266
- internalType: "address"
4267
- },
4268
- {
4269
- name: "optionType",
4270
- type: "uint8",
4271
- indexed: false,
4272
- internalType: "uint8"
4273
- },
4274
- {
4275
- name: "strikeTick",
4276
- type: "int24",
4277
- indexed: false,
4278
- internalType: "int24"
4279
- },
4280
- {
4281
- name: "currentTick",
4282
- type: "int24",
4283
- indexed: false,
4284
- internalType: "int24"
4285
- },
4286
- {
4287
- name: "expiresAt",
4288
- type: "uint64",
4289
- indexed: false,
4290
- internalType: "uint64"
4291
- },
4292
- {
4293
- name: "timestamp",
4294
- type: "uint64",
4295
- indexed: false,
4296
- internalType: "uint64"
4297
- },
4298
- {
4299
- name: "totalPremium",
4300
- type: "uint128",
4301
- indexed: false,
4302
- internalType: "uint128"
4303
- },
4304
- {
4305
- name: "liquidities",
4306
- type: "uint128[]",
4307
- indexed: false,
4308
- internalType: "uint128[]"
4309
- }
4310
- ],
4311
- anonymous: false
4312
- },
4313
- {
4314
- type: "event",
4315
- name: "OwnershipTransferred",
4316
- inputs: [{
4317
- name: "previousOwner",
4318
- type: "address",
4319
- indexed: true,
4320
- internalType: "address"
4321
- }, {
4322
- name: "newOwner",
4323
- type: "address",
4324
- indexed: true,
4325
- internalType: "address"
4326
- }],
4327
- anonymous: false
4328
- },
4329
- {
4330
- type: "error",
4331
- name: "AmountOutOfBounds",
4332
- inputs: []
4333
- },
4334
- {
4335
- type: "error",
4336
- name: "DurationOutOfBounds",
4337
- inputs: []
4338
- },
4339
- {
4340
- type: "error",
4341
- name: "InsufficientLiquidity",
4342
- inputs: []
4343
- },
4344
- {
4345
- type: "error",
4346
- name: "InvalidArrayLength",
4347
- inputs: []
4348
- },
4349
- {
4350
- type: "error",
4351
- name: "InvalidOptionType",
4352
- inputs: []
4353
- },
4354
- {
4355
- type: "error",
4356
- name: "InvalidTickRange",
4357
- inputs: [{
4358
- name: "tickLower",
4359
- type: "int24",
4360
- internalType: "int24"
4361
- }, {
4362
- name: "tickUpper",
4363
- type: "int24",
4364
- internalType: "int24"
4365
- }]
4366
- },
4367
- {
4368
- type: "error",
4369
- name: "NotEnoughPayout",
4370
- inputs: []
4371
- },
4372
- {
4373
- type: "error",
4374
- name: "NotOptionOwner",
4375
- inputs: []
4376
- },
4377
- {
4378
- type: "error",
4379
- name: "OptionExpired",
4380
- inputs: []
4381
- },
4382
- {
4383
- type: "error",
4384
- name: "OptionNotFound",
4385
- inputs: []
4386
- },
4387
- {
4388
- type: "error",
4389
- name: "OwnableInvalidOwner",
4390
- inputs: [{
4391
- name: "owner",
4392
- type: "address",
4393
- internalType: "address"
4394
- }]
4395
- },
4396
- {
4397
- type: "error",
4398
- name: "OwnableUnauthorizedAccount",
4399
- inputs: [{
4400
- name: "account",
4401
- type: "address",
4402
- internalType: "address"
4403
- }]
4404
- },
4405
- {
4406
- type: "error",
4407
- name: "PremiumTooHigh",
4408
- inputs: []
4409
- },
4410
- {
4411
- type: "error",
4412
- name: "ReentrancyGuardReentrantCall",
4413
- inputs: []
4414
- },
4415
- {
4416
- type: "error",
4417
- name: "SafeERC20FailedOperation",
4418
- inputs: [{
4419
- name: "token",
4420
- type: "address",
4421
- internalType: "address"
4422
- }]
4423
- }
4424
- ];
4425
-
4426
- //#endregion
4427
- //#region src/lib/contracts.ts
4428
- const getErc20 = (address, client) => getContract({
4429
- abi: erc20Abi$1,
4430
- address,
4431
- client
4432
- });
4433
- const getTimelockVault = (address, client) => {
4434
- return getContract({
4435
- abi: singleOwnerVaultAbi,
4436
- address,
4437
- client
4438
- });
4439
- };
4440
- const getTimelockMarket = (address, client) => {
4441
- return getContract({
4442
- abi: optionsMarketAbi,
4443
- address,
4444
- client
4445
- });
4446
- };
4447
- const getUniswapPool = (address, client) => {
4448
- return getContract({
4449
- abi: uniswapV3PoolAbi,
4450
- address,
4451
- client
4452
- });
4453
- };
4454
- const getUniswapMathLens = (client) => getContract({
4455
- abi: uniswapMathLensAbi,
4456
- address: uniswapMathLenses[client.chain.id],
4457
- client
4458
- });
4459
- const getTimelockLens = (client) => getContract({
4460
- abi: lensAbi,
4461
- address: timelockLenses[client.chain.id],
4462
- client
4463
- });
4464
- const timelockLenses = { [monadTestnet.id]: "0x97558b2ccb55F88118989BC19FCEa7AFa13F71b9" };
4465
- const uniswapMathLenses = { [monadTestnet.id]: "0x4C8375D1F6D5F452e92e211C1D3E7a44F78dFc95" };
4466
-
4467
- //#endregion
4468
- //#region src/lib/liquidityUtils.ts
4469
- const PRICE_PRECISION = BigInt(0xde0b6b3a7640000);
4470
- const getPriceAtTick = (tick) => {
4471
- const sqrtRatioX96 = BigInt(TickMath.getSqrtRatioAtTick(tick).toString());
4472
- return sqrtRatioX96 * sqrtRatioX96 * PRICE_PRECISION / BigInt(2 ** 192);
4473
- };
4474
- const getTickAtPrice = (price) => {
4475
- const priceX192 = price * BigInt(2 ** 192) / PRICE_PRECISION;
4476
- const sqrtPriceX96 = JSBI.BigInt(new Big(priceX192.toString()).sqrt().toFixed(0));
4477
- return TickMath.getTickAtSqrtRatio(sqrtPriceX96);
4478
- };
4479
- const roundTickDown = (tick, spacing) => {
4480
- const rem = tick % spacing;
4481
- if (rem >= 0) return tick - rem;
4482
- return tick - rem - spacing;
4483
- };
4484
- const roundTickUp = (tick, spacing) => {
4485
- const rem = tick % spacing;
4486
- if (rem === 0) return tick;
4487
- if (rem > 0) return tick - rem + spacing;
4488
- return tick - rem;
4489
- };
4490
- const token0ToToken1 = (amount0, tick) => {
4491
- return amount0 * getPriceAtTick(tick) / PRICE_PRECISION;
4492
- };
4493
- const token1ToToken0 = (amount1, tick) => {
4494
- const price = getPriceAtTick(tick);
4495
- return amount1 * PRICE_PRECISION / price;
4496
- };
4497
- const liquiditiesToAmount0 = (liquidities, startTick, tickSpacing) => {
4498
- let amount0 = BigInt(0);
4499
- for (let i = 0; i < liquidities.length; i++) {
4500
- const liquidity = liquidities[i];
4501
- if (liquidity === BigInt(0)) continue;
4502
- const tickLower = startTick + tickSpacing * i;
4503
- const tickUpper = tickLower + tickSpacing;
4504
- const sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(tickLower);
4505
- const sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(tickUpper);
4506
- const liquidityJSBI = JSBI.BigInt(liquidity.toString());
4507
- const amount0Delta = SqrtPriceMath.getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, liquidityJSBI, false);
4508
- amount0 += BigInt(amount0Delta.toString());
4509
- }
4510
- return amount0;
4511
- };
4512
- const liquiditiesToAmount1 = (liquidities, startTick, tickSpacing) => {
4513
- let amount1 = BigInt(0);
4514
- for (let i = 0; i < liquidities.length; i++) {
4515
- const liquidity = liquidities[i];
4516
- if (liquidity === BigInt(0)) continue;
4517
- const tickLower = startTick + tickSpacing * i;
4518
- const tickUpper = tickLower + tickSpacing;
4519
- const sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(tickLower);
4520
- const sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(tickUpper);
4521
- const liquidityJSBI = JSBI.BigInt(liquidity.toString());
4522
- const amount1Delta = SqrtPriceMath.getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, liquidityJSBI, false);
4523
- amount1 += BigInt(amount1Delta.toString());
4524
- }
4525
- return amount1;
4526
- };
4527
- const liquiditiesToAmounts = (liquidities, startTick, currentTick, tickSpacing) => {
4528
- let amount0 = 0n;
4529
- let amount1 = 0n;
4530
- const sqrtRatioX96 = TickMath.getSqrtRatioAtTick(currentTick);
4531
- for (let i = 0; i < liquidities.length; i++) {
4532
- const liquidity = liquidities[i];
4533
- if (liquidity === BigInt(0)) continue;
4534
- const tickLower = startTick + tickSpacing * i;
4535
- const tickUpper = tickLower + tickSpacing;
4536
- const sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(tickLower);
4537
- const sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(tickUpper);
4538
- const liquidityJSBI = JSBI.BigInt(liquidity.toString());
4539
- if (currentTick < tickLower) {
4540
- const delta0 = SqrtPriceMath.getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, liquidityJSBI, false);
4541
- amount0 += BigInt(delta0.toString());
4542
- } else if (currentTick >= tickUpper) {
4543
- const delta1 = SqrtPriceMath.getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, liquidityJSBI, false);
4544
- amount1 += BigInt(delta1.toString());
4545
- } else {
4546
- const delta0 = SqrtPriceMath.getAmount0Delta(sqrtRatioX96, sqrtRatioBX96, liquidityJSBI, false);
4547
- const delta1 = SqrtPriceMath.getAmount1Delta(sqrtRatioAX96, sqrtRatioX96, liquidityJSBI, false);
4548
- amount0 += BigInt(delta0.toString());
4549
- amount1 += BigInt(delta1.toString());
4550
- }
4551
- }
4552
- return [amount0, amount1];
4553
- };
4554
-
4555
- //#endregion
4556
- //#region src/lib/numberUtils.ts
4557
- const zero = {
4558
- scaled: 0n,
4559
- unscaled: Big(0),
4560
- decimals: 18,
4561
- formatted: "0"
4562
- };
4563
- const wrapAmount = (scaled, decimals) => {
4564
- const unscaled = unscaleAmount(scaled, decimals);
4565
- return {
4566
- scaled,
4567
- unscaled,
4568
- decimals,
4569
- formatted: formatAmount(unscaled)
4570
- };
4571
- };
4572
- const wrapAmountUnscaled = (unscaled, decimals) => {
4573
- unscaled = Big(unscaled);
4574
- const scaled = scaleAmount(unscaled, decimals);
4575
- const formatted = formatAmount(unscaled);
4576
- return {
4577
- scaled,
4578
- unscaled,
4579
- decimals,
4580
- formatted
4581
- };
4582
- };
4583
- const wrapPrice = (scaled, decimals0, decimals1) => {
4584
- const unscaled = unscalePrice(scaled, decimals0, decimals1);
4585
- const formatted = formatAmount(unscaled);
4586
- return {
4587
- scaled,
4588
- unscaled,
4589
- decimals: 36 + decimals1 - decimals0,
4590
- formatted
4591
- };
4592
- };
4593
- const wrapPriceUnscaled = (unscaled, decimals0, decimals1) => {
4594
- unscaled = Big(unscaled);
4595
- const scaled = scalePrice(unscaled, decimals0, decimals1);
4596
- const formatted = formatAmount(unscaled);
4597
- return {
4598
- scaled,
4599
- unscaled,
4600
- decimals: 36 + decimals1 - decimals0,
4601
- formatted
4602
- };
4603
- };
4604
- const unscaleAmount = (scaled, decimals) => {
4605
- return new Big(scaled.toString()).div(new Big(10).pow(decimals));
4606
- };
4607
- const scaleAmount = (unscaled, decimals) => {
4608
- return BigInt(Big(unscaled).mul(new Big(10).pow(decimals)).round().toFixed(0));
4609
- };
4610
- const unscalePrice = (scaled, decimals0, decimals1, precision = 18) => {
4611
- return new Big(scaled.toString()).mul(new Big(10).pow(decimals0)).div(new Big(10).pow(decimals1)).div(new Big(10).pow(precision));
4612
- };
4613
- const scalePrice = (unscaled, decimals0, decimals1, precision = 18) => {
4614
- return BigInt(Big(unscaled).mul(new Big(10).pow(precision)).mul(new Big(10).pow(decimals1)).div(new Big(10).pow(decimals0)).round().toFixed(0));
4615
- };
4616
- const formatAmount = (value) => {
4617
- if (value === void 0) return "-";
4618
- return formatCondensed(Big(value).toFixed(100));
4619
- };
4620
- const formatVagueAmount = (value) => {
4621
- value = Number(value);
4622
- if (value >= 0xe8d4a51000) return `${(value / 0xe8d4a51000).toFixed(2)}T`;
4623
- else if (value >= 1e9) return `${(value / 1e9).toFixed(2)}B`;
4624
- else if (value >= 1e6) return `${(value / 1e6).toFixed(2)}M`;
4625
- else if (value >= 1e3) return `${(value / 1e3).toFixed(2)}K`;
4626
- else if (value < 1) return value.toPrecision(2);
4627
- else return value.toFixed(2);
4628
- };
4629
- const formatCondensed = (input, decimals = 2) => {
4630
- const [whole, decimal] = (typeof input === "number" ? input.toFixed(20) : input).replace(/(\.\d*?)0+$/, "$1").replace(/\.$/, "").split(".");
4631
- const formattedWhole = whole.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
4632
- if (!decimal) return formattedWhole;
4633
- const leadingZeroMatch = decimal.match(/^(0{3,})/);
4634
- if (leadingZeroMatch) {
4635
- const zeroCount = leadingZeroMatch[1].length;
4636
- return `${formattedWhole}.0${toSubscript(zeroCount.toString())}${decimal.slice(zeroCount).slice(0, decimals)}`;
4637
- } else {
4638
- const nonZeroStart = decimal.search(/[1-9]/);
4639
- if (nonZeroStart === -1) return formattedWhole;
4640
- const twoDigits = decimal.slice(nonZeroStart).slice(0, decimals);
4641
- return `${formattedWhole}.${decimal.slice(0, nonZeroStart)}${twoDigits}`;
4642
- }
4643
- };
4644
- const toSubscript = (input) => {
4645
- return input.replace(/[0-9]/g, (m) => "₀₁₂₃₄₅₆₇₈₉"[+m]);
4646
- };
4647
- const formatUSD = (value) => {
4648
- return "$" + formatAmount(value);
4649
- };
4650
-
4651
- //#endregion
4652
- export { PRICE_PRECISION, erc20Abi$1 as erc20Abi, formatAmount, formatCondensed, formatUSD, formatVagueAmount, getErc20, getPriceAtTick, getTickAtPrice, getTimelockLens, getTimelockMarket, getTimelockVault, getUniswapMathLens, getUniswapPool, lensAbi, liquiditiesToAmount0, liquiditiesToAmount1, liquiditiesToAmounts, optionsMarketAbi, roundTickDown, roundTickUp, scaleAmount, scalePrice, singleOwnerVaultAbi, timelockLenses, token0ToToken1, token1ToToken0, uniswapMathLensAbi, uniswapMathLenses, uniswapV3PoolAbi, unscaleAmount, unscalePrice, wrapAmount, wrapAmountUnscaled, wrapPrice, wrapPriceUnscaled, zero };