@drift-labs/sdk 0.2.0-master.3 → 0.2.0-master.31
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/README.md +13 -13
- package/lib/accounts/bulkUserStatsSubscription.d.ts +7 -0
- package/lib/accounts/bulkUserStatsSubscription.js +21 -0
- package/lib/accounts/bulkUserSubscription.js +0 -1
- package/lib/accounts/fetch.d.ts +2 -1
- package/lib/accounts/fetch.js +9 -1
- package/lib/accounts/pollingClearingHouseAccountSubscriber.d.ts +16 -16
- package/lib/accounts/pollingClearingHouseAccountSubscriber.js +31 -28
- package/lib/accounts/pollingUserStatsAccountSubscriber.d.ts +27 -0
- package/lib/accounts/pollingUserStatsAccountSubscriber.js +113 -0
- package/lib/accounts/types.d.ts +22 -11
- package/lib/accounts/webSocketClearingHouseAccountSubscriber.d.ts +17 -17
- package/lib/accounts/webSocketClearingHouseAccountSubscriber.js +37 -35
- package/lib/accounts/webSocketUserStatsAccountSubsriber.d.ts +20 -0
- package/lib/accounts/webSocketUserStatsAccountSubsriber.js +47 -0
- package/lib/addresses/marketAddresses.d.ts +1 -3
- package/lib/addresses/pda.d.ts +10 -4
- package/lib/addresses/pda.js +51 -14
- package/lib/admin.d.ts +42 -26
- package/lib/admin.js +228 -81
- package/lib/clearingHouse.d.ts +130 -49
- package/lib/clearingHouse.js +1256 -367
- package/lib/clearingHouseConfig.d.ts +4 -4
- package/lib/clearingHouseUser.d.ts +51 -39
- package/lib/clearingHouseUser.js +408 -191
- package/lib/clearingHouseUserStats.d.ts +18 -0
- package/lib/clearingHouseUserStats.js +49 -0
- package/lib/clearingHouseUserStatsConfig.d.ts +14 -0
- package/lib/clearingHouseUserStatsConfig.js +2 -0
- package/lib/config.d.ts +7 -9
- package/lib/config.js +21 -21
- package/lib/constants/numericConstants.d.ts +25 -12
- package/lib/constants/numericConstants.js +35 -21
- package/lib/constants/perpMarkets.d.ts +18 -0
- package/lib/constants/{markets.js → perpMarkets.js} +7 -7
- package/lib/constants/spotMarkets.d.ts +19 -0
- package/lib/constants/spotMarkets.js +53 -0
- package/lib/dlob/DLOB.d.ts +74 -0
- package/lib/dlob/DLOB.js +595 -0
- package/lib/dlob/DLOBNode.d.ts +54 -0
- package/lib/dlob/DLOBNode.js +85 -0
- package/lib/dlob/NodeList.d.ts +26 -0
- package/lib/dlob/NodeList.js +139 -0
- package/lib/events/eventList.js +3 -0
- package/lib/events/eventSubscriber.d.ts +4 -2
- package/lib/events/eventSubscriber.js +16 -9
- package/lib/events/fetchLogs.d.ts +10 -1
- package/lib/events/fetchLogs.js +27 -7
- package/lib/events/pollingLogProvider.d.ts +2 -1
- package/lib/events/pollingLogProvider.js +6 -2
- package/lib/events/sort.js +8 -11
- package/lib/events/types.d.ts +8 -2
- package/lib/events/types.js +6 -0
- package/lib/examples/makeTradeExample.js +20 -8
- package/lib/factory/bigNum.d.ts +2 -0
- package/lib/factory/bigNum.js +48 -10
- package/lib/idl/clearing_house.json +4889 -1529
- package/lib/idl/{mock_usdc_faucet.json → token_faucet.json} +46 -23
- package/lib/index.d.ts +21 -6
- package/lib/index.js +25 -6
- package/lib/math/amm.d.ts +9 -6
- package/lib/math/amm.js +91 -66
- package/lib/math/auction.js +4 -1
- package/lib/math/conversion.js +1 -1
- package/lib/math/funding.d.ts +6 -6
- package/lib/math/funding.js +11 -10
- package/lib/math/insurance.d.ts +4 -0
- package/lib/math/insurance.js +27 -0
- package/lib/math/margin.d.ts +11 -0
- package/lib/math/margin.js +77 -0
- package/lib/math/market.d.ts +14 -9
- package/lib/math/market.js +72 -10
- package/lib/math/oracles.d.ts +4 -0
- package/lib/math/oracles.js +36 -8
- package/lib/math/orders.d.ts +6 -2
- package/lib/math/orders.js +78 -3
- package/lib/math/position.d.ts +21 -13
- package/lib/math/position.js +76 -36
- package/lib/math/repeg.js +14 -5
- package/lib/math/spotBalance.d.ts +22 -0
- package/lib/math/spotBalance.js +192 -0
- package/lib/math/spotMarket.d.ts +4 -0
- package/lib/math/spotMarket.js +8 -0
- package/lib/math/spotPosition.d.ts +6 -0
- package/lib/math/spotPosition.js +23 -0
- package/lib/math/trade.d.ts +10 -10
- package/lib/math/trade.js +32 -39
- package/lib/oracles/pythClient.js +1 -1
- package/lib/oracles/quoteAssetOracleClient.js +1 -1
- package/lib/oracles/switchboardClient.js +1 -1
- package/lib/orderParams.d.ts +14 -5
- package/lib/orderParams.js +12 -92
- package/lib/serum/serumSubscriber.d.ts +23 -0
- package/lib/serum/serumSubscriber.js +41 -0
- package/lib/serum/types.d.ts +11 -0
- package/lib/serum/types.js +2 -0
- package/lib/slot/SlotSubscriber.d.ts +7 -0
- package/lib/slot/SlotSubscriber.js +3 -0
- package/lib/{mockUSDCFaucet.d.ts → tokenFaucet.d.ts} +8 -5
- package/lib/{mockUSDCFaucet.js → tokenFaucet.js} +63 -51
- package/lib/tx/retryTxSender.d.ts +1 -1
- package/lib/tx/retryTxSender.js +13 -4
- package/lib/tx/types.d.ts +1 -1
- package/lib/tx/utils.js +1 -1
- package/lib/types.d.ts +566 -138
- package/lib/types.js +129 -5
- package/lib/userMap/userMap.d.ts +25 -0
- package/lib/userMap/userMap.js +73 -0
- package/lib/userMap/userStatsMap.d.ts +19 -0
- package/lib/userMap/userStatsMap.js +68 -0
- package/lib/util/computeUnits.js +1 -1
- package/lib/util/getTokenAddress.d.ts +2 -0
- package/lib/util/getTokenAddress.js +9 -0
- package/package.json +12 -6
- package/src/accounts/bulkUserStatsSubscription.ts +33 -0
- package/src/accounts/bulkUserSubscription.ts +0 -1
- package/src/accounts/fetch.ts +27 -2
- package/src/accounts/pollingClearingHouseAccountSubscriber.ts +46 -42
- package/src/accounts/pollingUserStatsAccountSubscriber.ts +172 -0
- package/src/accounts/types.ts +31 -11
- package/src/accounts/webSocketClearingHouseAccountSubscriber.ts +64 -59
- package/src/accounts/webSocketUserStatsAccountSubsriber.ts +80 -0
- package/src/addresses/marketAddresses.ts +1 -2
- package/src/addresses/pda.ts +88 -14
- package/src/admin.ts +452 -147
- package/src/assert/assert.js +9 -0
- package/src/clearingHouse.ts +2066 -467
- package/src/clearingHouseConfig.ts +4 -3
- package/src/clearingHouseUser.ts +747 -294
- package/src/clearingHouseUserStats.ts +75 -0
- package/src/clearingHouseUserStatsConfig.ts +18 -0
- package/src/config.ts +30 -31
- package/src/constants/numericConstants.ts +48 -25
- package/src/constants/{markets.ts → perpMarkets.ts} +10 -10
- package/src/constants/spotMarkets.ts +73 -0
- package/src/dlob/DLOB.ts +953 -0
- package/src/dlob/DLOBNode.ts +167 -0
- package/src/dlob/NodeList.ts +189 -0
- package/src/events/eventList.js +77 -0
- package/src/events/eventList.ts +3 -0
- package/src/events/eventSubscriber.ts +20 -12
- package/src/events/fetchLogs.ts +35 -8
- package/src/events/pollingLogProvider.ts +10 -2
- package/src/events/sort.ts +11 -15
- package/src/events/types.ts +19 -1
- package/src/examples/makeTradeExample.js +157 -0
- package/src/examples/makeTradeExample.ts +32 -14
- package/src/factory/bigNum.ts +65 -13
- package/src/idl/clearing_house.json +4889 -1529
- package/src/idl/{mock_usdc_faucet.json → token_faucet.json} +46 -23
- package/src/index.ts +21 -6
- package/src/math/amm.ts +171 -88
- package/src/math/auction.ts +5 -1
- package/src/math/conversion.ts +2 -2
- package/src/math/funding.ts +20 -18
- package/src/math/insurance.ts +35 -0
- package/src/math/margin.ts +127 -0
- package/src/math/market.ts +145 -14
- package/src/math/oracles.ts +63 -9
- package/src/math/orders.ts +138 -4
- package/src/math/position.ts +119 -58
- package/src/math/repeg.ts +16 -6
- package/src/math/spotBalance.ts +319 -0
- package/src/math/spotMarket.ts +9 -0
- package/src/math/spotPosition.ts +47 -0
- package/src/math/trade.ts +53 -59
- package/src/oracles/pythClient.ts +2 -2
- package/src/oracles/quoteAssetOracleClient.ts +2 -2
- package/src/oracles/switchboardClient.ts +2 -2
- package/src/orderParams.ts +24 -137
- package/src/serum/serumSubscriber.ts +80 -0
- package/src/serum/types.ts +13 -0
- package/src/slot/SlotSubscriber.ts +11 -1
- package/src/token/index.js +38 -0
- package/src/{mockUSDCFaucet.ts → tokenFaucet.ts} +82 -70
- package/src/tx/retryTxSender.ts +16 -5
- package/src/tx/types.js +2 -0
- package/src/tx/types.ts +2 -1
- package/src/tx/utils.js +17 -0
- package/src/tx/utils.ts +1 -1
- package/src/types.ts +533 -140
- package/src/userMap/userMap.ts +100 -0
- package/src/userMap/userStatsMap.ts +110 -0
- package/src/util/computeUnits.js +21 -11
- package/src/util/computeUnits.ts +1 -1
- package/src/util/getTokenAddress.js +9 -0
- package/src/util/getTokenAddress.ts +18 -0
- package/src/util/promiseTimeout.js +14 -0
- package/src/util/tps.js +27 -0
- package/tests/bn/test.ts +24 -10
- package/tests/dlob/helpers.ts +397 -0
- package/tests/dlob/test.ts +3688 -0
- package/lib/constants/banks.d.ts +0 -16
- package/lib/constants/banks.js +0 -34
- package/lib/constants/markets.d.ts +0 -19
- package/lib/math/bankBalance.d.ts +0 -9
- package/lib/math/bankBalance.js +0 -75
- package/lib/math/state.d.ts +0 -8
- package/lib/math/state.js +0 -15
- package/lib/orders.d.ts +0 -8
- package/lib/orders.js +0 -134
- package/src/constants/banks.ts +0 -43
- package/src/math/bankBalance.ts +0 -112
- package/src/math/state.ts +0 -14
- package/src/math/utils.js +0 -27
- package/src/math/utils.js.map +0 -1
- package/src/orders.ts +0 -244
- package/src/util/computeUnits.js.map +0 -1
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
|
2
|
+
import {
|
|
3
|
+
AMM,
|
|
4
|
+
AssetTier,
|
|
5
|
+
PerpPosition,
|
|
6
|
+
BN,
|
|
7
|
+
PerpMarketAccount,
|
|
8
|
+
SpotMarketAccount,
|
|
9
|
+
MarketStatus,
|
|
10
|
+
ContractType,
|
|
11
|
+
OracleSource,
|
|
12
|
+
DevnetSpotMarkets,
|
|
13
|
+
BASE_PRECISION,
|
|
14
|
+
QUOTE_PRECISION,
|
|
15
|
+
AMM_TO_QUOTE_PRECISION_RATIO,
|
|
16
|
+
} from '../../src';
|
|
17
|
+
|
|
18
|
+
export const mockPerpPosition: PerpPosition = {
|
|
19
|
+
baseAssetAmount: new BN(0),
|
|
20
|
+
lastCumulativeFundingRate: new BN(0),
|
|
21
|
+
marketIndex: 0,
|
|
22
|
+
quoteAssetAmount: new BN(0),
|
|
23
|
+
quoteEntryAmount: new BN(0),
|
|
24
|
+
openOrders: 0,
|
|
25
|
+
openBids: new BN(0),
|
|
26
|
+
openAsks: new BN(0),
|
|
27
|
+
settledPnl: new BN(0),
|
|
28
|
+
lpShares: new BN(0),
|
|
29
|
+
remainderBaseAssetAmount: 0,
|
|
30
|
+
lastNetBaseAssetAmountPerLp: new BN(0),
|
|
31
|
+
lastNetQuoteAssetAmountPerLp: new BN(0),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const mockAMM: AMM = {
|
|
35
|
+
/* these values create a bid/ask price of 12 */
|
|
36
|
+
baseAssetReserve: new BN(1).mul(BASE_PRECISION),
|
|
37
|
+
quoteAssetReserve: new BN(12)
|
|
38
|
+
.mul(QUOTE_PRECISION)
|
|
39
|
+
.mul(AMM_TO_QUOTE_PRECISION_RATIO),
|
|
40
|
+
sqrtK: new BN(1),
|
|
41
|
+
pegMultiplier: new BN(1),
|
|
42
|
+
maxSlippageRatio: 1_000_000,
|
|
43
|
+
|
|
44
|
+
cumulativeFundingRate: new BN(0),
|
|
45
|
+
lastFundingRate: new BN(0),
|
|
46
|
+
lastFundingRateTs: new BN(0),
|
|
47
|
+
lastMarkPriceTwap: new BN(0),
|
|
48
|
+
lastMarkPriceTwap5min: new BN(0),
|
|
49
|
+
lastMarkPriceTwapTs: new BN(0),
|
|
50
|
+
historicalOracleData: {
|
|
51
|
+
lastOraclePrice: new BN(0),
|
|
52
|
+
lastOracleConf: new BN(0),
|
|
53
|
+
lastOracleDelay: new BN(0),
|
|
54
|
+
lastOraclePriceTwap: new BN(0),
|
|
55
|
+
lastOraclePriceTwap5min: new BN(0),
|
|
56
|
+
lastOraclePriceTwapTs: new BN(0),
|
|
57
|
+
},
|
|
58
|
+
lastOracleReservePriceSpreadPct: new BN(0),
|
|
59
|
+
lastOracleConfPct: new BN(0),
|
|
60
|
+
oracle: PublicKey.default,
|
|
61
|
+
oracleSource: OracleSource.PYTH,
|
|
62
|
+
fundingPeriod: new BN(0),
|
|
63
|
+
cumulativeFundingRateLong: new BN(0),
|
|
64
|
+
cumulativeFundingRateShort: new BN(0),
|
|
65
|
+
cumulativeFundingRateLp: new BN(0),
|
|
66
|
+
totalFeeMinusDistributions: new BN(0),
|
|
67
|
+
totalFeeWithdrawn: new BN(0),
|
|
68
|
+
totalFee: new BN(0),
|
|
69
|
+
cumulativeFundingPaymentPerLp: new BN(0),
|
|
70
|
+
cumulativeFeePerLp: new BN(0),
|
|
71
|
+
cumulativeNetBaseAssetAmountPerLp: new BN(0),
|
|
72
|
+
userLpShares: new BN(0),
|
|
73
|
+
netUnsettledLpBaseAssetAmount: new BN(0),
|
|
74
|
+
minimumQuoteAssetTradeSize: new BN(0),
|
|
75
|
+
baseAssetAmountStepSize: new BN(0),
|
|
76
|
+
maxBaseAssetAmountRatio: 0,
|
|
77
|
+
baseSpread: 0,
|
|
78
|
+
curveUpdateIntensity: 0,
|
|
79
|
+
netBaseAssetAmount: new BN(0),
|
|
80
|
+
quoteAssetAmountLong: new BN(0),
|
|
81
|
+
quoteAssetAmountShort: new BN(0),
|
|
82
|
+
terminalQuoteAssetReserve: new BN(0),
|
|
83
|
+
feePool: {
|
|
84
|
+
balance: new BN(0),
|
|
85
|
+
marketIndex: 0,
|
|
86
|
+
},
|
|
87
|
+
totalExchangeFee: new BN(0),
|
|
88
|
+
totalMmFee: new BN(0),
|
|
89
|
+
netRevenueSinceLastFunding: new BN(0),
|
|
90
|
+
lastUpdateSlot: new BN(0),
|
|
91
|
+
lastOracleValid: true,
|
|
92
|
+
lastBidPriceTwap: new BN(0),
|
|
93
|
+
lastAskPriceTwap: new BN(0),
|
|
94
|
+
longSpread: new BN(0),
|
|
95
|
+
shortSpread: new BN(0),
|
|
96
|
+
maxSpread: 0,
|
|
97
|
+
marketPosition: mockPerpPosition,
|
|
98
|
+
marketPositionPerLp: mockPerpPosition,
|
|
99
|
+
ammJitIntensity: 0,
|
|
100
|
+
maxBaseAssetReserve: new BN(0),
|
|
101
|
+
minBaseAssetReserve: new BN(0),
|
|
102
|
+
cumulativeSocialLoss: new BN(0),
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const mockPerpMarkets: Array<PerpMarketAccount> = [
|
|
106
|
+
{
|
|
107
|
+
status: MarketStatus.INITIALIZED,
|
|
108
|
+
contractType: ContractType.PERPETUAL,
|
|
109
|
+
expiryTs: new BN(0),
|
|
110
|
+
settlementPrice: new BN(0),
|
|
111
|
+
marketIndex: 0,
|
|
112
|
+
pubkey: PublicKey.default,
|
|
113
|
+
amm: mockAMM,
|
|
114
|
+
baseAssetAmount: new BN(0),
|
|
115
|
+
baseAssetAmountLong: new BN(0),
|
|
116
|
+
baseAssetAmountShort: new BN(0),
|
|
117
|
+
openInterest: new BN(0),
|
|
118
|
+
marginRatioInitial: 0,
|
|
119
|
+
marginRatioMaintenance: 0,
|
|
120
|
+
nextFillRecordId: new BN(0),
|
|
121
|
+
pnlPool: {
|
|
122
|
+
balance: new BN(0),
|
|
123
|
+
marketIndex: 0,
|
|
124
|
+
},
|
|
125
|
+
ifLiquidationFee: new BN(0),
|
|
126
|
+
liquidatorFee: new BN(0),
|
|
127
|
+
imfFactor: new BN(0),
|
|
128
|
+
unrealizedImfFactor: new BN(0),
|
|
129
|
+
unrealizedMaxImbalance: new BN(0),
|
|
130
|
+
unrealizedInitialAssetWeight: 0,
|
|
131
|
+
unrealizedMaintenanceAssetWeight: 0,
|
|
132
|
+
revenueWithdrawSinceLastSettle: new BN(0),
|
|
133
|
+
maxRevenueWithdrawPerPeriod: new BN(0),
|
|
134
|
+
lastRevenueWithdrawTs: new BN(0),
|
|
135
|
+
quoteSettledInsurance: new BN(0),
|
|
136
|
+
quoteMaxInsurance: new BN(0),
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
status: MarketStatus.INITIALIZED,
|
|
140
|
+
contractType: ContractType.PERPETUAL,
|
|
141
|
+
expiryTs: new BN(0),
|
|
142
|
+
settlementPrice: new BN(0),
|
|
143
|
+
marketIndex: 1,
|
|
144
|
+
pubkey: PublicKey.default,
|
|
145
|
+
amm: mockAMM,
|
|
146
|
+
baseAssetAmount: new BN(0),
|
|
147
|
+
baseAssetAmountLong: new BN(0),
|
|
148
|
+
baseAssetAmountShort: new BN(0),
|
|
149
|
+
openInterest: new BN(0),
|
|
150
|
+
marginRatioInitial: 0,
|
|
151
|
+
marginRatioMaintenance: 0,
|
|
152
|
+
nextFillRecordId: new BN(0),
|
|
153
|
+
pnlPool: {
|
|
154
|
+
balance: new BN(0),
|
|
155
|
+
marketIndex: 0,
|
|
156
|
+
},
|
|
157
|
+
ifLiquidationFee: new BN(0),
|
|
158
|
+
liquidatorFee: new BN(0),
|
|
159
|
+
imfFactor: new BN(0),
|
|
160
|
+
unrealizedImfFactor: new BN(0),
|
|
161
|
+
unrealizedMaxImbalance: new BN(0),
|
|
162
|
+
unrealizedInitialAssetWeight: 0,
|
|
163
|
+
unrealizedMaintenanceAssetWeight: 0,
|
|
164
|
+
revenueWithdrawSinceLastSettle: new BN(0),
|
|
165
|
+
maxRevenueWithdrawPerPeriod: new BN(0),
|
|
166
|
+
lastRevenueWithdrawTs: new BN(0),
|
|
167
|
+
quoteSettledInsurance: new BN(0),
|
|
168
|
+
quoteMaxInsurance: new BN(0),
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
status: MarketStatus.INITIALIZED,
|
|
172
|
+
contractType: ContractType.PERPETUAL,
|
|
173
|
+
expiryTs: new BN(0),
|
|
174
|
+
settlementPrice: new BN(0),
|
|
175
|
+
marketIndex: 2,
|
|
176
|
+
pubkey: PublicKey.default,
|
|
177
|
+
amm: mockAMM,
|
|
178
|
+
baseAssetAmount: new BN(0),
|
|
179
|
+
baseAssetAmountLong: new BN(0),
|
|
180
|
+
baseAssetAmountShort: new BN(0),
|
|
181
|
+
openInterest: new BN(0),
|
|
182
|
+
marginRatioInitial: 0,
|
|
183
|
+
marginRatioMaintenance: 0,
|
|
184
|
+
nextFillRecordId: new BN(0),
|
|
185
|
+
pnlPool: {
|
|
186
|
+
balance: new BN(0),
|
|
187
|
+
marketIndex: 0,
|
|
188
|
+
},
|
|
189
|
+
ifLiquidationFee: new BN(0),
|
|
190
|
+
liquidatorFee: new BN(0),
|
|
191
|
+
imfFactor: new BN(0),
|
|
192
|
+
unrealizedImfFactor: new BN(0),
|
|
193
|
+
unrealizedMaxImbalance: new BN(0),
|
|
194
|
+
unrealizedInitialAssetWeight: 0,
|
|
195
|
+
unrealizedMaintenanceAssetWeight: 0,
|
|
196
|
+
revenueWithdrawSinceLastSettle: new BN(0),
|
|
197
|
+
maxRevenueWithdrawPerPeriod: new BN(0),
|
|
198
|
+
lastRevenueWithdrawTs: new BN(0),
|
|
199
|
+
quoteSettledInsurance: new BN(0),
|
|
200
|
+
quoteMaxInsurance: new BN(0),
|
|
201
|
+
},
|
|
202
|
+
];
|
|
203
|
+
|
|
204
|
+
export const mockSpotMarkets: Array<SpotMarketAccount> = [
|
|
205
|
+
{
|
|
206
|
+
status: MarketStatus.ACTIVE,
|
|
207
|
+
assetTier: AssetTier.COLLATERAL,
|
|
208
|
+
maxTokenDeposits: new BN(100),
|
|
209
|
+
marketIndex: 0,
|
|
210
|
+
pubkey: PublicKey.default,
|
|
211
|
+
mint: DevnetSpotMarkets[0].mint,
|
|
212
|
+
vault: PublicKey.default,
|
|
213
|
+
insuranceFundVault: PublicKey.default,
|
|
214
|
+
insuranceWithdrawEscrowPeriod: new BN(0),
|
|
215
|
+
revenuePool: {
|
|
216
|
+
balance: new BN(0),
|
|
217
|
+
marketIndex: 0,
|
|
218
|
+
},
|
|
219
|
+
totalIfShares: new BN(0),
|
|
220
|
+
userIfShares: new BN(0),
|
|
221
|
+
userIfFactor: 0,
|
|
222
|
+
totalIfFactor: 0,
|
|
223
|
+
ifLiquidationFee: new BN(0),
|
|
224
|
+
liquidatorFee: new BN(0),
|
|
225
|
+
decimals: 6,
|
|
226
|
+
optimalUtilization: 0,
|
|
227
|
+
optimalBorrowRate: 0,
|
|
228
|
+
maxBorrowRate: 0,
|
|
229
|
+
cumulativeDepositInterest: new BN(0),
|
|
230
|
+
cumulativeBorrowInterest: new BN(0),
|
|
231
|
+
depositBalance: new BN(0),
|
|
232
|
+
borrowBalance: new BN(0),
|
|
233
|
+
lastInterestTs: new BN(0),
|
|
234
|
+
lastTwapTs: new BN(0),
|
|
235
|
+
oracle: PublicKey.default,
|
|
236
|
+
initialAssetWeight: new BN(0),
|
|
237
|
+
maintenanceAssetWeight: new BN(0),
|
|
238
|
+
initialLiabilityWeight: new BN(0),
|
|
239
|
+
maintenanceLiabilityWeight: new BN(0),
|
|
240
|
+
imfFactor: new BN(0),
|
|
241
|
+
withdrawGuardThreshold: new BN(0),
|
|
242
|
+
depositTokenTwap: new BN(0),
|
|
243
|
+
borrowTokenTwap: new BN(0),
|
|
244
|
+
utilizationTwap: new BN(0),
|
|
245
|
+
orderStepSize: new BN(0),
|
|
246
|
+
nextFillRecordId: new BN(0),
|
|
247
|
+
spotFeePool: {
|
|
248
|
+
balance: new BN(0),
|
|
249
|
+
marketIndex: 0,
|
|
250
|
+
},
|
|
251
|
+
totalSpotFee: new BN(0),
|
|
252
|
+
oracleSource: OracleSource.PYTH,
|
|
253
|
+
historicalOracleData: {
|
|
254
|
+
lastOraclePrice: new BN(0),
|
|
255
|
+
lastOracleConf: new BN(0),
|
|
256
|
+
lastOracleDelay: new BN(0),
|
|
257
|
+
lastOraclePriceTwap: new BN(0),
|
|
258
|
+
lastOraclePriceTwap5min: new BN(0),
|
|
259
|
+
lastOraclePriceTwapTs: new BN(0),
|
|
260
|
+
},
|
|
261
|
+
historicalIndexData: {
|
|
262
|
+
lastIndexBidPrice: new BN(0),
|
|
263
|
+
lastIndexAskPrice: new BN(0),
|
|
264
|
+
lastIndexPriceTwap: new BN(0),
|
|
265
|
+
lastIndexPriceTwap5Min: new BN(0),
|
|
266
|
+
lastIndexPriceTwapTs: new BN(0),
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
status: MarketStatus.ACTIVE,
|
|
271
|
+
assetTier: AssetTier.CROSS,
|
|
272
|
+
maxTokenDeposits: new BN(100),
|
|
273
|
+
marketIndex: 1,
|
|
274
|
+
pubkey: PublicKey.default,
|
|
275
|
+
mint: DevnetSpotMarkets[1].mint,
|
|
276
|
+
vault: PublicKey.default,
|
|
277
|
+
insuranceFundVault: PublicKey.default,
|
|
278
|
+
insuranceWithdrawEscrowPeriod: new BN(0),
|
|
279
|
+
revenuePool: {
|
|
280
|
+
balance: new BN(0),
|
|
281
|
+
marketIndex: 0,
|
|
282
|
+
},
|
|
283
|
+
totalIfShares: new BN(0),
|
|
284
|
+
userIfShares: new BN(0),
|
|
285
|
+
userIfFactor: 0,
|
|
286
|
+
totalIfFactor: 0,
|
|
287
|
+
ifLiquidationFee: new BN(0),
|
|
288
|
+
liquidatorFee: new BN(0),
|
|
289
|
+
decimals: 9,
|
|
290
|
+
optimalUtilization: 0,
|
|
291
|
+
optimalBorrowRate: 0,
|
|
292
|
+
maxBorrowRate: 0,
|
|
293
|
+
cumulativeDepositInterest: new BN(0),
|
|
294
|
+
cumulativeBorrowInterest: new BN(0),
|
|
295
|
+
depositBalance: new BN(0),
|
|
296
|
+
borrowBalance: new BN(0),
|
|
297
|
+
lastInterestTs: new BN(0),
|
|
298
|
+
lastTwapTs: new BN(0),
|
|
299
|
+
oracle: PublicKey.default,
|
|
300
|
+
initialAssetWeight: new BN(0),
|
|
301
|
+
maintenanceAssetWeight: new BN(0),
|
|
302
|
+
initialLiabilityWeight: new BN(0),
|
|
303
|
+
maintenanceLiabilityWeight: new BN(0),
|
|
304
|
+
imfFactor: new BN(0),
|
|
305
|
+
withdrawGuardThreshold: new BN(0),
|
|
306
|
+
depositTokenTwap: new BN(0),
|
|
307
|
+
borrowTokenTwap: new BN(0),
|
|
308
|
+
utilizationTwap: new BN(0),
|
|
309
|
+
orderStepSize: new BN(0),
|
|
310
|
+
nextFillRecordId: new BN(0),
|
|
311
|
+
spotFeePool: {
|
|
312
|
+
balance: new BN(0),
|
|
313
|
+
marketIndex: 0,
|
|
314
|
+
},
|
|
315
|
+
totalSpotFee: new BN(0),
|
|
316
|
+
oracleSource: OracleSource.PYTH,
|
|
317
|
+
historicalOracleData: {
|
|
318
|
+
lastOraclePrice: new BN(0),
|
|
319
|
+
lastOracleConf: new BN(0),
|
|
320
|
+
lastOracleDelay: new BN(0),
|
|
321
|
+
lastOraclePriceTwap: new BN(0),
|
|
322
|
+
lastOraclePriceTwap5min: new BN(0),
|
|
323
|
+
lastOraclePriceTwapTs: new BN(0),
|
|
324
|
+
},
|
|
325
|
+
historicalIndexData: {
|
|
326
|
+
lastIndexBidPrice: new BN(0),
|
|
327
|
+
lastIndexAskPrice: new BN(0),
|
|
328
|
+
lastIndexPriceTwap: new BN(0),
|
|
329
|
+
lastIndexPriceTwap5Min: new BN(0),
|
|
330
|
+
lastIndexPriceTwapTs: new BN(0),
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
status: MarketStatus.ACTIVE,
|
|
335
|
+
assetTier: AssetTier.PROTECTED,
|
|
336
|
+
maxTokenDeposits: new BN(100),
|
|
337
|
+
marketIndex: 2,
|
|
338
|
+
pubkey: PublicKey.default,
|
|
339
|
+
mint: DevnetSpotMarkets[2].mint,
|
|
340
|
+
vault: PublicKey.default,
|
|
341
|
+
insuranceFundVault: PublicKey.default,
|
|
342
|
+
insuranceWithdrawEscrowPeriod: new BN(0),
|
|
343
|
+
revenuePool: {
|
|
344
|
+
balance: new BN(0),
|
|
345
|
+
marketIndex: 0,
|
|
346
|
+
},
|
|
347
|
+
totalIfShares: new BN(0),
|
|
348
|
+
userIfShares: new BN(0),
|
|
349
|
+
userIfFactor: 0,
|
|
350
|
+
totalIfFactor: 0,
|
|
351
|
+
ifLiquidationFee: new BN(0),
|
|
352
|
+
liquidatorFee: new BN(0),
|
|
353
|
+
decimals: 6,
|
|
354
|
+
optimalUtilization: 0,
|
|
355
|
+
optimalBorrowRate: 0,
|
|
356
|
+
maxBorrowRate: 0,
|
|
357
|
+
cumulativeDepositInterest: new BN(0),
|
|
358
|
+
cumulativeBorrowInterest: new BN(0),
|
|
359
|
+
depositBalance: new BN(0),
|
|
360
|
+
borrowBalance: new BN(0),
|
|
361
|
+
lastInterestTs: new BN(0),
|
|
362
|
+
lastTwapTs: new BN(0),
|
|
363
|
+
oracle: PublicKey.default,
|
|
364
|
+
initialAssetWeight: new BN(0),
|
|
365
|
+
maintenanceAssetWeight: new BN(0),
|
|
366
|
+
initialLiabilityWeight: new BN(0),
|
|
367
|
+
maintenanceLiabilityWeight: new BN(0),
|
|
368
|
+
imfFactor: new BN(0),
|
|
369
|
+
withdrawGuardThreshold: new BN(0),
|
|
370
|
+
depositTokenTwap: new BN(0),
|
|
371
|
+
borrowTokenTwap: new BN(0),
|
|
372
|
+
utilizationTwap: new BN(0),
|
|
373
|
+
orderStepSize: new BN(0),
|
|
374
|
+
nextFillRecordId: new BN(0),
|
|
375
|
+
spotFeePool: {
|
|
376
|
+
balance: new BN(0),
|
|
377
|
+
marketIndex: 0,
|
|
378
|
+
},
|
|
379
|
+
totalSpotFee: new BN(0),
|
|
380
|
+
oracleSource: OracleSource.PYTH,
|
|
381
|
+
historicalOracleData: {
|
|
382
|
+
lastOraclePrice: new BN(0),
|
|
383
|
+
lastOracleConf: new BN(0),
|
|
384
|
+
lastOracleDelay: new BN(0),
|
|
385
|
+
lastOraclePriceTwap: new BN(0),
|
|
386
|
+
lastOraclePriceTwap5min: new BN(0),
|
|
387
|
+
lastOraclePriceTwapTs: new BN(0),
|
|
388
|
+
},
|
|
389
|
+
historicalIndexData: {
|
|
390
|
+
lastIndexBidPrice: new BN(0),
|
|
391
|
+
lastIndexAskPrice: new BN(0),
|
|
392
|
+
lastIndexPriceTwap: new BN(0),
|
|
393
|
+
lastIndexPriceTwap5Min: new BN(0),
|
|
394
|
+
lastIndexPriceTwapTs: new BN(0),
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
];
|