perk-protocol 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/idl.json ADDED
@@ -0,0 +1,3740 @@
1
+ {
2
+ "address": "5mqYowuNCA8iKFjqn6XKA7vURuaKEUUmPK5QJiCbHyMW",
3
+ "metadata": {
4
+ "name": "perk_protocol",
5
+ "version": "0.1.0",
6
+ "spec": "0.1.0",
7
+ "description": "Created with Anchor"
8
+ },
9
+ "instructions": [
10
+ {
11
+ "name": "accept_admin",
12
+ "docs": [
13
+ "M5: Accept admin transfer (pending admin only)."
14
+ ],
15
+ "discriminator": [
16
+ 112,
17
+ 42,
18
+ 45,
19
+ 90,
20
+ 116,
21
+ 181,
22
+ 13,
23
+ 170
24
+ ],
25
+ "accounts": [
26
+ {
27
+ "name": "protocol",
28
+ "writable": true,
29
+ "pda": {
30
+ "seeds": [
31
+ {
32
+ "kind": "const",
33
+ "value": [
34
+ 112,
35
+ 114,
36
+ 111,
37
+ 116,
38
+ 111,
39
+ 99,
40
+ 111,
41
+ 108
42
+ ]
43
+ }
44
+ ]
45
+ }
46
+ },
47
+ {
48
+ "name": "new_admin",
49
+ "signer": true
50
+ }
51
+ ],
52
+ "args": []
53
+ },
54
+ {
55
+ "name": "admin_pause",
56
+ "docs": [
57
+ "Emergency pause/unpause. Admin only."
58
+ ],
59
+ "discriminator": [
60
+ 13,
61
+ 109,
62
+ 240,
63
+ 129,
64
+ 86,
65
+ 245,
66
+ 182,
67
+ 45
68
+ ],
69
+ "accounts": [
70
+ {
71
+ "name": "protocol",
72
+ "writable": true,
73
+ "pda": {
74
+ "seeds": [
75
+ {
76
+ "kind": "const",
77
+ "value": [
78
+ 112,
79
+ 114,
80
+ 111,
81
+ 116,
82
+ 111,
83
+ 99,
84
+ 111,
85
+ 108
86
+ ]
87
+ }
88
+ ]
89
+ }
90
+ },
91
+ {
92
+ "name": "admin",
93
+ "signer": true,
94
+ "relations": [
95
+ "protocol"
96
+ ]
97
+ }
98
+ ],
99
+ "args": [
100
+ {
101
+ "name": "paused",
102
+ "type": "bool"
103
+ }
104
+ ]
105
+ },
106
+ {
107
+ "name": "admin_set_fallback_oracle",
108
+ "docs": [
109
+ "Set or remove fallback oracle on a market. Admin only."
110
+ ],
111
+ "discriminator": [
112
+ 200,
113
+ 149,
114
+ 112,
115
+ 230,
116
+ 185,
117
+ 176,
118
+ 152,
119
+ 229
120
+ ],
121
+ "accounts": [
122
+ {
123
+ "name": "protocol",
124
+ "pda": {
125
+ "seeds": [
126
+ {
127
+ "kind": "const",
128
+ "value": [
129
+ 112,
130
+ 114,
131
+ 111,
132
+ 116,
133
+ 111,
134
+ 99,
135
+ 111,
136
+ 108
137
+ ]
138
+ }
139
+ ]
140
+ }
141
+ },
142
+ {
143
+ "name": "market",
144
+ "writable": true,
145
+ "pda": {
146
+ "seeds": [
147
+ {
148
+ "kind": "const",
149
+ "value": [
150
+ 109,
151
+ 97,
152
+ 114,
153
+ 107,
154
+ 101,
155
+ 116
156
+ ]
157
+ },
158
+ {
159
+ "kind": "account",
160
+ "path": "market.token_mint",
161
+ "account": "Market"
162
+ }
163
+ ]
164
+ }
165
+ },
166
+ {
167
+ "name": "fallback_oracle"
168
+ },
169
+ {
170
+ "name": "admin",
171
+ "signer": true,
172
+ "relations": [
173
+ "protocol"
174
+ ]
175
+ }
176
+ ],
177
+ "args": [
178
+ {
179
+ "name": "params",
180
+ "type": {
181
+ "defined": {
182
+ "name": "SetFallbackOracleParams"
183
+ }
184
+ }
185
+ }
186
+ ]
187
+ },
188
+ {
189
+ "name": "admin_update_market",
190
+ "docs": [
191
+ "M4: Admin market update — update oracle, active status, trading fee."
192
+ ],
193
+ "discriminator": [
194
+ 93,
195
+ 220,
196
+ 192,
197
+ 97,
198
+ 105,
199
+ 26,
200
+ 64,
201
+ 150
202
+ ],
203
+ "accounts": [
204
+ {
205
+ "name": "protocol",
206
+ "pda": {
207
+ "seeds": [
208
+ {
209
+ "kind": "const",
210
+ "value": [
211
+ 112,
212
+ 114,
213
+ 111,
214
+ 116,
215
+ 111,
216
+ 99,
217
+ 111,
218
+ 108
219
+ ]
220
+ }
221
+ ]
222
+ }
223
+ },
224
+ {
225
+ "name": "market",
226
+ "writable": true,
227
+ "pda": {
228
+ "seeds": [
229
+ {
230
+ "kind": "const",
231
+ "value": [
232
+ 109,
233
+ 97,
234
+ 114,
235
+ 107,
236
+ 101,
237
+ 116
238
+ ]
239
+ },
240
+ {
241
+ "kind": "account",
242
+ "path": "market.token_mint",
243
+ "account": "Market"
244
+ }
245
+ ]
246
+ }
247
+ },
248
+ {
249
+ "name": "oracle",
250
+ "optional": true
251
+ },
252
+ {
253
+ "name": "admin",
254
+ "signer": true
255
+ }
256
+ ],
257
+ "args": [
258
+ {
259
+ "name": "params",
260
+ "type": {
261
+ "defined": {
262
+ "name": "AdminUpdateMarketParams"
263
+ }
264
+ }
265
+ }
266
+ ]
267
+ },
268
+ {
269
+ "name": "admin_withdraw_sol",
270
+ "docs": [
271
+ "H1 (R3): Withdraw accumulated SOL creation fees from protocol PDA."
272
+ ],
273
+ "discriminator": [
274
+ 111,
275
+ 237,
276
+ 192,
277
+ 44,
278
+ 255,
279
+ 224,
280
+ 149,
281
+ 126
282
+ ],
283
+ "accounts": [
284
+ {
285
+ "name": "protocol",
286
+ "writable": true,
287
+ "pda": {
288
+ "seeds": [
289
+ {
290
+ "kind": "const",
291
+ "value": [
292
+ 112,
293
+ 114,
294
+ 111,
295
+ 116,
296
+ 111,
297
+ 99,
298
+ 111,
299
+ 108
300
+ ]
301
+ }
302
+ ]
303
+ }
304
+ },
305
+ {
306
+ "name": "admin",
307
+ "writable": true,
308
+ "signer": true
309
+ },
310
+ {
311
+ "name": "system_program",
312
+ "address": "11111111111111111111111111111111"
313
+ }
314
+ ],
315
+ "args": [
316
+ {
317
+ "name": "amount",
318
+ "type": "u64"
319
+ }
320
+ ]
321
+ },
322
+ {
323
+ "name": "cancel_trigger_order",
324
+ "docs": [
325
+ "Cancel a trigger order."
326
+ ],
327
+ "discriminator": [
328
+ 144,
329
+ 84,
330
+ 67,
331
+ 39,
332
+ 27,
333
+ 25,
334
+ 202,
335
+ 141
336
+ ],
337
+ "accounts": [
338
+ {
339
+ "name": "market",
340
+ "pda": {
341
+ "seeds": [
342
+ {
343
+ "kind": "const",
344
+ "value": [
345
+ 109,
346
+ 97,
347
+ 114,
348
+ 107,
349
+ 101,
350
+ 116
351
+ ]
352
+ },
353
+ {
354
+ "kind": "account",
355
+ "path": "market.token_mint",
356
+ "account": "Market"
357
+ }
358
+ ]
359
+ }
360
+ },
361
+ {
362
+ "name": "user_position",
363
+ "writable": true,
364
+ "pda": {
365
+ "seeds": [
366
+ {
367
+ "kind": "const",
368
+ "value": [
369
+ 112,
370
+ 111,
371
+ 115,
372
+ 105,
373
+ 116,
374
+ 105,
375
+ 111,
376
+ 110
377
+ ]
378
+ },
379
+ {
380
+ "kind": "account",
381
+ "path": "market"
382
+ },
383
+ {
384
+ "kind": "account",
385
+ "path": "user"
386
+ }
387
+ ]
388
+ }
389
+ },
390
+ {
391
+ "name": "trigger_order",
392
+ "writable": true,
393
+ "pda": {
394
+ "seeds": [
395
+ {
396
+ "kind": "const",
397
+ "value": [
398
+ 116,
399
+ 114,
400
+ 105,
401
+ 103,
402
+ 103,
403
+ 101,
404
+ 114
405
+ ]
406
+ },
407
+ {
408
+ "kind": "account",
409
+ "path": "market"
410
+ },
411
+ {
412
+ "kind": "account",
413
+ "path": "user"
414
+ },
415
+ {
416
+ "kind": "account",
417
+ "path": "trigger_order.order_id",
418
+ "account": "TriggerOrder"
419
+ }
420
+ ]
421
+ }
422
+ },
423
+ {
424
+ "name": "authority",
425
+ "signer": true,
426
+ "relations": [
427
+ "user_position"
428
+ ]
429
+ },
430
+ {
431
+ "name": "user",
432
+ "writable": true,
433
+ "signer": true
434
+ }
435
+ ],
436
+ "args": []
437
+ },
438
+ {
439
+ "name": "claim_fees",
440
+ "docs": [
441
+ "C7: Claim accumulated trading fees. Creator or protocol admin."
442
+ ],
443
+ "discriminator": [
444
+ 82,
445
+ 251,
446
+ 233,
447
+ 156,
448
+ 12,
449
+ 52,
450
+ 184,
451
+ 202
452
+ ],
453
+ "accounts": [
454
+ {
455
+ "name": "protocol",
456
+ "pda": {
457
+ "seeds": [
458
+ {
459
+ "kind": "const",
460
+ "value": [
461
+ 112,
462
+ 114,
463
+ 111,
464
+ 116,
465
+ 111,
466
+ 99,
467
+ 111,
468
+ 108
469
+ ]
470
+ }
471
+ ]
472
+ }
473
+ },
474
+ {
475
+ "name": "market",
476
+ "writable": true,
477
+ "pda": {
478
+ "seeds": [
479
+ {
480
+ "kind": "const",
481
+ "value": [
482
+ 109,
483
+ 97,
484
+ 114,
485
+ 107,
486
+ 101,
487
+ 116
488
+ ]
489
+ },
490
+ {
491
+ "kind": "account",
492
+ "path": "market.token_mint",
493
+ "account": "Market"
494
+ }
495
+ ]
496
+ }
497
+ },
498
+ {
499
+ "name": "vault",
500
+ "writable": true,
501
+ "pda": {
502
+ "seeds": [
503
+ {
504
+ "kind": "const",
505
+ "value": [
506
+ 118,
507
+ 97,
508
+ 117,
509
+ 108,
510
+ 116
511
+ ]
512
+ },
513
+ {
514
+ "kind": "account",
515
+ "path": "market"
516
+ }
517
+ ]
518
+ }
519
+ },
520
+ {
521
+ "name": "recipient_token_account",
522
+ "writable": true
523
+ },
524
+ {
525
+ "name": "claimer",
526
+ "signer": true
527
+ },
528
+ {
529
+ "name": "token_program",
530
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
531
+ }
532
+ ],
533
+ "args": []
534
+ },
535
+ {
536
+ "name": "close_position",
537
+ "docs": [
538
+ "Close a position (fully or partially)."
539
+ ],
540
+ "discriminator": [
541
+ 123,
542
+ 134,
543
+ 81,
544
+ 0,
545
+ 49,
546
+ 68,
547
+ 98,
548
+ 98
549
+ ],
550
+ "accounts": [
551
+ {
552
+ "name": "protocol",
553
+ "writable": true,
554
+ "pda": {
555
+ "seeds": [
556
+ {
557
+ "kind": "const",
558
+ "value": [
559
+ 112,
560
+ 114,
561
+ 111,
562
+ 116,
563
+ 111,
564
+ 99,
565
+ 111,
566
+ 108
567
+ ]
568
+ }
569
+ ]
570
+ }
571
+ },
572
+ {
573
+ "name": "market",
574
+ "writable": true,
575
+ "pda": {
576
+ "seeds": [
577
+ {
578
+ "kind": "const",
579
+ "value": [
580
+ 109,
581
+ 97,
582
+ 114,
583
+ 107,
584
+ 101,
585
+ 116
586
+ ]
587
+ },
588
+ {
589
+ "kind": "account",
590
+ "path": "market.token_mint",
591
+ "account": "Market"
592
+ }
593
+ ]
594
+ }
595
+ },
596
+ {
597
+ "name": "user_position",
598
+ "writable": true,
599
+ "pda": {
600
+ "seeds": [
601
+ {
602
+ "kind": "const",
603
+ "value": [
604
+ 112,
605
+ 111,
606
+ 115,
607
+ 105,
608
+ 116,
609
+ 105,
610
+ 111,
611
+ 110
612
+ ]
613
+ },
614
+ {
615
+ "kind": "account",
616
+ "path": "market"
617
+ },
618
+ {
619
+ "kind": "account",
620
+ "path": "user"
621
+ }
622
+ ]
623
+ }
624
+ },
625
+ {
626
+ "name": "oracle"
627
+ },
628
+ {
629
+ "name": "fallback_oracle"
630
+ },
631
+ {
632
+ "name": "authority",
633
+ "signer": true,
634
+ "relations": [
635
+ "user_position"
636
+ ]
637
+ },
638
+ {
639
+ "name": "user",
640
+ "signer": true
641
+ }
642
+ ],
643
+ "args": [
644
+ {
645
+ "name": "base_size_to_close",
646
+ "type": {
647
+ "option": "u64"
648
+ }
649
+ }
650
+ ]
651
+ },
652
+ {
653
+ "name": "crank_funding",
654
+ "docs": [
655
+ "Crank the funding rate. Permissionless."
656
+ ],
657
+ "discriminator": [
658
+ 83,
659
+ 30,
660
+ 120,
661
+ 80,
662
+ 177,
663
+ 60,
664
+ 27,
665
+ 119
666
+ ],
667
+ "accounts": [
668
+ {
669
+ "name": "market",
670
+ "writable": true,
671
+ "pda": {
672
+ "seeds": [
673
+ {
674
+ "kind": "const",
675
+ "value": [
676
+ 109,
677
+ 97,
678
+ 114,
679
+ 107,
680
+ 101,
681
+ 116
682
+ ]
683
+ },
684
+ {
685
+ "kind": "account",
686
+ "path": "market.token_mint",
687
+ "account": "Market"
688
+ }
689
+ ]
690
+ }
691
+ },
692
+ {
693
+ "name": "oracle"
694
+ },
695
+ {
696
+ "name": "fallback_oracle"
697
+ },
698
+ {
699
+ "name": "cranker",
700
+ "signer": true
701
+ }
702
+ ],
703
+ "args": []
704
+ },
705
+ {
706
+ "name": "create_market",
707
+ "docs": [
708
+ "Create a new perpetual futures market. Permissionless — anyone can call."
709
+ ],
710
+ "discriminator": [
711
+ 103,
712
+ 226,
713
+ 97,
714
+ 235,
715
+ 200,
716
+ 188,
717
+ 251,
718
+ 254
719
+ ],
720
+ "accounts": [
721
+ {
722
+ "name": "protocol",
723
+ "writable": true,
724
+ "pda": {
725
+ "seeds": [
726
+ {
727
+ "kind": "const",
728
+ "value": [
729
+ 112,
730
+ 114,
731
+ 111,
732
+ 116,
733
+ 111,
734
+ 99,
735
+ 111,
736
+ 108
737
+ ]
738
+ }
739
+ ]
740
+ }
741
+ },
742
+ {
743
+ "name": "market",
744
+ "writable": true,
745
+ "pda": {
746
+ "seeds": [
747
+ {
748
+ "kind": "const",
749
+ "value": [
750
+ 109,
751
+ 97,
752
+ 114,
753
+ 107,
754
+ 101,
755
+ 116
756
+ ]
757
+ },
758
+ {
759
+ "kind": "account",
760
+ "path": "token_mint"
761
+ }
762
+ ]
763
+ }
764
+ },
765
+ {
766
+ "name": "token_mint"
767
+ },
768
+ {
769
+ "name": "oracle"
770
+ },
771
+ {
772
+ "name": "vault",
773
+ "writable": true,
774
+ "pda": {
775
+ "seeds": [
776
+ {
777
+ "kind": "const",
778
+ "value": [
779
+ 118,
780
+ 97,
781
+ 117,
782
+ 108,
783
+ 116
784
+ ]
785
+ },
786
+ {
787
+ "kind": "account",
788
+ "path": "market"
789
+ }
790
+ ]
791
+ }
792
+ },
793
+ {
794
+ "name": "creator",
795
+ "writable": true,
796
+ "signer": true
797
+ },
798
+ {
799
+ "name": "system_program",
800
+ "address": "11111111111111111111111111111111"
801
+ },
802
+ {
803
+ "name": "token_program",
804
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
805
+ },
806
+ {
807
+ "name": "rent",
808
+ "address": "SysvarRent111111111111111111111111111111111"
809
+ }
810
+ ],
811
+ "args": [
812
+ {
813
+ "name": "params",
814
+ "type": {
815
+ "defined": {
816
+ "name": "CreateMarketParams"
817
+ }
818
+ }
819
+ }
820
+ ]
821
+ },
822
+ {
823
+ "name": "deposit",
824
+ "docs": [
825
+ "Deposit collateral into a market position."
826
+ ],
827
+ "discriminator": [
828
+ 242,
829
+ 35,
830
+ 198,
831
+ 137,
832
+ 82,
833
+ 225,
834
+ 242,
835
+ 182
836
+ ],
837
+ "accounts": [
838
+ {
839
+ "name": "protocol",
840
+ "pda": {
841
+ "seeds": [
842
+ {
843
+ "kind": "const",
844
+ "value": [
845
+ 112,
846
+ 114,
847
+ 111,
848
+ 116,
849
+ 111,
850
+ 99,
851
+ 111,
852
+ 108
853
+ ]
854
+ }
855
+ ]
856
+ }
857
+ },
858
+ {
859
+ "name": "market",
860
+ "writable": true,
861
+ "pda": {
862
+ "seeds": [
863
+ {
864
+ "kind": "const",
865
+ "value": [
866
+ 109,
867
+ 97,
868
+ 114,
869
+ 107,
870
+ 101,
871
+ 116
872
+ ]
873
+ },
874
+ {
875
+ "kind": "account",
876
+ "path": "market.token_mint",
877
+ "account": "Market"
878
+ }
879
+ ]
880
+ }
881
+ },
882
+ {
883
+ "name": "user_position",
884
+ "writable": true,
885
+ "pda": {
886
+ "seeds": [
887
+ {
888
+ "kind": "const",
889
+ "value": [
890
+ 112,
891
+ 111,
892
+ 115,
893
+ 105,
894
+ 116,
895
+ 105,
896
+ 111,
897
+ 110
898
+ ]
899
+ },
900
+ {
901
+ "kind": "account",
902
+ "path": "market"
903
+ },
904
+ {
905
+ "kind": "account",
906
+ "path": "user"
907
+ }
908
+ ]
909
+ }
910
+ },
911
+ {
912
+ "name": "oracle"
913
+ },
914
+ {
915
+ "name": "fallback_oracle"
916
+ },
917
+ {
918
+ "name": "user_token_account",
919
+ "writable": true
920
+ },
921
+ {
922
+ "name": "vault",
923
+ "writable": true,
924
+ "pda": {
925
+ "seeds": [
926
+ {
927
+ "kind": "const",
928
+ "value": [
929
+ 118,
930
+ 97,
931
+ 117,
932
+ 108,
933
+ 116
934
+ ]
935
+ },
936
+ {
937
+ "kind": "account",
938
+ "path": "market"
939
+ }
940
+ ]
941
+ }
942
+ },
943
+ {
944
+ "name": "user",
945
+ "writable": true,
946
+ "signer": true
947
+ },
948
+ {
949
+ "name": "system_program",
950
+ "address": "11111111111111111111111111111111"
951
+ },
952
+ {
953
+ "name": "token_program",
954
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
955
+ }
956
+ ],
957
+ "args": [
958
+ {
959
+ "name": "amount",
960
+ "type": "u64"
961
+ }
962
+ ]
963
+ },
964
+ {
965
+ "name": "execute_trigger_order",
966
+ "docs": [
967
+ "Execute a trigger order. Permissionless — anyone can call (cranker incentive)."
968
+ ],
969
+ "discriminator": [
970
+ 105,
971
+ 10,
972
+ 104,
973
+ 136,
974
+ 215,
975
+ 134,
976
+ 84,
977
+ 171
978
+ ],
979
+ "accounts": [
980
+ {
981
+ "name": "protocol",
982
+ "writable": true,
983
+ "pda": {
984
+ "seeds": [
985
+ {
986
+ "kind": "const",
987
+ "value": [
988
+ 112,
989
+ 114,
990
+ 111,
991
+ 116,
992
+ 111,
993
+ 99,
994
+ 111,
995
+ 108
996
+ ]
997
+ }
998
+ ]
999
+ }
1000
+ },
1001
+ {
1002
+ "name": "market",
1003
+ "writable": true,
1004
+ "pda": {
1005
+ "seeds": [
1006
+ {
1007
+ "kind": "const",
1008
+ "value": [
1009
+ 109,
1010
+ 97,
1011
+ 114,
1012
+ 107,
1013
+ 101,
1014
+ 116
1015
+ ]
1016
+ },
1017
+ {
1018
+ "kind": "account",
1019
+ "path": "market.token_mint",
1020
+ "account": "Market"
1021
+ }
1022
+ ]
1023
+ }
1024
+ },
1025
+ {
1026
+ "name": "user_position",
1027
+ "writable": true,
1028
+ "pda": {
1029
+ "seeds": [
1030
+ {
1031
+ "kind": "const",
1032
+ "value": [
1033
+ 112,
1034
+ 111,
1035
+ 115,
1036
+ 105,
1037
+ 116,
1038
+ 105,
1039
+ 111,
1040
+ 110
1041
+ ]
1042
+ },
1043
+ {
1044
+ "kind": "account",
1045
+ "path": "market"
1046
+ },
1047
+ {
1048
+ "kind": "account",
1049
+ "path": "trigger_order.authority",
1050
+ "account": "TriggerOrder"
1051
+ }
1052
+ ]
1053
+ }
1054
+ },
1055
+ {
1056
+ "name": "trigger_order",
1057
+ "writable": true,
1058
+ "pda": {
1059
+ "seeds": [
1060
+ {
1061
+ "kind": "const",
1062
+ "value": [
1063
+ 116,
1064
+ 114,
1065
+ 105,
1066
+ 103,
1067
+ 103,
1068
+ 101,
1069
+ 114
1070
+ ]
1071
+ },
1072
+ {
1073
+ "kind": "account",
1074
+ "path": "market"
1075
+ },
1076
+ {
1077
+ "kind": "account",
1078
+ "path": "trigger_order.authority",
1079
+ "account": "TriggerOrder"
1080
+ },
1081
+ {
1082
+ "kind": "account",
1083
+ "path": "trigger_order.order_id",
1084
+ "account": "TriggerOrder"
1085
+ }
1086
+ ]
1087
+ }
1088
+ },
1089
+ {
1090
+ "name": "oracle"
1091
+ },
1092
+ {
1093
+ "name": "fallback_oracle"
1094
+ },
1095
+ {
1096
+ "name": "executor_token_account",
1097
+ "writable": true
1098
+ },
1099
+ {
1100
+ "name": "vault",
1101
+ "writable": true,
1102
+ "pda": {
1103
+ "seeds": [
1104
+ {
1105
+ "kind": "const",
1106
+ "value": [
1107
+ 118,
1108
+ 97,
1109
+ 117,
1110
+ 108,
1111
+ 116
1112
+ ]
1113
+ },
1114
+ {
1115
+ "kind": "account",
1116
+ "path": "market"
1117
+ }
1118
+ ]
1119
+ }
1120
+ },
1121
+ {
1122
+ "name": "executor",
1123
+ "writable": true,
1124
+ "signer": true
1125
+ },
1126
+ {
1127
+ "name": "token_program",
1128
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
1129
+ }
1130
+ ],
1131
+ "args": []
1132
+ },
1133
+ {
1134
+ "name": "freeze_perk_oracle",
1135
+ "docs": [
1136
+ "Freeze or unfreeze a PerkOracle. Admin only."
1137
+ ],
1138
+ "discriminator": [
1139
+ 148,
1140
+ 8,
1141
+ 66,
1142
+ 182,
1143
+ 119,
1144
+ 83,
1145
+ 178,
1146
+ 216
1147
+ ],
1148
+ "accounts": [
1149
+ {
1150
+ "name": "protocol",
1151
+ "pda": {
1152
+ "seeds": [
1153
+ {
1154
+ "kind": "const",
1155
+ "value": [
1156
+ 112,
1157
+ 114,
1158
+ 111,
1159
+ 116,
1160
+ 111,
1161
+ 99,
1162
+ 111,
1163
+ 108
1164
+ ]
1165
+ }
1166
+ ]
1167
+ }
1168
+ },
1169
+ {
1170
+ "name": "perk_oracle",
1171
+ "writable": true,
1172
+ "pda": {
1173
+ "seeds": [
1174
+ {
1175
+ "kind": "const",
1176
+ "value": [
1177
+ 112,
1178
+ 101,
1179
+ 114,
1180
+ 107,
1181
+ 95,
1182
+ 111,
1183
+ 114,
1184
+ 97,
1185
+ 99,
1186
+ 108,
1187
+ 101
1188
+ ]
1189
+ },
1190
+ {
1191
+ "kind": "account",
1192
+ "path": "perk_oracle.token_mint",
1193
+ "account": "PerkOraclePrice"
1194
+ }
1195
+ ]
1196
+ }
1197
+ },
1198
+ {
1199
+ "name": "admin",
1200
+ "signer": true,
1201
+ "relations": [
1202
+ "protocol"
1203
+ ]
1204
+ }
1205
+ ],
1206
+ "args": [
1207
+ {
1208
+ "name": "frozen",
1209
+ "type": "bool"
1210
+ }
1211
+ ]
1212
+ },
1213
+ {
1214
+ "name": "initialize_perk_oracle",
1215
+ "docs": [
1216
+ "Initialize a PerkOracle price feed. Admin only."
1217
+ ],
1218
+ "discriminator": [
1219
+ 47,
1220
+ 220,
1221
+ 120,
1222
+ 24,
1223
+ 102,
1224
+ 127,
1225
+ 209,
1226
+ 184
1227
+ ],
1228
+ "accounts": [
1229
+ {
1230
+ "name": "protocol",
1231
+ "pda": {
1232
+ "seeds": [
1233
+ {
1234
+ "kind": "const",
1235
+ "value": [
1236
+ 112,
1237
+ 114,
1238
+ 111,
1239
+ 116,
1240
+ 111,
1241
+ 99,
1242
+ 111,
1243
+ 108
1244
+ ]
1245
+ }
1246
+ ]
1247
+ }
1248
+ },
1249
+ {
1250
+ "name": "perk_oracle",
1251
+ "writable": true,
1252
+ "pda": {
1253
+ "seeds": [
1254
+ {
1255
+ "kind": "const",
1256
+ "value": [
1257
+ 112,
1258
+ 101,
1259
+ 114,
1260
+ 107,
1261
+ 95,
1262
+ 111,
1263
+ 114,
1264
+ 97,
1265
+ 99,
1266
+ 108,
1267
+ 101
1268
+ ]
1269
+ },
1270
+ {
1271
+ "kind": "account",
1272
+ "path": "token_mint"
1273
+ }
1274
+ ]
1275
+ }
1276
+ },
1277
+ {
1278
+ "name": "token_mint",
1279
+ "docs": [
1280
+ "Token mint to create oracle for (validated as real SPL Mint)"
1281
+ ]
1282
+ },
1283
+ {
1284
+ "name": "oracle_authority",
1285
+ "docs": [
1286
+ "The initial oracle authority (cranker)"
1287
+ ]
1288
+ },
1289
+ {
1290
+ "name": "admin",
1291
+ "writable": true,
1292
+ "signer": true,
1293
+ "relations": [
1294
+ "protocol"
1295
+ ]
1296
+ },
1297
+ {
1298
+ "name": "system_program",
1299
+ "address": "11111111111111111111111111111111"
1300
+ }
1301
+ ],
1302
+ "args": [
1303
+ {
1304
+ "name": "params",
1305
+ "type": {
1306
+ "defined": {
1307
+ "name": "InitPerkOracleParams"
1308
+ }
1309
+ }
1310
+ }
1311
+ ]
1312
+ },
1313
+ {
1314
+ "name": "initialize_position",
1315
+ "docs": [
1316
+ "C12: Initialize a user position account. Must be called before deposit."
1317
+ ],
1318
+ "discriminator": [
1319
+ 219,
1320
+ 192,
1321
+ 234,
1322
+ 71,
1323
+ 190,
1324
+ 191,
1325
+ 102,
1326
+ 80
1327
+ ],
1328
+ "accounts": [
1329
+ {
1330
+ "name": "protocol",
1331
+ "writable": true,
1332
+ "pda": {
1333
+ "seeds": [
1334
+ {
1335
+ "kind": "const",
1336
+ "value": [
1337
+ 112,
1338
+ 114,
1339
+ 111,
1340
+ 116,
1341
+ 111,
1342
+ 99,
1343
+ 111,
1344
+ 108
1345
+ ]
1346
+ }
1347
+ ]
1348
+ }
1349
+ },
1350
+ {
1351
+ "name": "market",
1352
+ "writable": true,
1353
+ "pda": {
1354
+ "seeds": [
1355
+ {
1356
+ "kind": "const",
1357
+ "value": [
1358
+ 109,
1359
+ 97,
1360
+ 114,
1361
+ 107,
1362
+ 101,
1363
+ 116
1364
+ ]
1365
+ },
1366
+ {
1367
+ "kind": "account",
1368
+ "path": "market.token_mint",
1369
+ "account": "Market"
1370
+ }
1371
+ ]
1372
+ }
1373
+ },
1374
+ {
1375
+ "name": "user_position",
1376
+ "writable": true,
1377
+ "pda": {
1378
+ "seeds": [
1379
+ {
1380
+ "kind": "const",
1381
+ "value": [
1382
+ 112,
1383
+ 111,
1384
+ 115,
1385
+ 105,
1386
+ 116,
1387
+ 105,
1388
+ 111,
1389
+ 110
1390
+ ]
1391
+ },
1392
+ {
1393
+ "kind": "account",
1394
+ "path": "market"
1395
+ },
1396
+ {
1397
+ "kind": "account",
1398
+ "path": "user"
1399
+ }
1400
+ ]
1401
+ }
1402
+ },
1403
+ {
1404
+ "name": "user",
1405
+ "writable": true,
1406
+ "signer": true
1407
+ },
1408
+ {
1409
+ "name": "system_program",
1410
+ "address": "11111111111111111111111111111111"
1411
+ }
1412
+ ],
1413
+ "args": []
1414
+ },
1415
+ {
1416
+ "name": "initialize_protocol",
1417
+ "docs": [
1418
+ "Initialize the protocol singleton. Called once by admin."
1419
+ ],
1420
+ "discriminator": [
1421
+ 188,
1422
+ 233,
1423
+ 252,
1424
+ 106,
1425
+ 134,
1426
+ 146,
1427
+ 202,
1428
+ 91
1429
+ ],
1430
+ "accounts": [
1431
+ {
1432
+ "name": "protocol",
1433
+ "writable": true,
1434
+ "pda": {
1435
+ "seeds": [
1436
+ {
1437
+ "kind": "const",
1438
+ "value": [
1439
+ 112,
1440
+ 114,
1441
+ 111,
1442
+ 116,
1443
+ 111,
1444
+ 99,
1445
+ 111,
1446
+ 108
1447
+ ]
1448
+ }
1449
+ ]
1450
+ }
1451
+ },
1452
+ {
1453
+ "name": "admin",
1454
+ "writable": true,
1455
+ "signer": true
1456
+ },
1457
+ {
1458
+ "name": "protocol_fee_vault",
1459
+ "docs": [
1460
+ "CPI transfers — fee claims use per-market vaults directly. Admin-only, one-time init."
1461
+ ]
1462
+ },
1463
+ {
1464
+ "name": "system_program",
1465
+ "address": "11111111111111111111111111111111"
1466
+ }
1467
+ ],
1468
+ "args": []
1469
+ },
1470
+ {
1471
+ "name": "liquidate",
1472
+ "docs": [
1473
+ "Liquidate an underwater position. Permissionless."
1474
+ ],
1475
+ "discriminator": [
1476
+ 223,
1477
+ 179,
1478
+ 226,
1479
+ 125,
1480
+ 48,
1481
+ 46,
1482
+ 39,
1483
+ 74
1484
+ ],
1485
+ "accounts": [
1486
+ {
1487
+ "name": "protocol",
1488
+ "pda": {
1489
+ "seeds": [
1490
+ {
1491
+ "kind": "const",
1492
+ "value": [
1493
+ 112,
1494
+ 114,
1495
+ 111,
1496
+ 116,
1497
+ 111,
1498
+ 99,
1499
+ 111,
1500
+ 108
1501
+ ]
1502
+ }
1503
+ ]
1504
+ }
1505
+ },
1506
+ {
1507
+ "name": "market",
1508
+ "writable": true,
1509
+ "pda": {
1510
+ "seeds": [
1511
+ {
1512
+ "kind": "const",
1513
+ "value": [
1514
+ 109,
1515
+ 97,
1516
+ 114,
1517
+ 107,
1518
+ 101,
1519
+ 116
1520
+ ]
1521
+ },
1522
+ {
1523
+ "kind": "account",
1524
+ "path": "market.token_mint",
1525
+ "account": "Market"
1526
+ }
1527
+ ]
1528
+ }
1529
+ },
1530
+ {
1531
+ "name": "user_position",
1532
+ "writable": true,
1533
+ "pda": {
1534
+ "seeds": [
1535
+ {
1536
+ "kind": "const",
1537
+ "value": [
1538
+ 112,
1539
+ 111,
1540
+ 115,
1541
+ 105,
1542
+ 116,
1543
+ 105,
1544
+ 111,
1545
+ 110
1546
+ ]
1547
+ },
1548
+ {
1549
+ "kind": "account",
1550
+ "path": "market"
1551
+ },
1552
+ {
1553
+ "kind": "account",
1554
+ "path": "target_user"
1555
+ }
1556
+ ]
1557
+ }
1558
+ },
1559
+ {
1560
+ "name": "oracle"
1561
+ },
1562
+ {
1563
+ "name": "fallback_oracle"
1564
+ },
1565
+ {
1566
+ "name": "target_user"
1567
+ },
1568
+ {
1569
+ "name": "liquidator_token_account",
1570
+ "writable": true
1571
+ },
1572
+ {
1573
+ "name": "vault",
1574
+ "writable": true,
1575
+ "pda": {
1576
+ "seeds": [
1577
+ {
1578
+ "kind": "const",
1579
+ "value": [
1580
+ 118,
1581
+ 97,
1582
+ 117,
1583
+ 108,
1584
+ 116
1585
+ ]
1586
+ },
1587
+ {
1588
+ "kind": "account",
1589
+ "path": "market"
1590
+ }
1591
+ ]
1592
+ }
1593
+ },
1594
+ {
1595
+ "name": "liquidator",
1596
+ "writable": true,
1597
+ "signer": true
1598
+ },
1599
+ {
1600
+ "name": "token_program",
1601
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
1602
+ }
1603
+ ],
1604
+ "args": []
1605
+ },
1606
+ {
1607
+ "name": "open_position",
1608
+ "docs": [
1609
+ "Open a leveraged position via vAMM."
1610
+ ],
1611
+ "discriminator": [
1612
+ 135,
1613
+ 128,
1614
+ 47,
1615
+ 77,
1616
+ 15,
1617
+ 152,
1618
+ 240,
1619
+ 49
1620
+ ],
1621
+ "accounts": [
1622
+ {
1623
+ "name": "protocol",
1624
+ "writable": true,
1625
+ "pda": {
1626
+ "seeds": [
1627
+ {
1628
+ "kind": "const",
1629
+ "value": [
1630
+ 112,
1631
+ 114,
1632
+ 111,
1633
+ 116,
1634
+ 111,
1635
+ 99,
1636
+ 111,
1637
+ 108
1638
+ ]
1639
+ }
1640
+ ]
1641
+ }
1642
+ },
1643
+ {
1644
+ "name": "market",
1645
+ "writable": true,
1646
+ "pda": {
1647
+ "seeds": [
1648
+ {
1649
+ "kind": "const",
1650
+ "value": [
1651
+ 109,
1652
+ 97,
1653
+ 114,
1654
+ 107,
1655
+ 101,
1656
+ 116
1657
+ ]
1658
+ },
1659
+ {
1660
+ "kind": "account",
1661
+ "path": "market.token_mint",
1662
+ "account": "Market"
1663
+ }
1664
+ ]
1665
+ }
1666
+ },
1667
+ {
1668
+ "name": "user_position",
1669
+ "writable": true,
1670
+ "pda": {
1671
+ "seeds": [
1672
+ {
1673
+ "kind": "const",
1674
+ "value": [
1675
+ 112,
1676
+ 111,
1677
+ 115,
1678
+ 105,
1679
+ 116,
1680
+ 105,
1681
+ 111,
1682
+ 110
1683
+ ]
1684
+ },
1685
+ {
1686
+ "kind": "account",
1687
+ "path": "market"
1688
+ },
1689
+ {
1690
+ "kind": "account",
1691
+ "path": "user"
1692
+ }
1693
+ ]
1694
+ }
1695
+ },
1696
+ {
1697
+ "name": "oracle"
1698
+ },
1699
+ {
1700
+ "name": "fallback_oracle"
1701
+ },
1702
+ {
1703
+ "name": "authority",
1704
+ "signer": true,
1705
+ "relations": [
1706
+ "user_position"
1707
+ ]
1708
+ },
1709
+ {
1710
+ "name": "user",
1711
+ "signer": true
1712
+ }
1713
+ ],
1714
+ "args": [
1715
+ {
1716
+ "name": "side",
1717
+ "type": {
1718
+ "defined": {
1719
+ "name": "Side"
1720
+ }
1721
+ }
1722
+ },
1723
+ {
1724
+ "name": "base_size",
1725
+ "type": "u64"
1726
+ },
1727
+ {
1728
+ "name": "leverage",
1729
+ "type": "u32"
1730
+ },
1731
+ {
1732
+ "name": "max_slippage_bps",
1733
+ "type": "u16"
1734
+ }
1735
+ ]
1736
+ },
1737
+ {
1738
+ "name": "place_trigger_order",
1739
+ "docs": [
1740
+ "Place a trigger order (limit, stop-loss, take-profit)."
1741
+ ],
1742
+ "discriminator": [
1743
+ 32,
1744
+ 156,
1745
+ 50,
1746
+ 188,
1747
+ 232,
1748
+ 159,
1749
+ 112,
1750
+ 236
1751
+ ],
1752
+ "accounts": [
1753
+ {
1754
+ "name": "market",
1755
+ "writable": true,
1756
+ "pda": {
1757
+ "seeds": [
1758
+ {
1759
+ "kind": "const",
1760
+ "value": [
1761
+ 109,
1762
+ 97,
1763
+ 114,
1764
+ 107,
1765
+ 101,
1766
+ 116
1767
+ ]
1768
+ },
1769
+ {
1770
+ "kind": "account",
1771
+ "path": "market.token_mint",
1772
+ "account": "Market"
1773
+ }
1774
+ ]
1775
+ }
1776
+ },
1777
+ {
1778
+ "name": "user_position",
1779
+ "writable": true,
1780
+ "pda": {
1781
+ "seeds": [
1782
+ {
1783
+ "kind": "const",
1784
+ "value": [
1785
+ 112,
1786
+ 111,
1787
+ 115,
1788
+ 105,
1789
+ 116,
1790
+ 105,
1791
+ 111,
1792
+ 110
1793
+ ]
1794
+ },
1795
+ {
1796
+ "kind": "account",
1797
+ "path": "market"
1798
+ },
1799
+ {
1800
+ "kind": "account",
1801
+ "path": "user"
1802
+ }
1803
+ ]
1804
+ }
1805
+ },
1806
+ {
1807
+ "name": "trigger_order",
1808
+ "writable": true,
1809
+ "pda": {
1810
+ "seeds": [
1811
+ {
1812
+ "kind": "const",
1813
+ "value": [
1814
+ 116,
1815
+ 114,
1816
+ 105,
1817
+ 103,
1818
+ 103,
1819
+ 101,
1820
+ 114
1821
+ ]
1822
+ },
1823
+ {
1824
+ "kind": "account",
1825
+ "path": "market"
1826
+ },
1827
+ {
1828
+ "kind": "account",
1829
+ "path": "user"
1830
+ },
1831
+ {
1832
+ "kind": "account",
1833
+ "path": "user_position.next_order_id",
1834
+ "account": "UserPosition"
1835
+ }
1836
+ ]
1837
+ }
1838
+ },
1839
+ {
1840
+ "name": "authority",
1841
+ "signer": true,
1842
+ "relations": [
1843
+ "user_position"
1844
+ ]
1845
+ },
1846
+ {
1847
+ "name": "user",
1848
+ "writable": true,
1849
+ "signer": true
1850
+ },
1851
+ {
1852
+ "name": "system_program",
1853
+ "address": "11111111111111111111111111111111"
1854
+ }
1855
+ ],
1856
+ "args": [
1857
+ {
1858
+ "name": "params",
1859
+ "type": {
1860
+ "defined": {
1861
+ "name": "TriggerOrderParams"
1862
+ }
1863
+ }
1864
+ }
1865
+ ]
1866
+ },
1867
+ {
1868
+ "name": "propose_admin",
1869
+ "docs": [
1870
+ "M5: Propose admin transfer (current admin only)."
1871
+ ],
1872
+ "discriminator": [
1873
+ 121,
1874
+ 214,
1875
+ 199,
1876
+ 212,
1877
+ 87,
1878
+ 39,
1879
+ 117,
1880
+ 234
1881
+ ],
1882
+ "accounts": [
1883
+ {
1884
+ "name": "protocol",
1885
+ "writable": true,
1886
+ "pda": {
1887
+ "seeds": [
1888
+ {
1889
+ "kind": "const",
1890
+ "value": [
1891
+ 112,
1892
+ 114,
1893
+ 111,
1894
+ 116,
1895
+ 111,
1896
+ 99,
1897
+ 111,
1898
+ 108
1899
+ ]
1900
+ }
1901
+ ]
1902
+ }
1903
+ },
1904
+ {
1905
+ "name": "admin",
1906
+ "signer": true
1907
+ }
1908
+ ],
1909
+ "args": [
1910
+ {
1911
+ "name": "new_admin",
1912
+ "type": "pubkey"
1913
+ }
1914
+ ]
1915
+ },
1916
+ {
1917
+ "name": "reclaim_empty_account",
1918
+ "docs": [
1919
+ "Reclaim an empty position account. Permissionless.",
1920
+ "Sweeps dust capital to insurance, closes account, returns rent."
1921
+ ],
1922
+ "discriminator": [
1923
+ 126,
1924
+ 9,
1925
+ 242,
1926
+ 33,
1927
+ 58,
1928
+ 222,
1929
+ 8,
1930
+ 150
1931
+ ],
1932
+ "accounts": [
1933
+ {
1934
+ "name": "market",
1935
+ "writable": true,
1936
+ "pda": {
1937
+ "seeds": [
1938
+ {
1939
+ "kind": "const",
1940
+ "value": [
1941
+ 109,
1942
+ 97,
1943
+ 114,
1944
+ 107,
1945
+ 101,
1946
+ 116
1947
+ ]
1948
+ },
1949
+ {
1950
+ "kind": "account",
1951
+ "path": "market.token_mint",
1952
+ "account": "Market"
1953
+ }
1954
+ ]
1955
+ }
1956
+ },
1957
+ {
1958
+ "name": "user_position",
1959
+ "writable": true,
1960
+ "pda": {
1961
+ "seeds": [
1962
+ {
1963
+ "kind": "const",
1964
+ "value": [
1965
+ 112,
1966
+ 111,
1967
+ 115,
1968
+ 105,
1969
+ 116,
1970
+ 105,
1971
+ 111,
1972
+ 110
1973
+ ]
1974
+ },
1975
+ {
1976
+ "kind": "account",
1977
+ "path": "market"
1978
+ },
1979
+ {
1980
+ "kind": "account",
1981
+ "path": "position_owner"
1982
+ }
1983
+ ]
1984
+ }
1985
+ },
1986
+ {
1987
+ "name": "oracle"
1988
+ },
1989
+ {
1990
+ "name": "fallback_oracle"
1991
+ },
1992
+ {
1993
+ "name": "position_owner"
1994
+ },
1995
+ {
1996
+ "name": "rent_receiver",
1997
+ "docs": [
1998
+ "M11 fix: Must be the position owner (not arbitrary caller) to prevent rent theft."
1999
+ ],
2000
+ "writable": true
2001
+ },
2002
+ {
2003
+ "name": "caller",
2004
+ "docs": [
2005
+ "Anyone can call this"
2006
+ ],
2007
+ "signer": true
2008
+ }
2009
+ ],
2010
+ "args": []
2011
+ },
2012
+ {
2013
+ "name": "transfer_oracle_authority",
2014
+ "docs": [
2015
+ "Transfer PerkOracle authority. Current authority only."
2016
+ ],
2017
+ "discriminator": [
2018
+ 121,
2019
+ 248,
2020
+ 188,
2021
+ 188,
2022
+ 98,
2023
+ 217,
2024
+ 168,
2025
+ 20
2026
+ ],
2027
+ "accounts": [
2028
+ {
2029
+ "name": "protocol",
2030
+ "pda": {
2031
+ "seeds": [
2032
+ {
2033
+ "kind": "const",
2034
+ "value": [
2035
+ 112,
2036
+ 114,
2037
+ 111,
2038
+ 116,
2039
+ 111,
2040
+ 99,
2041
+ 111,
2042
+ 108
2043
+ ]
2044
+ }
2045
+ ]
2046
+ }
2047
+ },
2048
+ {
2049
+ "name": "perk_oracle",
2050
+ "writable": true,
2051
+ "pda": {
2052
+ "seeds": [
2053
+ {
2054
+ "kind": "const",
2055
+ "value": [
2056
+ 112,
2057
+ 101,
2058
+ 114,
2059
+ 107,
2060
+ 95,
2061
+ 111,
2062
+ 114,
2063
+ 97,
2064
+ 99,
2065
+ 108,
2066
+ 101
2067
+ ]
2068
+ },
2069
+ {
2070
+ "kind": "account",
2071
+ "path": "perk_oracle.token_mint",
2072
+ "account": "PerkOraclePrice"
2073
+ }
2074
+ ]
2075
+ }
2076
+ },
2077
+ {
2078
+ "name": "signer",
2079
+ "docs": [
2080
+ "Signer must be either the current oracle authority or the protocol admin"
2081
+ ],
2082
+ "signer": true
2083
+ },
2084
+ {
2085
+ "name": "new_authority"
2086
+ }
2087
+ ],
2088
+ "args": []
2089
+ },
2090
+ {
2091
+ "name": "update_amm",
2092
+ "docs": [
2093
+ "Update AMM peg multiplier to re-anchor to oracle. Permissionless."
2094
+ ],
2095
+ "discriminator": [
2096
+ 121,
2097
+ 106,
2098
+ 59,
2099
+ 30,
2100
+ 103,
2101
+ 223,
2102
+ 61,
2103
+ 19
2104
+ ],
2105
+ "accounts": [
2106
+ {
2107
+ "name": "market",
2108
+ "writable": true,
2109
+ "pda": {
2110
+ "seeds": [
2111
+ {
2112
+ "kind": "const",
2113
+ "value": [
2114
+ 109,
2115
+ 97,
2116
+ 114,
2117
+ 107,
2118
+ 101,
2119
+ 116
2120
+ ]
2121
+ },
2122
+ {
2123
+ "kind": "account",
2124
+ "path": "market.token_mint",
2125
+ "account": "Market"
2126
+ }
2127
+ ]
2128
+ }
2129
+ },
2130
+ {
2131
+ "name": "oracle"
2132
+ },
2133
+ {
2134
+ "name": "fallback_oracle"
2135
+ },
2136
+ {
2137
+ "name": "caller",
2138
+ "signer": true
2139
+ }
2140
+ ],
2141
+ "args": []
2142
+ },
2143
+ {
2144
+ "name": "update_oracle_config",
2145
+ "docs": [
2146
+ "Update PerkOracle config (price banding). Admin only."
2147
+ ],
2148
+ "discriminator": [
2149
+ 83,
2150
+ 16,
2151
+ 11,
2152
+ 254,
2153
+ 57,
2154
+ 99,
2155
+ 156,
2156
+ 58
2157
+ ],
2158
+ "accounts": [
2159
+ {
2160
+ "name": "protocol",
2161
+ "pda": {
2162
+ "seeds": [
2163
+ {
2164
+ "kind": "const",
2165
+ "value": [
2166
+ 112,
2167
+ 114,
2168
+ 111,
2169
+ 116,
2170
+ 111,
2171
+ 99,
2172
+ 111,
2173
+ 108
2174
+ ]
2175
+ }
2176
+ ]
2177
+ }
2178
+ },
2179
+ {
2180
+ "name": "perk_oracle",
2181
+ "writable": true,
2182
+ "pda": {
2183
+ "seeds": [
2184
+ {
2185
+ "kind": "const",
2186
+ "value": [
2187
+ 112,
2188
+ 101,
2189
+ 114,
2190
+ 107,
2191
+ 95,
2192
+ 111,
2193
+ 114,
2194
+ 97,
2195
+ 99,
2196
+ 108,
2197
+ 101
2198
+ ]
2199
+ },
2200
+ {
2201
+ "kind": "account",
2202
+ "path": "perk_oracle.token_mint",
2203
+ "account": "PerkOraclePrice"
2204
+ }
2205
+ ]
2206
+ }
2207
+ },
2208
+ {
2209
+ "name": "admin",
2210
+ "signer": true,
2211
+ "relations": [
2212
+ "protocol"
2213
+ ]
2214
+ }
2215
+ ],
2216
+ "args": [
2217
+ {
2218
+ "name": "params",
2219
+ "type": {
2220
+ "defined": {
2221
+ "name": "UpdateOracleConfigParams"
2222
+ }
2223
+ }
2224
+ }
2225
+ ]
2226
+ },
2227
+ {
2228
+ "name": "update_perk_oracle",
2229
+ "docs": [
2230
+ "Update a PerkOracle price feed. Authorized cranker only."
2231
+ ],
2232
+ "discriminator": [
2233
+ 120,
2234
+ 68,
2235
+ 244,
2236
+ 104,
2237
+ 150,
2238
+ 124,
2239
+ 65,
2240
+ 139
2241
+ ],
2242
+ "accounts": [
2243
+ {
2244
+ "name": "perk_oracle",
2245
+ "writable": true,
2246
+ "pda": {
2247
+ "seeds": [
2248
+ {
2249
+ "kind": "const",
2250
+ "value": [
2251
+ 112,
2252
+ 101,
2253
+ 114,
2254
+ 107,
2255
+ 95,
2256
+ 111,
2257
+ 114,
2258
+ 97,
2259
+ 99,
2260
+ 108,
2261
+ 101
2262
+ ]
2263
+ },
2264
+ {
2265
+ "kind": "account",
2266
+ "path": "perk_oracle.token_mint",
2267
+ "account": "PerkOraclePrice"
2268
+ }
2269
+ ]
2270
+ }
2271
+ },
2272
+ {
2273
+ "name": "authority",
2274
+ "signer": true,
2275
+ "relations": [
2276
+ "perk_oracle"
2277
+ ]
2278
+ }
2279
+ ],
2280
+ "args": [
2281
+ {
2282
+ "name": "params",
2283
+ "type": {
2284
+ "defined": {
2285
+ "name": "UpdatePerkOracleParams"
2286
+ }
2287
+ }
2288
+ }
2289
+ ]
2290
+ },
2291
+ {
2292
+ "name": "withdraw",
2293
+ "docs": [
2294
+ "Withdraw collateral from a market position."
2295
+ ],
2296
+ "discriminator": [
2297
+ 183,
2298
+ 18,
2299
+ 70,
2300
+ 156,
2301
+ 148,
2302
+ 109,
2303
+ 161,
2304
+ 34
2305
+ ],
2306
+ "accounts": [
2307
+ {
2308
+ "name": "protocol",
2309
+ "pda": {
2310
+ "seeds": [
2311
+ {
2312
+ "kind": "const",
2313
+ "value": [
2314
+ 112,
2315
+ 114,
2316
+ 111,
2317
+ 116,
2318
+ 111,
2319
+ 99,
2320
+ 111,
2321
+ 108
2322
+ ]
2323
+ }
2324
+ ]
2325
+ }
2326
+ },
2327
+ {
2328
+ "name": "market",
2329
+ "writable": true,
2330
+ "pda": {
2331
+ "seeds": [
2332
+ {
2333
+ "kind": "const",
2334
+ "value": [
2335
+ 109,
2336
+ 97,
2337
+ 114,
2338
+ 107,
2339
+ 101,
2340
+ 116
2341
+ ]
2342
+ },
2343
+ {
2344
+ "kind": "account",
2345
+ "path": "market.token_mint",
2346
+ "account": "Market"
2347
+ }
2348
+ ]
2349
+ }
2350
+ },
2351
+ {
2352
+ "name": "user_position",
2353
+ "writable": true,
2354
+ "pda": {
2355
+ "seeds": [
2356
+ {
2357
+ "kind": "const",
2358
+ "value": [
2359
+ 112,
2360
+ 111,
2361
+ 115,
2362
+ 105,
2363
+ 116,
2364
+ 105,
2365
+ 111,
2366
+ 110
2367
+ ]
2368
+ },
2369
+ {
2370
+ "kind": "account",
2371
+ "path": "market"
2372
+ },
2373
+ {
2374
+ "kind": "account",
2375
+ "path": "user"
2376
+ }
2377
+ ]
2378
+ }
2379
+ },
2380
+ {
2381
+ "name": "oracle"
2382
+ },
2383
+ {
2384
+ "name": "fallback_oracle"
2385
+ },
2386
+ {
2387
+ "name": "user_token_account",
2388
+ "writable": true
2389
+ },
2390
+ {
2391
+ "name": "vault",
2392
+ "writable": true,
2393
+ "pda": {
2394
+ "seeds": [
2395
+ {
2396
+ "kind": "const",
2397
+ "value": [
2398
+ 118,
2399
+ 97,
2400
+ 117,
2401
+ 108,
2402
+ 116
2403
+ ]
2404
+ },
2405
+ {
2406
+ "kind": "account",
2407
+ "path": "market"
2408
+ }
2409
+ ]
2410
+ }
2411
+ },
2412
+ {
2413
+ "name": "authority",
2414
+ "signer": true,
2415
+ "relations": [
2416
+ "user_position"
2417
+ ]
2418
+ },
2419
+ {
2420
+ "name": "user",
2421
+ "writable": true,
2422
+ "signer": true
2423
+ },
2424
+ {
2425
+ "name": "token_program",
2426
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
2427
+ }
2428
+ ],
2429
+ "args": [
2430
+ {
2431
+ "name": "amount",
2432
+ "type": "u64"
2433
+ }
2434
+ ]
2435
+ }
2436
+ ],
2437
+ "accounts": [
2438
+ {
2439
+ "name": "Market",
2440
+ "discriminator": [
2441
+ 219,
2442
+ 190,
2443
+ 213,
2444
+ 55,
2445
+ 0,
2446
+ 227,
2447
+ 198,
2448
+ 154
2449
+ ]
2450
+ },
2451
+ {
2452
+ "name": "PerkOraclePrice",
2453
+ "discriminator": [
2454
+ 215,
2455
+ 196,
2456
+ 234,
2457
+ 180,
2458
+ 130,
2459
+ 99,
2460
+ 25,
2461
+ 5
2462
+ ]
2463
+ },
2464
+ {
2465
+ "name": "Protocol",
2466
+ "discriminator": [
2467
+ 45,
2468
+ 39,
2469
+ 101,
2470
+ 43,
2471
+ 115,
2472
+ 72,
2473
+ 131,
2474
+ 40
2475
+ ]
2476
+ },
2477
+ {
2478
+ "name": "TriggerOrder",
2479
+ "discriminator": [
2480
+ 236,
2481
+ 61,
2482
+ 42,
2483
+ 190,
2484
+ 152,
2485
+ 12,
2486
+ 106,
2487
+ 116
2488
+ ]
2489
+ },
2490
+ {
2491
+ "name": "UserPosition",
2492
+ "discriminator": [
2493
+ 251,
2494
+ 248,
2495
+ 209,
2496
+ 245,
2497
+ 83,
2498
+ 234,
2499
+ 17,
2500
+ 27
2501
+ ]
2502
+ }
2503
+ ],
2504
+ "errors": [
2505
+ {
2506
+ "code": 6000,
2507
+ "name": "ProtocolPaused",
2508
+ "msg": "Protocol is paused"
2509
+ },
2510
+ {
2511
+ "code": 6001,
2512
+ "name": "MarketNotActive",
2513
+ "msg": "Market is not active"
2514
+ },
2515
+ {
2516
+ "code": 6002,
2517
+ "name": "Unauthorized",
2518
+ "msg": "Unauthorized"
2519
+ },
2520
+ {
2521
+ "code": 6003,
2522
+ "name": "MathOverflow",
2523
+ "msg": "Math overflow"
2524
+ },
2525
+ {
2526
+ "code": 6004,
2527
+ "name": "InsufficientCollateral",
2528
+ "msg": "Insufficient collateral"
2529
+ },
2530
+ {
2531
+ "code": 6005,
2532
+ "name": "InsufficientMargin",
2533
+ "msg": "Insufficient margin"
2534
+ },
2535
+ {
2536
+ "code": 6006,
2537
+ "name": "InvalidLeverage",
2538
+ "msg": "Invalid leverage"
2539
+ },
2540
+ {
2541
+ "code": 6007,
2542
+ "name": "SlippageExceeded",
2543
+ "msg": "Slippage exceeded"
2544
+ },
2545
+ {
2546
+ "code": 6008,
2547
+ "name": "InvalidTradingFee",
2548
+ "msg": "Invalid trading fee"
2549
+ },
2550
+ {
2551
+ "code": 6009,
2552
+ "name": "InitialKTooSmall",
2553
+ "msg": "Initial k too small"
2554
+ },
2555
+ {
2556
+ "code": 6010,
2557
+ "name": "OracleStale",
2558
+ "msg": "Oracle price is stale"
2559
+ },
2560
+ {
2561
+ "code": 6011,
2562
+ "name": "OracleConfidenceTooWide",
2563
+ "msg": "Oracle confidence too wide"
2564
+ },
2565
+ {
2566
+ "code": 6012,
2567
+ "name": "OraclePriceInvalid",
2568
+ "msg": "Oracle price invalid"
2569
+ },
2570
+ {
2571
+ "code": 6013,
2572
+ "name": "NotLiquidatable",
2573
+ "msg": "Position not liquidatable"
2574
+ },
2575
+ {
2576
+ "code": 6014,
2577
+ "name": "MaxTriggerOrdersReached",
2578
+ "msg": "Max trigger orders reached"
2579
+ },
2580
+ {
2581
+ "code": 6015,
2582
+ "name": "TriggerConditionNotMet",
2583
+ "msg": "Trigger condition not met"
2584
+ },
2585
+ {
2586
+ "code": 6016,
2587
+ "name": "TriggerOrderExpired",
2588
+ "msg": "Trigger order expired"
2589
+ },
2590
+ {
2591
+ "code": 6017,
2592
+ "name": "NoOpenPosition",
2593
+ "msg": "No open position"
2594
+ },
2595
+ {
2596
+ "code": 6018,
2597
+ "name": "SideBlocked",
2598
+ "msg": "Side blocked - drain only mode"
2599
+ },
2600
+ {
2601
+ "code": 6019,
2602
+ "name": "CorruptState",
2603
+ "msg": "Corrupt state"
2604
+ },
2605
+ {
2606
+ "code": 6020,
2607
+ "name": "InvalidOracleSource",
2608
+ "msg": "Invalid oracle source"
2609
+ },
2610
+ {
2611
+ "code": 6021,
2612
+ "name": "WithdrawalWouldLiquidate",
2613
+ "msg": "Withdrawal would make position underwater"
2614
+ },
2615
+ {
2616
+ "code": 6022,
2617
+ "name": "FundingPeriodNotElapsed",
2618
+ "msg": "Funding period not elapsed"
2619
+ },
2620
+ {
2621
+ "code": 6023,
2622
+ "name": "AmmPegWithinThreshold",
2623
+ "msg": "AMM peg within threshold"
2624
+ },
2625
+ {
2626
+ "code": 6024,
2627
+ "name": "InvalidAmount",
2628
+ "msg": "Invalid collateral amount"
2629
+ },
2630
+ {
2631
+ "code": 6025,
2632
+ "name": "PositionFlipNotAllowed",
2633
+ "msg": "Position flip not allowed — close first, then reopen"
2634
+ },
2635
+ {
2636
+ "code": 6026,
2637
+ "name": "PegCooldownNotElapsed",
2638
+ "msg": "AMM peg update cooldown not elapsed"
2639
+ },
2640
+ {
2641
+ "code": 6027,
2642
+ "name": "InsuranceEpochCapExceeded",
2643
+ "msg": "Insurance fund epoch payout cap exceeded"
2644
+ },
2645
+ {
2646
+ "code": 6028,
2647
+ "name": "PositionSizeLimitExceeded",
2648
+ "msg": "Position size exceeds market limit"
2649
+ },
2650
+ {
2651
+ "code": 6029,
2652
+ "name": "OiLimitExceeded",
2653
+ "msg": "Open interest exceeds market limit"
2654
+ },
2655
+ {
2656
+ "code": 6030,
2657
+ "name": "DexPoolOracleNotSupported",
2658
+ "msg": "DexPool oracle source not yet supported"
2659
+ },
2660
+ {
2661
+ "code": 6031,
2662
+ "name": "PositionNotInitialized",
2663
+ "msg": "Position not initialized — call initialize_position first"
2664
+ },
2665
+ {
2666
+ "code": 6032,
2667
+ "name": "InsufficientOiForFunding",
2668
+ "msg": "Insufficient OI on both sides for funding"
2669
+ },
2670
+ {
2671
+ "code": 6033,
2672
+ "name": "NoFeesToClaim",
2673
+ "msg": "No fees to claim"
2674
+ },
2675
+ {
2676
+ "code": 6034,
2677
+ "name": "DepositBelowMinimum",
2678
+ "msg": "Deposit below minimum amount"
2679
+ },
2680
+ {
2681
+ "code": 6035,
2682
+ "name": "RemainingPositionTooSmall",
2683
+ "msg": "Remaining position size below minimum after partial close"
2684
+ },
2685
+ {
2686
+ "code": 6036,
2687
+ "name": "TriggerOrderTooOld",
2688
+ "msg": "Trigger order too old (exceeded max age)"
2689
+ },
2690
+ {
2691
+ "code": 6037,
2692
+ "name": "InvalidTokenDecimals",
2693
+ "msg": "Token mint decimals out of supported range"
2694
+ },
2695
+ {
2696
+ "code": 6038,
2697
+ "name": "WarmupPeriodTooSmall",
2698
+ "msg": "Warmup period below minimum"
2699
+ },
2700
+ {
2701
+ "code": 6039,
2702
+ "name": "PositionNotEmpty",
2703
+ "msg": "Position is not empty — cannot reclaim"
2704
+ },
2705
+ {
2706
+ "code": 6040,
2707
+ "name": "PositionHasOpenOrders",
2708
+ "msg": "Position has open trigger orders — cannot reclaim"
2709
+ },
2710
+ {
2711
+ "code": 6041,
2712
+ "name": "VaultInsufficient",
2713
+ "msg": "Vault insufficient for transfer"
2714
+ },
2715
+ {
2716
+ "code": 6042,
2717
+ "name": "ReclaimTooSoon",
2718
+ "msg": "Account too young to reclaim"
2719
+ },
2720
+ {
2721
+ "code": 6043,
2722
+ "name": "ReclaimFeeDebt",
2723
+ "msg": "Account has outstanding fee debt — cannot reclaim"
2724
+ },
2725
+ {
2726
+ "code": 6044,
2727
+ "name": "ReclaimCollateralAboveDust",
2728
+ "msg": "Account collateral above dust threshold — cannot reclaim"
2729
+ },
2730
+ {
2731
+ "code": 6045,
2732
+ "name": "AdminTransferPending",
2733
+ "msg": "Admin transfer already pending — accept or cancel first"
2734
+ },
2735
+ {
2736
+ "code": 6046,
2737
+ "name": "MinHoldingPeriodNotMet",
2738
+ "msg": "Must wait at least 1 slot before closing position"
2739
+ },
2740
+ {
2741
+ "code": 6047,
2742
+ "name": "OracleFrozen",
2743
+ "msg": "Oracle is frozen"
2744
+ },
2745
+ {
2746
+ "code": 6048,
2747
+ "name": "OracleNotFrozen",
2748
+ "msg": "Oracle must be frozen for this operation"
2749
+ },
2750
+ {
2751
+ "code": 6049,
2752
+ "name": "OracleInsufficientSources",
2753
+ "msg": "Insufficient oracle sources"
2754
+ },
2755
+ {
2756
+ "code": 6050,
2757
+ "name": "OracleUpdateTooFrequent",
2758
+ "msg": "Oracle update too frequent (one per slot max)"
2759
+ },
2760
+ {
2761
+ "code": 6051,
2762
+ "name": "OracleGapTooLarge",
2763
+ "msg": "Oracle gap too large — unfreeze required"
2764
+ },
2765
+ {
2766
+ "code": 6052,
2767
+ "name": "OracleFallbackFailed",
2768
+ "msg": "Primary and fallback oracles both failed"
2769
+ },
2770
+ {
2771
+ "code": 6053,
2772
+ "name": "OracleCircuitBreakerTripped",
2773
+ "msg": "Oracle circuit breaker tripped — price deviation from EMA exceeds threshold"
2774
+ }
2775
+ ],
2776
+ "types": [
2777
+ {
2778
+ "name": "AdminUpdateMarketParams",
2779
+ "type": {
2780
+ "kind": "struct",
2781
+ "fields": [
2782
+ {
2783
+ "name": "oracle_address",
2784
+ "docs": [
2785
+ "New oracle address (None = keep current)"
2786
+ ],
2787
+ "type": {
2788
+ "option": "pubkey"
2789
+ }
2790
+ },
2791
+ {
2792
+ "name": "active",
2793
+ "docs": [
2794
+ "Set market active/inactive (None = keep current)"
2795
+ ],
2796
+ "type": {
2797
+ "option": "bool"
2798
+ }
2799
+ },
2800
+ {
2801
+ "name": "trading_fee_bps",
2802
+ "docs": [
2803
+ "New trading fee in BPS (None = keep current)"
2804
+ ],
2805
+ "type": {
2806
+ "option": "u16"
2807
+ }
2808
+ },
2809
+ {
2810
+ "name": "max_leverage",
2811
+ "docs": [
2812
+ "H4 (Pashov2): New max leverage (100x-scaled, e.g. 2000 = 20x). None = keep current."
2813
+ ],
2814
+ "type": {
2815
+ "option": "u32"
2816
+ }
2817
+ }
2818
+ ]
2819
+ }
2820
+ },
2821
+ {
2822
+ "name": "CreateMarketParams",
2823
+ "type": {
2824
+ "kind": "struct",
2825
+ "fields": [
2826
+ {
2827
+ "name": "oracle_source",
2828
+ "type": {
2829
+ "defined": {
2830
+ "name": "OracleSource"
2831
+ }
2832
+ }
2833
+ },
2834
+ {
2835
+ "name": "max_leverage",
2836
+ "type": "u32"
2837
+ },
2838
+ {
2839
+ "name": "trading_fee_bps",
2840
+ "type": "u16"
2841
+ },
2842
+ {
2843
+ "name": "initial_k",
2844
+ "type": "u128"
2845
+ }
2846
+ ]
2847
+ }
2848
+ },
2849
+ {
2850
+ "name": "InitPerkOracleParams",
2851
+ "type": {
2852
+ "kind": "struct",
2853
+ "fields": [
2854
+ {
2855
+ "name": "min_sources",
2856
+ "type": "u8"
2857
+ },
2858
+ {
2859
+ "name": "max_staleness_seconds",
2860
+ "type": "u32"
2861
+ },
2862
+ {
2863
+ "name": "max_price_change_bps",
2864
+ "docs": [
2865
+ "Max allowed price change per update in basis points. 0 = no banding (memecoins).",
2866
+ "3000 = 30% max change per update (deep liquidity tokens)."
2867
+ ],
2868
+ "type": "u16"
2869
+ },
2870
+ {
2871
+ "name": "circuit_breaker_deviation_bps",
2872
+ "docs": [
2873
+ "Circuit breaker: max deviation from EMA in bps. 0 = disabled."
2874
+ ],
2875
+ "type": "u16"
2876
+ }
2877
+ ]
2878
+ }
2879
+ },
2880
+ {
2881
+ "name": "Market",
2882
+ "type": {
2883
+ "kind": "struct",
2884
+ "fields": [
2885
+ {
2886
+ "name": "market_index",
2887
+ "type": "u64"
2888
+ },
2889
+ {
2890
+ "name": "token_mint",
2891
+ "type": "pubkey"
2892
+ },
2893
+ {
2894
+ "name": "collateral_mint",
2895
+ "type": "pubkey"
2896
+ },
2897
+ {
2898
+ "name": "creator",
2899
+ "type": "pubkey"
2900
+ },
2901
+ {
2902
+ "name": "vault",
2903
+ "type": "pubkey"
2904
+ },
2905
+ {
2906
+ "name": "vault_bump",
2907
+ "type": "u8"
2908
+ },
2909
+ {
2910
+ "name": "base_reserve",
2911
+ "type": "u128"
2912
+ },
2913
+ {
2914
+ "name": "quote_reserve",
2915
+ "type": "u128"
2916
+ },
2917
+ {
2918
+ "name": "k",
2919
+ "type": "u128"
2920
+ },
2921
+ {
2922
+ "name": "peg_multiplier",
2923
+ "type": "u128"
2924
+ },
2925
+ {
2926
+ "name": "total_long_position",
2927
+ "type": "u128"
2928
+ },
2929
+ {
2930
+ "name": "total_short_position",
2931
+ "type": "u128"
2932
+ },
2933
+ {
2934
+ "name": "max_leverage",
2935
+ "type": "u32"
2936
+ },
2937
+ {
2938
+ "name": "trading_fee_bps",
2939
+ "type": "u16"
2940
+ },
2941
+ {
2942
+ "name": "liquidation_fee_bps",
2943
+ "type": "u16"
2944
+ },
2945
+ {
2946
+ "name": "maintenance_margin_bps",
2947
+ "type": "u16"
2948
+ },
2949
+ {
2950
+ "name": "oracle_source",
2951
+ "type": {
2952
+ "defined": {
2953
+ "name": "OracleSource"
2954
+ }
2955
+ }
2956
+ },
2957
+ {
2958
+ "name": "oracle_address",
2959
+ "type": "pubkey"
2960
+ },
2961
+ {
2962
+ "name": "insurance_fund_balance",
2963
+ "type": "u64"
2964
+ },
2965
+ {
2966
+ "name": "haircut_numerator",
2967
+ "type": "u128"
2968
+ },
2969
+ {
2970
+ "name": "haircut_denominator",
2971
+ "type": "u128"
2972
+ },
2973
+ {
2974
+ "name": "long_a",
2975
+ "type": "u128"
2976
+ },
2977
+ {
2978
+ "name": "long_k_index",
2979
+ "type": "i128"
2980
+ },
2981
+ {
2982
+ "name": "long_epoch",
2983
+ "type": "u64"
2984
+ },
2985
+ {
2986
+ "name": "long_state",
2987
+ "type": {
2988
+ "defined": {
2989
+ "name": "SideState"
2990
+ }
2991
+ }
2992
+ },
2993
+ {
2994
+ "name": "long_epoch_start_k",
2995
+ "type": "i128"
2996
+ },
2997
+ {
2998
+ "name": "short_a",
2999
+ "type": "u128"
3000
+ },
3001
+ {
3002
+ "name": "short_k_index",
3003
+ "type": "i128"
3004
+ },
3005
+ {
3006
+ "name": "short_epoch",
3007
+ "type": "u64"
3008
+ },
3009
+ {
3010
+ "name": "short_state",
3011
+ "type": {
3012
+ "defined": {
3013
+ "name": "SideState"
3014
+ }
3015
+ }
3016
+ },
3017
+ {
3018
+ "name": "short_epoch_start_k",
3019
+ "type": "i128"
3020
+ },
3021
+ {
3022
+ "name": "last_funding_time",
3023
+ "type": "i64"
3024
+ },
3025
+ {
3026
+ "name": "cumulative_long_funding",
3027
+ "type": "i128"
3028
+ },
3029
+ {
3030
+ "name": "cumulative_short_funding",
3031
+ "type": "i128"
3032
+ },
3033
+ {
3034
+ "name": "funding_period_seconds",
3035
+ "type": "u32"
3036
+ },
3037
+ {
3038
+ "name": "funding_rate_cap_bps",
3039
+ "type": "u16"
3040
+ },
3041
+ {
3042
+ "name": "warmup_period_slots",
3043
+ "type": "u64"
3044
+ },
3045
+ {
3046
+ "name": "creator_fees_earned",
3047
+ "type": "u64"
3048
+ },
3049
+ {
3050
+ "name": "protocol_fees_earned",
3051
+ "type": "u64"
3052
+ },
3053
+ {
3054
+ "name": "total_volume",
3055
+ "type": "u128"
3056
+ },
3057
+ {
3058
+ "name": "active",
3059
+ "type": "bool"
3060
+ },
3061
+ {
3062
+ "name": "total_users",
3063
+ "type": "u32"
3064
+ },
3065
+ {
3066
+ "name": "total_positions",
3067
+ "type": "u32"
3068
+ },
3069
+ {
3070
+ "name": "c_tot",
3071
+ "type": "u128"
3072
+ },
3073
+ {
3074
+ "name": "pnl_pos_tot",
3075
+ "type": "u128"
3076
+ },
3077
+ {
3078
+ "name": "pnl_matured_pos_tot",
3079
+ "type": "u128"
3080
+ },
3081
+ {
3082
+ "name": "vault_balance",
3083
+ "type": "u128"
3084
+ },
3085
+ {
3086
+ "name": "oi_eff_long_q",
3087
+ "type": "u128"
3088
+ },
3089
+ {
3090
+ "name": "oi_eff_short_q",
3091
+ "type": "u128"
3092
+ },
3093
+ {
3094
+ "name": "stored_pos_count_long",
3095
+ "type": "u64"
3096
+ },
3097
+ {
3098
+ "name": "stored_pos_count_short",
3099
+ "type": "u64"
3100
+ },
3101
+ {
3102
+ "name": "bump",
3103
+ "type": "u8"
3104
+ },
3105
+ {
3106
+ "name": "created_at",
3107
+ "type": "i64"
3108
+ },
3109
+ {
3110
+ "name": "max_position_size",
3111
+ "type": "u128"
3112
+ },
3113
+ {
3114
+ "name": "max_oi",
3115
+ "type": "u128"
3116
+ },
3117
+ {
3118
+ "name": "last_peg_update_slot",
3119
+ "type": "u64"
3120
+ },
3121
+ {
3122
+ "name": "last_mark_price_for_funding",
3123
+ "type": "u64"
3124
+ },
3125
+ {
3126
+ "name": "creator_claimable_fees",
3127
+ "type": "u64"
3128
+ },
3129
+ {
3130
+ "name": "protocol_claimable_fees",
3131
+ "type": "u64"
3132
+ },
3133
+ {
3134
+ "name": "insurance_epoch_start",
3135
+ "type": "i64"
3136
+ },
3137
+ {
3138
+ "name": "insurance_epoch_payout",
3139
+ "type": "u64"
3140
+ },
3141
+ {
3142
+ "name": "last_oracle_price",
3143
+ "docs": [
3144
+ "Last oracle price used in accrue_market_to (spec §5.4)"
3145
+ ],
3146
+ "type": "u64"
3147
+ },
3148
+ {
3149
+ "name": "last_market_slot",
3150
+ "docs": [
3151
+ "Last slot used in accrue_market_to"
3152
+ ],
3153
+ "type": "u64"
3154
+ },
3155
+ {
3156
+ "name": "current_slot",
3157
+ "docs": [
3158
+ "Current slot (updated on every touch)"
3159
+ ],
3160
+ "type": "u64"
3161
+ },
3162
+ {
3163
+ "name": "funding_rate_bps_per_slot_last",
3164
+ "docs": [
3165
+ "Stored funding rate for anti-retroactivity (bps per slot, spec §5.5)"
3166
+ ],
3167
+ "type": "i64"
3168
+ },
3169
+ {
3170
+ "name": "funding_price_sample_last",
3171
+ "docs": [
3172
+ "Funding price sample for anti-retroactivity"
3173
+ ],
3174
+ "type": "u64"
3175
+ },
3176
+ {
3177
+ "name": "insurance_floor",
3178
+ "docs": [
3179
+ "Insurance floor (spec §4.7)"
3180
+ ],
3181
+ "type": "u128"
3182
+ },
3183
+ {
3184
+ "name": "stale_account_count_long",
3185
+ "docs": [
3186
+ "Stale account counts per side (for ResetPending drain tracking)"
3187
+ ],
3188
+ "type": "u64"
3189
+ },
3190
+ {
3191
+ "name": "stale_account_count_short",
3192
+ "type": "u64"
3193
+ },
3194
+ {
3195
+ "name": "phantom_dust_bound_long_q",
3196
+ "docs": [
3197
+ "Dynamic phantom dust bounds (spec §4.6, §5.7)"
3198
+ ],
3199
+ "type": "u128"
3200
+ },
3201
+ {
3202
+ "name": "phantom_dust_bound_short_q",
3203
+ "type": "u128"
3204
+ },
3205
+ {
3206
+ "name": "insurance_fee_revenue",
3207
+ "docs": [
3208
+ "Insurance fee revenue tracking"
3209
+ ],
3210
+ "type": "u128"
3211
+ },
3212
+ {
3213
+ "name": "pending_reset_long",
3214
+ "type": "bool"
3215
+ },
3216
+ {
3217
+ "name": "pending_reset_short",
3218
+ "type": "bool"
3219
+ },
3220
+ {
3221
+ "name": "mark_price_accumulator",
3222
+ "type": "u128"
3223
+ },
3224
+ {
3225
+ "name": "twap_observation_count",
3226
+ "type": "u32"
3227
+ },
3228
+ {
3229
+ "name": "twap_volume_accumulator",
3230
+ "type": "u128"
3231
+ },
3232
+ {
3233
+ "name": "creation_fee_paid",
3234
+ "type": "u64"
3235
+ },
3236
+ {
3237
+ "name": "fallback_oracle_source",
3238
+ "type": {
3239
+ "defined": {
3240
+ "name": "OracleSource"
3241
+ }
3242
+ }
3243
+ },
3244
+ {
3245
+ "name": "fallback_oracle_address",
3246
+ "type": "pubkey"
3247
+ }
3248
+ ]
3249
+ }
3250
+ },
3251
+ {
3252
+ "name": "OracleSource",
3253
+ "type": {
3254
+ "kind": "enum",
3255
+ "variants": [
3256
+ {
3257
+ "name": "Pyth"
3258
+ },
3259
+ {
3260
+ "name": "PerkOracle"
3261
+ },
3262
+ {
3263
+ "name": "DexPool"
3264
+ }
3265
+ ]
3266
+ }
3267
+ },
3268
+ {
3269
+ "name": "PerkOraclePrice",
3270
+ "type": {
3271
+ "kind": "struct",
3272
+ "fields": [
3273
+ {
3274
+ "name": "bump",
3275
+ "type": "u8"
3276
+ },
3277
+ {
3278
+ "name": "token_mint",
3279
+ "type": "pubkey"
3280
+ },
3281
+ {
3282
+ "name": "authority",
3283
+ "type": "pubkey"
3284
+ },
3285
+ {
3286
+ "name": "price",
3287
+ "type": "u64"
3288
+ },
3289
+ {
3290
+ "name": "confidence",
3291
+ "type": "u64"
3292
+ },
3293
+ {
3294
+ "name": "timestamp",
3295
+ "type": "i64"
3296
+ },
3297
+ {
3298
+ "name": "num_sources",
3299
+ "type": "u8"
3300
+ },
3301
+ {
3302
+ "name": "min_sources",
3303
+ "type": "u8"
3304
+ },
3305
+ {
3306
+ "name": "last_slot",
3307
+ "type": "u64"
3308
+ },
3309
+ {
3310
+ "name": "ema_price",
3311
+ "type": "u64"
3312
+ },
3313
+ {
3314
+ "name": "max_staleness_seconds",
3315
+ "type": "u32"
3316
+ },
3317
+ {
3318
+ "name": "is_frozen",
3319
+ "type": "bool"
3320
+ },
3321
+ {
3322
+ "name": "created_at",
3323
+ "type": "i64"
3324
+ },
3325
+ {
3326
+ "name": "total_updates",
3327
+ "type": "u64"
3328
+ },
3329
+ {
3330
+ "name": "_reserved",
3331
+ "type": {
3332
+ "array": [
3333
+ "u8",
3334
+ 64
3335
+ ]
3336
+ }
3337
+ }
3338
+ ]
3339
+ }
3340
+ },
3341
+ {
3342
+ "name": "Protocol",
3343
+ "type": {
3344
+ "kind": "struct",
3345
+ "fields": [
3346
+ {
3347
+ "name": "admin",
3348
+ "type": "pubkey"
3349
+ },
3350
+ {
3351
+ "name": "paused",
3352
+ "type": "bool"
3353
+ },
3354
+ {
3355
+ "name": "market_count",
3356
+ "type": "u64"
3357
+ },
3358
+ {
3359
+ "name": "protocol_fee_vault",
3360
+ "type": "pubkey"
3361
+ },
3362
+ {
3363
+ "name": "creator_fee_share_bps",
3364
+ "type": "u16"
3365
+ },
3366
+ {
3367
+ "name": "min_trading_fee_bps",
3368
+ "type": "u16"
3369
+ },
3370
+ {
3371
+ "name": "max_trading_fee_bps",
3372
+ "type": "u16"
3373
+ },
3374
+ {
3375
+ "name": "min_initial_liquidity",
3376
+ "type": "u64"
3377
+ },
3378
+ {
3379
+ "name": "total_volume",
3380
+ "type": "u128"
3381
+ },
3382
+ {
3383
+ "name": "total_fees_collected",
3384
+ "type": "u128"
3385
+ },
3386
+ {
3387
+ "name": "total_users",
3388
+ "type": "u64"
3389
+ },
3390
+ {
3391
+ "name": "bump",
3392
+ "type": "u8"
3393
+ },
3394
+ {
3395
+ "name": "market_creation_fee",
3396
+ "type": "u64"
3397
+ },
3398
+ {
3399
+ "name": "pending_admin",
3400
+ "type": {
3401
+ "option": "pubkey"
3402
+ }
3403
+ }
3404
+ ]
3405
+ }
3406
+ },
3407
+ {
3408
+ "name": "SetFallbackOracleParams",
3409
+ "type": {
3410
+ "kind": "struct",
3411
+ "fields": [
3412
+ {
3413
+ "name": "fallback_oracle_source",
3414
+ "type": {
3415
+ "defined": {
3416
+ "name": "OracleSource"
3417
+ }
3418
+ }
3419
+ },
3420
+ {
3421
+ "name": "fallback_oracle_address",
3422
+ "type": "pubkey"
3423
+ }
3424
+ ]
3425
+ }
3426
+ },
3427
+ {
3428
+ "name": "Side",
3429
+ "type": {
3430
+ "kind": "enum",
3431
+ "variants": [
3432
+ {
3433
+ "name": "Long"
3434
+ },
3435
+ {
3436
+ "name": "Short"
3437
+ }
3438
+ ]
3439
+ }
3440
+ },
3441
+ {
3442
+ "name": "SideState",
3443
+ "type": {
3444
+ "kind": "enum",
3445
+ "variants": [
3446
+ {
3447
+ "name": "Normal"
3448
+ },
3449
+ {
3450
+ "name": "DrainOnly"
3451
+ },
3452
+ {
3453
+ "name": "ResetPending"
3454
+ }
3455
+ ]
3456
+ }
3457
+ },
3458
+ {
3459
+ "name": "TriggerOrder",
3460
+ "type": {
3461
+ "kind": "struct",
3462
+ "fields": [
3463
+ {
3464
+ "name": "authority",
3465
+ "type": "pubkey"
3466
+ },
3467
+ {
3468
+ "name": "market",
3469
+ "type": "pubkey"
3470
+ },
3471
+ {
3472
+ "name": "order_id",
3473
+ "type": "u64"
3474
+ },
3475
+ {
3476
+ "name": "order_type",
3477
+ "type": {
3478
+ "defined": {
3479
+ "name": "TriggerOrderType"
3480
+ }
3481
+ }
3482
+ },
3483
+ {
3484
+ "name": "side",
3485
+ "type": {
3486
+ "defined": {
3487
+ "name": "Side"
3488
+ }
3489
+ }
3490
+ },
3491
+ {
3492
+ "name": "size",
3493
+ "type": "u64"
3494
+ },
3495
+ {
3496
+ "name": "trigger_price",
3497
+ "type": "u64"
3498
+ },
3499
+ {
3500
+ "name": "leverage",
3501
+ "type": "u32"
3502
+ },
3503
+ {
3504
+ "name": "reduce_only",
3505
+ "type": "bool"
3506
+ },
3507
+ {
3508
+ "name": "created_at",
3509
+ "type": "i64"
3510
+ },
3511
+ {
3512
+ "name": "expiry",
3513
+ "type": "i64"
3514
+ },
3515
+ {
3516
+ "name": "bump",
3517
+ "type": "u8"
3518
+ }
3519
+ ]
3520
+ }
3521
+ },
3522
+ {
3523
+ "name": "TriggerOrderParams",
3524
+ "type": {
3525
+ "kind": "struct",
3526
+ "fields": [
3527
+ {
3528
+ "name": "order_type",
3529
+ "type": {
3530
+ "defined": {
3531
+ "name": "TriggerOrderType"
3532
+ }
3533
+ }
3534
+ },
3535
+ {
3536
+ "name": "side",
3537
+ "type": {
3538
+ "defined": {
3539
+ "name": "Side"
3540
+ }
3541
+ }
3542
+ },
3543
+ {
3544
+ "name": "size",
3545
+ "type": "u64"
3546
+ },
3547
+ {
3548
+ "name": "trigger_price",
3549
+ "type": "u64"
3550
+ },
3551
+ {
3552
+ "name": "leverage",
3553
+ "type": "u32"
3554
+ },
3555
+ {
3556
+ "name": "reduce_only",
3557
+ "type": "bool"
3558
+ },
3559
+ {
3560
+ "name": "expiry",
3561
+ "type": "i64"
3562
+ }
3563
+ ]
3564
+ }
3565
+ },
3566
+ {
3567
+ "name": "TriggerOrderType",
3568
+ "type": {
3569
+ "kind": "enum",
3570
+ "variants": [
3571
+ {
3572
+ "name": "Limit"
3573
+ },
3574
+ {
3575
+ "name": "StopLoss"
3576
+ },
3577
+ {
3578
+ "name": "TakeProfit"
3579
+ }
3580
+ ]
3581
+ }
3582
+ },
3583
+ {
3584
+ "name": "UpdateOracleConfigParams",
3585
+ "type": {
3586
+ "kind": "struct",
3587
+ "fields": [
3588
+ {
3589
+ "name": "max_price_change_bps",
3590
+ "docs": [
3591
+ "New max price change per update in bps. 0 = no banding."
3592
+ ],
3593
+ "type": {
3594
+ "option": "u16"
3595
+ }
3596
+ },
3597
+ {
3598
+ "name": "min_sources",
3599
+ "docs": [
3600
+ "Minimum number of sources required for oracle updates."
3601
+ ],
3602
+ "type": {
3603
+ "option": "u8"
3604
+ }
3605
+ },
3606
+ {
3607
+ "name": "max_staleness_seconds",
3608
+ "docs": [
3609
+ "Maximum staleness in seconds before oracle is considered stale."
3610
+ ],
3611
+ "type": {
3612
+ "option": "u32"
3613
+ }
3614
+ },
3615
+ {
3616
+ "name": "circuit_breaker_deviation_bps",
3617
+ "docs": [
3618
+ "Circuit breaker: max deviation from EMA in bps. 0 = disabled."
3619
+ ],
3620
+ "type": {
3621
+ "option": "u16"
3622
+ }
3623
+ }
3624
+ ]
3625
+ }
3626
+ },
3627
+ {
3628
+ "name": "UpdatePerkOracleParams",
3629
+ "type": {
3630
+ "kind": "struct",
3631
+ "fields": [
3632
+ {
3633
+ "name": "price",
3634
+ "type": "u64"
3635
+ },
3636
+ {
3637
+ "name": "confidence",
3638
+ "type": "u64"
3639
+ },
3640
+ {
3641
+ "name": "num_sources",
3642
+ "type": "u8"
3643
+ }
3644
+ ]
3645
+ }
3646
+ },
3647
+ {
3648
+ "name": "UserPosition",
3649
+ "type": {
3650
+ "kind": "struct",
3651
+ "fields": [
3652
+ {
3653
+ "name": "authority",
3654
+ "type": "pubkey"
3655
+ },
3656
+ {
3657
+ "name": "market",
3658
+ "type": "pubkey"
3659
+ },
3660
+ {
3661
+ "name": "deposited_collateral",
3662
+ "type": "u64"
3663
+ },
3664
+ {
3665
+ "name": "base_size",
3666
+ "type": "i64"
3667
+ },
3668
+ {
3669
+ "name": "quote_entry_amount",
3670
+ "type": "u128"
3671
+ },
3672
+ {
3673
+ "name": "last_cumulative_funding",
3674
+ "type": "i128"
3675
+ },
3676
+ {
3677
+ "name": "pnl",
3678
+ "type": "i128"
3679
+ },
3680
+ {
3681
+ "name": "reserved_pnl",
3682
+ "type": "u128"
3683
+ },
3684
+ {
3685
+ "name": "warmup_started_at_slot",
3686
+ "type": "u64"
3687
+ },
3688
+ {
3689
+ "name": "warmup_slope",
3690
+ "type": "u128"
3691
+ },
3692
+ {
3693
+ "name": "basis",
3694
+ "type": "i128"
3695
+ },
3696
+ {
3697
+ "name": "a_snapshot",
3698
+ "type": "u128"
3699
+ },
3700
+ {
3701
+ "name": "k_snapshot",
3702
+ "type": "i128"
3703
+ },
3704
+ {
3705
+ "name": "epoch_snapshot",
3706
+ "type": "u64"
3707
+ },
3708
+ {
3709
+ "name": "fee_credits",
3710
+ "type": "i128"
3711
+ },
3712
+ {
3713
+ "name": "last_fee_slot",
3714
+ "type": "u64"
3715
+ },
3716
+ {
3717
+ "name": "open_trigger_orders",
3718
+ "type": "u8"
3719
+ },
3720
+ {
3721
+ "name": "max_trigger_orders",
3722
+ "type": "u8"
3723
+ },
3724
+ {
3725
+ "name": "next_order_id",
3726
+ "type": "u64"
3727
+ },
3728
+ {
3729
+ "name": "last_activity_slot",
3730
+ "type": "u64"
3731
+ },
3732
+ {
3733
+ "name": "bump",
3734
+ "type": "u8"
3735
+ }
3736
+ ]
3737
+ }
3738
+ }
3739
+ ]
3740
+ }