@parqxchange/sdk 0.1.0 → 0.2.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/actions/liquidity.js +2 -1
- package/dist/decode/index.js +18 -6
- package/dist/events/decoder.d.ts +4 -1
- package/dist/events/decoder.js +19 -2
- package/dist/programs/pool.d.ts +12 -0
- package/dist/programs/pool.js +14 -1
- package/dist/types/index.d.ts +10 -0
- package/dist/utils/pda.d.ts +1 -0
- package/dist/utils/pda.js +4 -0
- package/idl/perp_engine.json +124 -3
- package/idl/pool_program.json +982 -11
- package/package.json +2 -1
package/idl/pool_program.json
CHANGED
|
@@ -57,6 +57,9 @@
|
|
|
57
57
|
"accounts": [
|
|
58
58
|
{
|
|
59
59
|
"name": "insurance_fund",
|
|
60
|
+
"docs": [
|
|
61
|
+
"Insurance fund state (mutated for total_accrued + event)."
|
|
62
|
+
],
|
|
60
63
|
"writable": true,
|
|
61
64
|
"pda": {
|
|
62
65
|
"seeds": [
|
|
@@ -84,14 +87,24 @@
|
|
|
84
87
|
},
|
|
85
88
|
{
|
|
86
89
|
"name": "pool_state",
|
|
90
|
+
"docs": [
|
|
91
|
+
"Pool state for the market being liquidated. We mutate `total_usdc` to",
|
|
92
|
+
"reflect that 25 bps was never LP-owned."
|
|
93
|
+
],
|
|
87
94
|
"writable": true
|
|
88
95
|
},
|
|
89
96
|
{
|
|
90
97
|
"name": "pool_vault_usdc",
|
|
98
|
+
"docs": [
|
|
99
|
+
"Source: pool's USDC vault. Must match `pool_state`'s vault."
|
|
100
|
+
],
|
|
91
101
|
"writable": true
|
|
92
102
|
},
|
|
93
103
|
{
|
|
94
104
|
"name": "insurance_vault",
|
|
105
|
+
"docs": [
|
|
106
|
+
"Destination: insurance fund's USDC vault."
|
|
107
|
+
],
|
|
95
108
|
"writable": true
|
|
96
109
|
},
|
|
97
110
|
{
|
|
@@ -99,6 +112,9 @@
|
|
|
99
112
|
},
|
|
100
113
|
{
|
|
101
114
|
"name": "engine_auth",
|
|
115
|
+
"docs": [
|
|
116
|
+
"Key equality with pool_state.engine_auth enforced in handler."
|
|
117
|
+
],
|
|
102
118
|
"signer": true
|
|
103
119
|
},
|
|
104
120
|
{
|
|
@@ -188,6 +204,9 @@
|
|
|
188
204
|
},
|
|
189
205
|
{
|
|
190
206
|
"name": "trader",
|
|
207
|
+
"docs": [
|
|
208
|
+
"Trader wallet — payer for rent on first init, and owner of the claims account."
|
|
209
|
+
],
|
|
191
210
|
"writable": true,
|
|
192
211
|
"signer": true
|
|
193
212
|
},
|
|
@@ -216,6 +235,210 @@
|
|
|
216
235
|
}
|
|
217
236
|
]
|
|
218
237
|
},
|
|
238
|
+
{
|
|
239
|
+
"name": "apply_queue_haircut",
|
|
240
|
+
"docs": [
|
|
241
|
+
"ADL Tier B — permissionless queue-IOU haircut. Walks the contiguous aged",
|
|
242
|
+
"Pending prefix from queue_head_idx and socializes the unbacked tail",
|
|
243
|
+
"pro-rata, re-deriving the whole trigger live from on-chain bytes. The",
|
|
244
|
+
"handler is the sole gate. Step 3, 2026-06-05."
|
|
245
|
+
],
|
|
246
|
+
"discriminator": [
|
|
247
|
+
60,
|
|
248
|
+
181,
|
|
249
|
+
236,
|
|
250
|
+
16,
|
|
251
|
+
168,
|
|
252
|
+
31,
|
|
253
|
+
41,
|
|
254
|
+
40
|
|
255
|
+
],
|
|
256
|
+
"accounts": [
|
|
257
|
+
{
|
|
258
|
+
"name": "pool_state",
|
|
259
|
+
"writable": true,
|
|
260
|
+
"pda": {
|
|
261
|
+
"seeds": [
|
|
262
|
+
{
|
|
263
|
+
"kind": "const",
|
|
264
|
+
"value": [
|
|
265
|
+
112,
|
|
266
|
+
111,
|
|
267
|
+
111,
|
|
268
|
+
108
|
|
269
|
+
]
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"kind": "account",
|
|
273
|
+
"path": "pool_state.market_id",
|
|
274
|
+
"account": "PoolState"
|
|
275
|
+
}
|
|
276
|
+
]
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"name": "market_state",
|
|
281
|
+
"docs": [
|
|
282
|
+
"are validated in-handler before any byte is trusted."
|
|
283
|
+
]
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"name": "protocol_config",
|
|
287
|
+
"docs": [
|
|
288
|
+
"`[b\"protocol_config\"]` PDA derivation are validated in-handler."
|
|
289
|
+
]
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"name": "caller",
|
|
293
|
+
"docs": [
|
|
294
|
+
"Permissionless caller — keeps the keeper-down / backup-operator story."
|
|
295
|
+
],
|
|
296
|
+
"signer": true
|
|
297
|
+
}
|
|
298
|
+
],
|
|
299
|
+
"args": [
|
|
300
|
+
{
|
|
301
|
+
"name": "max_entries",
|
|
302
|
+
"type": "u8"
|
|
303
|
+
}
|
|
304
|
+
]
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"name": "apply_retroactive_funding",
|
|
308
|
+
"docs": [
|
|
309
|
+
"Admin-only retroactive funding correction (2026-06-09). Debits one",
|
|
310
|
+
"Pending queue IOU by the funding it dodged while adaptive funding was",
|
|
311
|
+
"structurally off (launch → 2026-06-09). Gated on `pool_state.admin`."
|
|
312
|
+
],
|
|
313
|
+
"discriminator": [
|
|
314
|
+
122,
|
|
315
|
+
5,
|
|
316
|
+
179,
|
|
317
|
+
204,
|
|
318
|
+
24,
|
|
319
|
+
119,
|
|
320
|
+
127,
|
|
321
|
+
240
|
|
322
|
+
],
|
|
323
|
+
"accounts": [
|
|
324
|
+
{
|
|
325
|
+
"name": "pool_state",
|
|
326
|
+
"writable": true,
|
|
327
|
+
"pda": {
|
|
328
|
+
"seeds": [
|
|
329
|
+
{
|
|
330
|
+
"kind": "const",
|
|
331
|
+
"value": [
|
|
332
|
+
112,
|
|
333
|
+
111,
|
|
334
|
+
111,
|
|
335
|
+
108
|
|
336
|
+
]
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"kind": "account",
|
|
340
|
+
"path": "pool_state.market_id",
|
|
341
|
+
"account": "PoolState"
|
|
342
|
+
}
|
|
343
|
+
]
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"name": "entry",
|
|
348
|
+
"writable": true,
|
|
349
|
+
"pda": {
|
|
350
|
+
"seeds": [
|
|
351
|
+
{
|
|
352
|
+
"kind": "const",
|
|
353
|
+
"value": [
|
|
354
|
+
112,
|
|
355
|
+
97,
|
|
356
|
+
121,
|
|
357
|
+
111,
|
|
358
|
+
117,
|
|
359
|
+
116,
|
|
360
|
+
95,
|
|
361
|
+
113,
|
|
362
|
+
117,
|
|
363
|
+
101,
|
|
364
|
+
117,
|
|
365
|
+
101,
|
|
366
|
+
95,
|
|
367
|
+
101,
|
|
368
|
+
110,
|
|
369
|
+
116,
|
|
370
|
+
114,
|
|
371
|
+
121
|
|
372
|
+
]
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
"kind": "account",
|
|
376
|
+
"path": "pool_state.market_id",
|
|
377
|
+
"account": "PoolState"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"kind": "account",
|
|
381
|
+
"path": "entry.idx",
|
|
382
|
+
"account": "PayoutQueueEntry"
|
|
383
|
+
}
|
|
384
|
+
]
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"name": "user_claims",
|
|
389
|
+
"writable": true,
|
|
390
|
+
"pda": {
|
|
391
|
+
"seeds": [
|
|
392
|
+
{
|
|
393
|
+
"kind": "const",
|
|
394
|
+
"value": [
|
|
395
|
+
117,
|
|
396
|
+
115,
|
|
397
|
+
101,
|
|
398
|
+
114,
|
|
399
|
+
95,
|
|
400
|
+
113,
|
|
401
|
+
117,
|
|
402
|
+
101,
|
|
403
|
+
117,
|
|
404
|
+
101,
|
|
405
|
+
95,
|
|
406
|
+
99,
|
|
407
|
+
108,
|
|
408
|
+
97,
|
|
409
|
+
105,
|
|
410
|
+
109,
|
|
411
|
+
115
|
|
412
|
+
]
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"kind": "account",
|
|
416
|
+
"path": "pool_state.market_id",
|
|
417
|
+
"account": "PoolState"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
"kind": "account",
|
|
421
|
+
"path": "entry.owner",
|
|
422
|
+
"account": "PayoutQueueEntry"
|
|
423
|
+
}
|
|
424
|
+
]
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
"name": "admin",
|
|
429
|
+
"signer": true,
|
|
430
|
+
"relations": [
|
|
431
|
+
"pool_state"
|
|
432
|
+
]
|
|
433
|
+
}
|
|
434
|
+
],
|
|
435
|
+
"args": [
|
|
436
|
+
{
|
|
437
|
+
"name": "funding_debit",
|
|
438
|
+
"type": "u64"
|
|
439
|
+
}
|
|
440
|
+
]
|
|
441
|
+
},
|
|
219
442
|
{
|
|
220
443
|
"name": "credit_collateral",
|
|
221
444
|
"discriminator": [
|
|
@@ -281,13 +504,22 @@
|
|
|
281
504
|
"name": "user_usdc",
|
|
282
505
|
"writable": true
|
|
283
506
|
},
|
|
507
|
+
{
|
|
508
|
+
"name": "lp_dead",
|
|
509
|
+
"writable": true
|
|
510
|
+
},
|
|
284
511
|
{
|
|
285
512
|
"name": "depositor",
|
|
513
|
+
"writable": true,
|
|
286
514
|
"signer": true
|
|
287
515
|
},
|
|
288
516
|
{
|
|
289
517
|
"name": "token_program",
|
|
290
518
|
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
"name": "system_program",
|
|
522
|
+
"address": "11111111111111111111111111111111"
|
|
291
523
|
}
|
|
292
524
|
],
|
|
293
525
|
"args": [
|
|
@@ -499,6 +731,9 @@
|
|
|
499
731
|
},
|
|
500
732
|
{
|
|
501
733
|
"name": "caller",
|
|
734
|
+
"docs": [
|
|
735
|
+
"Caller receives rent refunds when entry PDAs are closed."
|
|
736
|
+
],
|
|
502
737
|
"writable": true,
|
|
503
738
|
"signer": true
|
|
504
739
|
},
|
|
@@ -509,6 +744,81 @@
|
|
|
509
744
|
{
|
|
510
745
|
"name": "system_program",
|
|
511
746
|
"address": "11111111111111111111111111111111"
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
"name": "insurance_fund",
|
|
750
|
+
"writable": true,
|
|
751
|
+
"optional": true,
|
|
752
|
+
"pda": {
|
|
753
|
+
"seeds": [
|
|
754
|
+
{
|
|
755
|
+
"kind": "const",
|
|
756
|
+
"value": [
|
|
757
|
+
105,
|
|
758
|
+
110,
|
|
759
|
+
115,
|
|
760
|
+
117,
|
|
761
|
+
114,
|
|
762
|
+
97,
|
|
763
|
+
110,
|
|
764
|
+
99,
|
|
765
|
+
101,
|
|
766
|
+
95,
|
|
767
|
+
102,
|
|
768
|
+
117,
|
|
769
|
+
110,
|
|
770
|
+
100
|
|
771
|
+
]
|
|
772
|
+
}
|
|
773
|
+
]
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
"name": "insurance_vault",
|
|
778
|
+
"docs": [
|
|
779
|
+
"insurance_vault.key() == insurance_fund.usdc_vault is verified in the handler",
|
|
780
|
+
"(Anchor `address =` against an Option account is brittle)."
|
|
781
|
+
],
|
|
782
|
+
"writable": true,
|
|
783
|
+
"optional": true
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
"name": "insurance_vault_authority",
|
|
787
|
+
"optional": true,
|
|
788
|
+
"pda": {
|
|
789
|
+
"seeds": [
|
|
790
|
+
{
|
|
791
|
+
"kind": "const",
|
|
792
|
+
"value": [
|
|
793
|
+
105,
|
|
794
|
+
110,
|
|
795
|
+
115,
|
|
796
|
+
117,
|
|
797
|
+
114,
|
|
798
|
+
97,
|
|
799
|
+
110,
|
|
800
|
+
99,
|
|
801
|
+
101,
|
|
802
|
+
95,
|
|
803
|
+
118,
|
|
804
|
+
97,
|
|
805
|
+
117,
|
|
806
|
+
108,
|
|
807
|
+
116,
|
|
808
|
+
95,
|
|
809
|
+
97,
|
|
810
|
+
117,
|
|
811
|
+
116,
|
|
812
|
+
104,
|
|
813
|
+
111,
|
|
814
|
+
114,
|
|
815
|
+
105,
|
|
816
|
+
116,
|
|
817
|
+
121
|
|
818
|
+
]
|
|
819
|
+
}
|
|
820
|
+
]
|
|
821
|
+
}
|
|
512
822
|
}
|
|
513
823
|
],
|
|
514
824
|
"args": [
|
|
@@ -658,6 +968,9 @@
|
|
|
658
968
|
},
|
|
659
969
|
{
|
|
660
970
|
"name": "vault_authority",
|
|
971
|
+
"docs": [
|
|
972
|
+
"Never holds data; only signs SPL transfers for the vault via PDA seeds."
|
|
973
|
+
],
|
|
661
974
|
"pda": {
|
|
662
975
|
"seeds": [
|
|
663
976
|
{
|
|
@@ -864,8 +1177,76 @@
|
|
|
864
1177
|
}
|
|
865
1178
|
]
|
|
866
1179
|
},
|
|
1180
|
+
{
|
|
1181
|
+
"name": "migrate_pool_state_v2",
|
|
1182
|
+
"docs": [
|
|
1183
|
+
"PoolState V1 (240) → V2 (252): appends the ADL idempotency state",
|
|
1184
|
+
"(current_adl_epoch, last_adl_cut_idx). The FIRST-EVER pool realloc.",
|
|
1185
|
+
"Step 3, 2026-06-05."
|
|
1186
|
+
],
|
|
1187
|
+
"discriminator": [
|
|
1188
|
+
254,
|
|
1189
|
+
70,
|
|
1190
|
+
145,
|
|
1191
|
+
57,
|
|
1192
|
+
158,
|
|
1193
|
+
248,
|
|
1194
|
+
76,
|
|
1195
|
+
50
|
|
1196
|
+
],
|
|
1197
|
+
"accounts": [
|
|
1198
|
+
{
|
|
1199
|
+
"name": "pool_state",
|
|
1200
|
+
"docs": [
|
|
1201
|
+
"admin is validated from the raw buffer in the handler."
|
|
1202
|
+
],
|
|
1203
|
+
"writable": true,
|
|
1204
|
+
"pda": {
|
|
1205
|
+
"seeds": [
|
|
1206
|
+
{
|
|
1207
|
+
"kind": "const",
|
|
1208
|
+
"value": [
|
|
1209
|
+
112,
|
|
1210
|
+
111,
|
|
1211
|
+
111,
|
|
1212
|
+
108
|
|
1213
|
+
]
|
|
1214
|
+
},
|
|
1215
|
+
{
|
|
1216
|
+
"kind": "arg",
|
|
1217
|
+
"path": "market_id"
|
|
1218
|
+
}
|
|
1219
|
+
]
|
|
1220
|
+
}
|
|
1221
|
+
},
|
|
1222
|
+
{
|
|
1223
|
+
"name": "admin",
|
|
1224
|
+
"writable": true,
|
|
1225
|
+
"signer": true
|
|
1226
|
+
},
|
|
1227
|
+
{
|
|
1228
|
+
"name": "system_program",
|
|
1229
|
+
"address": "11111111111111111111111111111111"
|
|
1230
|
+
}
|
|
1231
|
+
],
|
|
1232
|
+
"args": [
|
|
1233
|
+
{
|
|
1234
|
+
"name": "market_id",
|
|
1235
|
+
"type": {
|
|
1236
|
+
"array": [
|
|
1237
|
+
"u8",
|
|
1238
|
+
32
|
|
1239
|
+
]
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
]
|
|
1243
|
+
},
|
|
867
1244
|
{
|
|
868
1245
|
"name": "reimburse_liquidator",
|
|
1246
|
+
"docs": [
|
|
1247
|
+
"Followup #44 — liquidator-reward fallback. CPI-only; signer is",
|
|
1248
|
+
"perp-engine `engine_auth`. See `reimburse_liquidator.rs`."
|
|
1249
|
+
],
|
|
869
1250
|
"discriminator": [
|
|
870
1251
|
253,
|
|
871
1252
|
77,
|
|
@@ -879,6 +1260,9 @@
|
|
|
879
1260
|
"accounts": [
|
|
880
1261
|
{
|
|
881
1262
|
"name": "insurance_fund",
|
|
1263
|
+
"docs": [
|
|
1264
|
+
"Insurance fund state (mutated for counter + event)."
|
|
1265
|
+
],
|
|
882
1266
|
"writable": true,
|
|
883
1267
|
"pda": {
|
|
884
1268
|
"seeds": [
|
|
@@ -906,10 +1290,16 @@
|
|
|
906
1290
|
},
|
|
907
1291
|
{
|
|
908
1292
|
"name": "insurance_vault",
|
|
1293
|
+
"docs": [
|
|
1294
|
+
"Source: insurance fund's USDC vault."
|
|
1295
|
+
],
|
|
909
1296
|
"writable": true
|
|
910
1297
|
},
|
|
911
1298
|
{
|
|
912
1299
|
"name": "insurance_vault_authority",
|
|
1300
|
+
"docs": [
|
|
1301
|
+
"Validated via seed-bind; mirrors `reimburse_pool_from_fund`."
|
|
1302
|
+
],
|
|
913
1303
|
"pda": {
|
|
914
1304
|
"seeds": [
|
|
915
1305
|
{
|
|
@@ -947,13 +1337,24 @@
|
|
|
947
1337
|
},
|
|
948
1338
|
{
|
|
949
1339
|
"name": "liquidator_ata",
|
|
1340
|
+
"docs": [
|
|
1341
|
+
"Destination: liquidator's USDC ATA."
|
|
1342
|
+
],
|
|
950
1343
|
"writable": true
|
|
951
1344
|
},
|
|
952
1345
|
{
|
|
953
|
-
"name": "pool_state"
|
|
1346
|
+
"name": "pool_state",
|
|
1347
|
+
"docs": [
|
|
1348
|
+
"Read-only — anchors `engine_auth.key() == pool_state.engine_auth`.",
|
|
1349
|
+
"Perp-engine's liquidate handler already passes `pool_state` (it's",
|
|
1350
|
+
"the market's pool), so threading it here is free."
|
|
1351
|
+
]
|
|
954
1352
|
},
|
|
955
1353
|
{
|
|
956
1354
|
"name": "engine_auth",
|
|
1355
|
+
"docs": [
|
|
1356
|
+
"Key equality with `pool_state.engine_auth` enforced in handler."
|
|
1357
|
+
],
|
|
957
1358
|
"signer": true
|
|
958
1359
|
},
|
|
959
1360
|
{
|
|
@@ -1010,6 +1411,11 @@
|
|
|
1010
1411
|
},
|
|
1011
1412
|
{
|
|
1012
1413
|
"name": "pool_state",
|
|
1414
|
+
"docs": [
|
|
1415
|
+
"Pool to reimburse. No seed constraint — admin can pick any pool to",
|
|
1416
|
+
"restore after a bad-debt event. `address = pool_state.usdc_vault` on",
|
|
1417
|
+
"`pool_vault_usdc` below pins source-of-truth wiring."
|
|
1418
|
+
],
|
|
1013
1419
|
"writable": true
|
|
1014
1420
|
},
|
|
1015
1421
|
{
|
|
@@ -1076,6 +1482,60 @@
|
|
|
1076
1482
|
}
|
|
1077
1483
|
]
|
|
1078
1484
|
},
|
|
1485
|
+
{
|
|
1486
|
+
"name": "sweep_stranded_to_insurance",
|
|
1487
|
+
"discriminator": [
|
|
1488
|
+
222,
|
|
1489
|
+
173,
|
|
1490
|
+
220,
|
|
1491
|
+
245,
|
|
1492
|
+
212,
|
|
1493
|
+
29,
|
|
1494
|
+
17,
|
|
1495
|
+
226
|
|
1496
|
+
],
|
|
1497
|
+
"accounts": [
|
|
1498
|
+
{
|
|
1499
|
+
"name": "pool_state",
|
|
1500
|
+
"writable": true
|
|
1501
|
+
},
|
|
1502
|
+
{
|
|
1503
|
+
"name": "pool_vault_usdc",
|
|
1504
|
+
"writable": true
|
|
1505
|
+
},
|
|
1506
|
+
{
|
|
1507
|
+
"name": "vault_authority"
|
|
1508
|
+
},
|
|
1509
|
+
{
|
|
1510
|
+
"name": "lp_mint"
|
|
1511
|
+
},
|
|
1512
|
+
{
|
|
1513
|
+
"name": "insurance_fund",
|
|
1514
|
+
"writable": true
|
|
1515
|
+
},
|
|
1516
|
+
{
|
|
1517
|
+
"name": "insurance_vault",
|
|
1518
|
+
"writable": true
|
|
1519
|
+
},
|
|
1520
|
+
{
|
|
1521
|
+
"name": "admin",
|
|
1522
|
+
"signer": true,
|
|
1523
|
+
"relations": [
|
|
1524
|
+
"pool_state"
|
|
1525
|
+
]
|
|
1526
|
+
},
|
|
1527
|
+
{
|
|
1528
|
+
"name": "token_program",
|
|
1529
|
+
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
1530
|
+
}
|
|
1531
|
+
],
|
|
1532
|
+
"args": [
|
|
1533
|
+
{
|
|
1534
|
+
"name": "amount",
|
|
1535
|
+
"type": "u64"
|
|
1536
|
+
}
|
|
1537
|
+
]
|
|
1538
|
+
},
|
|
1079
1539
|
{
|
|
1080
1540
|
"name": "release_and_enqueue",
|
|
1081
1541
|
"discriminator": [
|
|
@@ -1094,10 +1554,20 @@
|
|
|
1094
1554
|
"writable": true
|
|
1095
1555
|
},
|
|
1096
1556
|
{
|
|
1097
|
-
"name": "trader"
|
|
1557
|
+
"name": "trader",
|
|
1558
|
+
"docs": [
|
|
1559
|
+
"The user/trader being settled. Used as a seed for user_claims and stored",
|
|
1560
|
+
"in queue_entry.owner / user_claims.owner. Does NOT need to sign — the",
|
|
1561
|
+
"rent_payer signs and pays. Verified by perp-engine to be the position owner."
|
|
1562
|
+
]
|
|
1098
1563
|
},
|
|
1099
1564
|
{
|
|
1100
1565
|
"name": "rent_payer",
|
|
1566
|
+
"docs": [
|
|
1567
|
+
"The lamports source for the new PDAs. For user-driven closes (close_position),",
|
|
1568
|
+
"callers pass the trader's account here. For keeper-driven decreases",
|
|
1569
|
+
"(execute_decrease), callers pass the keeper's account here."
|
|
1570
|
+
],
|
|
1101
1571
|
"writable": true,
|
|
1102
1572
|
"signer": true
|
|
1103
1573
|
},
|
|
@@ -1107,6 +1577,9 @@
|
|
|
1107
1577
|
},
|
|
1108
1578
|
{
|
|
1109
1579
|
"name": "queue_entry",
|
|
1580
|
+
"docs": [
|
|
1581
|
+
"New queue entry PDA. Index = pool_state.queue_tail_idx at time of call."
|
|
1582
|
+
],
|
|
1110
1583
|
"writable": true,
|
|
1111
1584
|
"pda": {
|
|
1112
1585
|
"seeds": [
|
|
@@ -1148,6 +1621,10 @@
|
|
|
1148
1621
|
},
|
|
1149
1622
|
{
|
|
1150
1623
|
"name": "user_claims",
|
|
1624
|
+
"docs": [
|
|
1625
|
+
"User's queue claims tracking account. init_if_needed: first enqueue for",
|
|
1626
|
+
"this user creates the account; subsequent enqueues just update unpaid_owed."
|
|
1627
|
+
],
|
|
1151
1628
|
"writable": true,
|
|
1152
1629
|
"pda": {
|
|
1153
1630
|
"seeds": [
|
|
@@ -1192,6 +1669,17 @@
|
|
|
1192
1669
|
{
|
|
1193
1670
|
"name": "system_program",
|
|
1194
1671
|
"address": "11111111111111111111111111111111"
|
|
1672
|
+
},
|
|
1673
|
+
{
|
|
1674
|
+
"name": "usdc_vault",
|
|
1675
|
+
"writable": true
|
|
1676
|
+
},
|
|
1677
|
+
{
|
|
1678
|
+
"name": "vault_authority"
|
|
1679
|
+
},
|
|
1680
|
+
{
|
|
1681
|
+
"name": "user_usdc",
|
|
1682
|
+
"writable": true
|
|
1195
1683
|
}
|
|
1196
1684
|
],
|
|
1197
1685
|
"args": [
|
|
@@ -1200,7 +1688,11 @@
|
|
|
1200
1688
|
"type": "u64"
|
|
1201
1689
|
},
|
|
1202
1690
|
{
|
|
1203
|
-
"name": "
|
|
1691
|
+
"name": "direct_payout",
|
|
1692
|
+
"type": "u64"
|
|
1693
|
+
},
|
|
1694
|
+
{
|
|
1695
|
+
"name": "enqueue_amount",
|
|
1204
1696
|
"type": "u64"
|
|
1205
1697
|
}
|
|
1206
1698
|
]
|
|
@@ -1346,12 +1838,74 @@
|
|
|
1346
1838
|
],
|
|
1347
1839
|
"args": [
|
|
1348
1840
|
{
|
|
1349
|
-
"name": "collateral_release",
|
|
1350
|
-
"type": "u64"
|
|
1351
|
-
},
|
|
1352
|
-
{
|
|
1353
|
-
"name": "phantom_credit",
|
|
1354
|
-
"type": "u64"
|
|
1841
|
+
"name": "collateral_release",
|
|
1842
|
+
"type": "u64"
|
|
1843
|
+
},
|
|
1844
|
+
{
|
|
1845
|
+
"name": "phantom_credit",
|
|
1846
|
+
"type": "u64"
|
|
1847
|
+
}
|
|
1848
|
+
]
|
|
1849
|
+
},
|
|
1850
|
+
{
|
|
1851
|
+
"name": "set_insurance_auto_payouts",
|
|
1852
|
+
"docs": [
|
|
1853
|
+
"Admin kill switch: when `frozen`, disables the two AUTOMATIC insurance",
|
|
1854
|
+
"debits — `reimburse_liquidator` (#44) no-ops and `harvest`'s #129",
|
|
1855
|
+
"queued-winner fallback declines to draw from the fund. The MANUAL levers",
|
|
1856
|
+
"(`reimburse_pool_from_fund`, `withdraw_insurance`) are unaffected, so the",
|
|
1857
|
+
"fund becomes an emergency-only reserve. Reversible in one tx."
|
|
1858
|
+
],
|
|
1859
|
+
"discriminator": [
|
|
1860
|
+
117,
|
|
1861
|
+
181,
|
|
1862
|
+
125,
|
|
1863
|
+
174,
|
|
1864
|
+
207,
|
|
1865
|
+
84,
|
|
1866
|
+
119,
|
|
1867
|
+
133
|
|
1868
|
+
],
|
|
1869
|
+
"accounts": [
|
|
1870
|
+
{
|
|
1871
|
+
"name": "insurance_fund",
|
|
1872
|
+
"writable": true,
|
|
1873
|
+
"pda": {
|
|
1874
|
+
"seeds": [
|
|
1875
|
+
{
|
|
1876
|
+
"kind": "const",
|
|
1877
|
+
"value": [
|
|
1878
|
+
105,
|
|
1879
|
+
110,
|
|
1880
|
+
115,
|
|
1881
|
+
117,
|
|
1882
|
+
114,
|
|
1883
|
+
97,
|
|
1884
|
+
110,
|
|
1885
|
+
99,
|
|
1886
|
+
101,
|
|
1887
|
+
95,
|
|
1888
|
+
102,
|
|
1889
|
+
117,
|
|
1890
|
+
110,
|
|
1891
|
+
100
|
|
1892
|
+
]
|
|
1893
|
+
}
|
|
1894
|
+
]
|
|
1895
|
+
}
|
|
1896
|
+
},
|
|
1897
|
+
{
|
|
1898
|
+
"name": "admin",
|
|
1899
|
+
"signer": true,
|
|
1900
|
+
"relations": [
|
|
1901
|
+
"insurance_fund"
|
|
1902
|
+
]
|
|
1903
|
+
}
|
|
1904
|
+
],
|
|
1905
|
+
"args": [
|
|
1906
|
+
{
|
|
1907
|
+
"name": "frozen",
|
|
1908
|
+
"type": "bool"
|
|
1355
1909
|
}
|
|
1356
1910
|
]
|
|
1357
1911
|
},
|
|
@@ -1885,6 +2439,32 @@
|
|
|
1885
2439
|
}
|
|
1886
2440
|
],
|
|
1887
2441
|
"events": [
|
|
2442
|
+
{
|
|
2443
|
+
"name": "AdlHaircutApplied",
|
|
2444
|
+
"discriminator": [
|
|
2445
|
+
45,
|
|
2446
|
+
183,
|
|
2447
|
+
107,
|
|
2448
|
+
249,
|
|
2449
|
+
160,
|
|
2450
|
+
213,
|
|
2451
|
+
154,
|
|
2452
|
+
255
|
|
2453
|
+
]
|
|
2454
|
+
},
|
|
2455
|
+
{
|
|
2456
|
+
"name": "AdlTailUnclearable",
|
|
2457
|
+
"discriminator": [
|
|
2458
|
+
192,
|
|
2459
|
+
236,
|
|
2460
|
+
249,
|
|
2461
|
+
237,
|
|
2462
|
+
3,
|
|
2463
|
+
27,
|
|
2464
|
+
201,
|
|
2465
|
+
205
|
|
2466
|
+
]
|
|
2467
|
+
},
|
|
1888
2468
|
{
|
|
1889
2469
|
"name": "CollateralCredited",
|
|
1890
2470
|
"discriminator": [
|
|
@@ -1976,6 +2556,19 @@
|
|
|
1976
2556
|
215
|
|
1977
2557
|
]
|
|
1978
2558
|
},
|
|
2559
|
+
{
|
|
2560
|
+
"name": "InsuranceAutoPayoutsSet",
|
|
2561
|
+
"discriminator": [
|
|
2562
|
+
48,
|
|
2563
|
+
182,
|
|
2564
|
+
26,
|
|
2565
|
+
194,
|
|
2566
|
+
149,
|
|
2567
|
+
152,
|
|
2568
|
+
81,
|
|
2569
|
+
62
|
|
2570
|
+
]
|
|
2571
|
+
},
|
|
1979
2572
|
{
|
|
1980
2573
|
"name": "InsuranceReimbursed",
|
|
1981
2574
|
"discriminator": [
|
|
@@ -2015,6 +2608,19 @@
|
|
|
2015
2608
|
156
|
|
2016
2609
|
]
|
|
2017
2610
|
},
|
|
2611
|
+
{
|
|
2612
|
+
"name": "MarginReturned",
|
|
2613
|
+
"discriminator": [
|
|
2614
|
+
133,
|
|
2615
|
+
233,
|
|
2616
|
+
166,
|
|
2617
|
+
9,
|
|
2618
|
+
235,
|
|
2619
|
+
18,
|
|
2620
|
+
193,
|
|
2621
|
+
184
|
|
2622
|
+
]
|
|
2623
|
+
},
|
|
2018
2624
|
{
|
|
2019
2625
|
"name": "PhantomCreditDrained",
|
|
2020
2626
|
"discriminator": [
|
|
@@ -2054,6 +2660,19 @@
|
|
|
2054
2660
|
232
|
|
2055
2661
|
]
|
|
2056
2662
|
},
|
|
2663
|
+
{
|
|
2664
|
+
"name": "RetroactiveFundingApplied",
|
|
2665
|
+
"discriminator": [
|
|
2666
|
+
29,
|
|
2667
|
+
154,
|
|
2668
|
+
201,
|
|
2669
|
+
249,
|
|
2670
|
+
129,
|
|
2671
|
+
10,
|
|
2672
|
+
17,
|
|
2673
|
+
25
|
|
2674
|
+
]
|
|
2675
|
+
},
|
|
2057
2676
|
{
|
|
2058
2677
|
"name": "Settled",
|
|
2059
2678
|
"discriminator": [
|
|
@@ -2080,6 +2699,19 @@
|
|
|
2080
2699
|
164
|
|
2081
2700
|
]
|
|
2082
2701
|
},
|
|
2702
|
+
{
|
|
2703
|
+
"name": "StrandedLpGainSweptToInsurance",
|
|
2704
|
+
"discriminator": [
|
|
2705
|
+
66,
|
|
2706
|
+
145,
|
|
2707
|
+
181,
|
|
2708
|
+
189,
|
|
2709
|
+
9,
|
|
2710
|
+
212,
|
|
2711
|
+
139,
|
|
2712
|
+
165
|
|
2713
|
+
]
|
|
2714
|
+
},
|
|
2083
2715
|
{
|
|
2084
2716
|
"name": "Withdrawn",
|
|
2085
2717
|
"discriminator": [
|
|
@@ -2224,9 +2856,131 @@
|
|
|
2224
2856
|
"code": 6025,
|
|
2225
2857
|
"name": "WrongMint",
|
|
2226
2858
|
"msg": "Destination mint does not match source mint"
|
|
2859
|
+
},
|
|
2860
|
+
{
|
|
2861
|
+
"code": 6026,
|
|
2862
|
+
"name": "AdlDisarmed",
|
|
2863
|
+
"msg": "ADL is disarmed for this market (adl_frozen set)"
|
|
2864
|
+
},
|
|
2865
|
+
{
|
|
2866
|
+
"code": 6027,
|
|
2867
|
+
"name": "AdlNotArmed",
|
|
2868
|
+
"msg": "ADL trigger not armed: deficit below floor, head fundable, or head not aged"
|
|
2869
|
+
},
|
|
2870
|
+
{
|
|
2871
|
+
"code": 6028,
|
|
2872
|
+
"name": "WrongMarketState",
|
|
2873
|
+
"msg": "MarketState account does not match this pool's market/engine"
|
|
2874
|
+
},
|
|
2875
|
+
{
|
|
2876
|
+
"code": 6029,
|
|
2877
|
+
"name": "WrongProtocolConfig",
|
|
2878
|
+
"msg": "ProtocolConfig account does not match this pool's engine"
|
|
2879
|
+
},
|
|
2880
|
+
{
|
|
2881
|
+
"code": 6030,
|
|
2882
|
+
"name": "NothingToDebit",
|
|
2883
|
+
"msg": "Retroactive funding debit resolves to zero (entry already at/below target)"
|
|
2884
|
+
},
|
|
2885
|
+
{
|
|
2886
|
+
"code": 6031,
|
|
2887
|
+
"name": "StrandedPoolBalance",
|
|
2888
|
+
"msg": "Pool holds a stranded balance with zero LP supply; sweep to insurance before the first deposit"
|
|
2889
|
+
},
|
|
2890
|
+
{
|
|
2891
|
+
"code": 6032,
|
|
2892
|
+
"name": "PoolHasLpSupply",
|
|
2893
|
+
"msg": "Sweep refused: pool has outstanding LP shares (total_usdc is LP-owned)"
|
|
2227
2894
|
}
|
|
2228
2895
|
],
|
|
2229
2896
|
"types": [
|
|
2897
|
+
{
|
|
2898
|
+
"name": "AdlHaircutApplied",
|
|
2899
|
+
"docs": [
|
|
2900
|
+
"Emitted by `apply_queue_haircut` (Tier B) when a queue-IOU haircut is applied.",
|
|
2901
|
+
"`total_cut` is removed from `queue_total_owed` (and the corresponding entries'",
|
|
2902
|
+
"`amount` + owners' `unpaid_owed`), socializing the unbacked tail pro-rata."
|
|
2903
|
+
],
|
|
2904
|
+
"type": {
|
|
2905
|
+
"kind": "struct",
|
|
2906
|
+
"fields": [
|
|
2907
|
+
{
|
|
2908
|
+
"name": "market_id",
|
|
2909
|
+
"type": {
|
|
2910
|
+
"array": [
|
|
2911
|
+
"u8",
|
|
2912
|
+
32
|
|
2913
|
+
]
|
|
2914
|
+
}
|
|
2915
|
+
},
|
|
2916
|
+
{
|
|
2917
|
+
"name": "epoch",
|
|
2918
|
+
"type": "u32"
|
|
2919
|
+
},
|
|
2920
|
+
{
|
|
2921
|
+
"name": "entries_cut",
|
|
2922
|
+
"type": "u32"
|
|
2923
|
+
},
|
|
2924
|
+
{
|
|
2925
|
+
"name": "total_cut",
|
|
2926
|
+
"type": "u64"
|
|
2927
|
+
},
|
|
2928
|
+
{
|
|
2929
|
+
"name": "deficit_before",
|
|
2930
|
+
"type": "u64"
|
|
2931
|
+
},
|
|
2932
|
+
{
|
|
2933
|
+
"name": "deficit_after",
|
|
2934
|
+
"type": "u64"
|
|
2935
|
+
},
|
|
2936
|
+
{
|
|
2937
|
+
"name": "queue_total_owed_after",
|
|
2938
|
+
"type": "u64"
|
|
2939
|
+
}
|
|
2940
|
+
]
|
|
2941
|
+
}
|
|
2942
|
+
},
|
|
2943
|
+
{
|
|
2944
|
+
"name": "AdlTailUnclearable",
|
|
2945
|
+
"docs": [
|
|
2946
|
+
"Emitted by `apply_queue_haircut` when ADL was armed but could clear nothing",
|
|
2947
|
+
"(the worst queue: every claim already drew its collateral, so `cut ≈ 0`) and",
|
|
2948
|
+
"the deficit still exceeds the trigger floor. The terminal signal: the keeper",
|
|
2949
|
+
"safety path alerts and the operator escalates by reusing PR #122",
|
|
2950
|
+
"`set_trading_halt(ReduceOnly)` (or per-market `set_market_paused`). ADL never",
|
|
2951
|
+
"auto-halts. See spec §4.8."
|
|
2952
|
+
],
|
|
2953
|
+
"type": {
|
|
2954
|
+
"kind": "struct",
|
|
2955
|
+
"fields": [
|
|
2956
|
+
{
|
|
2957
|
+
"name": "market_id",
|
|
2958
|
+
"type": {
|
|
2959
|
+
"array": [
|
|
2960
|
+
"u8",
|
|
2961
|
+
32
|
|
2962
|
+
]
|
|
2963
|
+
}
|
|
2964
|
+
},
|
|
2965
|
+
{
|
|
2966
|
+
"name": "epoch",
|
|
2967
|
+
"type": "u32"
|
|
2968
|
+
},
|
|
2969
|
+
{
|
|
2970
|
+
"name": "deficit",
|
|
2971
|
+
"type": "u64"
|
|
2972
|
+
},
|
|
2973
|
+
{
|
|
2974
|
+
"name": "queue_total_owed",
|
|
2975
|
+
"type": "u64"
|
|
2976
|
+
},
|
|
2977
|
+
{
|
|
2978
|
+
"name": "side_bucket",
|
|
2979
|
+
"type": "u64"
|
|
2980
|
+
}
|
|
2981
|
+
]
|
|
2982
|
+
}
|
|
2983
|
+
},
|
|
2230
2984
|
{
|
|
2231
2985
|
"name": "CollateralCredited",
|
|
2232
2986
|
"type": {
|
|
@@ -2450,6 +3204,10 @@
|
|
|
2450
3204
|
},
|
|
2451
3205
|
{
|
|
2452
3206
|
"name": "engine_auth",
|
|
3207
|
+
"docs": [
|
|
3208
|
+
"The engine_auth PDA from perp-engine: PDA([b\"engine_auth\", market_id], perp_engine_id).",
|
|
3209
|
+
"perp-engine computes this PDA, passes it here; pool stores it as the authorized caller."
|
|
3210
|
+
],
|
|
2453
3211
|
"type": "pubkey"
|
|
2454
3212
|
},
|
|
2455
3213
|
{
|
|
@@ -2496,45 +3254,125 @@
|
|
|
2496
3254
|
]
|
|
2497
3255
|
}
|
|
2498
3256
|
},
|
|
3257
|
+
{
|
|
3258
|
+
"name": "InsuranceAutoPayoutsSet",
|
|
3259
|
+
"docs": [
|
|
3260
|
+
"Emitted by `set_insurance_auto_payouts` when the admin toggles the automatic",
|
|
3261
|
+
"insurance-debit kill switch (`InsuranceFund.auto_payouts_frozen`).",
|
|
3262
|
+
"`frozen = true` disables #44 (liquidator reimburse) + #129 (queued-winner",
|
|
3263
|
+
"harvest fallback); the manual admin levers are unaffected."
|
|
3264
|
+
],
|
|
3265
|
+
"type": {
|
|
3266
|
+
"kind": "struct",
|
|
3267
|
+
"fields": [
|
|
3268
|
+
{
|
|
3269
|
+
"name": "frozen",
|
|
3270
|
+
"type": "bool"
|
|
3271
|
+
}
|
|
3272
|
+
]
|
|
3273
|
+
}
|
|
3274
|
+
},
|
|
2499
3275
|
{
|
|
2500
3276
|
"name": "InsuranceFund",
|
|
3277
|
+
"docs": [
|
|
3278
|
+
"Cross-market USDC liquidation insurance fund.",
|
|
3279
|
+
"",
|
|
3280
|
+
"Singleton PDA at seeds `[b\"insurance_fund\"]`. Holds a separate USDC vault",
|
|
3281
|
+
"(`usdc_vault`, a PDA-owned token account at seeds `[b\"insurance_vault\"]`)",
|
|
3282
|
+
"authorized by a third PDA (`[b\"insurance_vault_authority\"]`).",
|
|
3283
|
+
"",
|
|
3284
|
+
"Accrues 25 bps of every liquidation (re-splits the existing 50 bps liq fee:",
|
|
3285
|
+
"25 bps liquidator + 25 bps insurance). Operator-triggered reimbursement via",
|
|
3286
|
+
"`reimburse_pool_from_fund` (WP-4) restores `pool.total_usdc` after bad-debt",
|
|
3287
|
+
"events. See docs/superpowers/specs/2026-05-20-liquidation-insurance-fund-design.md."
|
|
3288
|
+
],
|
|
2501
3289
|
"type": {
|
|
2502
3290
|
"kind": "struct",
|
|
2503
3291
|
"fields": [
|
|
2504
3292
|
{
|
|
2505
3293
|
"name": "usdc_vault",
|
|
3294
|
+
"docs": [
|
|
3295
|
+
"USDC token account owned by the vault authority PDA."
|
|
3296
|
+
],
|
|
2506
3297
|
"type": "pubkey"
|
|
2507
3298
|
},
|
|
2508
3299
|
{
|
|
2509
3300
|
"name": "vault_bump",
|
|
3301
|
+
"docs": [
|
|
3302
|
+
"Bump for the usdc_vault PDA (`[b\"insurance_vault\"]`)."
|
|
3303
|
+
],
|
|
2510
3304
|
"type": "u8"
|
|
2511
3305
|
},
|
|
2512
3306
|
{
|
|
2513
3307
|
"name": "admin",
|
|
3308
|
+
"docs": [
|
|
3309
|
+
"Admin authority for reimburse + withdraw operations."
|
|
3310
|
+
],
|
|
2514
3311
|
"type": "pubkey"
|
|
2515
3312
|
},
|
|
2516
3313
|
{
|
|
2517
3314
|
"name": "total_accrued",
|
|
3315
|
+
"docs": [
|
|
3316
|
+
"Lifetime monotonic accrual sum (observability only — does NOT cap accrual)."
|
|
3317
|
+
],
|
|
2518
3318
|
"type": "u64"
|
|
2519
3319
|
},
|
|
2520
3320
|
{
|
|
2521
3321
|
"name": "total_reimbursed",
|
|
3322
|
+
"docs": [
|
|
3323
|
+
"Lifetime monotonic reimbursement sum (operator pool-reimburse via",
|
|
3324
|
+
"`reimburse_pool_from_fund`) — observability only."
|
|
3325
|
+
],
|
|
2522
3326
|
"type": "u64"
|
|
2523
3327
|
},
|
|
2524
3328
|
{
|
|
2525
3329
|
"name": "bump",
|
|
3330
|
+
"docs": [
|
|
3331
|
+
"Bump for this InsuranceFund PDA (`[b\"insurance_fund\"]`)."
|
|
3332
|
+
],
|
|
2526
3333
|
"type": "u8"
|
|
2527
3334
|
},
|
|
2528
3335
|
{
|
|
2529
3336
|
"name": "total_reimbursed_liquidator",
|
|
3337
|
+
"docs": [
|
|
3338
|
+
"Lifetime monotonic counter for liquidator-reward fallbacks (#44).",
|
|
3339
|
+
"Incremented by `reimburse_liquidator` when perp-engine's liquidate",
|
|
3340
|
+
"detects that `release_and_settle`'s PayDirect under-paid the",
|
|
3341
|
+
"liquidator and the gap is sourced from the insurance fund.",
|
|
3342
|
+
"Carved from the prior 32-byte `_reserved` slot — existing V1 PDAs",
|
|
3343
|
+
"already have 8 zero bytes at this offset, so they decode as 0",
|
|
3344
|
+
"the moment the program is redeployed (no realloc, no migration)."
|
|
3345
|
+
],
|
|
2530
3346
|
"type": "u64"
|
|
2531
3347
|
},
|
|
3348
|
+
{
|
|
3349
|
+
"name": "auto_payouts_frozen",
|
|
3350
|
+
"docs": [
|
|
3351
|
+
"Kill switch for the two AUTOMATIC insurance debits. When non-zero:",
|
|
3352
|
+
"`reimburse_liquidator` (#44 liquidator-reward fallback) no-ops, and",
|
|
3353
|
+
"`harvest`'s #129 queued-winner fallback declines to draw from the fund",
|
|
3354
|
+
"(the winner stays queued until side_bucket / LP can cover it). The",
|
|
3355
|
+
"MANUAL admin levers (`reimburse_pool_from_fund`, `withdraw_insurance`)",
|
|
3356
|
+
"are intentionally NOT gated, so the fund stays usable as an emergency /",
|
|
3357
|
+
"discretionary reserve that pays no one automatically. Toggled by the",
|
|
3358
|
+
"admin via `set_insurance_auto_payouts` — reversible in one tx, no",
|
|
3359
|
+
"realloc. Carved from `_reserved`, so existing on-chain PDAs decode it as",
|
|
3360
|
+
"0 (= auto-payouts ENABLED, the pre-change behavior) on redeploy; turning",
|
|
3361
|
+
"it off is one admin tx after the upgrade."
|
|
3362
|
+
],
|
|
3363
|
+
"type": "u8"
|
|
3364
|
+
},
|
|
2532
3365
|
{
|
|
2533
3366
|
"name": "_reserved",
|
|
3367
|
+
"docs": [
|
|
3368
|
+
"Forward-compat slot for v1.2 cap + cooldown fields. Do not remove.",
|
|
3369
|
+
"Carved 32 → 24 → 23 bytes (the missing byte is `auto_payouts_frozen`",
|
|
3370
|
+
"above). `InsuranceFund::LEN` stays at 122 — wire-compatible with V1."
|
|
3371
|
+
],
|
|
2534
3372
|
"type": {
|
|
2535
3373
|
"array": [
|
|
2536
3374
|
"u8",
|
|
2537
|
-
|
|
3375
|
+
23
|
|
2538
3376
|
]
|
|
2539
3377
|
}
|
|
2540
3378
|
}
|
|
@@ -2563,6 +3401,16 @@
|
|
|
2563
3401
|
},
|
|
2564
3402
|
{
|
|
2565
3403
|
"name": "InsuranceReimbursedLiquidator",
|
|
3404
|
+
"docs": [
|
|
3405
|
+
"Followup #44 — liquidator-reward fallback path. Emitted by",
|
|
3406
|
+
"`reimburse_liquidator` when perp-engine's liquidate handler detects",
|
|
3407
|
+
"that `release_and_settle`'s saturating PayDirect under-paid the",
|
|
3408
|
+
"liquidator and sources the gap from the insurance fund.",
|
|
3409
|
+
"",
|
|
3410
|
+
"`amount` is the shortfall covered by the fund (NOT the spec'd full",
|
|
3411
|
+
"50-bps reward — that figure equals the prior `release_and_settle`",
|
|
3412
|
+
"PayDirect transfer + `amount`)."
|
|
3413
|
+
],
|
|
2566
3414
|
"type": {
|
|
2567
3415
|
"kind": "struct",
|
|
2568
3416
|
"fields": [
|
|
@@ -2597,6 +3445,37 @@
|
|
|
2597
3445
|
]
|
|
2598
3446
|
}
|
|
2599
3447
|
},
|
|
3448
|
+
{
|
|
3449
|
+
"name": "MarginReturned",
|
|
3450
|
+
"docs": [
|
|
3451
|
+
"Margin/profit split (2026-06-09). Emitted by `release_and_enqueue` when the",
|
|
3452
|
+
"trader's own wallet-funded margin is returned directly in the close tx while",
|
|
3453
|
+
"only the profit slice is enqueued. `amount` is the directly-paid margin (the",
|
|
3454
|
+
"enqueued profit is reported separately by the paired `Enqueued` event)."
|
|
3455
|
+
],
|
|
3456
|
+
"type": {
|
|
3457
|
+
"kind": "struct",
|
|
3458
|
+
"fields": [
|
|
3459
|
+
{
|
|
3460
|
+
"name": "market_id",
|
|
3461
|
+
"type": {
|
|
3462
|
+
"array": [
|
|
3463
|
+
"u8",
|
|
3464
|
+
32
|
|
3465
|
+
]
|
|
3466
|
+
}
|
|
3467
|
+
},
|
|
3468
|
+
{
|
|
3469
|
+
"name": "owner",
|
|
3470
|
+
"type": "pubkey"
|
|
3471
|
+
},
|
|
3472
|
+
{
|
|
3473
|
+
"name": "amount",
|
|
3474
|
+
"type": "u64"
|
|
3475
|
+
}
|
|
3476
|
+
]
|
|
3477
|
+
}
|
|
3478
|
+
},
|
|
2600
3479
|
{
|
|
2601
3480
|
"name": "PayoutQueueEntry",
|
|
2602
3481
|
"type": {
|
|
@@ -2703,6 +3582,10 @@
|
|
|
2703
3582
|
},
|
|
2704
3583
|
{
|
|
2705
3584
|
"name": "engine_auth",
|
|
3585
|
+
"docs": [
|
|
3586
|
+
"PDA from perp-engine authorized to call update_reserve and release_and_settle.",
|
|
3587
|
+
"Derived: PDA([b\"engine_auth\", market_id], perp_engine_program_id)"
|
|
3588
|
+
],
|
|
2706
3589
|
"type": "pubkey"
|
|
2707
3590
|
},
|
|
2708
3591
|
{
|
|
@@ -2748,6 +3631,14 @@
|
|
|
2748
3631
|
{
|
|
2749
3632
|
"name": "bump",
|
|
2750
3633
|
"type": "u8"
|
|
3634
|
+
},
|
|
3635
|
+
{
|
|
3636
|
+
"name": "current_adl_epoch",
|
|
3637
|
+
"type": "u32"
|
|
3638
|
+
},
|
|
3639
|
+
{
|
|
3640
|
+
"name": "last_adl_cut_idx",
|
|
3641
|
+
"type": "u64"
|
|
2751
3642
|
}
|
|
2752
3643
|
]
|
|
2753
3644
|
}
|
|
@@ -2794,6 +3685,50 @@
|
|
|
2794
3685
|
]
|
|
2795
3686
|
}
|
|
2796
3687
|
},
|
|
3688
|
+
{
|
|
3689
|
+
"name": "RetroactiveFundingApplied",
|
|
3690
|
+
"docs": [
|
|
3691
|
+
"Retroactive funding correction (2026-06-09). Emitted by",
|
|
3692
|
+
"`apply_retroactive_funding` when the admin debits a Pending queue IOU by the",
|
|
3693
|
+
"funding it dodged while adaptive funding was structurally off (launch →",
|
|
3694
|
+
"2026-06-09). `debit` is removed from the entry `amount`, the owner's",
|
|
3695
|
+
"`unpaid_owed`, and `queue_total_owed`. Audit-trail event for the correction."
|
|
3696
|
+
],
|
|
3697
|
+
"type": {
|
|
3698
|
+
"kind": "struct",
|
|
3699
|
+
"fields": [
|
|
3700
|
+
{
|
|
3701
|
+
"name": "idx",
|
|
3702
|
+
"type": "u64"
|
|
3703
|
+
},
|
|
3704
|
+
{
|
|
3705
|
+
"name": "owner",
|
|
3706
|
+
"type": "pubkey"
|
|
3707
|
+
},
|
|
3708
|
+
{
|
|
3709
|
+
"name": "market_id",
|
|
3710
|
+
"type": {
|
|
3711
|
+
"array": [
|
|
3712
|
+
"u8",
|
|
3713
|
+
32
|
|
3714
|
+
]
|
|
3715
|
+
}
|
|
3716
|
+
},
|
|
3717
|
+
{
|
|
3718
|
+
"name": "debit",
|
|
3719
|
+
"type": "u64"
|
|
3720
|
+
},
|
|
3721
|
+
{
|
|
3722
|
+
"name": "entry_amount_after",
|
|
3723
|
+
"type": "u64"
|
|
3724
|
+
},
|
|
3725
|
+
{
|
|
3726
|
+
"name": "queue_total_owed_after",
|
|
3727
|
+
"type": "u64"
|
|
3728
|
+
}
|
|
3729
|
+
]
|
|
3730
|
+
}
|
|
3731
|
+
},
|
|
2797
3732
|
{
|
|
2798
3733
|
"name": "Settled",
|
|
2799
3734
|
"type": {
|
|
@@ -2844,6 +3779,42 @@
|
|
|
2844
3779
|
]
|
|
2845
3780
|
}
|
|
2846
3781
|
},
|
|
3782
|
+
{
|
|
3783
|
+
"name": "StrandedLpGainSweptToInsurance",
|
|
3784
|
+
"docs": [
|
|
3785
|
+
"Followup #123 — emitted when `release_and_settle` detects `lp_mint.supply == 0`",
|
|
3786
|
+
"for the Treasury LP-route and sweeps the lp_gain to the insurance vault instead",
|
|
3787
|
+
"of letting it strand in `pool.total_usdc` (where it would be claimable by the",
|
|
3788
|
+
"first depositor as the deposit-withdraw recovery cycle exploits).",
|
|
3789
|
+
"",
|
|
3790
|
+
"Fires only when the caller passed the optional insurance accounts via",
|
|
3791
|
+
"`remaining_accounts`. Old callers (perp-engine pre-#123) won't trigger this",
|
|
3792
|
+
"event and the stranding will still occur — until perp-engine is upgraded",
|
|
3793
|
+
"to forward the accounts."
|
|
3794
|
+
],
|
|
3795
|
+
"type": {
|
|
3796
|
+
"kind": "struct",
|
|
3797
|
+
"fields": [
|
|
3798
|
+
{
|
|
3799
|
+
"name": "market_id",
|
|
3800
|
+
"type": {
|
|
3801
|
+
"array": [
|
|
3802
|
+
"u8",
|
|
3803
|
+
32
|
|
3804
|
+
]
|
|
3805
|
+
}
|
|
3806
|
+
},
|
|
3807
|
+
{
|
|
3808
|
+
"name": "amount",
|
|
3809
|
+
"type": "u64"
|
|
3810
|
+
},
|
|
3811
|
+
{
|
|
3812
|
+
"name": "total_accrued",
|
|
3813
|
+
"type": "u64"
|
|
3814
|
+
}
|
|
3815
|
+
]
|
|
3816
|
+
}
|
|
3817
|
+
},
|
|
2847
3818
|
{
|
|
2848
3819
|
"name": "UpdateFeeSettingsArgs",
|
|
2849
3820
|
"type": {
|
|
@@ -2953,4 +3924,4 @@
|
|
|
2953
3924
|
}
|
|
2954
3925
|
}
|
|
2955
3926
|
]
|
|
2956
|
-
}
|
|
3927
|
+
}
|