@d8x/perpetuals-sdk 0.0.1

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