@drift-labs/sdk 0.2.0-master.8 → 0.2.0-temp.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.
- package/lib/admin.d.ts +3 -3
- package/lib/admin.js +6 -6
- package/lib/clearingHouse.d.ts +15 -4
- package/lib/clearingHouse.js +200 -37
- package/lib/clearingHouseUser.d.ts +2 -2
- package/lib/clearingHouseUser.js +8 -17
- package/lib/config.js +1 -1
- package/lib/constants/banks.js +2 -3
- package/lib/constants/numericConstants.d.ts +1 -0
- package/lib/constants/numericConstants.js +2 -1
- package/lib/idl/clearing_house.json +484 -103
- package/lib/idl/{mock_usdc_faucet.json → token_faucet.json} +46 -23
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/orders.js +1 -1
- package/lib/{mockUSDCFaucet.d.ts → tokenFaucet.d.ts} +7 -5
- package/lib/{mockUSDCFaucet.js → tokenFaucet.js} +41 -40
- package/lib/types.d.ts +62 -13
- package/lib/types.js +12 -1
- package/lib/util/computeUnits.js +1 -1
- package/package.json +1 -1
- package/src/admin.js +517 -0
- package/src/admin.ts +7 -7
- package/src/clearingHouse.ts +335 -47
- package/src/clearingHouseConfig.js +2 -0
- package/src/clearingHouseUser.ts +12 -23
- package/src/clearingHouseUserConfig.js +2 -0
- package/src/config.js +67 -0
- package/src/config.ts +1 -1
- package/src/constants/banks.js +42 -0
- package/src/constants/banks.ts +2 -3
- package/src/constants/markets.js +42 -0
- package/src/constants/numericConstants.js +41 -0
- package/src/constants/numericConstants.ts +1 -0
- package/src/factory/bigNum.js +37 -11
- package/src/idl/clearing_house.json +484 -103
- package/src/idl/{mock_usdc_faucet.json → token_faucet.json} +46 -23
- package/src/index.js +1 -1
- package/src/index.ts +1 -1
- package/src/mockUSDCFaucet.js +276 -167
- package/src/orders.ts +2 -1
- package/src/tokenFaucet.js +189 -0
- package/src/{mockUSDCFaucet.ts → tokenFaucet.ts} +48 -59
- package/src/types.js +12 -1
- package/src/types.ts +63 -13
- package/src/{accounts/fetch.js → util/computeUnits.js} +11 -13
- package/src/util/computeUnits.ts +1 -1
- package/src/util/getTokenAddress.js +9 -0
- package/src/addresses/pda.js +0 -104
- package/src/math/bankBalance.js +0 -75
- package/src/math/market.js +0 -57
- package/src/math/orders.js +0 -110
- package/src/math/position.js +0 -140
- package/src/orders.js +0 -134
- package/src/tx/retryTxSender.js +0 -188
|
@@ -145,6 +145,10 @@
|
|
|
145
145
|
{
|
|
146
146
|
"name": "imfFactor",
|
|
147
147
|
"type": "u128"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "liquidationFee",
|
|
151
|
+
"type": "u128"
|
|
148
152
|
}
|
|
149
153
|
]
|
|
150
154
|
},
|
|
@@ -210,12 +214,12 @@
|
|
|
210
214
|
"type": "u32"
|
|
211
215
|
},
|
|
212
216
|
{
|
|
213
|
-
"name": "
|
|
217
|
+
"name": "marginRatioMaintenance",
|
|
214
218
|
"type": "u32"
|
|
215
219
|
},
|
|
216
220
|
{
|
|
217
|
-
"name": "
|
|
218
|
-
"type": "
|
|
221
|
+
"name": "liquidationFee",
|
|
222
|
+
"type": "u128"
|
|
219
223
|
}
|
|
220
224
|
]
|
|
221
225
|
},
|
|
@@ -644,7 +648,7 @@
|
|
|
644
648
|
]
|
|
645
649
|
},
|
|
646
650
|
{
|
|
647
|
-
"name": "
|
|
651
|
+
"name": "liquidatePerp",
|
|
648
652
|
"accounts": [
|
|
649
653
|
{
|
|
650
654
|
"name": "state",
|
|
@@ -665,29 +669,135 @@
|
|
|
665
669
|
"name": "user",
|
|
666
670
|
"isMut": true,
|
|
667
671
|
"isSigner": false
|
|
672
|
+
}
|
|
673
|
+
],
|
|
674
|
+
"args": [
|
|
675
|
+
{
|
|
676
|
+
"name": "marketIndex",
|
|
677
|
+
"type": "u64"
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
"name": "liquidatorMaxBaseAssetAmount",
|
|
681
|
+
"type": "u128"
|
|
682
|
+
}
|
|
683
|
+
]
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
"name": "liquidateBorrow",
|
|
687
|
+
"accounts": [
|
|
688
|
+
{
|
|
689
|
+
"name": "state",
|
|
690
|
+
"isMut": false,
|
|
691
|
+
"isSigner": false
|
|
668
692
|
},
|
|
669
693
|
{
|
|
670
|
-
"name": "
|
|
694
|
+
"name": "authority",
|
|
695
|
+
"isMut": false,
|
|
696
|
+
"isSigner": true
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
"name": "liquidator",
|
|
671
700
|
"isMut": true,
|
|
672
701
|
"isSigner": false
|
|
673
702
|
},
|
|
674
703
|
{
|
|
675
|
-
"name": "
|
|
704
|
+
"name": "user",
|
|
676
705
|
"isMut": true,
|
|
677
706
|
"isSigner": false
|
|
707
|
+
}
|
|
708
|
+
],
|
|
709
|
+
"args": [
|
|
710
|
+
{
|
|
711
|
+
"name": "assetBankIndex",
|
|
712
|
+
"type": "u64"
|
|
678
713
|
},
|
|
679
714
|
{
|
|
680
|
-
"name": "
|
|
715
|
+
"name": "liabilityBankIndex",
|
|
716
|
+
"type": "u64"
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
"name": "liquidatorMaxLiabilityTransfer",
|
|
720
|
+
"type": "u128"
|
|
721
|
+
}
|
|
722
|
+
]
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"name": "liquidateBorrowForPerpPnl",
|
|
726
|
+
"accounts": [
|
|
727
|
+
{
|
|
728
|
+
"name": "state",
|
|
729
|
+
"isMut": false,
|
|
730
|
+
"isSigner": false
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
"name": "authority",
|
|
734
|
+
"isMut": false,
|
|
735
|
+
"isSigner": true
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
"name": "liquidator",
|
|
681
739
|
"isMut": true,
|
|
682
740
|
"isSigner": false
|
|
683
741
|
},
|
|
684
742
|
{
|
|
685
|
-
"name": "
|
|
743
|
+
"name": "user",
|
|
744
|
+
"isMut": true,
|
|
745
|
+
"isSigner": false
|
|
746
|
+
}
|
|
747
|
+
],
|
|
748
|
+
"args": [
|
|
749
|
+
{
|
|
750
|
+
"name": "perpMarketIndex",
|
|
751
|
+
"type": "u64"
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
"name": "liabilityBankIndex",
|
|
755
|
+
"type": "u64"
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
"name": "liquidatorMaxLiabilityTransfer",
|
|
759
|
+
"type": "u128"
|
|
760
|
+
}
|
|
761
|
+
]
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
"name": "liquidatePerpPnlForDeposit",
|
|
765
|
+
"accounts": [
|
|
766
|
+
{
|
|
767
|
+
"name": "state",
|
|
686
768
|
"isMut": false,
|
|
687
769
|
"isSigner": false
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
"name": "authority",
|
|
773
|
+
"isMut": false,
|
|
774
|
+
"isSigner": true
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
"name": "liquidator",
|
|
778
|
+
"isMut": true,
|
|
779
|
+
"isSigner": false
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
"name": "user",
|
|
783
|
+
"isMut": true,
|
|
784
|
+
"isSigner": false
|
|
688
785
|
}
|
|
689
786
|
],
|
|
690
|
-
"args": [
|
|
787
|
+
"args": [
|
|
788
|
+
{
|
|
789
|
+
"name": "perpMarketIndex",
|
|
790
|
+
"type": "u64"
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
"name": "assetBankIndex",
|
|
794
|
+
"type": "u64"
|
|
795
|
+
},
|
|
796
|
+
{
|
|
797
|
+
"name": "liquidatorMaxPnlTransfer",
|
|
798
|
+
"type": "u128"
|
|
799
|
+
}
|
|
800
|
+
]
|
|
691
801
|
},
|
|
692
802
|
{
|
|
693
803
|
"name": "moveAmmPrice",
|
|
@@ -1093,12 +1203,60 @@
|
|
|
1093
1203
|
"type": "u32"
|
|
1094
1204
|
},
|
|
1095
1205
|
{
|
|
1096
|
-
"name": "
|
|
1206
|
+
"name": "marginRatioMaintenance",
|
|
1097
1207
|
"type": "u32"
|
|
1208
|
+
}
|
|
1209
|
+
]
|
|
1210
|
+
},
|
|
1211
|
+
{
|
|
1212
|
+
"name": "updatePerpLiquidationFee",
|
|
1213
|
+
"accounts": [
|
|
1214
|
+
{
|
|
1215
|
+
"name": "admin",
|
|
1216
|
+
"isMut": false,
|
|
1217
|
+
"isSigner": true
|
|
1098
1218
|
},
|
|
1099
1219
|
{
|
|
1100
|
-
"name": "
|
|
1101
|
-
"
|
|
1220
|
+
"name": "state",
|
|
1221
|
+
"isMut": false,
|
|
1222
|
+
"isSigner": false
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
"name": "market",
|
|
1226
|
+
"isMut": true,
|
|
1227
|
+
"isSigner": false
|
|
1228
|
+
}
|
|
1229
|
+
],
|
|
1230
|
+
"args": [
|
|
1231
|
+
{
|
|
1232
|
+
"name": "liquidationFee",
|
|
1233
|
+
"type": "u128"
|
|
1234
|
+
}
|
|
1235
|
+
]
|
|
1236
|
+
},
|
|
1237
|
+
{
|
|
1238
|
+
"name": "updateBankLiquidationFee",
|
|
1239
|
+
"accounts": [
|
|
1240
|
+
{
|
|
1241
|
+
"name": "admin",
|
|
1242
|
+
"isMut": false,
|
|
1243
|
+
"isSigner": true
|
|
1244
|
+
},
|
|
1245
|
+
{
|
|
1246
|
+
"name": "state",
|
|
1247
|
+
"isMut": false,
|
|
1248
|
+
"isSigner": false
|
|
1249
|
+
},
|
|
1250
|
+
{
|
|
1251
|
+
"name": "bank",
|
|
1252
|
+
"isMut": true,
|
|
1253
|
+
"isSigner": false
|
|
1254
|
+
}
|
|
1255
|
+
],
|
|
1256
|
+
"args": [
|
|
1257
|
+
{
|
|
1258
|
+
"name": "liquidationFee",
|
|
1259
|
+
"type": "u128"
|
|
1102
1260
|
}
|
|
1103
1261
|
]
|
|
1104
1262
|
},
|
|
@@ -1800,6 +1958,10 @@
|
|
|
1800
1958
|
{
|
|
1801
1959
|
"name": "imfFactor",
|
|
1802
1960
|
"type": "u128"
|
|
1961
|
+
},
|
|
1962
|
+
{
|
|
1963
|
+
"name": "liquidationFee",
|
|
1964
|
+
"type": "u128"
|
|
1803
1965
|
}
|
|
1804
1966
|
]
|
|
1805
1967
|
}
|
|
@@ -1843,10 +2005,6 @@
|
|
|
1843
2005
|
"name": "marginRatioInitial",
|
|
1844
2006
|
"type": "u32"
|
|
1845
2007
|
},
|
|
1846
|
-
{
|
|
1847
|
-
"name": "marginRatioPartial",
|
|
1848
|
-
"type": "u32"
|
|
1849
|
-
},
|
|
1850
2008
|
{
|
|
1851
2009
|
"name": "marginRatioMaintenance",
|
|
1852
2010
|
"type": "u32"
|
|
@@ -1893,6 +2051,10 @@
|
|
|
1893
2051
|
"name": "unsettledImfFactor",
|
|
1894
2052
|
"type": "u128"
|
|
1895
2053
|
},
|
|
2054
|
+
{
|
|
2055
|
+
"name": "liquidationFee",
|
|
2056
|
+
"type": "u128"
|
|
2057
|
+
},
|
|
1896
2058
|
{
|
|
1897
2059
|
"name": "padding0",
|
|
1898
2060
|
"type": "u32"
|
|
@@ -2033,6 +2195,10 @@
|
|
|
2033
2195
|
"name": "maxAuctionDuration",
|
|
2034
2196
|
"type": "u8"
|
|
2035
2197
|
},
|
|
2198
|
+
{
|
|
2199
|
+
"name": "liquidationMarginBufferRatio",
|
|
2200
|
+
"type": "u8"
|
|
2201
|
+
},
|
|
2036
2202
|
{
|
|
2037
2203
|
"name": "padding0",
|
|
2038
2204
|
"type": "u128"
|
|
@@ -2108,6 +2274,10 @@
|
|
|
2108
2274
|
32
|
|
2109
2275
|
]
|
|
2110
2276
|
}
|
|
2277
|
+
},
|
|
2278
|
+
{
|
|
2279
|
+
"name": "beingLiquidated",
|
|
2280
|
+
"type": "bool"
|
|
2111
2281
|
}
|
|
2112
2282
|
]
|
|
2113
2283
|
}
|
|
@@ -2214,6 +2384,156 @@
|
|
|
2214
2384
|
]
|
|
2215
2385
|
}
|
|
2216
2386
|
},
|
|
2387
|
+
{
|
|
2388
|
+
"name": "LiquidatePerpRecord",
|
|
2389
|
+
"type": {
|
|
2390
|
+
"kind": "struct",
|
|
2391
|
+
"fields": [
|
|
2392
|
+
{
|
|
2393
|
+
"name": "marketIndex",
|
|
2394
|
+
"type": "u64"
|
|
2395
|
+
},
|
|
2396
|
+
{
|
|
2397
|
+
"name": "orderIds",
|
|
2398
|
+
"type": {
|
|
2399
|
+
"vec": "u64"
|
|
2400
|
+
}
|
|
2401
|
+
},
|
|
2402
|
+
{
|
|
2403
|
+
"name": "canceledOrdersFee",
|
|
2404
|
+
"type": "u128"
|
|
2405
|
+
},
|
|
2406
|
+
{
|
|
2407
|
+
"name": "oraclePrice",
|
|
2408
|
+
"type": "i128"
|
|
2409
|
+
},
|
|
2410
|
+
{
|
|
2411
|
+
"name": "baseAssetAmount",
|
|
2412
|
+
"type": "i128"
|
|
2413
|
+
},
|
|
2414
|
+
{
|
|
2415
|
+
"name": "quoteAssetAmount",
|
|
2416
|
+
"type": "u128"
|
|
2417
|
+
},
|
|
2418
|
+
{
|
|
2419
|
+
"name": "userPnl",
|
|
2420
|
+
"type": "i128"
|
|
2421
|
+
},
|
|
2422
|
+
{
|
|
2423
|
+
"name": "liquidatorPnl",
|
|
2424
|
+
"type": "i128"
|
|
2425
|
+
},
|
|
2426
|
+
{
|
|
2427
|
+
"name": "fillRecordId",
|
|
2428
|
+
"type": "u64"
|
|
2429
|
+
},
|
|
2430
|
+
{
|
|
2431
|
+
"name": "userOrderId",
|
|
2432
|
+
"type": "u64"
|
|
2433
|
+
},
|
|
2434
|
+
{
|
|
2435
|
+
"name": "liquidatorOrderId",
|
|
2436
|
+
"type": "u64"
|
|
2437
|
+
}
|
|
2438
|
+
]
|
|
2439
|
+
}
|
|
2440
|
+
},
|
|
2441
|
+
{
|
|
2442
|
+
"name": "LiquidateBorrowRecord",
|
|
2443
|
+
"type": {
|
|
2444
|
+
"kind": "struct",
|
|
2445
|
+
"fields": [
|
|
2446
|
+
{
|
|
2447
|
+
"name": "assetBankIndex",
|
|
2448
|
+
"type": "u64"
|
|
2449
|
+
},
|
|
2450
|
+
{
|
|
2451
|
+
"name": "assetPrice",
|
|
2452
|
+
"type": "i128"
|
|
2453
|
+
},
|
|
2454
|
+
{
|
|
2455
|
+
"name": "assetTransfer",
|
|
2456
|
+
"type": "u128"
|
|
2457
|
+
},
|
|
2458
|
+
{
|
|
2459
|
+
"name": "liabilityBankIndex",
|
|
2460
|
+
"type": "u64"
|
|
2461
|
+
},
|
|
2462
|
+
{
|
|
2463
|
+
"name": "liabilityPrice",
|
|
2464
|
+
"type": "i128"
|
|
2465
|
+
},
|
|
2466
|
+
{
|
|
2467
|
+
"name": "liabilityTransfer",
|
|
2468
|
+
"type": "u128"
|
|
2469
|
+
}
|
|
2470
|
+
]
|
|
2471
|
+
}
|
|
2472
|
+
},
|
|
2473
|
+
{
|
|
2474
|
+
"name": "LiquidateBorrowForPerpPnlRecord",
|
|
2475
|
+
"type": {
|
|
2476
|
+
"kind": "struct",
|
|
2477
|
+
"fields": [
|
|
2478
|
+
{
|
|
2479
|
+
"name": "marketIndex",
|
|
2480
|
+
"type": "u64"
|
|
2481
|
+
},
|
|
2482
|
+
{
|
|
2483
|
+
"name": "marketOraclePrice",
|
|
2484
|
+
"type": "i128"
|
|
2485
|
+
},
|
|
2486
|
+
{
|
|
2487
|
+
"name": "pnlTransfer",
|
|
2488
|
+
"type": "u128"
|
|
2489
|
+
},
|
|
2490
|
+
{
|
|
2491
|
+
"name": "liabilityBankIndex",
|
|
2492
|
+
"type": "u64"
|
|
2493
|
+
},
|
|
2494
|
+
{
|
|
2495
|
+
"name": "liabilityPrice",
|
|
2496
|
+
"type": "i128"
|
|
2497
|
+
},
|
|
2498
|
+
{
|
|
2499
|
+
"name": "liabilityTransfer",
|
|
2500
|
+
"type": "u128"
|
|
2501
|
+
}
|
|
2502
|
+
]
|
|
2503
|
+
}
|
|
2504
|
+
},
|
|
2505
|
+
{
|
|
2506
|
+
"name": "LiquidatePerpPnlForDepositRecord",
|
|
2507
|
+
"type": {
|
|
2508
|
+
"kind": "struct",
|
|
2509
|
+
"fields": [
|
|
2510
|
+
{
|
|
2511
|
+
"name": "marketIndex",
|
|
2512
|
+
"type": "u64"
|
|
2513
|
+
},
|
|
2514
|
+
{
|
|
2515
|
+
"name": "marketOraclePrice",
|
|
2516
|
+
"type": "i128"
|
|
2517
|
+
},
|
|
2518
|
+
{
|
|
2519
|
+
"name": "pnlTransfer",
|
|
2520
|
+
"type": "u128"
|
|
2521
|
+
},
|
|
2522
|
+
{
|
|
2523
|
+
"name": "assetBankIndex",
|
|
2524
|
+
"type": "u64"
|
|
2525
|
+
},
|
|
2526
|
+
{
|
|
2527
|
+
"name": "assetPrice",
|
|
2528
|
+
"type": "i128"
|
|
2529
|
+
},
|
|
2530
|
+
{
|
|
2531
|
+
"name": "assetTransfer",
|
|
2532
|
+
"type": "u128"
|
|
2533
|
+
}
|
|
2534
|
+
]
|
|
2535
|
+
}
|
|
2536
|
+
},
|
|
2217
2537
|
{
|
|
2218
2538
|
"name": "PoolBalance",
|
|
2219
2539
|
"type": {
|
|
@@ -2572,6 +2892,10 @@
|
|
|
2572
2892
|
"type": {
|
|
2573
2893
|
"defined": "OrderFillerRewardStructure"
|
|
2574
2894
|
}
|
|
2895
|
+
},
|
|
2896
|
+
{
|
|
2897
|
+
"name": "cancelOrderFee",
|
|
2898
|
+
"type": "u128"
|
|
2575
2899
|
}
|
|
2576
2900
|
]
|
|
2577
2901
|
}
|
|
@@ -2956,35 +3280,29 @@
|
|
|
2956
3280
|
}
|
|
2957
3281
|
},
|
|
2958
3282
|
{
|
|
2959
|
-
"name": "
|
|
3283
|
+
"name": "LiquidationMultiplierType",
|
|
2960
3284
|
"type": {
|
|
2961
3285
|
"kind": "enum",
|
|
2962
3286
|
"variants": [
|
|
2963
3287
|
{
|
|
2964
|
-
"name": "
|
|
2965
|
-
},
|
|
2966
|
-
{
|
|
2967
|
-
"name": "Partial"
|
|
3288
|
+
"name": "Discount"
|
|
2968
3289
|
},
|
|
2969
3290
|
{
|
|
2970
|
-
"name": "
|
|
3291
|
+
"name": "Premium"
|
|
2971
3292
|
}
|
|
2972
3293
|
]
|
|
2973
3294
|
}
|
|
2974
3295
|
},
|
|
2975
3296
|
{
|
|
2976
|
-
"name": "
|
|
3297
|
+
"name": "MarginRequirementType",
|
|
2977
3298
|
"type": {
|
|
2978
3299
|
"kind": "enum",
|
|
2979
3300
|
"variants": [
|
|
2980
3301
|
{
|
|
2981
|
-
"name": "
|
|
2982
|
-
},
|
|
2983
|
-
{
|
|
2984
|
-
"name": "PARTIAL"
|
|
3302
|
+
"name": "Initial"
|
|
2985
3303
|
},
|
|
2986
3304
|
{
|
|
2987
|
-
"name": "
|
|
3305
|
+
"name": "Maintenance"
|
|
2988
3306
|
}
|
|
2989
3307
|
]
|
|
2990
3308
|
}
|
|
@@ -3059,6 +3377,29 @@
|
|
|
3059
3377
|
},
|
|
3060
3378
|
{
|
|
3061
3379
|
"name": "MarketOrderAuctionExpired"
|
|
3380
|
+
},
|
|
3381
|
+
{
|
|
3382
|
+
"name": "CanceledForLiquidation"
|
|
3383
|
+
}
|
|
3384
|
+
]
|
|
3385
|
+
}
|
|
3386
|
+
},
|
|
3387
|
+
{
|
|
3388
|
+
"name": "LiquidationType",
|
|
3389
|
+
"type": {
|
|
3390
|
+
"kind": "enum",
|
|
3391
|
+
"variants": [
|
|
3392
|
+
{
|
|
3393
|
+
"name": "LiquidatePerp"
|
|
3394
|
+
},
|
|
3395
|
+
{
|
|
3396
|
+
"name": "LiquidateBorrow"
|
|
3397
|
+
},
|
|
3398
|
+
{
|
|
3399
|
+
"name": "LiquidateBorrowForPerpPnl"
|
|
3400
|
+
},
|
|
3401
|
+
{
|
|
3402
|
+
"name": "LiquidatePerpPnlForDeposit"
|
|
3062
3403
|
}
|
|
3063
3404
|
]
|
|
3064
3405
|
}
|
|
@@ -3434,81 +3775,6 @@
|
|
|
3434
3775
|
}
|
|
3435
3776
|
]
|
|
3436
3777
|
},
|
|
3437
|
-
{
|
|
3438
|
-
"name": "LiquidationRecord",
|
|
3439
|
-
"fields": [
|
|
3440
|
-
{
|
|
3441
|
-
"name": "ts",
|
|
3442
|
-
"type": "i64",
|
|
3443
|
-
"index": false
|
|
3444
|
-
},
|
|
3445
|
-
{
|
|
3446
|
-
"name": "userAuthority",
|
|
3447
|
-
"type": "publicKey",
|
|
3448
|
-
"index": false
|
|
3449
|
-
},
|
|
3450
|
-
{
|
|
3451
|
-
"name": "user",
|
|
3452
|
-
"type": "publicKey",
|
|
3453
|
-
"index": false
|
|
3454
|
-
},
|
|
3455
|
-
{
|
|
3456
|
-
"name": "partial",
|
|
3457
|
-
"type": "bool",
|
|
3458
|
-
"index": false
|
|
3459
|
-
},
|
|
3460
|
-
{
|
|
3461
|
-
"name": "baseAssetValue",
|
|
3462
|
-
"type": "u128",
|
|
3463
|
-
"index": false
|
|
3464
|
-
},
|
|
3465
|
-
{
|
|
3466
|
-
"name": "baseAssetValueClosed",
|
|
3467
|
-
"type": "u128",
|
|
3468
|
-
"index": false
|
|
3469
|
-
},
|
|
3470
|
-
{
|
|
3471
|
-
"name": "liquidationFee",
|
|
3472
|
-
"type": "u128",
|
|
3473
|
-
"index": false
|
|
3474
|
-
},
|
|
3475
|
-
{
|
|
3476
|
-
"name": "feeToLiquidator",
|
|
3477
|
-
"type": "u64",
|
|
3478
|
-
"index": false
|
|
3479
|
-
},
|
|
3480
|
-
{
|
|
3481
|
-
"name": "feeToInsuranceFund",
|
|
3482
|
-
"type": "u64",
|
|
3483
|
-
"index": false
|
|
3484
|
-
},
|
|
3485
|
-
{
|
|
3486
|
-
"name": "liquidator",
|
|
3487
|
-
"type": "publicKey",
|
|
3488
|
-
"index": false
|
|
3489
|
-
},
|
|
3490
|
-
{
|
|
3491
|
-
"name": "totalCollateral",
|
|
3492
|
-
"type": "u128",
|
|
3493
|
-
"index": false
|
|
3494
|
-
},
|
|
3495
|
-
{
|
|
3496
|
-
"name": "collateral",
|
|
3497
|
-
"type": "u128",
|
|
3498
|
-
"index": false
|
|
3499
|
-
},
|
|
3500
|
-
{
|
|
3501
|
-
"name": "unrealizedPnl",
|
|
3502
|
-
"type": "i128",
|
|
3503
|
-
"index": false
|
|
3504
|
-
},
|
|
3505
|
-
{
|
|
3506
|
-
"name": "marginRatio",
|
|
3507
|
-
"type": "u128",
|
|
3508
|
-
"index": false
|
|
3509
|
-
}
|
|
3510
|
-
]
|
|
3511
|
-
},
|
|
3512
3778
|
{
|
|
3513
3779
|
"name": "OrderRecord",
|
|
3514
3780
|
"fields": [
|
|
@@ -3621,6 +3887,71 @@
|
|
|
3621
3887
|
"index": false
|
|
3622
3888
|
}
|
|
3623
3889
|
]
|
|
3890
|
+
},
|
|
3891
|
+
{
|
|
3892
|
+
"name": "LiquidationRecord",
|
|
3893
|
+
"fields": [
|
|
3894
|
+
{
|
|
3895
|
+
"name": "ts",
|
|
3896
|
+
"type": "i64",
|
|
3897
|
+
"index": false
|
|
3898
|
+
},
|
|
3899
|
+
{
|
|
3900
|
+
"name": "liquidationType",
|
|
3901
|
+
"type": {
|
|
3902
|
+
"defined": "LiquidationType"
|
|
3903
|
+
},
|
|
3904
|
+
"index": false
|
|
3905
|
+
},
|
|
3906
|
+
{
|
|
3907
|
+
"name": "user",
|
|
3908
|
+
"type": "publicKey",
|
|
3909
|
+
"index": false
|
|
3910
|
+
},
|
|
3911
|
+
{
|
|
3912
|
+
"name": "liquidator",
|
|
3913
|
+
"type": "publicKey",
|
|
3914
|
+
"index": false
|
|
3915
|
+
},
|
|
3916
|
+
{
|
|
3917
|
+
"name": "marginRequirement",
|
|
3918
|
+
"type": "u128",
|
|
3919
|
+
"index": false
|
|
3920
|
+
},
|
|
3921
|
+
{
|
|
3922
|
+
"name": "totalCollateral",
|
|
3923
|
+
"type": "i128",
|
|
3924
|
+
"index": false
|
|
3925
|
+
},
|
|
3926
|
+
{
|
|
3927
|
+
"name": "liquidatePerp",
|
|
3928
|
+
"type": {
|
|
3929
|
+
"defined": "LiquidatePerpRecord"
|
|
3930
|
+
},
|
|
3931
|
+
"index": false
|
|
3932
|
+
},
|
|
3933
|
+
{
|
|
3934
|
+
"name": "liquidateBorrow",
|
|
3935
|
+
"type": {
|
|
3936
|
+
"defined": "LiquidateBorrowRecord"
|
|
3937
|
+
},
|
|
3938
|
+
"index": false
|
|
3939
|
+
},
|
|
3940
|
+
{
|
|
3941
|
+
"name": "liquidateBorrowForPerpPnl",
|
|
3942
|
+
"type": {
|
|
3943
|
+
"defined": "LiquidateBorrowForPerpPnlRecord"
|
|
3944
|
+
},
|
|
3945
|
+
"index": false
|
|
3946
|
+
},
|
|
3947
|
+
{
|
|
3948
|
+
"name": "liquidatePerpPnlForDeposit",
|
|
3949
|
+
"type": {
|
|
3950
|
+
"defined": "LiquidatePerpPnlForDepositRecord"
|
|
3951
|
+
},
|
|
3952
|
+
"index": false
|
|
3953
|
+
}
|
|
3954
|
+
]
|
|
3624
3955
|
}
|
|
3625
3956
|
],
|
|
3626
3957
|
"errors": [
|
|
@@ -4076,6 +4407,56 @@
|
|
|
4076
4407
|
},
|
|
4077
4408
|
{
|
|
4078
4409
|
"code": 6090,
|
|
4410
|
+
"name": "PositionAlreadyBeingLiquidated",
|
|
4411
|
+
"msg": "PositionAlreadyBeingLiquidated"
|
|
4412
|
+
},
|
|
4413
|
+
{
|
|
4414
|
+
"code": 6091,
|
|
4415
|
+
"name": "PositionDoesntHaveOpenPositionOrOrders",
|
|
4416
|
+
"msg": "PositionDoesntHaveOpenPositionOrOrders"
|
|
4417
|
+
},
|
|
4418
|
+
{
|
|
4419
|
+
"code": 6092,
|
|
4420
|
+
"name": "AllOrdersAreAlreadyLiquidations",
|
|
4421
|
+
"msg": "AllOrdersAreAlreadyLiquidations"
|
|
4422
|
+
},
|
|
4423
|
+
{
|
|
4424
|
+
"code": 6093,
|
|
4425
|
+
"name": "CantCancelLiquidationOrder",
|
|
4426
|
+
"msg": "CantCancelLiquidationOrder"
|
|
4427
|
+
},
|
|
4428
|
+
{
|
|
4429
|
+
"code": 6094,
|
|
4430
|
+
"name": "UserIsBeingLiquidated",
|
|
4431
|
+
"msg": "UserIsBeingLiquidated"
|
|
4432
|
+
},
|
|
4433
|
+
{
|
|
4434
|
+
"code": 6095,
|
|
4435
|
+
"name": "LiquidationsOngoing",
|
|
4436
|
+
"msg": "LiquidationsOngoing"
|
|
4437
|
+
},
|
|
4438
|
+
{
|
|
4439
|
+
"code": 6096,
|
|
4440
|
+
"name": "WrongBankBalanceType",
|
|
4441
|
+
"msg": "WrongBankBalanceType"
|
|
4442
|
+
},
|
|
4443
|
+
{
|
|
4444
|
+
"code": 6097,
|
|
4445
|
+
"name": "UserCantLiquidateThemself",
|
|
4446
|
+
"msg": "UserCantLiquidateThemself"
|
|
4447
|
+
},
|
|
4448
|
+
{
|
|
4449
|
+
"code": 6098,
|
|
4450
|
+
"name": "InvalidPerpPositionToLiquidate",
|
|
4451
|
+
"msg": "InvalidPerpPositionToLiquidate"
|
|
4452
|
+
},
|
|
4453
|
+
{
|
|
4454
|
+
"code": 6099,
|
|
4455
|
+
"name": "InvalidBaseAssetAmountForLiquidatePerp",
|
|
4456
|
+
"msg": "InvalidBaseAssetAmountForLiquidatePerp"
|
|
4457
|
+
},
|
|
4458
|
+
{
|
|
4459
|
+
"code": 6100,
|
|
4079
4460
|
"name": "DefaultError",
|
|
4080
4461
|
"msg": "DefaultError"
|
|
4081
4462
|
}
|