@underscore-finance/sdk 1.2.13 → 1.2.14

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.
@@ -0,0 +1,2523 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /* @ts-nocheck */
5
+ import { singleQuery, mutate } from '@dappql/async';
6
+ import { encodeEventTopics, parseEventLogs, } from 'viem';
7
+ export const abi = [
8
+ {
9
+ name: 'NonceIncremented',
10
+ inputs: [
11
+ {
12
+ name: 'levgVault',
13
+ type: 'address',
14
+ indexed: false,
15
+ },
16
+ {
17
+ name: 'oldNonce',
18
+ type: 'uint256',
19
+ indexed: false,
20
+ },
21
+ {
22
+ name: 'newNonce',
23
+ type: 'uint256',
24
+ indexed: false,
25
+ },
26
+ ],
27
+ anonymous: false,
28
+ type: 'event',
29
+ },
30
+ {
31
+ name: 'OwnershipChangeInitiated',
32
+ inputs: [
33
+ {
34
+ name: 'prevOwner',
35
+ type: 'address',
36
+ indexed: true,
37
+ },
38
+ {
39
+ name: 'newOwner',
40
+ type: 'address',
41
+ indexed: true,
42
+ },
43
+ {
44
+ name: 'confirmBlock',
45
+ type: 'uint256',
46
+ indexed: false,
47
+ },
48
+ ],
49
+ anonymous: false,
50
+ type: 'event',
51
+ },
52
+ {
53
+ name: 'OwnershipChangeConfirmed',
54
+ inputs: [
55
+ {
56
+ name: 'prevOwner',
57
+ type: 'address',
58
+ indexed: true,
59
+ },
60
+ {
61
+ name: 'newOwner',
62
+ type: 'address',
63
+ indexed: true,
64
+ },
65
+ {
66
+ name: 'initiatedBlock',
67
+ type: 'uint256',
68
+ indexed: false,
69
+ },
70
+ {
71
+ name: 'confirmBlock',
72
+ type: 'uint256',
73
+ indexed: false,
74
+ },
75
+ ],
76
+ anonymous: false,
77
+ type: 'event',
78
+ },
79
+ {
80
+ name: 'OwnershipChangeCancelled',
81
+ inputs: [
82
+ {
83
+ name: 'cancelledOwner',
84
+ type: 'address',
85
+ indexed: true,
86
+ },
87
+ {
88
+ name: 'cancelledBy',
89
+ type: 'address',
90
+ indexed: true,
91
+ },
92
+ {
93
+ name: 'initiatedBlock',
94
+ type: 'uint256',
95
+ indexed: false,
96
+ },
97
+ {
98
+ name: 'confirmBlock',
99
+ type: 'uint256',
100
+ indexed: false,
101
+ },
102
+ ],
103
+ anonymous: false,
104
+ type: 'event',
105
+ },
106
+ {
107
+ name: 'OwnershipTimeLockSet',
108
+ inputs: [
109
+ {
110
+ name: 'numBlocks',
111
+ type: 'uint256',
112
+ indexed: false,
113
+ },
114
+ ],
115
+ anonymous: false,
116
+ type: 'event',
117
+ },
118
+ {
119
+ stateMutability: 'nonpayable',
120
+ type: 'function',
121
+ name: 'changeOwnership',
122
+ inputs: [
123
+ {
124
+ name: '_newOwner',
125
+ type: 'address',
126
+ },
127
+ ],
128
+ outputs: [],
129
+ },
130
+ {
131
+ stateMutability: 'nonpayable',
132
+ type: 'function',
133
+ name: 'confirmOwnershipChange',
134
+ inputs: [],
135
+ outputs: [],
136
+ },
137
+ {
138
+ stateMutability: 'nonpayable',
139
+ type: 'function',
140
+ name: 'cancelOwnershipChange',
141
+ inputs: [],
142
+ outputs: [],
143
+ },
144
+ {
145
+ stateMutability: 'view',
146
+ type: 'function',
147
+ name: 'hasPendingOwnerChange',
148
+ inputs: [],
149
+ outputs: [
150
+ {
151
+ name: '',
152
+ type: 'bool',
153
+ },
154
+ ],
155
+ },
156
+ {
157
+ stateMutability: 'nonpayable',
158
+ type: 'function',
159
+ name: 'setOwnershipTimeLock',
160
+ inputs: [
161
+ {
162
+ name: '_numBlocks',
163
+ type: 'uint256',
164
+ },
165
+ ],
166
+ outputs: [],
167
+ },
168
+ {
169
+ stateMutability: 'view',
170
+ type: 'function',
171
+ name: 'owner',
172
+ inputs: [],
173
+ outputs: [
174
+ {
175
+ name: '',
176
+ type: 'address',
177
+ },
178
+ ],
179
+ },
180
+ {
181
+ stateMutability: 'view',
182
+ type: 'function',
183
+ name: 'ownershipTimeLock',
184
+ inputs: [],
185
+ outputs: [
186
+ {
187
+ name: '',
188
+ type: 'uint256',
189
+ },
190
+ ],
191
+ },
192
+ {
193
+ stateMutability: 'view',
194
+ type: 'function',
195
+ name: 'pendingOwner',
196
+ inputs: [],
197
+ outputs: [
198
+ {
199
+ name: '',
200
+ type: 'tuple',
201
+ components: [
202
+ {
203
+ name: 'newOwner',
204
+ type: 'address',
205
+ },
206
+ {
207
+ name: 'initiatedBlock',
208
+ type: 'uint256',
209
+ },
210
+ {
211
+ name: 'confirmBlock',
212
+ type: 'uint256',
213
+ },
214
+ ],
215
+ },
216
+ ],
217
+ },
218
+ {
219
+ stateMutability: 'view',
220
+ type: 'function',
221
+ name: 'MIN_OWNERSHIP_TIMELOCK',
222
+ inputs: [],
223
+ outputs: [
224
+ {
225
+ name: '',
226
+ type: 'uint256',
227
+ },
228
+ ],
229
+ },
230
+ {
231
+ stateMutability: 'view',
232
+ type: 'function',
233
+ name: 'MAX_OWNERSHIP_TIMELOCK',
234
+ inputs: [],
235
+ outputs: [
236
+ {
237
+ name: '',
238
+ type: 'uint256',
239
+ },
240
+ ],
241
+ },
242
+ {
243
+ stateMutability: 'nonpayable',
244
+ type: 'function',
245
+ name: 'borrowAndEarnYield',
246
+ inputs: [
247
+ {
248
+ name: '_levgWallet',
249
+ type: 'address',
250
+ },
251
+ ],
252
+ outputs: [],
253
+ },
254
+ {
255
+ stateMutability: 'nonpayable',
256
+ type: 'function',
257
+ name: 'borrowAndEarnYield',
258
+ inputs: [
259
+ {
260
+ name: '_levgWallet',
261
+ type: 'address',
262
+ },
263
+ {
264
+ name: '_removeCollateral',
265
+ type: 'tuple[]',
266
+ components: [
267
+ {
268
+ name: 'positionType',
269
+ type: 'uint8',
270
+ },
271
+ {
272
+ name: 'amount',
273
+ type: 'uint256',
274
+ },
275
+ ],
276
+ },
277
+ ],
278
+ outputs: [],
279
+ },
280
+ {
281
+ stateMutability: 'nonpayable',
282
+ type: 'function',
283
+ name: 'borrowAndEarnYield',
284
+ inputs: [
285
+ {
286
+ name: '_levgWallet',
287
+ type: 'address',
288
+ },
289
+ {
290
+ name: '_removeCollateral',
291
+ type: 'tuple[]',
292
+ components: [
293
+ {
294
+ name: 'positionType',
295
+ type: 'uint8',
296
+ },
297
+ {
298
+ name: 'amount',
299
+ type: 'uint256',
300
+ },
301
+ ],
302
+ },
303
+ {
304
+ name: '_withdrawPositions',
305
+ type: 'tuple[]',
306
+ components: [
307
+ {
308
+ name: 'positionType',
309
+ type: 'uint8',
310
+ },
311
+ {
312
+ name: 'amount',
313
+ type: 'uint256',
314
+ },
315
+ ],
316
+ },
317
+ ],
318
+ outputs: [],
319
+ },
320
+ {
321
+ stateMutability: 'nonpayable',
322
+ type: 'function',
323
+ name: 'borrowAndEarnYield',
324
+ inputs: [
325
+ {
326
+ name: '_levgWallet',
327
+ type: 'address',
328
+ },
329
+ {
330
+ name: '_removeCollateral',
331
+ type: 'tuple[]',
332
+ components: [
333
+ {
334
+ name: 'positionType',
335
+ type: 'uint8',
336
+ },
337
+ {
338
+ name: 'amount',
339
+ type: 'uint256',
340
+ },
341
+ ],
342
+ },
343
+ {
344
+ name: '_withdrawPositions',
345
+ type: 'tuple[]',
346
+ components: [
347
+ {
348
+ name: 'positionType',
349
+ type: 'uint8',
350
+ },
351
+ {
352
+ name: 'amount',
353
+ type: 'uint256',
354
+ },
355
+ ],
356
+ },
357
+ {
358
+ name: '_depositPositions',
359
+ type: 'tuple[]',
360
+ components: [
361
+ {
362
+ name: 'positionType',
363
+ type: 'uint8',
364
+ },
365
+ {
366
+ name: 'amount',
367
+ type: 'uint256',
368
+ },
369
+ {
370
+ name: 'shouldAddToRipeCollateral',
371
+ type: 'bool',
372
+ },
373
+ {
374
+ name: 'shouldSweepAll',
375
+ type: 'bool',
376
+ },
377
+ ],
378
+ },
379
+ ],
380
+ outputs: [],
381
+ },
382
+ {
383
+ stateMutability: 'nonpayable',
384
+ type: 'function',
385
+ name: 'borrowAndEarnYield',
386
+ inputs: [
387
+ {
388
+ name: '_levgWallet',
389
+ type: 'address',
390
+ },
391
+ {
392
+ name: '_removeCollateral',
393
+ type: 'tuple[]',
394
+ components: [
395
+ {
396
+ name: 'positionType',
397
+ type: 'uint8',
398
+ },
399
+ {
400
+ name: 'amount',
401
+ type: 'uint256',
402
+ },
403
+ ],
404
+ },
405
+ {
406
+ name: '_withdrawPositions',
407
+ type: 'tuple[]',
408
+ components: [
409
+ {
410
+ name: 'positionType',
411
+ type: 'uint8',
412
+ },
413
+ {
414
+ name: 'amount',
415
+ type: 'uint256',
416
+ },
417
+ ],
418
+ },
419
+ {
420
+ name: '_depositPositions',
421
+ type: 'tuple[]',
422
+ components: [
423
+ {
424
+ name: 'positionType',
425
+ type: 'uint8',
426
+ },
427
+ {
428
+ name: 'amount',
429
+ type: 'uint256',
430
+ },
431
+ {
432
+ name: 'shouldAddToRipeCollateral',
433
+ type: 'bool',
434
+ },
435
+ {
436
+ name: 'shouldSweepAll',
437
+ type: 'bool',
438
+ },
439
+ ],
440
+ },
441
+ {
442
+ name: '_addCollateral',
443
+ type: 'tuple[]',
444
+ components: [
445
+ {
446
+ name: 'positionType',
447
+ type: 'uint8',
448
+ },
449
+ {
450
+ name: 'amount',
451
+ type: 'uint256',
452
+ },
453
+ ],
454
+ },
455
+ ],
456
+ outputs: [],
457
+ },
458
+ {
459
+ stateMutability: 'nonpayable',
460
+ type: 'function',
461
+ name: 'borrowAndEarnYield',
462
+ inputs: [
463
+ {
464
+ name: '_levgWallet',
465
+ type: 'address',
466
+ },
467
+ {
468
+ name: '_removeCollateral',
469
+ type: 'tuple[]',
470
+ components: [
471
+ {
472
+ name: 'positionType',
473
+ type: 'uint8',
474
+ },
475
+ {
476
+ name: 'amount',
477
+ type: 'uint256',
478
+ },
479
+ ],
480
+ },
481
+ {
482
+ name: '_withdrawPositions',
483
+ type: 'tuple[]',
484
+ components: [
485
+ {
486
+ name: 'positionType',
487
+ type: 'uint8',
488
+ },
489
+ {
490
+ name: 'amount',
491
+ type: 'uint256',
492
+ },
493
+ ],
494
+ },
495
+ {
496
+ name: '_depositPositions',
497
+ type: 'tuple[]',
498
+ components: [
499
+ {
500
+ name: 'positionType',
501
+ type: 'uint8',
502
+ },
503
+ {
504
+ name: 'amount',
505
+ type: 'uint256',
506
+ },
507
+ {
508
+ name: 'shouldAddToRipeCollateral',
509
+ type: 'bool',
510
+ },
511
+ {
512
+ name: 'shouldSweepAll',
513
+ type: 'bool',
514
+ },
515
+ ],
516
+ },
517
+ {
518
+ name: '_addCollateral',
519
+ type: 'tuple[]',
520
+ components: [
521
+ {
522
+ name: 'positionType',
523
+ type: 'uint8',
524
+ },
525
+ {
526
+ name: 'amount',
527
+ type: 'uint256',
528
+ },
529
+ ],
530
+ },
531
+ {
532
+ name: '_borrowAmount',
533
+ type: 'uint256',
534
+ },
535
+ ],
536
+ outputs: [],
537
+ },
538
+ {
539
+ stateMutability: 'nonpayable',
540
+ type: 'function',
541
+ name: 'borrowAndEarnYield',
542
+ inputs: [
543
+ {
544
+ name: '_levgWallet',
545
+ type: 'address',
546
+ },
547
+ {
548
+ name: '_removeCollateral',
549
+ type: 'tuple[]',
550
+ components: [
551
+ {
552
+ name: 'positionType',
553
+ type: 'uint8',
554
+ },
555
+ {
556
+ name: 'amount',
557
+ type: 'uint256',
558
+ },
559
+ ],
560
+ },
561
+ {
562
+ name: '_withdrawPositions',
563
+ type: 'tuple[]',
564
+ components: [
565
+ {
566
+ name: 'positionType',
567
+ type: 'uint8',
568
+ },
569
+ {
570
+ name: 'amount',
571
+ type: 'uint256',
572
+ },
573
+ ],
574
+ },
575
+ {
576
+ name: '_depositPositions',
577
+ type: 'tuple[]',
578
+ components: [
579
+ {
580
+ name: 'positionType',
581
+ type: 'uint8',
582
+ },
583
+ {
584
+ name: 'amount',
585
+ type: 'uint256',
586
+ },
587
+ {
588
+ name: 'shouldAddToRipeCollateral',
589
+ type: 'bool',
590
+ },
591
+ {
592
+ name: 'shouldSweepAll',
593
+ type: 'bool',
594
+ },
595
+ ],
596
+ },
597
+ {
598
+ name: '_addCollateral',
599
+ type: 'tuple[]',
600
+ components: [
601
+ {
602
+ name: 'positionType',
603
+ type: 'uint8',
604
+ },
605
+ {
606
+ name: 'amount',
607
+ type: 'uint256',
608
+ },
609
+ ],
610
+ },
611
+ {
612
+ name: '_borrowAmount',
613
+ type: 'uint256',
614
+ },
615
+ {
616
+ name: '_wantsSavingsGreen',
617
+ type: 'bool',
618
+ },
619
+ ],
620
+ outputs: [],
621
+ },
622
+ {
623
+ stateMutability: 'nonpayable',
624
+ type: 'function',
625
+ name: 'borrowAndEarnYield',
626
+ inputs: [
627
+ {
628
+ name: '_levgWallet',
629
+ type: 'address',
630
+ },
631
+ {
632
+ name: '_removeCollateral',
633
+ type: 'tuple[]',
634
+ components: [
635
+ {
636
+ name: 'positionType',
637
+ type: 'uint8',
638
+ },
639
+ {
640
+ name: 'amount',
641
+ type: 'uint256',
642
+ },
643
+ ],
644
+ },
645
+ {
646
+ name: '_withdrawPositions',
647
+ type: 'tuple[]',
648
+ components: [
649
+ {
650
+ name: 'positionType',
651
+ type: 'uint8',
652
+ },
653
+ {
654
+ name: 'amount',
655
+ type: 'uint256',
656
+ },
657
+ ],
658
+ },
659
+ {
660
+ name: '_depositPositions',
661
+ type: 'tuple[]',
662
+ components: [
663
+ {
664
+ name: 'positionType',
665
+ type: 'uint8',
666
+ },
667
+ {
668
+ name: 'amount',
669
+ type: 'uint256',
670
+ },
671
+ {
672
+ name: 'shouldAddToRipeCollateral',
673
+ type: 'bool',
674
+ },
675
+ {
676
+ name: 'shouldSweepAll',
677
+ type: 'bool',
678
+ },
679
+ ],
680
+ },
681
+ {
682
+ name: '_addCollateral',
683
+ type: 'tuple[]',
684
+ components: [
685
+ {
686
+ name: 'positionType',
687
+ type: 'uint8',
688
+ },
689
+ {
690
+ name: 'amount',
691
+ type: 'uint256',
692
+ },
693
+ ],
694
+ },
695
+ {
696
+ name: '_borrowAmount',
697
+ type: 'uint256',
698
+ },
699
+ {
700
+ name: '_wantsSavingsGreen',
701
+ type: 'bool',
702
+ },
703
+ {
704
+ name: '_shouldEnterStabPool',
705
+ type: 'bool',
706
+ },
707
+ ],
708
+ outputs: [],
709
+ },
710
+ {
711
+ stateMutability: 'nonpayable',
712
+ type: 'function',
713
+ name: 'borrowAndEarnYield',
714
+ inputs: [
715
+ {
716
+ name: '_levgWallet',
717
+ type: 'address',
718
+ },
719
+ {
720
+ name: '_removeCollateral',
721
+ type: 'tuple[]',
722
+ components: [
723
+ {
724
+ name: 'positionType',
725
+ type: 'uint8',
726
+ },
727
+ {
728
+ name: 'amount',
729
+ type: 'uint256',
730
+ },
731
+ ],
732
+ },
733
+ {
734
+ name: '_withdrawPositions',
735
+ type: 'tuple[]',
736
+ components: [
737
+ {
738
+ name: 'positionType',
739
+ type: 'uint8',
740
+ },
741
+ {
742
+ name: 'amount',
743
+ type: 'uint256',
744
+ },
745
+ ],
746
+ },
747
+ {
748
+ name: '_depositPositions',
749
+ type: 'tuple[]',
750
+ components: [
751
+ {
752
+ name: 'positionType',
753
+ type: 'uint8',
754
+ },
755
+ {
756
+ name: 'amount',
757
+ type: 'uint256',
758
+ },
759
+ {
760
+ name: 'shouldAddToRipeCollateral',
761
+ type: 'bool',
762
+ },
763
+ {
764
+ name: 'shouldSweepAll',
765
+ type: 'bool',
766
+ },
767
+ ],
768
+ },
769
+ {
770
+ name: '_addCollateral',
771
+ type: 'tuple[]',
772
+ components: [
773
+ {
774
+ name: 'positionType',
775
+ type: 'uint8',
776
+ },
777
+ {
778
+ name: 'amount',
779
+ type: 'uint256',
780
+ },
781
+ ],
782
+ },
783
+ {
784
+ name: '_borrowAmount',
785
+ type: 'uint256',
786
+ },
787
+ {
788
+ name: '_wantsSavingsGreen',
789
+ type: 'bool',
790
+ },
791
+ {
792
+ name: '_shouldEnterStabPool',
793
+ type: 'bool',
794
+ },
795
+ {
796
+ name: '_swapInstruction',
797
+ type: 'tuple',
798
+ components: [
799
+ {
800
+ name: 'legoId',
801
+ type: 'uint256',
802
+ },
803
+ {
804
+ name: 'amountIn',
805
+ type: 'uint256',
806
+ },
807
+ {
808
+ name: 'minAmountOut',
809
+ type: 'uint256',
810
+ },
811
+ {
812
+ name: 'tokenPath',
813
+ type: 'address[]',
814
+ },
815
+ {
816
+ name: 'poolPath',
817
+ type: 'address[]',
818
+ },
819
+ ],
820
+ },
821
+ ],
822
+ outputs: [],
823
+ },
824
+ {
825
+ stateMutability: 'nonpayable',
826
+ type: 'function',
827
+ name: 'borrowAndEarnYield',
828
+ inputs: [
829
+ {
830
+ name: '_levgWallet',
831
+ type: 'address',
832
+ },
833
+ {
834
+ name: '_removeCollateral',
835
+ type: 'tuple[]',
836
+ components: [
837
+ {
838
+ name: 'positionType',
839
+ type: 'uint8',
840
+ },
841
+ {
842
+ name: 'amount',
843
+ type: 'uint256',
844
+ },
845
+ ],
846
+ },
847
+ {
848
+ name: '_withdrawPositions',
849
+ type: 'tuple[]',
850
+ components: [
851
+ {
852
+ name: 'positionType',
853
+ type: 'uint8',
854
+ },
855
+ {
856
+ name: 'amount',
857
+ type: 'uint256',
858
+ },
859
+ ],
860
+ },
861
+ {
862
+ name: '_depositPositions',
863
+ type: 'tuple[]',
864
+ components: [
865
+ {
866
+ name: 'positionType',
867
+ type: 'uint8',
868
+ },
869
+ {
870
+ name: 'amount',
871
+ type: 'uint256',
872
+ },
873
+ {
874
+ name: 'shouldAddToRipeCollateral',
875
+ type: 'bool',
876
+ },
877
+ {
878
+ name: 'shouldSweepAll',
879
+ type: 'bool',
880
+ },
881
+ ],
882
+ },
883
+ {
884
+ name: '_addCollateral',
885
+ type: 'tuple[]',
886
+ components: [
887
+ {
888
+ name: 'positionType',
889
+ type: 'uint8',
890
+ },
891
+ {
892
+ name: 'amount',
893
+ type: 'uint256',
894
+ },
895
+ ],
896
+ },
897
+ {
898
+ name: '_borrowAmount',
899
+ type: 'uint256',
900
+ },
901
+ {
902
+ name: '_wantsSavingsGreen',
903
+ type: 'bool',
904
+ },
905
+ {
906
+ name: '_shouldEnterStabPool',
907
+ type: 'bool',
908
+ },
909
+ {
910
+ name: '_swapInstruction',
911
+ type: 'tuple',
912
+ components: [
913
+ {
914
+ name: 'legoId',
915
+ type: 'uint256',
916
+ },
917
+ {
918
+ name: 'amountIn',
919
+ type: 'uint256',
920
+ },
921
+ {
922
+ name: 'minAmountOut',
923
+ type: 'uint256',
924
+ },
925
+ {
926
+ name: 'tokenPath',
927
+ type: 'address[]',
928
+ },
929
+ {
930
+ name: 'poolPath',
931
+ type: 'address[]',
932
+ },
933
+ ],
934
+ },
935
+ {
936
+ name: '_postSwapDeposits',
937
+ type: 'tuple[]',
938
+ components: [
939
+ {
940
+ name: 'positionType',
941
+ type: 'uint8',
942
+ },
943
+ {
944
+ name: 'amount',
945
+ type: 'uint256',
946
+ },
947
+ {
948
+ name: 'shouldAddToRipeCollateral',
949
+ type: 'bool',
950
+ },
951
+ {
952
+ name: 'shouldSweepAll',
953
+ type: 'bool',
954
+ },
955
+ ],
956
+ },
957
+ ],
958
+ outputs: [],
959
+ },
960
+ {
961
+ stateMutability: 'nonpayable',
962
+ type: 'function',
963
+ name: 'borrowAndEarnYield',
964
+ inputs: [
965
+ {
966
+ name: '_levgWallet',
967
+ type: 'address',
968
+ },
969
+ {
970
+ name: '_removeCollateral',
971
+ type: 'tuple[]',
972
+ components: [
973
+ {
974
+ name: 'positionType',
975
+ type: 'uint8',
976
+ },
977
+ {
978
+ name: 'amount',
979
+ type: 'uint256',
980
+ },
981
+ ],
982
+ },
983
+ {
984
+ name: '_withdrawPositions',
985
+ type: 'tuple[]',
986
+ components: [
987
+ {
988
+ name: 'positionType',
989
+ type: 'uint8',
990
+ },
991
+ {
992
+ name: 'amount',
993
+ type: 'uint256',
994
+ },
995
+ ],
996
+ },
997
+ {
998
+ name: '_depositPositions',
999
+ type: 'tuple[]',
1000
+ components: [
1001
+ {
1002
+ name: 'positionType',
1003
+ type: 'uint8',
1004
+ },
1005
+ {
1006
+ name: 'amount',
1007
+ type: 'uint256',
1008
+ },
1009
+ {
1010
+ name: 'shouldAddToRipeCollateral',
1011
+ type: 'bool',
1012
+ },
1013
+ {
1014
+ name: 'shouldSweepAll',
1015
+ type: 'bool',
1016
+ },
1017
+ ],
1018
+ },
1019
+ {
1020
+ name: '_addCollateral',
1021
+ type: 'tuple[]',
1022
+ components: [
1023
+ {
1024
+ name: 'positionType',
1025
+ type: 'uint8',
1026
+ },
1027
+ {
1028
+ name: 'amount',
1029
+ type: 'uint256',
1030
+ },
1031
+ ],
1032
+ },
1033
+ {
1034
+ name: '_borrowAmount',
1035
+ type: 'uint256',
1036
+ },
1037
+ {
1038
+ name: '_wantsSavingsGreen',
1039
+ type: 'bool',
1040
+ },
1041
+ {
1042
+ name: '_shouldEnterStabPool',
1043
+ type: 'bool',
1044
+ },
1045
+ {
1046
+ name: '_swapInstruction',
1047
+ type: 'tuple',
1048
+ components: [
1049
+ {
1050
+ name: 'legoId',
1051
+ type: 'uint256',
1052
+ },
1053
+ {
1054
+ name: 'amountIn',
1055
+ type: 'uint256',
1056
+ },
1057
+ {
1058
+ name: 'minAmountOut',
1059
+ type: 'uint256',
1060
+ },
1061
+ {
1062
+ name: 'tokenPath',
1063
+ type: 'address[]',
1064
+ },
1065
+ {
1066
+ name: 'poolPath',
1067
+ type: 'address[]',
1068
+ },
1069
+ ],
1070
+ },
1071
+ {
1072
+ name: '_postSwapDeposits',
1073
+ type: 'tuple[]',
1074
+ components: [
1075
+ {
1076
+ name: 'positionType',
1077
+ type: 'uint8',
1078
+ },
1079
+ {
1080
+ name: 'amount',
1081
+ type: 'uint256',
1082
+ },
1083
+ {
1084
+ name: 'shouldAddToRipeCollateral',
1085
+ type: 'bool',
1086
+ },
1087
+ {
1088
+ name: 'shouldSweepAll',
1089
+ type: 'bool',
1090
+ },
1091
+ ],
1092
+ },
1093
+ {
1094
+ name: '_sig',
1095
+ type: 'tuple',
1096
+ components: [
1097
+ {
1098
+ name: 'signature',
1099
+ type: 'bytes',
1100
+ },
1101
+ {
1102
+ name: 'nonce',
1103
+ type: 'uint256',
1104
+ },
1105
+ {
1106
+ name: 'expiration',
1107
+ type: 'uint256',
1108
+ },
1109
+ ],
1110
+ },
1111
+ ],
1112
+ outputs: [],
1113
+ },
1114
+ {
1115
+ stateMutability: 'nonpayable',
1116
+ type: 'function',
1117
+ name: 'deleverage',
1118
+ inputs: [
1119
+ {
1120
+ name: '_levgWallet',
1121
+ type: 'address',
1122
+ },
1123
+ ],
1124
+ outputs: [],
1125
+ },
1126
+ {
1127
+ stateMutability: 'nonpayable',
1128
+ type: 'function',
1129
+ name: 'deleverage',
1130
+ inputs: [
1131
+ {
1132
+ name: '_levgWallet',
1133
+ type: 'address',
1134
+ },
1135
+ {
1136
+ name: '_mode',
1137
+ type: 'uint8',
1138
+ },
1139
+ ],
1140
+ outputs: [],
1141
+ },
1142
+ {
1143
+ stateMutability: 'nonpayable',
1144
+ type: 'function',
1145
+ name: 'deleverage',
1146
+ inputs: [
1147
+ {
1148
+ name: '_levgWallet',
1149
+ type: 'address',
1150
+ },
1151
+ {
1152
+ name: '_mode',
1153
+ type: 'uint8',
1154
+ },
1155
+ {
1156
+ name: '_autoDeleverageAmount',
1157
+ type: 'uint256',
1158
+ },
1159
+ ],
1160
+ outputs: [],
1161
+ },
1162
+ {
1163
+ stateMutability: 'nonpayable',
1164
+ type: 'function',
1165
+ name: 'deleverage',
1166
+ inputs: [
1167
+ {
1168
+ name: '_levgWallet',
1169
+ type: 'address',
1170
+ },
1171
+ {
1172
+ name: '_mode',
1173
+ type: 'uint8',
1174
+ },
1175
+ {
1176
+ name: '_autoDeleverageAmount',
1177
+ type: 'uint256',
1178
+ },
1179
+ {
1180
+ name: '_deleverageAssets',
1181
+ type: 'tuple[]',
1182
+ components: [
1183
+ {
1184
+ name: 'vaultId',
1185
+ type: 'uint256',
1186
+ },
1187
+ {
1188
+ name: 'asset',
1189
+ type: 'address',
1190
+ },
1191
+ {
1192
+ name: 'targetRepayAmount',
1193
+ type: 'uint256',
1194
+ },
1195
+ ],
1196
+ },
1197
+ ],
1198
+ outputs: [],
1199
+ },
1200
+ {
1201
+ stateMutability: 'nonpayable',
1202
+ type: 'function',
1203
+ name: 'deleverage',
1204
+ inputs: [
1205
+ {
1206
+ name: '_levgWallet',
1207
+ type: 'address',
1208
+ },
1209
+ {
1210
+ name: '_mode',
1211
+ type: 'uint8',
1212
+ },
1213
+ {
1214
+ name: '_autoDeleverageAmount',
1215
+ type: 'uint256',
1216
+ },
1217
+ {
1218
+ name: '_deleverageAssets',
1219
+ type: 'tuple[]',
1220
+ components: [
1221
+ {
1222
+ name: 'vaultId',
1223
+ type: 'uint256',
1224
+ },
1225
+ {
1226
+ name: 'asset',
1227
+ type: 'address',
1228
+ },
1229
+ {
1230
+ name: 'targetRepayAmount',
1231
+ type: 'uint256',
1232
+ },
1233
+ ],
1234
+ },
1235
+ {
1236
+ name: '_removeCollateral',
1237
+ type: 'tuple[]',
1238
+ components: [
1239
+ {
1240
+ name: 'positionType',
1241
+ type: 'uint8',
1242
+ },
1243
+ {
1244
+ name: 'amount',
1245
+ type: 'uint256',
1246
+ },
1247
+ ],
1248
+ },
1249
+ ],
1250
+ outputs: [],
1251
+ },
1252
+ {
1253
+ stateMutability: 'nonpayable',
1254
+ type: 'function',
1255
+ name: 'deleverage',
1256
+ inputs: [
1257
+ {
1258
+ name: '_levgWallet',
1259
+ type: 'address',
1260
+ },
1261
+ {
1262
+ name: '_mode',
1263
+ type: 'uint8',
1264
+ },
1265
+ {
1266
+ name: '_autoDeleverageAmount',
1267
+ type: 'uint256',
1268
+ },
1269
+ {
1270
+ name: '_deleverageAssets',
1271
+ type: 'tuple[]',
1272
+ components: [
1273
+ {
1274
+ name: 'vaultId',
1275
+ type: 'uint256',
1276
+ },
1277
+ {
1278
+ name: 'asset',
1279
+ type: 'address',
1280
+ },
1281
+ {
1282
+ name: 'targetRepayAmount',
1283
+ type: 'uint256',
1284
+ },
1285
+ ],
1286
+ },
1287
+ {
1288
+ name: '_removeCollateral',
1289
+ type: 'tuple[]',
1290
+ components: [
1291
+ {
1292
+ name: 'positionType',
1293
+ type: 'uint8',
1294
+ },
1295
+ {
1296
+ name: 'amount',
1297
+ type: 'uint256',
1298
+ },
1299
+ ],
1300
+ },
1301
+ {
1302
+ name: '_withdrawPositions',
1303
+ type: 'tuple[]',
1304
+ components: [
1305
+ {
1306
+ name: 'positionType',
1307
+ type: 'uint8',
1308
+ },
1309
+ {
1310
+ name: 'amount',
1311
+ type: 'uint256',
1312
+ },
1313
+ ],
1314
+ },
1315
+ ],
1316
+ outputs: [],
1317
+ },
1318
+ {
1319
+ stateMutability: 'nonpayable',
1320
+ type: 'function',
1321
+ name: 'deleverage',
1322
+ inputs: [
1323
+ {
1324
+ name: '_levgWallet',
1325
+ type: 'address',
1326
+ },
1327
+ {
1328
+ name: '_mode',
1329
+ type: 'uint8',
1330
+ },
1331
+ {
1332
+ name: '_autoDeleverageAmount',
1333
+ type: 'uint256',
1334
+ },
1335
+ {
1336
+ name: '_deleverageAssets',
1337
+ type: 'tuple[]',
1338
+ components: [
1339
+ {
1340
+ name: 'vaultId',
1341
+ type: 'uint256',
1342
+ },
1343
+ {
1344
+ name: 'asset',
1345
+ type: 'address',
1346
+ },
1347
+ {
1348
+ name: 'targetRepayAmount',
1349
+ type: 'uint256',
1350
+ },
1351
+ ],
1352
+ },
1353
+ {
1354
+ name: '_removeCollateral',
1355
+ type: 'tuple[]',
1356
+ components: [
1357
+ {
1358
+ name: 'positionType',
1359
+ type: 'uint8',
1360
+ },
1361
+ {
1362
+ name: 'amount',
1363
+ type: 'uint256',
1364
+ },
1365
+ ],
1366
+ },
1367
+ {
1368
+ name: '_withdrawPositions',
1369
+ type: 'tuple[]',
1370
+ components: [
1371
+ {
1372
+ name: 'positionType',
1373
+ type: 'uint8',
1374
+ },
1375
+ {
1376
+ name: 'amount',
1377
+ type: 'uint256',
1378
+ },
1379
+ ],
1380
+ },
1381
+ {
1382
+ name: '_swapInstruction',
1383
+ type: 'tuple',
1384
+ components: [
1385
+ {
1386
+ name: 'legoId',
1387
+ type: 'uint256',
1388
+ },
1389
+ {
1390
+ name: 'amountIn',
1391
+ type: 'uint256',
1392
+ },
1393
+ {
1394
+ name: 'minAmountOut',
1395
+ type: 'uint256',
1396
+ },
1397
+ {
1398
+ name: 'tokenPath',
1399
+ type: 'address[]',
1400
+ },
1401
+ {
1402
+ name: 'poolPath',
1403
+ type: 'address[]',
1404
+ },
1405
+ ],
1406
+ },
1407
+ ],
1408
+ outputs: [],
1409
+ },
1410
+ {
1411
+ stateMutability: 'nonpayable',
1412
+ type: 'function',
1413
+ name: 'deleverage',
1414
+ inputs: [
1415
+ {
1416
+ name: '_levgWallet',
1417
+ type: 'address',
1418
+ },
1419
+ {
1420
+ name: '_mode',
1421
+ type: 'uint8',
1422
+ },
1423
+ {
1424
+ name: '_autoDeleverageAmount',
1425
+ type: 'uint256',
1426
+ },
1427
+ {
1428
+ name: '_deleverageAssets',
1429
+ type: 'tuple[]',
1430
+ components: [
1431
+ {
1432
+ name: 'vaultId',
1433
+ type: 'uint256',
1434
+ },
1435
+ {
1436
+ name: 'asset',
1437
+ type: 'address',
1438
+ },
1439
+ {
1440
+ name: 'targetRepayAmount',
1441
+ type: 'uint256',
1442
+ },
1443
+ ],
1444
+ },
1445
+ {
1446
+ name: '_removeCollateral',
1447
+ type: 'tuple[]',
1448
+ components: [
1449
+ {
1450
+ name: 'positionType',
1451
+ type: 'uint8',
1452
+ },
1453
+ {
1454
+ name: 'amount',
1455
+ type: 'uint256',
1456
+ },
1457
+ ],
1458
+ },
1459
+ {
1460
+ name: '_withdrawPositions',
1461
+ type: 'tuple[]',
1462
+ components: [
1463
+ {
1464
+ name: 'positionType',
1465
+ type: 'uint8',
1466
+ },
1467
+ {
1468
+ name: 'amount',
1469
+ type: 'uint256',
1470
+ },
1471
+ ],
1472
+ },
1473
+ {
1474
+ name: '_swapInstruction',
1475
+ type: 'tuple',
1476
+ components: [
1477
+ {
1478
+ name: 'legoId',
1479
+ type: 'uint256',
1480
+ },
1481
+ {
1482
+ name: 'amountIn',
1483
+ type: 'uint256',
1484
+ },
1485
+ {
1486
+ name: 'minAmountOut',
1487
+ type: 'uint256',
1488
+ },
1489
+ {
1490
+ name: 'tokenPath',
1491
+ type: 'address[]',
1492
+ },
1493
+ {
1494
+ name: 'poolPath',
1495
+ type: 'address[]',
1496
+ },
1497
+ ],
1498
+ },
1499
+ {
1500
+ name: '_repayAsset',
1501
+ type: 'address',
1502
+ },
1503
+ ],
1504
+ outputs: [],
1505
+ },
1506
+ {
1507
+ stateMutability: 'nonpayable',
1508
+ type: 'function',
1509
+ name: 'deleverage',
1510
+ inputs: [
1511
+ {
1512
+ name: '_levgWallet',
1513
+ type: 'address',
1514
+ },
1515
+ {
1516
+ name: '_mode',
1517
+ type: 'uint8',
1518
+ },
1519
+ {
1520
+ name: '_autoDeleverageAmount',
1521
+ type: 'uint256',
1522
+ },
1523
+ {
1524
+ name: '_deleverageAssets',
1525
+ type: 'tuple[]',
1526
+ components: [
1527
+ {
1528
+ name: 'vaultId',
1529
+ type: 'uint256',
1530
+ },
1531
+ {
1532
+ name: 'asset',
1533
+ type: 'address',
1534
+ },
1535
+ {
1536
+ name: 'targetRepayAmount',
1537
+ type: 'uint256',
1538
+ },
1539
+ ],
1540
+ },
1541
+ {
1542
+ name: '_removeCollateral',
1543
+ type: 'tuple[]',
1544
+ components: [
1545
+ {
1546
+ name: 'positionType',
1547
+ type: 'uint8',
1548
+ },
1549
+ {
1550
+ name: 'amount',
1551
+ type: 'uint256',
1552
+ },
1553
+ ],
1554
+ },
1555
+ {
1556
+ name: '_withdrawPositions',
1557
+ type: 'tuple[]',
1558
+ components: [
1559
+ {
1560
+ name: 'positionType',
1561
+ type: 'uint8',
1562
+ },
1563
+ {
1564
+ name: 'amount',
1565
+ type: 'uint256',
1566
+ },
1567
+ ],
1568
+ },
1569
+ {
1570
+ name: '_swapInstruction',
1571
+ type: 'tuple',
1572
+ components: [
1573
+ {
1574
+ name: 'legoId',
1575
+ type: 'uint256',
1576
+ },
1577
+ {
1578
+ name: 'amountIn',
1579
+ type: 'uint256',
1580
+ },
1581
+ {
1582
+ name: 'minAmountOut',
1583
+ type: 'uint256',
1584
+ },
1585
+ {
1586
+ name: 'tokenPath',
1587
+ type: 'address[]',
1588
+ },
1589
+ {
1590
+ name: 'poolPath',
1591
+ type: 'address[]',
1592
+ },
1593
+ ],
1594
+ },
1595
+ {
1596
+ name: '_repayAsset',
1597
+ type: 'address',
1598
+ },
1599
+ {
1600
+ name: '_repayAmount',
1601
+ type: 'uint256',
1602
+ },
1603
+ ],
1604
+ outputs: [],
1605
+ },
1606
+ {
1607
+ stateMutability: 'nonpayable',
1608
+ type: 'function',
1609
+ name: 'deleverage',
1610
+ inputs: [
1611
+ {
1612
+ name: '_levgWallet',
1613
+ type: 'address',
1614
+ },
1615
+ {
1616
+ name: '_mode',
1617
+ type: 'uint8',
1618
+ },
1619
+ {
1620
+ name: '_autoDeleverageAmount',
1621
+ type: 'uint256',
1622
+ },
1623
+ {
1624
+ name: '_deleverageAssets',
1625
+ type: 'tuple[]',
1626
+ components: [
1627
+ {
1628
+ name: 'vaultId',
1629
+ type: 'uint256',
1630
+ },
1631
+ {
1632
+ name: 'asset',
1633
+ type: 'address',
1634
+ },
1635
+ {
1636
+ name: 'targetRepayAmount',
1637
+ type: 'uint256',
1638
+ },
1639
+ ],
1640
+ },
1641
+ {
1642
+ name: '_removeCollateral',
1643
+ type: 'tuple[]',
1644
+ components: [
1645
+ {
1646
+ name: 'positionType',
1647
+ type: 'uint8',
1648
+ },
1649
+ {
1650
+ name: 'amount',
1651
+ type: 'uint256',
1652
+ },
1653
+ ],
1654
+ },
1655
+ {
1656
+ name: '_withdrawPositions',
1657
+ type: 'tuple[]',
1658
+ components: [
1659
+ {
1660
+ name: 'positionType',
1661
+ type: 'uint8',
1662
+ },
1663
+ {
1664
+ name: 'amount',
1665
+ type: 'uint256',
1666
+ },
1667
+ ],
1668
+ },
1669
+ {
1670
+ name: '_swapInstruction',
1671
+ type: 'tuple',
1672
+ components: [
1673
+ {
1674
+ name: 'legoId',
1675
+ type: 'uint256',
1676
+ },
1677
+ {
1678
+ name: 'amountIn',
1679
+ type: 'uint256',
1680
+ },
1681
+ {
1682
+ name: 'minAmountOut',
1683
+ type: 'uint256',
1684
+ },
1685
+ {
1686
+ name: 'tokenPath',
1687
+ type: 'address[]',
1688
+ },
1689
+ {
1690
+ name: 'poolPath',
1691
+ type: 'address[]',
1692
+ },
1693
+ ],
1694
+ },
1695
+ {
1696
+ name: '_repayAsset',
1697
+ type: 'address',
1698
+ },
1699
+ {
1700
+ name: '_repayAmount',
1701
+ type: 'uint256',
1702
+ },
1703
+ {
1704
+ name: '_shouldSweepAllForRepay',
1705
+ type: 'bool',
1706
+ },
1707
+ ],
1708
+ outputs: [],
1709
+ },
1710
+ {
1711
+ stateMutability: 'nonpayable',
1712
+ type: 'function',
1713
+ name: 'deleverage',
1714
+ inputs: [
1715
+ {
1716
+ name: '_levgWallet',
1717
+ type: 'address',
1718
+ },
1719
+ {
1720
+ name: '_mode',
1721
+ type: 'uint8',
1722
+ },
1723
+ {
1724
+ name: '_autoDeleverageAmount',
1725
+ type: 'uint256',
1726
+ },
1727
+ {
1728
+ name: '_deleverageAssets',
1729
+ type: 'tuple[]',
1730
+ components: [
1731
+ {
1732
+ name: 'vaultId',
1733
+ type: 'uint256',
1734
+ },
1735
+ {
1736
+ name: 'asset',
1737
+ type: 'address',
1738
+ },
1739
+ {
1740
+ name: 'targetRepayAmount',
1741
+ type: 'uint256',
1742
+ },
1743
+ ],
1744
+ },
1745
+ {
1746
+ name: '_removeCollateral',
1747
+ type: 'tuple[]',
1748
+ components: [
1749
+ {
1750
+ name: 'positionType',
1751
+ type: 'uint8',
1752
+ },
1753
+ {
1754
+ name: 'amount',
1755
+ type: 'uint256',
1756
+ },
1757
+ ],
1758
+ },
1759
+ {
1760
+ name: '_withdrawPositions',
1761
+ type: 'tuple[]',
1762
+ components: [
1763
+ {
1764
+ name: 'positionType',
1765
+ type: 'uint8',
1766
+ },
1767
+ {
1768
+ name: 'amount',
1769
+ type: 'uint256',
1770
+ },
1771
+ ],
1772
+ },
1773
+ {
1774
+ name: '_swapInstruction',
1775
+ type: 'tuple',
1776
+ components: [
1777
+ {
1778
+ name: 'legoId',
1779
+ type: 'uint256',
1780
+ },
1781
+ {
1782
+ name: 'amountIn',
1783
+ type: 'uint256',
1784
+ },
1785
+ {
1786
+ name: 'minAmountOut',
1787
+ type: 'uint256',
1788
+ },
1789
+ {
1790
+ name: 'tokenPath',
1791
+ type: 'address[]',
1792
+ },
1793
+ {
1794
+ name: 'poolPath',
1795
+ type: 'address[]',
1796
+ },
1797
+ ],
1798
+ },
1799
+ {
1800
+ name: '_repayAsset',
1801
+ type: 'address',
1802
+ },
1803
+ {
1804
+ name: '_repayAmount',
1805
+ type: 'uint256',
1806
+ },
1807
+ {
1808
+ name: '_shouldSweepAllForRepay',
1809
+ type: 'bool',
1810
+ },
1811
+ {
1812
+ name: '_sig',
1813
+ type: 'tuple',
1814
+ components: [
1815
+ {
1816
+ name: 'signature',
1817
+ type: 'bytes',
1818
+ },
1819
+ {
1820
+ name: 'nonce',
1821
+ type: 'uint256',
1822
+ },
1823
+ {
1824
+ name: 'expiration',
1825
+ type: 'uint256',
1826
+ },
1827
+ ],
1828
+ },
1829
+ ],
1830
+ outputs: [],
1831
+ },
1832
+ {
1833
+ stateMutability: 'nonpayable',
1834
+ type: 'function',
1835
+ name: 'compoundYieldGains',
1836
+ inputs: [
1837
+ {
1838
+ name: '_levgWallet',
1839
+ type: 'address',
1840
+ },
1841
+ ],
1842
+ outputs: [],
1843
+ },
1844
+ {
1845
+ stateMutability: 'nonpayable',
1846
+ type: 'function',
1847
+ name: 'compoundYieldGains',
1848
+ inputs: [
1849
+ {
1850
+ name: '_levgWallet',
1851
+ type: 'address',
1852
+ },
1853
+ {
1854
+ name: '_removeCollateral',
1855
+ type: 'tuple[]',
1856
+ components: [
1857
+ {
1858
+ name: 'positionType',
1859
+ type: 'uint8',
1860
+ },
1861
+ {
1862
+ name: 'amount',
1863
+ type: 'uint256',
1864
+ },
1865
+ ],
1866
+ },
1867
+ ],
1868
+ outputs: [],
1869
+ },
1870
+ {
1871
+ stateMutability: 'nonpayable',
1872
+ type: 'function',
1873
+ name: 'compoundYieldGains',
1874
+ inputs: [
1875
+ {
1876
+ name: '_levgWallet',
1877
+ type: 'address',
1878
+ },
1879
+ {
1880
+ name: '_removeCollateral',
1881
+ type: 'tuple[]',
1882
+ components: [
1883
+ {
1884
+ name: 'positionType',
1885
+ type: 'uint8',
1886
+ },
1887
+ {
1888
+ name: 'amount',
1889
+ type: 'uint256',
1890
+ },
1891
+ ],
1892
+ },
1893
+ {
1894
+ name: '_withdrawPositions',
1895
+ type: 'tuple[]',
1896
+ components: [
1897
+ {
1898
+ name: 'positionType',
1899
+ type: 'uint8',
1900
+ },
1901
+ {
1902
+ name: 'amount',
1903
+ type: 'uint256',
1904
+ },
1905
+ ],
1906
+ },
1907
+ ],
1908
+ outputs: [],
1909
+ },
1910
+ {
1911
+ stateMutability: 'nonpayable',
1912
+ type: 'function',
1913
+ name: 'compoundYieldGains',
1914
+ inputs: [
1915
+ {
1916
+ name: '_levgWallet',
1917
+ type: 'address',
1918
+ },
1919
+ {
1920
+ name: '_removeCollateral',
1921
+ type: 'tuple[]',
1922
+ components: [
1923
+ {
1924
+ name: 'positionType',
1925
+ type: 'uint8',
1926
+ },
1927
+ {
1928
+ name: 'amount',
1929
+ type: 'uint256',
1930
+ },
1931
+ ],
1932
+ },
1933
+ {
1934
+ name: '_withdrawPositions',
1935
+ type: 'tuple[]',
1936
+ components: [
1937
+ {
1938
+ name: 'positionType',
1939
+ type: 'uint8',
1940
+ },
1941
+ {
1942
+ name: 'amount',
1943
+ type: 'uint256',
1944
+ },
1945
+ ],
1946
+ },
1947
+ {
1948
+ name: '_swapInstruction',
1949
+ type: 'tuple',
1950
+ components: [
1951
+ {
1952
+ name: 'legoId',
1953
+ type: 'uint256',
1954
+ },
1955
+ {
1956
+ name: 'amountIn',
1957
+ type: 'uint256',
1958
+ },
1959
+ {
1960
+ name: 'minAmountOut',
1961
+ type: 'uint256',
1962
+ },
1963
+ {
1964
+ name: 'tokenPath',
1965
+ type: 'address[]',
1966
+ },
1967
+ {
1968
+ name: 'poolPath',
1969
+ type: 'address[]',
1970
+ },
1971
+ ],
1972
+ },
1973
+ ],
1974
+ outputs: [],
1975
+ },
1976
+ {
1977
+ stateMutability: 'nonpayable',
1978
+ type: 'function',
1979
+ name: 'compoundYieldGains',
1980
+ inputs: [
1981
+ {
1982
+ name: '_levgWallet',
1983
+ type: 'address',
1984
+ },
1985
+ {
1986
+ name: '_removeCollateral',
1987
+ type: 'tuple[]',
1988
+ components: [
1989
+ {
1990
+ name: 'positionType',
1991
+ type: 'uint8',
1992
+ },
1993
+ {
1994
+ name: 'amount',
1995
+ type: 'uint256',
1996
+ },
1997
+ ],
1998
+ },
1999
+ {
2000
+ name: '_withdrawPositions',
2001
+ type: 'tuple[]',
2002
+ components: [
2003
+ {
2004
+ name: 'positionType',
2005
+ type: 'uint8',
2006
+ },
2007
+ {
2008
+ name: 'amount',
2009
+ type: 'uint256',
2010
+ },
2011
+ ],
2012
+ },
2013
+ {
2014
+ name: '_swapInstruction',
2015
+ type: 'tuple',
2016
+ components: [
2017
+ {
2018
+ name: 'legoId',
2019
+ type: 'uint256',
2020
+ },
2021
+ {
2022
+ name: 'amountIn',
2023
+ type: 'uint256',
2024
+ },
2025
+ {
2026
+ name: 'minAmountOut',
2027
+ type: 'uint256',
2028
+ },
2029
+ {
2030
+ name: 'tokenPath',
2031
+ type: 'address[]',
2032
+ },
2033
+ {
2034
+ name: 'poolPath',
2035
+ type: 'address[]',
2036
+ },
2037
+ ],
2038
+ },
2039
+ {
2040
+ name: '_postSwapDeposits',
2041
+ type: 'tuple[]',
2042
+ components: [
2043
+ {
2044
+ name: 'positionType',
2045
+ type: 'uint8',
2046
+ },
2047
+ {
2048
+ name: 'amount',
2049
+ type: 'uint256',
2050
+ },
2051
+ {
2052
+ name: 'shouldAddToRipeCollateral',
2053
+ type: 'bool',
2054
+ },
2055
+ {
2056
+ name: 'shouldSweepAll',
2057
+ type: 'bool',
2058
+ },
2059
+ ],
2060
+ },
2061
+ ],
2062
+ outputs: [],
2063
+ },
2064
+ {
2065
+ stateMutability: 'nonpayable',
2066
+ type: 'function',
2067
+ name: 'compoundYieldGains',
2068
+ inputs: [
2069
+ {
2070
+ name: '_levgWallet',
2071
+ type: 'address',
2072
+ },
2073
+ {
2074
+ name: '_removeCollateral',
2075
+ type: 'tuple[]',
2076
+ components: [
2077
+ {
2078
+ name: 'positionType',
2079
+ type: 'uint8',
2080
+ },
2081
+ {
2082
+ name: 'amount',
2083
+ type: 'uint256',
2084
+ },
2085
+ ],
2086
+ },
2087
+ {
2088
+ name: '_withdrawPositions',
2089
+ type: 'tuple[]',
2090
+ components: [
2091
+ {
2092
+ name: 'positionType',
2093
+ type: 'uint8',
2094
+ },
2095
+ {
2096
+ name: 'amount',
2097
+ type: 'uint256',
2098
+ },
2099
+ ],
2100
+ },
2101
+ {
2102
+ name: '_swapInstruction',
2103
+ type: 'tuple',
2104
+ components: [
2105
+ {
2106
+ name: 'legoId',
2107
+ type: 'uint256',
2108
+ },
2109
+ {
2110
+ name: 'amountIn',
2111
+ type: 'uint256',
2112
+ },
2113
+ {
2114
+ name: 'minAmountOut',
2115
+ type: 'uint256',
2116
+ },
2117
+ {
2118
+ name: 'tokenPath',
2119
+ type: 'address[]',
2120
+ },
2121
+ {
2122
+ name: 'poolPath',
2123
+ type: 'address[]',
2124
+ },
2125
+ ],
2126
+ },
2127
+ {
2128
+ name: '_postSwapDeposits',
2129
+ type: 'tuple[]',
2130
+ components: [
2131
+ {
2132
+ name: 'positionType',
2133
+ type: 'uint8',
2134
+ },
2135
+ {
2136
+ name: 'amount',
2137
+ type: 'uint256',
2138
+ },
2139
+ {
2140
+ name: 'shouldAddToRipeCollateral',
2141
+ type: 'bool',
2142
+ },
2143
+ {
2144
+ name: 'shouldSweepAll',
2145
+ type: 'bool',
2146
+ },
2147
+ ],
2148
+ },
2149
+ {
2150
+ name: '_addCollateral',
2151
+ type: 'tuple[]',
2152
+ components: [
2153
+ {
2154
+ name: 'positionType',
2155
+ type: 'uint8',
2156
+ },
2157
+ {
2158
+ name: 'amount',
2159
+ type: 'uint256',
2160
+ },
2161
+ ],
2162
+ },
2163
+ ],
2164
+ outputs: [],
2165
+ },
2166
+ {
2167
+ stateMutability: 'nonpayable',
2168
+ type: 'function',
2169
+ name: 'compoundYieldGains',
2170
+ inputs: [
2171
+ {
2172
+ name: '_levgWallet',
2173
+ type: 'address',
2174
+ },
2175
+ {
2176
+ name: '_removeCollateral',
2177
+ type: 'tuple[]',
2178
+ components: [
2179
+ {
2180
+ name: 'positionType',
2181
+ type: 'uint8',
2182
+ },
2183
+ {
2184
+ name: 'amount',
2185
+ type: 'uint256',
2186
+ },
2187
+ ],
2188
+ },
2189
+ {
2190
+ name: '_withdrawPositions',
2191
+ type: 'tuple[]',
2192
+ components: [
2193
+ {
2194
+ name: 'positionType',
2195
+ type: 'uint8',
2196
+ },
2197
+ {
2198
+ name: 'amount',
2199
+ type: 'uint256',
2200
+ },
2201
+ ],
2202
+ },
2203
+ {
2204
+ name: '_swapInstruction',
2205
+ type: 'tuple',
2206
+ components: [
2207
+ {
2208
+ name: 'legoId',
2209
+ type: 'uint256',
2210
+ },
2211
+ {
2212
+ name: 'amountIn',
2213
+ type: 'uint256',
2214
+ },
2215
+ {
2216
+ name: 'minAmountOut',
2217
+ type: 'uint256',
2218
+ },
2219
+ {
2220
+ name: 'tokenPath',
2221
+ type: 'address[]',
2222
+ },
2223
+ {
2224
+ name: 'poolPath',
2225
+ type: 'address[]',
2226
+ },
2227
+ ],
2228
+ },
2229
+ {
2230
+ name: '_postSwapDeposits',
2231
+ type: 'tuple[]',
2232
+ components: [
2233
+ {
2234
+ name: 'positionType',
2235
+ type: 'uint8',
2236
+ },
2237
+ {
2238
+ name: 'amount',
2239
+ type: 'uint256',
2240
+ },
2241
+ {
2242
+ name: 'shouldAddToRipeCollateral',
2243
+ type: 'bool',
2244
+ },
2245
+ {
2246
+ name: 'shouldSweepAll',
2247
+ type: 'bool',
2248
+ },
2249
+ ],
2250
+ },
2251
+ {
2252
+ name: '_addCollateral',
2253
+ type: 'tuple[]',
2254
+ components: [
2255
+ {
2256
+ name: 'positionType',
2257
+ type: 'uint8',
2258
+ },
2259
+ {
2260
+ name: 'amount',
2261
+ type: 'uint256',
2262
+ },
2263
+ ],
2264
+ },
2265
+ {
2266
+ name: '_sig',
2267
+ type: 'tuple',
2268
+ components: [
2269
+ {
2270
+ name: 'signature',
2271
+ type: 'bytes',
2272
+ },
2273
+ {
2274
+ name: 'nonce',
2275
+ type: 'uint256',
2276
+ },
2277
+ {
2278
+ name: 'expiration',
2279
+ type: 'uint256',
2280
+ },
2281
+ ],
2282
+ },
2283
+ ],
2284
+ outputs: [],
2285
+ },
2286
+ {
2287
+ stateMutability: 'nonpayable',
2288
+ type: 'function',
2289
+ name: 'incrementNonce',
2290
+ inputs: [
2291
+ {
2292
+ name: '_levgWallet',
2293
+ type: 'address',
2294
+ },
2295
+ ],
2296
+ outputs: [],
2297
+ },
2298
+ {
2299
+ stateMutability: 'view',
2300
+ type: 'function',
2301
+ name: 'getNonce',
2302
+ inputs: [
2303
+ {
2304
+ name: '_levgWallet',
2305
+ type: 'address',
2306
+ },
2307
+ ],
2308
+ outputs: [
2309
+ {
2310
+ name: '',
2311
+ type: 'uint256',
2312
+ },
2313
+ ],
2314
+ },
2315
+ {
2316
+ stateMutability: 'view',
2317
+ type: 'function',
2318
+ name: 'UNDY_HQ',
2319
+ inputs: [],
2320
+ outputs: [
2321
+ {
2322
+ name: '',
2323
+ type: 'address',
2324
+ },
2325
+ ],
2326
+ },
2327
+ {
2328
+ stateMutability: 'view',
2329
+ type: 'function',
2330
+ name: 'GREEN',
2331
+ inputs: [],
2332
+ outputs: [
2333
+ {
2334
+ name: '',
2335
+ type: 'address',
2336
+ },
2337
+ ],
2338
+ },
2339
+ {
2340
+ stateMutability: 'view',
2341
+ type: 'function',
2342
+ name: 'SAVINGS_GREEN',
2343
+ inputs: [],
2344
+ outputs: [
2345
+ {
2346
+ name: '',
2347
+ type: 'address',
2348
+ },
2349
+ ],
2350
+ },
2351
+ {
2352
+ stateMutability: 'view',
2353
+ type: 'function',
2354
+ name: 'currentNonce',
2355
+ inputs: [
2356
+ {
2357
+ name: 'arg0',
2358
+ type: 'address',
2359
+ },
2360
+ ],
2361
+ outputs: [
2362
+ {
2363
+ name: '',
2364
+ type: 'uint256',
2365
+ },
2366
+ ],
2367
+ },
2368
+ {
2369
+ stateMutability: 'nonpayable',
2370
+ type: 'constructor',
2371
+ inputs: [
2372
+ {
2373
+ name: '_undyHq',
2374
+ type: 'address',
2375
+ },
2376
+ {
2377
+ name: '_owner',
2378
+ type: 'address',
2379
+ },
2380
+ {
2381
+ name: '_minTimeLock',
2382
+ type: 'uint256',
2383
+ },
2384
+ {
2385
+ name: '_maxTimeLock',
2386
+ type: 'uint256',
2387
+ },
2388
+ {
2389
+ name: '_greenToken',
2390
+ type: 'address',
2391
+ },
2392
+ {
2393
+ name: '_savingsGreen',
2394
+ type: 'address',
2395
+ },
2396
+ ],
2397
+ outputs: [],
2398
+ },
2399
+ ];
2400
+ export const deployAddress = '0x476A8e3A57860A6C5Bc75328c98f2e55F5b9997C';
2401
+ function getRequest(method, args, contractAddressOrOptions) {
2402
+ const address = typeof contractAddressOrOptions === 'string' ? contractAddressOrOptions : contractAddressOrOptions?.contractAddress;
2403
+ const defaultValue = typeof contractAddressOrOptions === 'string' ? undefined : contractAddressOrOptions?.defaultValue;
2404
+ const call = {
2405
+ contractName: 'LevgVaultAgent',
2406
+ method,
2407
+ args,
2408
+ address,
2409
+ deployAddress,
2410
+ defaultValue,
2411
+ getAbi: () => abi,
2412
+ with: (options) => {
2413
+ call.address = options.contractAddress;
2414
+ call.defaultValue = options.defaultValue;
2415
+ return call;
2416
+ },
2417
+ defaultTo: (defaultValue) => {
2418
+ call.defaultValue = defaultValue;
2419
+ return call;
2420
+ },
2421
+ at: (address) => {
2422
+ call.address = address;
2423
+ return call;
2424
+ },
2425
+ };
2426
+ return call;
2427
+ }
2428
+ export const call = {
2429
+ hasPendingOwnerChange: (...args) => getRequest('hasPendingOwnerChange', args),
2430
+ owner: (...args) => getRequest('owner', args),
2431
+ ownershipTimeLock: (...args) => getRequest('ownershipTimeLock', args),
2432
+ pendingOwner: (...args) => getRequest('pendingOwner', args),
2433
+ MIN_OWNERSHIP_TIMELOCK: (...args) => getRequest('MIN_OWNERSHIP_TIMELOCK', args),
2434
+ MAX_OWNERSHIP_TIMELOCK: (...args) => getRequest('MAX_OWNERSHIP_TIMELOCK', args),
2435
+ getNonce: (...args) => getRequest('getNonce', args),
2436
+ UNDY_HQ: (...args) => getRequest('UNDY_HQ', args),
2437
+ GREEN: (...args) => getRequest('GREEN', args),
2438
+ SAVINGS_GREEN: (...args) => getRequest('SAVINGS_GREEN', args),
2439
+ currentNonce: (...args) => getRequest('currentNonce', args),
2440
+ };
2441
+ function getMutation(functionName) {
2442
+ return {
2443
+ contractName: 'LevgVaultAgent',
2444
+ functionName,
2445
+ deployAddress,
2446
+ argsType: undefined,
2447
+ getAbi: () => abi,
2448
+ };
2449
+ }
2450
+ export const mutation = {
2451
+ changeOwnership: getMutation('changeOwnership'),
2452
+ confirmOwnershipChange: getMutation('confirmOwnershipChange'),
2453
+ cancelOwnershipChange: getMutation('cancelOwnershipChange'),
2454
+ setOwnershipTimeLock: getMutation('setOwnershipTimeLock'),
2455
+ borrowAndEarnYield: getMutation('borrowAndEarnYield'),
2456
+ deleverage: getMutation('deleverage'),
2457
+ compoundYieldGains: getMutation('compoundYieldGains'),
2458
+ incrementNonce: getMutation('incrementNonce'),
2459
+ };
2460
+ export function parseEvents(eventName, events) {
2461
+ return events.map((event) => {
2462
+ return {
2463
+ event,
2464
+ parsed: parseEventLogs({
2465
+ abi,
2466
+ eventName,
2467
+ logs: [event],
2468
+ }),
2469
+ };
2470
+ });
2471
+ }
2472
+ export function getEventTopic(eventName) {
2473
+ return encodeEventTopics({ abi, eventName })[0];
2474
+ }
2475
+ export function toSdk(publicClient, walletClient, addressResolver) {
2476
+ return {
2477
+ deployAddress,
2478
+ abi,
2479
+ events: {
2480
+ NonceIncremented: {
2481
+ topic: getEventTopic('NonceIncremented'),
2482
+ parse: (events) => parseEvents('NonceIncremented', events),
2483
+ },
2484
+ OwnershipChangeInitiated: {
2485
+ topic: getEventTopic('OwnershipChangeInitiated'),
2486
+ parse: (events) => parseEvents('OwnershipChangeInitiated', events),
2487
+ },
2488
+ OwnershipChangeConfirmed: {
2489
+ topic: getEventTopic('OwnershipChangeConfirmed'),
2490
+ parse: (events) => parseEvents('OwnershipChangeConfirmed', events),
2491
+ },
2492
+ OwnershipChangeCancelled: {
2493
+ topic: getEventTopic('OwnershipChangeCancelled'),
2494
+ parse: (events) => parseEvents('OwnershipChangeCancelled', events),
2495
+ },
2496
+ OwnershipTimeLockSet: {
2497
+ topic: getEventTopic('OwnershipTimeLockSet'),
2498
+ parse: (events) => parseEvents('OwnershipTimeLockSet', events),
2499
+ },
2500
+ },
2501
+ // Queries
2502
+ hasPendingOwnerChange: (...args) => singleQuery(publicClient, call.hasPendingOwnerChange(...args), {}, addressResolver),
2503
+ owner: (...args) => singleQuery(publicClient, call.owner(...args), {}, addressResolver),
2504
+ ownershipTimeLock: (...args) => singleQuery(publicClient, call.ownershipTimeLock(...args), {}, addressResolver),
2505
+ pendingOwner: (...args) => singleQuery(publicClient, call.pendingOwner(...args), {}, addressResolver),
2506
+ MIN_OWNERSHIP_TIMELOCK: (...args) => singleQuery(publicClient, call.MIN_OWNERSHIP_TIMELOCK(...args), {}, addressResolver),
2507
+ MAX_OWNERSHIP_TIMELOCK: (...args) => singleQuery(publicClient, call.MAX_OWNERSHIP_TIMELOCK(...args), {}, addressResolver),
2508
+ getNonce: (...args) => singleQuery(publicClient, call.getNonce(...args), {}, addressResolver),
2509
+ UNDY_HQ: (...args) => singleQuery(publicClient, call.UNDY_HQ(...args), {}, addressResolver),
2510
+ GREEN: (...args) => singleQuery(publicClient, call.GREEN(...args), {}, addressResolver),
2511
+ SAVINGS_GREEN: (...args) => singleQuery(publicClient, call.SAVINGS_GREEN(...args), {}, addressResolver),
2512
+ currentNonce: (...args) => singleQuery(publicClient, call.currentNonce(...args), {}, addressResolver),
2513
+ // Mutations
2514
+ changeOwnership: (...args) => mutate(walletClient, mutation.changeOwnership, { addressResolver })(...args),
2515
+ confirmOwnershipChange: (...args) => mutate(walletClient, mutation.confirmOwnershipChange, { addressResolver })(...args),
2516
+ cancelOwnershipChange: (...args) => mutate(walletClient, mutation.cancelOwnershipChange, { addressResolver })(...args),
2517
+ setOwnershipTimeLock: (...args) => mutate(walletClient, mutation.setOwnershipTimeLock, { addressResolver })(...args),
2518
+ borrowAndEarnYield: (...args) => mutate(walletClient, mutation.borrowAndEarnYield, { addressResolver })(...args),
2519
+ deleverage: (...args) => mutate(walletClient, mutation.deleverage, { addressResolver })(...args),
2520
+ compoundYieldGains: (...args) => mutate(walletClient, mutation.compoundYieldGains, { addressResolver })(...args),
2521
+ incrementNonce: (...args) => mutate(walletClient, mutation.incrementNonce, { addressResolver })(...args),
2522
+ };
2523
+ }