@0dotxyz/p0-ts-sdk 2.3.2 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dto-rate-model.types-DWB7J91n.d.cts +860 -0
- package/dist/dto-rate-model.types-DWB7J91n.d.ts +860 -0
- package/dist/index.cjs +353 -738
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -20
- package/dist/index.d.ts +99 -20
- package/dist/index.js +345 -737
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.cts +2 -2
- package/dist/instructions.d.ts +2 -2
- package/dist/{types-Cxl2AUvk.d.ts → types-DDP4jEc9.d.cts} +10 -10
- package/dist/{types-DtUR-yHt.d.cts → types-rBQYamIi.d.ts} +10 -10
- package/dist/vendor.cjs +256 -722
- package/dist/vendor.cjs.map +1 -1
- package/dist/vendor.d.cts +605 -26
- package/dist/vendor.d.ts +605 -26
- package/dist/vendor.js +247 -713
- package/dist/vendor.js.map +1 -1
- package/package.json +1 -1
- package/dist/dto-rate-model.types-DveIB9Ll.d.cts +0 -1726
- package/dist/dto-rate-model.types-DveIB9Ll.d.ts +0 -1726
|
@@ -1,1726 +0,0 @@
|
|
|
1
|
-
import { PublicKey } from '@solana/web3.js';
|
|
2
|
-
import BN from 'bn.js';
|
|
3
|
-
|
|
4
|
-
interface LastUpdateFields {
|
|
5
|
-
/** Last slot when updated */
|
|
6
|
-
slot: BN;
|
|
7
|
-
/** True when marked stale, false when slot updated */
|
|
8
|
-
stale: number;
|
|
9
|
-
/** Status of the prices used to calculate the last update */
|
|
10
|
-
priceStatus: number;
|
|
11
|
-
placeholder: Array<number>;
|
|
12
|
-
}
|
|
13
|
-
interface BigFractionBytesFields {
|
|
14
|
-
value: Array<BN>;
|
|
15
|
-
padding: Array<BN>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface LastUpdateJSON {
|
|
19
|
-
/** Last slot when updated */
|
|
20
|
-
slot: string;
|
|
21
|
-
/** True when marked stale, false when slot updated */
|
|
22
|
-
stale: number;
|
|
23
|
-
/** Status of the prices used to calculate the last update */
|
|
24
|
-
priceStatus: number;
|
|
25
|
-
placeholder: Array<number>;
|
|
26
|
-
}
|
|
27
|
-
interface BigFractionBytesJSON {
|
|
28
|
-
value: Array<string>;
|
|
29
|
-
padding: Array<string>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
interface ReserveRaw {
|
|
33
|
-
/** Version of the reserve */
|
|
34
|
-
version: BN;
|
|
35
|
-
/** Last slot when supply and rates updated */
|
|
36
|
-
lastUpdate: LastUpdateFields;
|
|
37
|
-
/** Lending market address */
|
|
38
|
-
lendingMarket: PublicKey;
|
|
39
|
-
farmCollateral: PublicKey;
|
|
40
|
-
farmDebt: PublicKey;
|
|
41
|
-
/** Reserve liquidity */
|
|
42
|
-
liquidity: ReserveLiquidityFields;
|
|
43
|
-
reserveLiquidityPadding: Array<BN>;
|
|
44
|
-
/** Reserve collateral */
|
|
45
|
-
collateral: ReserveCollateralFields;
|
|
46
|
-
reserveCollateralPadding: Array<BN>;
|
|
47
|
-
/** Reserve configuration values */
|
|
48
|
-
config: ReserveConfigFields;
|
|
49
|
-
configPadding: Array<BN>;
|
|
50
|
-
borrowedAmountOutsideElevationGroup: BN;
|
|
51
|
-
/**
|
|
52
|
-
* Amount of token borrowed in lamport of debt asset in the given
|
|
53
|
-
* elevation group when this reserve is part of the collaterals.
|
|
54
|
-
*/
|
|
55
|
-
borrowedAmountsAgainstThisReserveInElevationGroups: Array<BN>;
|
|
56
|
-
padding: Array<BN>;
|
|
57
|
-
}
|
|
58
|
-
interface ReserveLiquidityFields {
|
|
59
|
-
/** Reserve liquidity mint address */
|
|
60
|
-
mintPubkey: PublicKey;
|
|
61
|
-
/** Reserve liquidity supply address */
|
|
62
|
-
supplyVault: PublicKey;
|
|
63
|
-
/** Reserve liquidity fee collection address */
|
|
64
|
-
feeVault: PublicKey;
|
|
65
|
-
/** Reserve liquidity available */
|
|
66
|
-
availableAmount: BN;
|
|
67
|
-
/** Reserve liquidity borrowed (scaled fraction) */
|
|
68
|
-
borrowedAmountSf: BN;
|
|
69
|
-
/** Reserve liquidity market price in quote currency (scaled fraction) */
|
|
70
|
-
marketPriceSf: BN;
|
|
71
|
-
/** Unix timestamp of the market price (from the oracle) */
|
|
72
|
-
marketPriceLastUpdatedTs: BN;
|
|
73
|
-
/** Reserve liquidity mint decimals */
|
|
74
|
-
mintDecimals: BN;
|
|
75
|
-
/**
|
|
76
|
-
* Timestamp when the last refresh reserve detected that the liquidity amount is above the deposit cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
|
|
77
|
-
* If the threshold is not crossed, then the timestamp is set to 0
|
|
78
|
-
*/
|
|
79
|
-
depositLimitCrossedTimestamp: BN;
|
|
80
|
-
/**
|
|
81
|
-
* Timestamp when the last refresh reserve detected that the borrowed amount is above the borrow cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
|
|
82
|
-
* If the threshold is not crossed, then the timestamp is set to 0
|
|
83
|
-
*/
|
|
84
|
-
borrowLimitCrossedTimestamp: BN;
|
|
85
|
-
/** Reserve liquidity cumulative borrow rate (scaled fraction) */
|
|
86
|
-
cumulativeBorrowRateBsf: BigFractionBytesFields;
|
|
87
|
-
/** Reserve cumulative protocol fees (scaled fraction) */
|
|
88
|
-
accumulatedProtocolFeesSf: BN;
|
|
89
|
-
/** Reserve cumulative referrer fees (scaled fraction) */
|
|
90
|
-
accumulatedReferrerFeesSf: BN;
|
|
91
|
-
/** Reserve pending referrer fees, to be claimed in refresh_obligation by referrer or protocol (scaled fraction) */
|
|
92
|
-
pendingReferrerFeesSf: BN;
|
|
93
|
-
/** Reserve referrer fee absolute rate calculated at each refresh_reserve operation (scaled fraction) */
|
|
94
|
-
absoluteReferralRateSf: BN;
|
|
95
|
-
/** Token program of the liquidity mint */
|
|
96
|
-
tokenProgram: PublicKey;
|
|
97
|
-
padding2: Array<BN>;
|
|
98
|
-
padding3: Array<BN>;
|
|
99
|
-
}
|
|
100
|
-
interface ReserveCollateralFields {
|
|
101
|
-
/** Reserve collateral mint address */
|
|
102
|
-
mintPubkey: PublicKey;
|
|
103
|
-
/** Reserve collateral mint supply, used for exchange rate */
|
|
104
|
-
mintTotalSupply: BN;
|
|
105
|
-
/** Reserve collateral supply address */
|
|
106
|
-
supplyVault: PublicKey;
|
|
107
|
-
padding1: Array<BN>;
|
|
108
|
-
padding2: Array<BN>;
|
|
109
|
-
}
|
|
110
|
-
interface ReserveConfigFields {
|
|
111
|
-
/** Status of the reserve Active/Obsolete/Hidden */
|
|
112
|
-
status: number;
|
|
113
|
-
/** Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt */
|
|
114
|
-
assetTier: number;
|
|
115
|
-
/** Flat rate that goes to the host */
|
|
116
|
-
hostFixedInterestRateBps: number;
|
|
117
|
-
/**
|
|
118
|
-
* [DEPRECATED] Space that used to hold 2 fields:
|
|
119
|
-
* - Boost for side (debt or collateral)
|
|
120
|
-
* - Reward points multiplier per obligation type
|
|
121
|
-
* Can be re-used after making sure all underlying production account data is zeroed.
|
|
122
|
-
*/
|
|
123
|
-
reserved2: Array<number>;
|
|
124
|
-
/** Cut of the order execution bonus that the protocol receives, as a percentage */
|
|
125
|
-
protocolOrderExecutionFeePct: number;
|
|
126
|
-
/** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */
|
|
127
|
-
protocolTakeRatePct: number;
|
|
128
|
-
/** Cut of the liquidation bonus that the protocol receives, as a percentage */
|
|
129
|
-
protocolLiquidationFeePct: number;
|
|
130
|
-
/**
|
|
131
|
-
* Target ratio of the value of borrows to deposits, as a percentage
|
|
132
|
-
* 0 if use as collateral is disabled
|
|
133
|
-
*/
|
|
134
|
-
loanToValuePct: number;
|
|
135
|
-
/** Loan to value ratio at which an obligation can be liquidated, as percentage */
|
|
136
|
-
liquidationThresholdPct: number;
|
|
137
|
-
/** Minimum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */
|
|
138
|
-
minLiquidationBonusBps: number;
|
|
139
|
-
/** Maximum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */
|
|
140
|
-
maxLiquidationBonusBps: number;
|
|
141
|
-
/** Bad debt liquidation bonus for an undercollateralized obligation, as bps */
|
|
142
|
-
badDebtLiquidationBonusBps: number;
|
|
143
|
-
/**
|
|
144
|
-
* Time in seconds that must pass before redemptions are enabled after the deposit limit is
|
|
145
|
-
* crossed.
|
|
146
|
-
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
147
|
-
*/
|
|
148
|
-
deleveragingMarginCallPeriodSecs: BN;
|
|
149
|
-
/**
|
|
150
|
-
* The rate at which the deleveraging threshold decreases, in bps per day.
|
|
151
|
-
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
152
|
-
*/
|
|
153
|
-
deleveragingThresholdDecreaseBpsPerDay: BN;
|
|
154
|
-
/** Program owner fees assessed, separate from gains due to interest accrual */
|
|
155
|
-
fees: ReserveFeesFields;
|
|
156
|
-
/** Borrow rate curve based on utilization */
|
|
157
|
-
borrowRateCurve: BorrowRateCurveFields;
|
|
158
|
-
/** Borrow factor in percentage - used for risk adjustment */
|
|
159
|
-
borrowFactorPct: BN;
|
|
160
|
-
/** Maximum deposit limit of liquidity in native units, u64::MAX for inf */
|
|
161
|
-
depositLimit: BN;
|
|
162
|
-
/** Maximum amount borrowed, u64::MAX for inf, 0 to disable borrows (protected deposits) */
|
|
163
|
-
borrowLimit: BN;
|
|
164
|
-
/** Token id from TokenInfos struct */
|
|
165
|
-
tokenInfo: TokenInfoFields$1;
|
|
166
|
-
/** Deposit withdrawal caps - deposit & redeem */
|
|
167
|
-
depositWithdrawalCap: WithdrawalCapsFields;
|
|
168
|
-
/** Debt withdrawal caps - borrow & repay */
|
|
169
|
-
debtWithdrawalCap: WithdrawalCapsFields;
|
|
170
|
-
elevationGroups: Array<number>;
|
|
171
|
-
disableUsageAsCollOutsideEmode: number;
|
|
172
|
-
/** Utilization (in percentage) above which borrowing is blocked. 0 to disable. */
|
|
173
|
-
utilizationLimitBlockBorrowingAbovePct: number;
|
|
174
|
-
/**
|
|
175
|
-
* Whether this reserve should be subject to auto-deleveraging after deposit or borrow limit is
|
|
176
|
-
* crossed.
|
|
177
|
-
* Besides this flag, the lending market's flag also needs to be enabled (logical `AND`).
|
|
178
|
-
* **NOTE:** the manual "target LTV" deleveraging (enabled by the risk council for individual
|
|
179
|
-
* obligations) is NOT affected by this flag.
|
|
180
|
-
*/
|
|
181
|
-
autodeleverageEnabled: number;
|
|
182
|
-
reserved1: Array<number>;
|
|
183
|
-
/**
|
|
184
|
-
* Maximum amount liquidity of this reserve borrowed outside all elevation groups
|
|
185
|
-
* - u64::MAX for inf
|
|
186
|
-
* - 0 to disable borrows outside elevation groups
|
|
187
|
-
*/
|
|
188
|
-
borrowLimitOutsideElevationGroup: BN;
|
|
189
|
-
/**
|
|
190
|
-
* Defines the maximum amount (in lamports of elevation group debt asset)
|
|
191
|
-
* that can be borrowed when this reserve is used as collateral.
|
|
192
|
-
* - u64::MAX for inf
|
|
193
|
-
* - 0 to disable borrows in this elevation group (expected value for the debt asset)
|
|
194
|
-
*/
|
|
195
|
-
borrowLimitAgainstThisCollateralInElevationGroup: Array<BN>;
|
|
196
|
-
/**
|
|
197
|
-
* The rate at which the deleveraging-related liquidation bonus increases, in bps per day.
|
|
198
|
-
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
199
|
-
*/
|
|
200
|
-
deleveragingBonusIncreaseBpsPerDay: BN;
|
|
201
|
-
}
|
|
202
|
-
interface ReserveFeesFields {
|
|
203
|
-
/**
|
|
204
|
-
* Fee assessed on `BorrowObligationLiquidity`, as scaled fraction (60 bits fractional part)
|
|
205
|
-
* Must be between `0` and `2^60`, such that `2^60 = 1`. A few examples for
|
|
206
|
-
* clarity:
|
|
207
|
-
* 1% = (1 << 60) / 100 = 11529215046068470
|
|
208
|
-
* 0.01% (1 basis point) = 115292150460685
|
|
209
|
-
* 0.00001% (Aave borrow fee) = 115292150461
|
|
210
|
-
*/
|
|
211
|
-
borrowFeeSf: BN;
|
|
212
|
-
/**
|
|
213
|
-
* Fee for flash loan, expressed as scaled fraction.
|
|
214
|
-
* 0.3% (Aave flash loan fee) = 0.003 * 2^60 = 3458764513820541
|
|
215
|
-
*/
|
|
216
|
-
flashLoanFeeSf: BN;
|
|
217
|
-
/** Used for allignment */
|
|
218
|
-
padding: Array<number>;
|
|
219
|
-
}
|
|
220
|
-
interface BorrowRateCurveFields {
|
|
221
|
-
points: Array<CurvePointFields>;
|
|
222
|
-
}
|
|
223
|
-
interface CurvePointFields {
|
|
224
|
-
utilizationRateBps: number;
|
|
225
|
-
borrowRateBps: number;
|
|
226
|
-
}
|
|
227
|
-
interface TokenInfoFields$1 {
|
|
228
|
-
/** UTF-8 encoded name of the token (null-terminated) */
|
|
229
|
-
name: Array<number>;
|
|
230
|
-
/** Heuristics limits of acceptable price */
|
|
231
|
-
heuristic: PriceHeuristicFields;
|
|
232
|
-
/** Max divergence between twap and price in bps */
|
|
233
|
-
maxTwapDivergenceBps: BN;
|
|
234
|
-
maxAgePriceSeconds: BN;
|
|
235
|
-
maxAgeTwapSeconds: BN;
|
|
236
|
-
/** Scope price configuration */
|
|
237
|
-
scopeConfiguration: ScopeConfigurationFields;
|
|
238
|
-
/** Switchboard configuration */
|
|
239
|
-
switchboardConfiguration: SwitchboardConfigurationFields;
|
|
240
|
-
/** Pyth configuration */
|
|
241
|
-
pythConfiguration: PythConfigurationFields;
|
|
242
|
-
blockPriceUsage: number;
|
|
243
|
-
reserved: Array<number>;
|
|
244
|
-
padding: Array<BN>;
|
|
245
|
-
}
|
|
246
|
-
interface PriceHeuristicFields {
|
|
247
|
-
/** Lower value of acceptable price */
|
|
248
|
-
lower: BN;
|
|
249
|
-
/** Upper value of acceptable price */
|
|
250
|
-
upper: BN;
|
|
251
|
-
/** Number of decimals of the previously defined values */
|
|
252
|
-
exp: BN;
|
|
253
|
-
}
|
|
254
|
-
interface ScopeConfigurationFields {
|
|
255
|
-
/** Pubkey of the scope price feed (disabled if `null` or `default`) */
|
|
256
|
-
priceFeed: PublicKey;
|
|
257
|
-
/** This is the scope_id price chain that results in a price for the token */
|
|
258
|
-
priceChain: Array<number>;
|
|
259
|
-
/** This is the scope_id price chain for the twap */
|
|
260
|
-
twapChain: Array<number>;
|
|
261
|
-
}
|
|
262
|
-
interface SwitchboardConfigurationFields {
|
|
263
|
-
/** Pubkey of the base price feed (disabled if `null` or `default`) */
|
|
264
|
-
priceAggregator: PublicKey;
|
|
265
|
-
twapAggregator: PublicKey;
|
|
266
|
-
}
|
|
267
|
-
interface PythConfigurationFields {
|
|
268
|
-
/** Pubkey of the base price feed (disabled if `null` or `default`) */
|
|
269
|
-
price: PublicKey;
|
|
270
|
-
}
|
|
271
|
-
interface WithdrawalCapsFields {
|
|
272
|
-
configCapacity: BN;
|
|
273
|
-
currentTotal: BN;
|
|
274
|
-
lastIntervalStartTimestamp: BN;
|
|
275
|
-
configIntervalLengthSeconds: BN;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
interface ReserveJSON {
|
|
279
|
-
/** Version of the reserve */
|
|
280
|
-
version: string;
|
|
281
|
-
/** Last slot when supply and rates updated */
|
|
282
|
-
lastUpdate: LastUpdateJSON;
|
|
283
|
-
/** Lending market address */
|
|
284
|
-
lendingMarket: string;
|
|
285
|
-
farmCollateral: string;
|
|
286
|
-
farmDebt: string;
|
|
287
|
-
/** Reserve liquidity */
|
|
288
|
-
liquidity: ReserveLiquidityJSON;
|
|
289
|
-
reserveLiquidityPadding: Array<string>;
|
|
290
|
-
/** Reserve collateral */
|
|
291
|
-
collateral: ReserveCollateralJSON;
|
|
292
|
-
reserveCollateralPadding: Array<string>;
|
|
293
|
-
/** Reserve configuration values */
|
|
294
|
-
config: ReserveConfigJSON;
|
|
295
|
-
configPadding: Array<string>;
|
|
296
|
-
borrowedAmountOutsideElevationGroup: string;
|
|
297
|
-
/**
|
|
298
|
-
* Amount of token borrowed in lamport of debt asset in the given
|
|
299
|
-
* elevation group when this reserve is part of the collaterals.
|
|
300
|
-
*/
|
|
301
|
-
borrowedAmountsAgainstThisReserveInElevationGroups: Array<string>;
|
|
302
|
-
padding: Array<string>;
|
|
303
|
-
}
|
|
304
|
-
interface ReserveLiquidityJSON {
|
|
305
|
-
/** Reserve liquidity mint address */
|
|
306
|
-
mintPubkey: string;
|
|
307
|
-
/** Reserve liquidity supply address */
|
|
308
|
-
supplyVault: string;
|
|
309
|
-
/** Reserve liquidity fee collection address */
|
|
310
|
-
feeVault: string;
|
|
311
|
-
/** Reserve liquidity available */
|
|
312
|
-
availableAmount: string;
|
|
313
|
-
/** Reserve liquidity borrowed (scaled fraction) */
|
|
314
|
-
borrowedAmountSf: string;
|
|
315
|
-
/** Reserve liquidity market price in quote currency (scaled fraction) */
|
|
316
|
-
marketPriceSf: string;
|
|
317
|
-
/** Unix timestamp of the market price (from the oracle) */
|
|
318
|
-
marketPriceLastUpdatedTs: string;
|
|
319
|
-
/** Reserve liquidity mint decimals */
|
|
320
|
-
mintDecimals: string;
|
|
321
|
-
/**
|
|
322
|
-
* Timestamp when the last refresh reserve detected that the liquidity amount is above the deposit cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
|
|
323
|
-
* If the threshold is not crossed, then the timestamp is set to 0
|
|
324
|
-
*/
|
|
325
|
-
depositLimitCrossedTimestamp: string;
|
|
326
|
-
/**
|
|
327
|
-
* Timestamp when the last refresh reserve detected that the borrowed amount is above the borrow cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
|
|
328
|
-
* If the threshold is not crossed, then the timestamp is set to 0
|
|
329
|
-
*/
|
|
330
|
-
borrowLimitCrossedTimestamp: string;
|
|
331
|
-
/** Reserve liquidity cumulative borrow rate (scaled fraction) */
|
|
332
|
-
cumulativeBorrowRateBsf: BigFractionBytesJSON;
|
|
333
|
-
/** Reserve cumulative protocol fees (scaled fraction) */
|
|
334
|
-
accumulatedProtocolFeesSf: string;
|
|
335
|
-
/** Reserve cumulative referrer fees (scaled fraction) */
|
|
336
|
-
accumulatedReferrerFeesSf: string;
|
|
337
|
-
/** Reserve pending referrer fees, to be claimed in refresh_obligation by referrer or protocol (scaled fraction) */
|
|
338
|
-
pendingReferrerFeesSf: string;
|
|
339
|
-
/** Reserve referrer fee absolute rate calculated at each refresh_reserve operation (scaled fraction) */
|
|
340
|
-
absoluteReferralRateSf: string;
|
|
341
|
-
/** Token program of the liquidity mint */
|
|
342
|
-
tokenProgram: string;
|
|
343
|
-
padding2: Array<string>;
|
|
344
|
-
padding3: Array<string>;
|
|
345
|
-
}
|
|
346
|
-
interface ReserveCollateralJSON {
|
|
347
|
-
/** Reserve collateral mint address */
|
|
348
|
-
mintPubkey: string;
|
|
349
|
-
/** Reserve collateral mint supply, used for exchange rate */
|
|
350
|
-
mintTotalSupply: string;
|
|
351
|
-
/** Reserve collateral supply address */
|
|
352
|
-
supplyVault: string;
|
|
353
|
-
padding1: Array<string>;
|
|
354
|
-
padding2: Array<string>;
|
|
355
|
-
}
|
|
356
|
-
interface ReserveConfigJSON {
|
|
357
|
-
/** Status of the reserve Active/Obsolete/Hidden */
|
|
358
|
-
status: number;
|
|
359
|
-
/** Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt */
|
|
360
|
-
assetTier: number;
|
|
361
|
-
/** Flat rate that goes to the host */
|
|
362
|
-
hostFixedInterestRateBps: number;
|
|
363
|
-
/**
|
|
364
|
-
* [DEPRECATED] Space that used to hold 2 fields:
|
|
365
|
-
* - Boost for side (debt or collateral)
|
|
366
|
-
* - Reward points multiplier per obligation type
|
|
367
|
-
* Can be re-used after making sure all underlying production account data is zeroed.
|
|
368
|
-
*/
|
|
369
|
-
reserved2: Array<number>;
|
|
370
|
-
/** Cut of the order execution bonus that the protocol receives, as a percentage */
|
|
371
|
-
protocolOrderExecutionFeePct: number;
|
|
372
|
-
/** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */
|
|
373
|
-
protocolTakeRatePct: number;
|
|
374
|
-
/** Cut of the liquidation bonus that the protocol receives, as a percentage */
|
|
375
|
-
protocolLiquidationFeePct: number;
|
|
376
|
-
/**
|
|
377
|
-
* Target ratio of the value of borrows to deposits, as a percentage
|
|
378
|
-
* 0 if use as collateral is disabled
|
|
379
|
-
*/
|
|
380
|
-
loanToValuePct: number;
|
|
381
|
-
/** Loan to value ratio at which an obligation can be liquidated, as percentage */
|
|
382
|
-
liquidationThresholdPct: number;
|
|
383
|
-
/** Minimum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */
|
|
384
|
-
minLiquidationBonusBps: number;
|
|
385
|
-
/** Maximum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */
|
|
386
|
-
maxLiquidationBonusBps: number;
|
|
387
|
-
/** Bad debt liquidation bonus for an undercollateralized obligation, as bps */
|
|
388
|
-
badDebtLiquidationBonusBps: number;
|
|
389
|
-
/**
|
|
390
|
-
* Time in seconds that must pass before redemptions are enabled after the deposit limit is
|
|
391
|
-
* crossed.
|
|
392
|
-
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
393
|
-
*/
|
|
394
|
-
deleveragingMarginCallPeriodSecs: string;
|
|
395
|
-
/**
|
|
396
|
-
* The rate at which the deleveraging threshold decreases, in bps per day.
|
|
397
|
-
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
398
|
-
*/
|
|
399
|
-
deleveragingThresholdDecreaseBpsPerDay: string;
|
|
400
|
-
/** Program owner fees assessed, separate from gains due to interest accrual */
|
|
401
|
-
fees: ReserveFeesJSON;
|
|
402
|
-
/** Borrow rate curve based on utilization */
|
|
403
|
-
borrowRateCurve: BorrowRateCurveJSON;
|
|
404
|
-
/** Borrow factor in percentage - used for risk adjustment */
|
|
405
|
-
borrowFactorPct: string;
|
|
406
|
-
/** Maximum deposit limit of liquidity in native units, u64::MAX for inf */
|
|
407
|
-
depositLimit: string;
|
|
408
|
-
/** Maximum amount borrowed, u64::MAX for inf, 0 to disable borrows (protected deposits) */
|
|
409
|
-
borrowLimit: string;
|
|
410
|
-
/** Token id from TokenInfos struct */
|
|
411
|
-
tokenInfo: TokenInfoJSON$1;
|
|
412
|
-
/** Deposit withdrawal caps - deposit & redeem */
|
|
413
|
-
depositWithdrawalCap: WithdrawalCapsJSON;
|
|
414
|
-
/** Debt withdrawal caps - borrow & repay */
|
|
415
|
-
debtWithdrawalCap: WithdrawalCapsJSON;
|
|
416
|
-
elevationGroups: Array<number>;
|
|
417
|
-
disableUsageAsCollOutsideEmode: number;
|
|
418
|
-
/** Utilization (in percentage) above which borrowing is blocked. 0 to disable. */
|
|
419
|
-
utilizationLimitBlockBorrowingAbovePct: number;
|
|
420
|
-
/**
|
|
421
|
-
* Whether this reserve should be subject to auto-deleveraging after deposit or borrow limit is
|
|
422
|
-
* crossed.
|
|
423
|
-
* Besides this flag, the lending market's flag also needs to be enabled (logical `AND`).
|
|
424
|
-
* **NOTE:** the manual "target LTV" deleveraging (enabled by the risk council for individual
|
|
425
|
-
* obligations) is NOT affected by this flag.
|
|
426
|
-
*/
|
|
427
|
-
autodeleverageEnabled: number;
|
|
428
|
-
reserved1: Array<number>;
|
|
429
|
-
/**
|
|
430
|
-
* Maximum amount liquidity of this reserve borrowed outside all elevation groups
|
|
431
|
-
* - u64::MAX for inf
|
|
432
|
-
* - 0 to disable borrows outside elevation groups
|
|
433
|
-
*/
|
|
434
|
-
borrowLimitOutsideElevationGroup: string;
|
|
435
|
-
/**
|
|
436
|
-
* Defines the maximum amount (in lamports of elevation group debt asset)
|
|
437
|
-
* that can be borrowed when this reserve is used as collateral.
|
|
438
|
-
* - u64::MAX for inf
|
|
439
|
-
* - 0 to disable borrows in this elevation group (expected value for the debt asset)
|
|
440
|
-
*/
|
|
441
|
-
borrowLimitAgainstThisCollateralInElevationGroup: Array<string>;
|
|
442
|
-
/**
|
|
443
|
-
* The rate at which the deleveraging-related liquidation bonus increases, in bps per day.
|
|
444
|
-
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
445
|
-
*/
|
|
446
|
-
deleveragingBonusIncreaseBpsPerDay: string;
|
|
447
|
-
}
|
|
448
|
-
interface ReserveFeesJSON {
|
|
449
|
-
/**
|
|
450
|
-
* Fee assessed on `BorrowObligationLiquidity`, as scaled fraction (60 bits fractional part)
|
|
451
|
-
* Must be between `0` and `2^60`, such that `2^60 = 1`. A few examples for
|
|
452
|
-
* clarity:
|
|
453
|
-
* 1% = (1 << 60) / 100 = 11529215046068470
|
|
454
|
-
* 0.01% (1 basis point) = 115292150460685
|
|
455
|
-
* 0.00001% (Aave borrow fee) = 115292150461
|
|
456
|
-
*/
|
|
457
|
-
borrowFeeSf: string;
|
|
458
|
-
/**
|
|
459
|
-
* Fee for flash loan, expressed as scaled fraction.
|
|
460
|
-
* 0.3% (Aave flash loan fee) = 0.003 * 2^60 = 3458764513820541
|
|
461
|
-
*/
|
|
462
|
-
flashLoanFeeSf: string;
|
|
463
|
-
/** Used for allignment */
|
|
464
|
-
padding: Array<number>;
|
|
465
|
-
}
|
|
466
|
-
interface BorrowRateCurveJSON {
|
|
467
|
-
points: Array<CurvePointJSON>;
|
|
468
|
-
}
|
|
469
|
-
interface CurvePointJSON {
|
|
470
|
-
utilizationRateBps: number;
|
|
471
|
-
borrowRateBps: number;
|
|
472
|
-
}
|
|
473
|
-
interface TokenInfoJSON$1 {
|
|
474
|
-
/** UTF-8 encoded name of the token (null-terminated) */
|
|
475
|
-
name: Array<number>;
|
|
476
|
-
/** Heuristics limits of acceptable price */
|
|
477
|
-
heuristic: PriceHeuristicJSON;
|
|
478
|
-
/** Max divergence between twap and price in bps */
|
|
479
|
-
maxTwapDivergenceBps: string;
|
|
480
|
-
maxAgePriceSeconds: string;
|
|
481
|
-
maxAgeTwapSeconds: string;
|
|
482
|
-
/** Scope price configuration */
|
|
483
|
-
scopeConfiguration: ScopeConfigurationJSON;
|
|
484
|
-
/** Switchboard configuration */
|
|
485
|
-
switchboardConfiguration: SwitchboardConfigurationJSON;
|
|
486
|
-
/** Pyth configuration */
|
|
487
|
-
pythConfiguration: PythConfigurationJSON;
|
|
488
|
-
blockPriceUsage: number;
|
|
489
|
-
reserved: Array<number>;
|
|
490
|
-
padding: Array<string>;
|
|
491
|
-
}
|
|
492
|
-
interface PriceHeuristicJSON {
|
|
493
|
-
/** Lower value of acceptable price */
|
|
494
|
-
lower: string;
|
|
495
|
-
/** Upper value of acceptable price */
|
|
496
|
-
upper: string;
|
|
497
|
-
/** Number of decimals of the previously defined values */
|
|
498
|
-
exp: string;
|
|
499
|
-
}
|
|
500
|
-
interface ScopeConfigurationJSON {
|
|
501
|
-
/** Pubkey of the scope price feed (disabled if `null` or `default`) */
|
|
502
|
-
priceFeed: string;
|
|
503
|
-
/** This is the scope_id price chain that results in a price for the token */
|
|
504
|
-
priceChain: Array<number>;
|
|
505
|
-
/** This is the scope_id price chain for the twap */
|
|
506
|
-
twapChain: Array<number>;
|
|
507
|
-
}
|
|
508
|
-
interface SwitchboardConfigurationJSON {
|
|
509
|
-
/** Pubkey of the base price feed (disabled if `null` or `default`) */
|
|
510
|
-
priceAggregator: string;
|
|
511
|
-
twapAggregator: string;
|
|
512
|
-
}
|
|
513
|
-
interface PythConfigurationJSON {
|
|
514
|
-
/** Pubkey of the base price feed (disabled if `null` or `default`) */
|
|
515
|
-
price: string;
|
|
516
|
-
}
|
|
517
|
-
interface WithdrawalCapsJSON {
|
|
518
|
-
configCapacity: string;
|
|
519
|
-
currentTotal: string;
|
|
520
|
-
lastIntervalStartTimestamp: string;
|
|
521
|
-
configIntervalLengthSeconds: string;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
interface ObligationJSON {
|
|
525
|
-
/** Version of the struct */
|
|
526
|
-
tag: string;
|
|
527
|
-
/** Last update to collateral, liquidity, or their market values */
|
|
528
|
-
lastUpdate: LastUpdateJSON;
|
|
529
|
-
/** Lending market address */
|
|
530
|
-
lendingMarket: string;
|
|
531
|
-
/** Owner authority which can borrow liquidity */
|
|
532
|
-
owner: string;
|
|
533
|
-
/** Deposited collateral for the obligation, unique by deposit reserve address */
|
|
534
|
-
deposits: Array<ObligationCollateralJSON>;
|
|
535
|
-
/** Worst LTV for the collaterals backing the loan, represented as a percentage */
|
|
536
|
-
lowestReserveDepositLiquidationLtv: string;
|
|
537
|
-
/** Market value of deposits (scaled fraction) */
|
|
538
|
-
depositedValueSf: string;
|
|
539
|
-
/** Borrowed liquidity for the obligation, unique by borrow reserve address */
|
|
540
|
-
borrows: Array<ObligationLiquidityJSON>;
|
|
541
|
-
/** Risk adjusted market value of borrows/debt (sum of price * borrowed_amount * borrow_factor) (scaled fraction) */
|
|
542
|
-
borrowFactorAdjustedDebtValueSf: string;
|
|
543
|
-
/** Market value of borrows - used for max_liquidatable_borrowed_amount (scaled fraction) */
|
|
544
|
-
borrowedAssetsMarketValueSf: string;
|
|
545
|
-
/** The maximum borrow value at the weighted average loan to value ratio (scaled fraction) */
|
|
546
|
-
allowedBorrowValueSf: string;
|
|
547
|
-
/** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */
|
|
548
|
-
unhealthyBorrowValueSf: string;
|
|
549
|
-
/** The asset tier of the deposits */
|
|
550
|
-
depositsAssetTiers: Array<number>;
|
|
551
|
-
/** The asset tier of the borrows */
|
|
552
|
-
borrowsAssetTiers: Array<number>;
|
|
553
|
-
/** The elevation group id the obligation opted into. */
|
|
554
|
-
elevationGroup: number;
|
|
555
|
-
/** The number of obsolete reserves the obligation has a deposit in */
|
|
556
|
-
numOfObsoleteDepositReserves: number;
|
|
557
|
-
/** Marked = 1 if borrows array is not empty, 0 = borrows empty */
|
|
558
|
-
hasDebt: number;
|
|
559
|
-
/** Wallet address of the referrer */
|
|
560
|
-
referrer: string;
|
|
561
|
-
/** Marked = 1 if borrowing disabled, 0 = borrowing enabled */
|
|
562
|
-
borrowingDisabled: number;
|
|
563
|
-
/**
|
|
564
|
-
* A target LTV set by the risk council when marking this obligation for deleveraging.
|
|
565
|
-
* Only effective when `deleveraging_margin_call_started_slot != 0`.
|
|
566
|
-
*/
|
|
567
|
-
autodeleverageTargetLtvPct: number;
|
|
568
|
-
/** The lowest max LTV found amongst the collateral deposits */
|
|
569
|
-
lowestReserveDepositMaxLtvPct: number;
|
|
570
|
-
/** The number of obsolete reserves the obligation has a borrow in */
|
|
571
|
-
numOfObsoleteBorrowReserves: number;
|
|
572
|
-
reserved: Array<number>;
|
|
573
|
-
highestBorrowFactorPct: string;
|
|
574
|
-
/**
|
|
575
|
-
* A timestamp at which the risk council most-recently marked this obligation for deleveraging.
|
|
576
|
-
* Zero if not currently subject to deleveraging.
|
|
577
|
-
*/
|
|
578
|
-
autodeleverageMarginCallStartedTimestamp: string;
|
|
579
|
-
/**
|
|
580
|
-
* Owner-defined, liquidator-executed orders applicable to this obligation.
|
|
581
|
-
* Typical use-cases would be a stop-loss and a take-profit (possibly co-existing).
|
|
582
|
-
*/
|
|
583
|
-
orders: Array<ObligationOrderJSON>;
|
|
584
|
-
padding3: Array<string>;
|
|
585
|
-
}
|
|
586
|
-
interface ObligationLiquidityJSON {
|
|
587
|
-
/** Reserve liquidity is borrowed from */
|
|
588
|
-
borrowReserve: string;
|
|
589
|
-
/** Borrow rate used for calculating interest (big scaled fraction) */
|
|
590
|
-
cumulativeBorrowRateBsf: BigFractionBytesJSON;
|
|
591
|
-
padding: string;
|
|
592
|
-
/** Amount of liquidity borrowed plus interest (scaled fraction) */
|
|
593
|
-
borrowedAmountSf: string;
|
|
594
|
-
/** Liquidity market value in quote currency (scaled fraction) */
|
|
595
|
-
marketValueSf: string;
|
|
596
|
-
/** Risk adjusted liquidity market value in quote currency - DEBUG ONLY - use market_value instead */
|
|
597
|
-
borrowFactorAdjustedMarketValueSf: string;
|
|
598
|
-
/** Amount of liquidity borrowed outside of an elevation group */
|
|
599
|
-
borrowedAmountOutsideElevationGroups: string;
|
|
600
|
-
padding2: Array<string>;
|
|
601
|
-
}
|
|
602
|
-
interface ObligationCollateralJSON {
|
|
603
|
-
/** Reserve collateral is deposited to */
|
|
604
|
-
depositReserve: string;
|
|
605
|
-
/** Amount of collateral deposited */
|
|
606
|
-
depositedAmount: string;
|
|
607
|
-
/** Collateral market value in quote currency (scaled fraction) */
|
|
608
|
-
marketValueSf: string;
|
|
609
|
-
/**
|
|
610
|
-
* Debt amount (lamport) taken against this collateral.
|
|
611
|
-
* (only meaningful if this obligation is part of an elevation group, otherwise 0)
|
|
612
|
-
* This is only indicative of the debt computed on the last refresh obligation.
|
|
613
|
-
* If the obligation have multiple collateral this value is the same for all of them.
|
|
614
|
-
*/
|
|
615
|
-
borrowedAmountAgainstThisCollateralInElevationGroup: string;
|
|
616
|
-
padding: Array<string>;
|
|
617
|
-
}
|
|
618
|
-
interface ObligationOrderJSON {
|
|
619
|
-
/**
|
|
620
|
-
* A threshold value used by the condition (scaled [Fraction]).
|
|
621
|
-
* The exact meaning depends on the specific [Self::condition_type].
|
|
622
|
-
*
|
|
623
|
-
* Examples:
|
|
624
|
-
* - when `condition_type == 2 (UserLtvBelow)`:
|
|
625
|
-
* then a value of `0.455` here means that the order is active only when the obligation's
|
|
626
|
-
* user LTV is less than `0.455` (i.e. < 45.5%).
|
|
627
|
-
* - when `condition_type == 3 (DebtCollPriceRatioAbove)`:
|
|
628
|
-
* assuming the obligation uses BTC collateral for SOL debt, then a value of `491.3` here
|
|
629
|
-
* means that the order is active only when the BTC-SOL price is greater than `491.3` (i.e.
|
|
630
|
-
* > 491.3 SOL per BTC).
|
|
631
|
-
*/
|
|
632
|
-
conditionThresholdSf: string;
|
|
633
|
-
/**
|
|
634
|
-
* A configuration parameter used by the opportunity (scaled [Fraction]).
|
|
635
|
-
* The exact meaning depends on the specific [Self::opportunity_type].
|
|
636
|
-
*
|
|
637
|
-
* Examples:
|
|
638
|
-
* - when `opportunity_type == 0 (DeleverageSingleDebtAmount)`:
|
|
639
|
-
* Assuming the obligation uses BTC collateral for SOL debt, then a value of `1_234_000_000`
|
|
640
|
-
* here means that a liquidator may repay up to 1234000000 lamports (i.e. 1.234 SOL) on this
|
|
641
|
-
* obligation.
|
|
642
|
-
* Note: the special value of [Fraction::MAX] is *not* allowed in this case.
|
|
643
|
-
* - when `opportunity_type == 1 (DeleverageAllDebtAmount)`:
|
|
644
|
-
* The only allowed value in this case is [Fraction::MAX] (to emphasize that *all* debt
|
|
645
|
-
* should be repaid).
|
|
646
|
-
*/
|
|
647
|
-
opportunityParameterSf: string;
|
|
648
|
-
/**
|
|
649
|
-
* A *minimum* additional fraction of collateral transferred to the liquidator, in bps.
|
|
650
|
-
*
|
|
651
|
-
* The minimum bonus is applied exactly when the [Self::condition_threshold_sf] is met, and
|
|
652
|
-
* grows linearly towards the [Self::max_execution_bonus_bps].
|
|
653
|
-
*
|
|
654
|
-
* Example: a value of `50` here means 50bps == 0.5% bonus for an "LTV > 65%" order, when
|
|
655
|
-
* executed precisely at the moment LTV exceeds 65%.
|
|
656
|
-
*/
|
|
657
|
-
minExecutionBonusBps: number;
|
|
658
|
-
/**
|
|
659
|
-
* A *maximum* additional fraction of collateral transferred to the liquidator, in bps.
|
|
660
|
-
*
|
|
661
|
-
* The maximum bonus is applied at the relevant "extreme" state of the obligation, i.e.:
|
|
662
|
-
* - for a stop-loss condition, it is a point at which the obligation becomes liquidatable;
|
|
663
|
-
* - for a take-profit condition, it is a point at which obligation has 0% LTV.
|
|
664
|
-
*
|
|
665
|
-
* In non-extreme states, the actual bonus value is interpolated linearly, starting from
|
|
666
|
-
* [Self::min_execution_bonus_bps] (at the point specified by the order's condition).
|
|
667
|
-
*
|
|
668
|
-
* Example: a value of `300` here means 300bps == 3.0% bonus for a "debt/coll price > 140"
|
|
669
|
-
* order, when executed at a higher price = 200, at which the obligation's LTV happens to
|
|
670
|
-
* be equal to its liquidation LTV.
|
|
671
|
-
*/
|
|
672
|
-
maxExecutionBonusBps: number;
|
|
673
|
-
/**
|
|
674
|
-
* Serialized [ConditionType].
|
|
675
|
-
* The entire order is void when this is zeroed (i.e. representing [ConditionType::Never]).
|
|
676
|
-
*
|
|
677
|
-
* Example: a value of `2` here denotes `UserLtvBelow` condition type. Of course, to
|
|
678
|
-
* interpret this condition, we also need to take the [Self::condition_threshold_sf] into
|
|
679
|
-
* account.
|
|
680
|
-
*/
|
|
681
|
-
conditionType: number;
|
|
682
|
-
/**
|
|
683
|
-
* Serialized [OpportunityType].
|
|
684
|
-
*
|
|
685
|
-
* Example: a value of `0` here denotes `DeleverageSingleDebtAmount` opportunity. Of course, to
|
|
686
|
-
* interpret this opportunity, we also need to take the [Self::opportunity_parameter_sf] into
|
|
687
|
-
* account.
|
|
688
|
-
*/
|
|
689
|
-
opportunityType: number;
|
|
690
|
-
/**
|
|
691
|
-
* Internal padding.
|
|
692
|
-
* The fields above take up 2+2+1+1 bytes = 48 bits, which means we need 80 bits = 10 bytes to
|
|
693
|
-
* align with `u128`s.
|
|
694
|
-
*/
|
|
695
|
-
padding1: Array<number>;
|
|
696
|
-
/**
|
|
697
|
-
* End padding.
|
|
698
|
-
* The total size of a single instance is 8*u128 = 128 bytes.
|
|
699
|
-
*/
|
|
700
|
-
padding2: Array<string>;
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
interface ObligationRaw {
|
|
704
|
-
/** Version of the struct */
|
|
705
|
-
tag: BN;
|
|
706
|
-
/** Last update to collateral, liquidity, or their market values */
|
|
707
|
-
lastUpdate: LastUpdateFields;
|
|
708
|
-
/** Lending market address */
|
|
709
|
-
lendingMarket: PublicKey;
|
|
710
|
-
/** Owner authority which can borrow liquidity */
|
|
711
|
-
owner: PublicKey;
|
|
712
|
-
/** Deposited collateral for the obligation, unique by deposit reserve address */
|
|
713
|
-
deposits: Array<ObligationCollateralFields>;
|
|
714
|
-
/** Worst LTV for the collaterals backing the loan, represented as a percentage */
|
|
715
|
-
lowestReserveDepositLiquidationLtv: BN;
|
|
716
|
-
/** Market value of deposits (scaled fraction) */
|
|
717
|
-
depositedValueSf: BN;
|
|
718
|
-
/** Borrowed liquidity for the obligation, unique by borrow reserve address */
|
|
719
|
-
borrows: Array<ObligationLiquidityFields>;
|
|
720
|
-
/** Risk adjusted market value of borrows/debt (sum of price * borrowed_amount * borrow_factor) (scaled fraction) */
|
|
721
|
-
borrowFactorAdjustedDebtValueSf: BN;
|
|
722
|
-
/** Market value of borrows - used for max_liquidatable_borrowed_amount (scaled fraction) */
|
|
723
|
-
borrowedAssetsMarketValueSf: BN;
|
|
724
|
-
/** The maximum borrow value at the weighted average loan to value ratio (scaled fraction) */
|
|
725
|
-
allowedBorrowValueSf: BN;
|
|
726
|
-
/** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */
|
|
727
|
-
unhealthyBorrowValueSf: BN;
|
|
728
|
-
/** The asset tier of the deposits */
|
|
729
|
-
depositsAssetTiers: Array<number>;
|
|
730
|
-
/** The asset tier of the borrows */
|
|
731
|
-
borrowsAssetTiers: Array<number>;
|
|
732
|
-
/** The elevation group id the obligation opted into. */
|
|
733
|
-
elevationGroup: number;
|
|
734
|
-
/** The number of obsolete reserves the obligation has a deposit in */
|
|
735
|
-
numOfObsoleteDepositReserves: number;
|
|
736
|
-
/** Marked = 1 if borrows array is not empty, 0 = borrows empty */
|
|
737
|
-
hasDebt: number;
|
|
738
|
-
/** Wallet address of the referrer */
|
|
739
|
-
referrer: PublicKey;
|
|
740
|
-
/** Marked = 1 if borrowing disabled, 0 = borrowing enabled */
|
|
741
|
-
borrowingDisabled: number;
|
|
742
|
-
/**
|
|
743
|
-
* A target LTV set by the risk council when marking this obligation for deleveraging.
|
|
744
|
-
* Only effective when `deleveraging_margin_call_started_slot != 0`.
|
|
745
|
-
*/
|
|
746
|
-
autodeleverageTargetLtvPct: number;
|
|
747
|
-
/** The lowest max LTV found amongst the collateral deposits */
|
|
748
|
-
lowestReserveDepositMaxLtvPct: number;
|
|
749
|
-
/** The number of obsolete reserves the obligation has a borrow in */
|
|
750
|
-
numOfObsoleteBorrowReserves: number;
|
|
751
|
-
reserved: Array<number>;
|
|
752
|
-
highestBorrowFactorPct: BN;
|
|
753
|
-
/**
|
|
754
|
-
* A timestamp at which the risk council most-recently marked this obligation for deleveraging.
|
|
755
|
-
* Zero if not currently subject to deleveraging.
|
|
756
|
-
*/
|
|
757
|
-
autodeleverageMarginCallStartedTimestamp: BN;
|
|
758
|
-
/**
|
|
759
|
-
* Owner-defined, liquidator-executed orders applicable to this obligation.
|
|
760
|
-
* Typical use-cases would be a stop-loss and a take-profit (possibly co-existing).
|
|
761
|
-
*/
|
|
762
|
-
orders: Array<ObligationOrderFields>;
|
|
763
|
-
padding3: Array<BN>;
|
|
764
|
-
}
|
|
765
|
-
interface ObligationCollateralFields {
|
|
766
|
-
/** Reserve collateral is deposited to */
|
|
767
|
-
depositReserve: PublicKey;
|
|
768
|
-
/** Amount of collateral deposited */
|
|
769
|
-
depositedAmount: BN;
|
|
770
|
-
/** Collateral market value in quote currency (scaled fraction) */
|
|
771
|
-
marketValueSf: BN;
|
|
772
|
-
/**
|
|
773
|
-
* Debt amount (lamport) taken against this collateral.
|
|
774
|
-
* (only meaningful if this obligation is part of an elevation group, otherwise 0)
|
|
775
|
-
* This is only indicative of the debt computed on the last refresh obligation.
|
|
776
|
-
* If the obligation have multiple collateral this value is the same for all of them.
|
|
777
|
-
*/
|
|
778
|
-
borrowedAmountAgainstThisCollateralInElevationGroup: BN;
|
|
779
|
-
padding: Array<BN>;
|
|
780
|
-
}
|
|
781
|
-
interface ObligationLiquidityFields {
|
|
782
|
-
/** Reserve liquidity is borrowed from */
|
|
783
|
-
borrowReserve: PublicKey;
|
|
784
|
-
/** Borrow rate used for calculating interest (big scaled fraction) */
|
|
785
|
-
cumulativeBorrowRateBsf: BigFractionBytesFields;
|
|
786
|
-
padding: BN;
|
|
787
|
-
/** Amount of liquidity borrowed plus interest (scaled fraction) */
|
|
788
|
-
borrowedAmountSf: BN;
|
|
789
|
-
/** Liquidity market value in quote currency (scaled fraction) */
|
|
790
|
-
marketValueSf: BN;
|
|
791
|
-
/** Risk adjusted liquidity market value in quote currency - DEBUG ONLY - use market_value instead */
|
|
792
|
-
borrowFactorAdjustedMarketValueSf: BN;
|
|
793
|
-
/** Amount of liquidity borrowed outside of an elevation group */
|
|
794
|
-
borrowedAmountOutsideElevationGroups: BN;
|
|
795
|
-
padding2: Array<BN>;
|
|
796
|
-
}
|
|
797
|
-
interface ObligationOrderFields {
|
|
798
|
-
/**
|
|
799
|
-
* A threshold value used by the condition (scaled [Fraction]).
|
|
800
|
-
* The exact meaning depends on the specific [Self::condition_type].
|
|
801
|
-
*
|
|
802
|
-
* Examples:
|
|
803
|
-
* - when `condition_type == 2 (UserLtvBelow)`:
|
|
804
|
-
* then a value of `0.455` here means that the order is active only when the obligation's
|
|
805
|
-
* user LTV is less than `0.455` (i.e. < 45.5%).
|
|
806
|
-
* - when `condition_type == 3 (DebtCollPriceRatioAbove)`:
|
|
807
|
-
* assuming the obligation uses BTC collateral for SOL debt, then a value of `491.3` here
|
|
808
|
-
* means that the order is active only when the BTC-SOL price is greater than `491.3` (i.e.
|
|
809
|
-
* > 491.3 SOL per BTC).
|
|
810
|
-
*/
|
|
811
|
-
conditionThresholdSf: BN;
|
|
812
|
-
/**
|
|
813
|
-
* A configuration parameter used by the opportunity (scaled [Fraction]).
|
|
814
|
-
* The exact meaning depends on the specific [Self::opportunity_type].
|
|
815
|
-
*
|
|
816
|
-
* Examples:
|
|
817
|
-
* - when `opportunity_type == 0 (DeleverageSingleDebtAmount)`:
|
|
818
|
-
* Assuming the obligation uses BTC collateral for SOL debt, then a value of `1_234_000_000`
|
|
819
|
-
* here means that a liquidator may repay up to 1234000000 lamports (i.e. 1.234 SOL) on this
|
|
820
|
-
* obligation.
|
|
821
|
-
* Note: the special value of [Fraction::MAX] is *not* allowed in this case.
|
|
822
|
-
* - when `opportunity_type == 1 (DeleverageAllDebtAmount)`:
|
|
823
|
-
* The only allowed value in this case is [Fraction::MAX] (to emphasize that *all* debt
|
|
824
|
-
* should be repaid).
|
|
825
|
-
*/
|
|
826
|
-
opportunityParameterSf: BN;
|
|
827
|
-
/**
|
|
828
|
-
* A *minimum* additional fraction of collateral transferred to the liquidator, in bps.
|
|
829
|
-
*
|
|
830
|
-
* The minimum bonus is applied exactly when the [Self::condition_threshold_sf] is met, and
|
|
831
|
-
* grows linearly towards the [Self::max_execution_bonus_bps].
|
|
832
|
-
*
|
|
833
|
-
* Example: a value of `50` here means 50bps == 0.5% bonus for an "LTV > 65%" order, when
|
|
834
|
-
* executed precisely at the moment LTV exceeds 65%.
|
|
835
|
-
*/
|
|
836
|
-
minExecutionBonusBps: number;
|
|
837
|
-
/**
|
|
838
|
-
* A *maximum* additional fraction of collateral transferred to the liquidator, in bps.
|
|
839
|
-
*
|
|
840
|
-
* The maximum bonus is applied at the relevant "extreme" state of the obligation, i.e.:
|
|
841
|
-
* - for a stop-loss condition, it is a point at which the obligation becomes liquidatable;
|
|
842
|
-
* - for a take-profit condition, it is a point at which obligation has 0% LTV.
|
|
843
|
-
*
|
|
844
|
-
* In non-extreme states, the actual bonus value is interpolated linearly, starting from
|
|
845
|
-
* [Self::min_execution_bonus_bps] (at the point specified by the order's condition).
|
|
846
|
-
*
|
|
847
|
-
* Example: a value of `300` here means 300bps == 3.0% bonus for a "debt/coll price > 140"
|
|
848
|
-
* order, when executed at a higher price = 200, at which the obligation's LTV happens to
|
|
849
|
-
* be equal to its liquidation LTV.
|
|
850
|
-
*/
|
|
851
|
-
maxExecutionBonusBps: number;
|
|
852
|
-
/**
|
|
853
|
-
* Serialized [ConditionType].
|
|
854
|
-
* The entire order is void when this is zeroed (i.e. representing [ConditionType::Never]).
|
|
855
|
-
*
|
|
856
|
-
* Example: a value of `2` here denotes `UserLtvBelow` condition type. Of course, to
|
|
857
|
-
* interpret this condition, we also need to take the [Self::condition_threshold_sf] into
|
|
858
|
-
* account.
|
|
859
|
-
*/
|
|
860
|
-
conditionType: number;
|
|
861
|
-
/**
|
|
862
|
-
* Serialized [OpportunityType].
|
|
863
|
-
*
|
|
864
|
-
* Example: a value of `0` here denotes `DeleverageSingleDebtAmount` opportunity. Of course, to
|
|
865
|
-
* interpret this opportunity, we also need to take the [Self::opportunity_parameter_sf] into
|
|
866
|
-
* account.
|
|
867
|
-
*/
|
|
868
|
-
opportunityType: number;
|
|
869
|
-
/**
|
|
870
|
-
* Internal padding.
|
|
871
|
-
* The fields above take up 2+2+1+1 bytes = 48 bits, which means we need 80 bits = 10 bytes to
|
|
872
|
-
* align with `u128`s.
|
|
873
|
-
*/
|
|
874
|
-
padding1: Array<number>;
|
|
875
|
-
/**
|
|
876
|
-
* End padding.
|
|
877
|
-
* The total size of a single instance is 8*u128 = 128 bytes.
|
|
878
|
-
*/
|
|
879
|
-
padding2: Array<BN>;
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
interface FarmStateRaw {
|
|
883
|
-
farmAdmin: PublicKey;
|
|
884
|
-
globalConfig: PublicKey;
|
|
885
|
-
token: TokenInfoFields;
|
|
886
|
-
rewardInfos: Array<RewardInfoFields>;
|
|
887
|
-
numRewardTokens: BN;
|
|
888
|
-
/** Data used to calculate the rewards of the user */
|
|
889
|
-
numUsers: BN;
|
|
890
|
-
/**
|
|
891
|
-
* The number of token in the `farm_vault` staked (getting rewards and fees)
|
|
892
|
-
* Set such as `farm_vault.amount = total_staked_amount + total_pending_amount`
|
|
893
|
-
*/
|
|
894
|
-
totalStakedAmount: BN;
|
|
895
|
-
farmVault: PublicKey;
|
|
896
|
-
farmVaultsAuthority: PublicKey;
|
|
897
|
-
farmVaultsAuthorityBump: BN;
|
|
898
|
-
/**
|
|
899
|
-
* Only used for delegate farms
|
|
900
|
-
* Set to `default()` otherwise
|
|
901
|
-
*/
|
|
902
|
-
delegateAuthority: PublicKey;
|
|
903
|
-
/**
|
|
904
|
-
* Raw representation of a `TimeUnit`
|
|
905
|
-
* Seconds = 0, Slots = 1
|
|
906
|
-
*/
|
|
907
|
-
timeUnit: number;
|
|
908
|
-
/**
|
|
909
|
-
* Automatically set to true in case of a full authority withdrawal
|
|
910
|
-
* If true, the farm is frozen and no more deposits are allowed
|
|
911
|
-
*/
|
|
912
|
-
isFarmFrozen: number;
|
|
913
|
-
/**
|
|
914
|
-
* Indicates if the farm is a delegate farm
|
|
915
|
-
* If true, the farm is a delegate farm and the `delegate_authority` is set*
|
|
916
|
-
*/
|
|
917
|
-
isFarmDelegated: number;
|
|
918
|
-
padding0: Array<number>;
|
|
919
|
-
/**
|
|
920
|
-
* Withdraw authority for the farm, allowed to lock deposited funds and withdraw them
|
|
921
|
-
* Set to `default()` if unused (only the depositors can withdraw their funds)
|
|
922
|
-
*/
|
|
923
|
-
withdrawAuthority: PublicKey;
|
|
924
|
-
/**
|
|
925
|
-
* Delay between a user deposit and the moment it is considered as staked
|
|
926
|
-
* 0 if unused
|
|
927
|
-
*/
|
|
928
|
-
depositWarmupPeriod: number;
|
|
929
|
-
/** Delay between a user unstake and the ability to withdraw his deposit. */
|
|
930
|
-
withdrawalCooldownPeriod: number;
|
|
931
|
-
/** Total active stake of tokens in the farm (scaled from `Decimal` representation). */
|
|
932
|
-
totalActiveStakeScaled: BN;
|
|
933
|
-
/**
|
|
934
|
-
* Total pending stake of tokens in the farm (scaled from `Decimal` representation).
|
|
935
|
-
* (can be used by `withdraw_authority` but don't get rewards or fees)
|
|
936
|
-
*/
|
|
937
|
-
totalPendingStakeScaled: BN;
|
|
938
|
-
/** Total pending amount of tokens in the farm */
|
|
939
|
-
totalPendingAmount: BN;
|
|
940
|
-
/** Slashed amounts from early withdrawal */
|
|
941
|
-
slashedAmountCurrent: BN;
|
|
942
|
-
slashedAmountCumulative: BN;
|
|
943
|
-
slashedAmountSpillAddress: PublicKey;
|
|
944
|
-
/** Locking stake */
|
|
945
|
-
lockingMode: BN;
|
|
946
|
-
lockingStartTimestamp: BN;
|
|
947
|
-
lockingDuration: BN;
|
|
948
|
-
lockingEarlyWithdrawalPenaltyBps: BN;
|
|
949
|
-
depositCapAmount: BN;
|
|
950
|
-
scopePrices: PublicKey;
|
|
951
|
-
scopeOraclePriceId: BN;
|
|
952
|
-
scopeOracleMaxAge: BN;
|
|
953
|
-
pendingFarmAdmin: PublicKey;
|
|
954
|
-
strategyId: PublicKey;
|
|
955
|
-
delegatedRpsAdmin: PublicKey;
|
|
956
|
-
vaultId: PublicKey;
|
|
957
|
-
secondDelegatedAuthority: PublicKey;
|
|
958
|
-
padding: Array<BN>;
|
|
959
|
-
}
|
|
960
|
-
interface TokenInfoFields {
|
|
961
|
-
mint: PublicKey;
|
|
962
|
-
decimals: BN;
|
|
963
|
-
tokenProgram: PublicKey;
|
|
964
|
-
padding: Array<BN>;
|
|
965
|
-
}
|
|
966
|
-
interface RewardInfoFields {
|
|
967
|
-
token: TokenInfoFields;
|
|
968
|
-
rewardsVault: PublicKey;
|
|
969
|
-
rewardsAvailable: BN;
|
|
970
|
-
rewardScheduleCurve: RewardScheduleCurveFields;
|
|
971
|
-
minClaimDurationSeconds: BN;
|
|
972
|
-
lastIssuanceTs: BN;
|
|
973
|
-
rewardsIssuedUnclaimed: BN;
|
|
974
|
-
rewardsIssuedCumulative: BN;
|
|
975
|
-
rewardPerShareScaled: BN;
|
|
976
|
-
placeholder0: BN;
|
|
977
|
-
rewardType: number;
|
|
978
|
-
rewardsPerSecondDecimals: number;
|
|
979
|
-
padding0: Array<number>;
|
|
980
|
-
padding1: Array<BN>;
|
|
981
|
-
}
|
|
982
|
-
interface RewardPerTimeUnitPointFields {
|
|
983
|
-
tsStart: BN;
|
|
984
|
-
rewardPerTimeUnit: BN;
|
|
985
|
-
}
|
|
986
|
-
interface RewardScheduleCurveFields {
|
|
987
|
-
/**
|
|
988
|
-
* This is a stepwise function, meaning that each point represents
|
|
989
|
-
* how many rewards are issued per time unit since the beginning
|
|
990
|
-
* of that point until the beginning of the next point.
|
|
991
|
-
* This is not a linear curve, there is no interpolation going on.
|
|
992
|
-
* A curve can be [[t0, 100], [t1, 50], [t2, 0]]
|
|
993
|
-
* meaning that from t0 to t1, 100 rewards are issued per time unit,
|
|
994
|
-
* from t1 to t2, 50 rewards are issued per time unit, and after t2 it stops
|
|
995
|
-
* Another curve, can be [[t0, 100], [u64::max, 0]]
|
|
996
|
-
* meaning that from t0 to u64::max, 100 rewards are issued per time unit
|
|
997
|
-
*/
|
|
998
|
-
points: Array<RewardPerTimeUnitPointFields>;
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
interface FarmStateJSON {
|
|
1002
|
-
farmAdmin: string;
|
|
1003
|
-
globalConfig: string;
|
|
1004
|
-
token: TokenInfoJSON;
|
|
1005
|
-
rewardInfos: Array<RewardInfoJSON>;
|
|
1006
|
-
numRewardTokens: string;
|
|
1007
|
-
/** Data used to calculate the rewards of the user */
|
|
1008
|
-
numUsers: string;
|
|
1009
|
-
/**
|
|
1010
|
-
* The number of token in the `farm_vault` staked (getting rewards and fees)
|
|
1011
|
-
* Set such as `farm_vault.amount = total_staked_amount + total_pending_amount`
|
|
1012
|
-
*/
|
|
1013
|
-
totalStakedAmount: string;
|
|
1014
|
-
farmVault: string;
|
|
1015
|
-
farmVaultsAuthority: string;
|
|
1016
|
-
farmVaultsAuthorityBump: string;
|
|
1017
|
-
/**
|
|
1018
|
-
* Only used for delegate farms
|
|
1019
|
-
* Set to `default()` otherwise
|
|
1020
|
-
*/
|
|
1021
|
-
delegateAuthority: string;
|
|
1022
|
-
/**
|
|
1023
|
-
* Raw representation of a `TimeUnit`
|
|
1024
|
-
* Seconds = 0, Slots = 1
|
|
1025
|
-
*/
|
|
1026
|
-
timeUnit: number;
|
|
1027
|
-
/**
|
|
1028
|
-
* Automatically set to true in case of a full authority withdrawal
|
|
1029
|
-
* If true, the farm is frozen and no more deposits are allowed
|
|
1030
|
-
*/
|
|
1031
|
-
isFarmFrozen: number;
|
|
1032
|
-
/**
|
|
1033
|
-
* Indicates if the farm is a delegate farm
|
|
1034
|
-
* If true, the farm is a delegate farm and the `delegate_authority` is set*
|
|
1035
|
-
*/
|
|
1036
|
-
isFarmDelegated: number;
|
|
1037
|
-
padding0: Array<number>;
|
|
1038
|
-
/**
|
|
1039
|
-
* Withdraw authority for the farm, allowed to lock deposited funds and withdraw them
|
|
1040
|
-
* Set to `default()` if unused (only the depositors can withdraw their funds)
|
|
1041
|
-
*/
|
|
1042
|
-
withdrawAuthority: string;
|
|
1043
|
-
/**
|
|
1044
|
-
* Delay between a user deposit and the moment it is considered as staked
|
|
1045
|
-
* 0 if unused
|
|
1046
|
-
*/
|
|
1047
|
-
depositWarmupPeriod: number;
|
|
1048
|
-
/** Delay between a user unstake and the ability to withdraw his deposit. */
|
|
1049
|
-
withdrawalCooldownPeriod: number;
|
|
1050
|
-
/** Total active stake of tokens in the farm (scaled from `Decimal` representation). */
|
|
1051
|
-
totalActiveStakeScaled: string;
|
|
1052
|
-
/**
|
|
1053
|
-
* Total pending stake of tokens in the farm (scaled from `Decimal` representation).
|
|
1054
|
-
* (can be used by `withdraw_authority` but don't get rewards or fees)
|
|
1055
|
-
*/
|
|
1056
|
-
totalPendingStakeScaled: string;
|
|
1057
|
-
/** Total pending amount of tokens in the farm */
|
|
1058
|
-
totalPendingAmount: string;
|
|
1059
|
-
/** Slashed amounts from early withdrawal */
|
|
1060
|
-
slashedAmountCurrent: string;
|
|
1061
|
-
slashedAmountCumulative: string;
|
|
1062
|
-
slashedAmountSpillAddress: string;
|
|
1063
|
-
/** Locking stake */
|
|
1064
|
-
lockingMode: string;
|
|
1065
|
-
lockingStartTimestamp: string;
|
|
1066
|
-
lockingDuration: string;
|
|
1067
|
-
lockingEarlyWithdrawalPenaltyBps: string;
|
|
1068
|
-
depositCapAmount: string;
|
|
1069
|
-
scopePrices: string;
|
|
1070
|
-
scopeOraclePriceId: string;
|
|
1071
|
-
scopeOracleMaxAge: string;
|
|
1072
|
-
pendingFarmAdmin: string;
|
|
1073
|
-
strategyId: string;
|
|
1074
|
-
delegatedRpsAdmin: string;
|
|
1075
|
-
vaultId: string;
|
|
1076
|
-
secondDelegatedAuthority: string;
|
|
1077
|
-
padding: Array<string>;
|
|
1078
|
-
}
|
|
1079
|
-
interface TokenInfoJSON {
|
|
1080
|
-
mint: string;
|
|
1081
|
-
decimals: string;
|
|
1082
|
-
tokenProgram: string;
|
|
1083
|
-
padding: Array<string>;
|
|
1084
|
-
}
|
|
1085
|
-
interface RewardInfoJSON {
|
|
1086
|
-
token: TokenInfoJSON;
|
|
1087
|
-
rewardsVault: string;
|
|
1088
|
-
rewardsAvailable: string;
|
|
1089
|
-
rewardScheduleCurve: RewardScheduleCurveJSON;
|
|
1090
|
-
minClaimDurationSeconds: string;
|
|
1091
|
-
lastIssuanceTs: string;
|
|
1092
|
-
rewardsIssuedUnclaimed: string;
|
|
1093
|
-
rewardsIssuedCumulative: string;
|
|
1094
|
-
rewardPerShareScaled: string;
|
|
1095
|
-
placeholder0: string;
|
|
1096
|
-
rewardType: number;
|
|
1097
|
-
rewardsPerSecondDecimals: number;
|
|
1098
|
-
padding0: Array<number>;
|
|
1099
|
-
padding1: Array<string>;
|
|
1100
|
-
}
|
|
1101
|
-
interface RewardScheduleCurveJSON {
|
|
1102
|
-
/**
|
|
1103
|
-
* This is a stepwise function, meaning that each point represents
|
|
1104
|
-
* how many rewards are issued per time unit since the beginning
|
|
1105
|
-
* of that point until the beginning of the next point.
|
|
1106
|
-
* This is not a linear curve, there is no interpolation going on.
|
|
1107
|
-
* A curve can be [[t0, 100], [t1, 50], [t2, 0]]
|
|
1108
|
-
* meaning that from t0 to t1, 100 rewards are issued per time unit,
|
|
1109
|
-
* from t1 to t2, 50 rewards are issued per time unit, and after t2 it stops
|
|
1110
|
-
* Another curve, can be [[t0, 100], [u64::max, 0]]
|
|
1111
|
-
* meaning that from t0 to u64::max, 100 rewards are issued per time unit
|
|
1112
|
-
*/
|
|
1113
|
-
points: Array<RewardPerTimeUnitPointJSON>;
|
|
1114
|
-
}
|
|
1115
|
-
interface RewardPerTimeUnitPointJSON {
|
|
1116
|
-
tsStart: string;
|
|
1117
|
-
rewardPerTimeUnit: string;
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
interface DriftUserStatsJSON {
|
|
1121
|
-
/** The authority for all of a users sub accounts */
|
|
1122
|
-
authority: string;
|
|
1123
|
-
/** The address that referred this user */
|
|
1124
|
-
referrer: string;
|
|
1125
|
-
/** Stats on the fees paid by the user */
|
|
1126
|
-
fees: UserFeesJSON;
|
|
1127
|
-
/**
|
|
1128
|
-
* The timestamp of the next epoch
|
|
1129
|
-
* Epoch is used to limit referrer rewards earned in single epoch
|
|
1130
|
-
*/
|
|
1131
|
-
nextEpochTs: string;
|
|
1132
|
-
/**
|
|
1133
|
-
* Rolling 30day maker volume for user
|
|
1134
|
-
* precision: QUOTE_PRECISION
|
|
1135
|
-
*/
|
|
1136
|
-
makerVolume30d: string;
|
|
1137
|
-
/**
|
|
1138
|
-
* Rolling 30day taker volume for user
|
|
1139
|
-
* precision: QUOTE_PRECISION
|
|
1140
|
-
*/
|
|
1141
|
-
takerVolume30d: string;
|
|
1142
|
-
/**
|
|
1143
|
-
* Rolling 30day filler volume for user
|
|
1144
|
-
* precision: QUOTE_PRECISION
|
|
1145
|
-
*/
|
|
1146
|
-
fillerVolume30d: string;
|
|
1147
|
-
/** last time the maker volume was updated */
|
|
1148
|
-
lastMakerVolume30dTs: string;
|
|
1149
|
-
/** last time the taker volume was updated */
|
|
1150
|
-
lastTakerVolume30dTs: string;
|
|
1151
|
-
/** last time the filler volume was updated */
|
|
1152
|
-
lastFillerVolume30dTs: string;
|
|
1153
|
-
/** The amount of tokens staked in the quote spot markets if */
|
|
1154
|
-
ifStakedQuoteAssetAmount: string;
|
|
1155
|
-
/** The current number of sub accounts */
|
|
1156
|
-
numberOfSubAccounts: number;
|
|
1157
|
-
/**
|
|
1158
|
-
* The number of sub accounts created. Can be greater than the number of sub accounts if user
|
|
1159
|
-
* has deleted sub accounts
|
|
1160
|
-
*/
|
|
1161
|
-
numberOfSubAccountsCreated: number;
|
|
1162
|
-
/**
|
|
1163
|
-
* Flags for referrer status:
|
|
1164
|
-
* First bit (LSB): 1 if user is a referrer, 0 otherwise
|
|
1165
|
-
* Second bit: 1 if user was referred, 0 otherwise
|
|
1166
|
-
*/
|
|
1167
|
-
referrerStatus: number;
|
|
1168
|
-
disableUpdatePerpBidAskTwap: boolean;
|
|
1169
|
-
padding1: Array<number>;
|
|
1170
|
-
/** whether the user has a FuelOverflow account */
|
|
1171
|
-
fuelOverflowStatus: number;
|
|
1172
|
-
/** accumulated fuel for token amounts of insurance */
|
|
1173
|
-
fuelInsurance: number;
|
|
1174
|
-
/** accumulated fuel for notional of deposits */
|
|
1175
|
-
fuelDeposits: number;
|
|
1176
|
-
/** accumulate fuel bonus for notional of borrows */
|
|
1177
|
-
fuelBorrows: number;
|
|
1178
|
-
/** accumulated fuel for perp open interest */
|
|
1179
|
-
fuelPositions: number;
|
|
1180
|
-
/** accumulate fuel bonus for taker volume */
|
|
1181
|
-
fuelTaker: number;
|
|
1182
|
-
/** accumulate fuel bonus for maker volume */
|
|
1183
|
-
fuelMaker: number;
|
|
1184
|
-
/** The amount of tokens staked in the governance spot markets if */
|
|
1185
|
-
ifStakedGovTokenAmount: string;
|
|
1186
|
-
/**
|
|
1187
|
-
* last unix ts user stats data was used to update if fuel (u32 to save space)
|
|
1188
|
-
*/
|
|
1189
|
-
lastFuelIfBonusUpdateTs: number;
|
|
1190
|
-
padding: Array<number>;
|
|
1191
|
-
}
|
|
1192
|
-
interface UserFeesJSON {
|
|
1193
|
-
/**
|
|
1194
|
-
* Total taker fee paid
|
|
1195
|
-
* precision: QUOTE_PRECISION
|
|
1196
|
-
*/
|
|
1197
|
-
totalFeePaid: string;
|
|
1198
|
-
/**
|
|
1199
|
-
* Total maker fee rebate
|
|
1200
|
-
* precision: QUOTE_PRECISION
|
|
1201
|
-
*/
|
|
1202
|
-
totalFeeRebate: string;
|
|
1203
|
-
/**
|
|
1204
|
-
* Total discount from holding token
|
|
1205
|
-
* precision: QUOTE_PRECISION
|
|
1206
|
-
*/
|
|
1207
|
-
totalTokenDiscount: string;
|
|
1208
|
-
/**
|
|
1209
|
-
* Total discount from being referred
|
|
1210
|
-
* precision: QUOTE_PRECISION
|
|
1211
|
-
*/
|
|
1212
|
-
totalRefereeDiscount: string;
|
|
1213
|
-
/**
|
|
1214
|
-
* Total reward to referrer
|
|
1215
|
-
* precision: QUOTE_PRECISION
|
|
1216
|
-
*/
|
|
1217
|
-
totalReferrerReward: string;
|
|
1218
|
-
/**
|
|
1219
|
-
* Total reward to referrer this epoch
|
|
1220
|
-
* precision: QUOTE_PRECISION
|
|
1221
|
-
*/
|
|
1222
|
-
currentEpochReferrerReward: string;
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
interface DriftUserStats {
|
|
1226
|
-
authority: PublicKey;
|
|
1227
|
-
referrer: PublicKey;
|
|
1228
|
-
fees: UserFeesFields;
|
|
1229
|
-
nextEpochTs: BN;
|
|
1230
|
-
makerVolume30d: BN;
|
|
1231
|
-
takerVolume30d: BN;
|
|
1232
|
-
fillerVolume30d: BN;
|
|
1233
|
-
lastMakerVolume30dTs: BN;
|
|
1234
|
-
lastTakerVolume30dTs: BN;
|
|
1235
|
-
lastFillerVolume30dTs: BN;
|
|
1236
|
-
ifStakedQuoteAssetAmount: BN;
|
|
1237
|
-
numberOfSubAccounts: number;
|
|
1238
|
-
numberOfSubAccountsCreated: number;
|
|
1239
|
-
referrerStatus: number;
|
|
1240
|
-
disableUpdatePerpBidAskTwap: boolean;
|
|
1241
|
-
padding1: Array<number>;
|
|
1242
|
-
fuelOverflowStatus: number;
|
|
1243
|
-
fuelInsurance: number;
|
|
1244
|
-
fuelDeposits: number;
|
|
1245
|
-
fuelBorrows: number;
|
|
1246
|
-
fuelPositions: number;
|
|
1247
|
-
fuelTaker: number;
|
|
1248
|
-
fuelMaker: number;
|
|
1249
|
-
ifStakedGovTokenAmount: BN;
|
|
1250
|
-
lastFuelIfBonusUpdateTs: number;
|
|
1251
|
-
padding: Array<number>;
|
|
1252
|
-
}
|
|
1253
|
-
interface UserFeesFields {
|
|
1254
|
-
totalFeePaid: BN;
|
|
1255
|
-
totalFeeRebate: BN;
|
|
1256
|
-
totalTokenDiscount: BN;
|
|
1257
|
-
totalRefereeDiscount: BN;
|
|
1258
|
-
totalReferrerReward: BN;
|
|
1259
|
-
currentEpochReferrerReward: BN;
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
interface DriftSpotMarketJSON {
|
|
1263
|
-
pubkey: string;
|
|
1264
|
-
oracle: string;
|
|
1265
|
-
mint: string;
|
|
1266
|
-
decimals: number;
|
|
1267
|
-
cumulativeDepositInterest: string;
|
|
1268
|
-
marketIndex: number;
|
|
1269
|
-
depositBalance: string;
|
|
1270
|
-
borrowBalance: string;
|
|
1271
|
-
cumulativeBorrowInterest: string;
|
|
1272
|
-
optimalUtilization: number;
|
|
1273
|
-
optimalBorrowRate: number;
|
|
1274
|
-
maxBorrowRate: number;
|
|
1275
|
-
minBorrowRate: number;
|
|
1276
|
-
insuranceFund: {
|
|
1277
|
-
totalFactor: number;
|
|
1278
|
-
};
|
|
1279
|
-
poolId: number;
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
|
-
interface FeeStructure {
|
|
1283
|
-
feeTiers: Array<FeeTier>;
|
|
1284
|
-
fillerRewardStructure: OrderFillerRewardStructure;
|
|
1285
|
-
referrerRewardEpochUpperBound: BN;
|
|
1286
|
-
flatFillerFee: BN;
|
|
1287
|
-
}
|
|
1288
|
-
interface FeeStructureJSON {
|
|
1289
|
-
feeTiers: Array<FeeTierJSON>;
|
|
1290
|
-
fillerRewardStructure: OrderFillerRewardStructureJSON;
|
|
1291
|
-
referrerRewardEpochUpperBound: string;
|
|
1292
|
-
flatFillerFee: string;
|
|
1293
|
-
}
|
|
1294
|
-
interface FeeTier {
|
|
1295
|
-
feeNumerator: number;
|
|
1296
|
-
feeDenominator: number;
|
|
1297
|
-
makerRebateNumerator: number;
|
|
1298
|
-
makerRebateDenominator: number;
|
|
1299
|
-
referrerRewardNumerator: number;
|
|
1300
|
-
referrerRewardDenominator: number;
|
|
1301
|
-
refereeFeeNumerator: number;
|
|
1302
|
-
refereeFeeDenominator: number;
|
|
1303
|
-
}
|
|
1304
|
-
interface FeeTierJSON {
|
|
1305
|
-
feeNumerator: number;
|
|
1306
|
-
feeDenominator: number;
|
|
1307
|
-
makerRebateNumerator: number;
|
|
1308
|
-
makerRebateDenominator: number;
|
|
1309
|
-
referrerRewardNumerator: number;
|
|
1310
|
-
referrerRewardDenominator: number;
|
|
1311
|
-
refereeFeeNumerator: number;
|
|
1312
|
-
refereeFeeDenominator: number;
|
|
1313
|
-
}
|
|
1314
|
-
interface OrderFillerRewardStructure {
|
|
1315
|
-
rewardNumerator: number;
|
|
1316
|
-
rewardDenominator: number;
|
|
1317
|
-
timeBasedRewardLowerBound: BN;
|
|
1318
|
-
}
|
|
1319
|
-
interface OrderFillerRewardStructureJSON {
|
|
1320
|
-
rewardNumerator: number;
|
|
1321
|
-
rewardDenominator: number;
|
|
1322
|
-
timeBasedRewardLowerBound: string;
|
|
1323
|
-
}
|
|
1324
|
-
interface OracleGuardRails {
|
|
1325
|
-
priceDivergence: PriceDivergenceGuardRails;
|
|
1326
|
-
validity: ValidityGuardRails;
|
|
1327
|
-
}
|
|
1328
|
-
interface OracleGuardRailsJSON {
|
|
1329
|
-
priceDivergence: PriceDivergenceGuardRailsJSON;
|
|
1330
|
-
validity: ValidityGuardRailsJSON;
|
|
1331
|
-
}
|
|
1332
|
-
interface PriceDivergenceGuardRails {
|
|
1333
|
-
markOraclePercentDivergence: BN;
|
|
1334
|
-
oracleTwap5minPercentDivergence: BN;
|
|
1335
|
-
}
|
|
1336
|
-
interface PriceDivergenceGuardRailsJSON {
|
|
1337
|
-
markOraclePercentDivergence: string;
|
|
1338
|
-
oracleTwap5minPercentDivergence: string;
|
|
1339
|
-
}
|
|
1340
|
-
interface ValidityGuardRails {
|
|
1341
|
-
slotsBeforeStaleForAmm: BN;
|
|
1342
|
-
slotsBeforeStaleForMargin: BN;
|
|
1343
|
-
confidenceIntervalMaxSize: BN;
|
|
1344
|
-
tooVolatileRatio: BN;
|
|
1345
|
-
}
|
|
1346
|
-
interface ValidityGuardRailsJSON {
|
|
1347
|
-
slotsBeforeStaleForAmm: string;
|
|
1348
|
-
slotsBeforeStaleForMargin: string;
|
|
1349
|
-
confidenceIntervalMaxSize: string;
|
|
1350
|
-
tooVolatileRatio: string;
|
|
1351
|
-
}
|
|
1352
|
-
interface HistoricalOracleData {
|
|
1353
|
-
/** precision: PRICE_PRECISION */
|
|
1354
|
-
lastOraclePrice: BN;
|
|
1355
|
-
/** precision: PRICE_PRECISION */
|
|
1356
|
-
lastOracleConf: BN;
|
|
1357
|
-
/** number of slots since last update */
|
|
1358
|
-
lastOracleDelay: BN;
|
|
1359
|
-
/** precision: PRICE_PRECISION */
|
|
1360
|
-
lastOraclePriceTwap: BN;
|
|
1361
|
-
/** precision: PRICE_PRECISION */
|
|
1362
|
-
lastOraclePriceTwap5min: BN;
|
|
1363
|
-
/** unix_timestamp of last snapshot */
|
|
1364
|
-
lastOraclePriceTwapTs: BN;
|
|
1365
|
-
}
|
|
1366
|
-
interface HistoricalOracleDataJSON {
|
|
1367
|
-
/** precision: PRICE_PRECISION */
|
|
1368
|
-
lastOraclePrice: string;
|
|
1369
|
-
/** precision: PRICE_PRECISION */
|
|
1370
|
-
lastOracleConf: string;
|
|
1371
|
-
/** number of slots since last update */
|
|
1372
|
-
lastOracleDelay: string;
|
|
1373
|
-
/** precision: PRICE_PRECISION */
|
|
1374
|
-
lastOraclePriceTwap: string;
|
|
1375
|
-
/** precision: PRICE_PRECISION */
|
|
1376
|
-
lastOraclePriceTwap5min: string;
|
|
1377
|
-
/** unix_timestamp of last snapshot */
|
|
1378
|
-
lastOraclePriceTwapTs: string;
|
|
1379
|
-
}
|
|
1380
|
-
interface HistoricalIndexData {
|
|
1381
|
-
/** precision: PRICE_PRECISION */
|
|
1382
|
-
lastIndexBidPrice: BN;
|
|
1383
|
-
/** precision: PRICE_PRECISION */
|
|
1384
|
-
lastIndexAskPrice: BN;
|
|
1385
|
-
/** precision: PRICE_PRECISION */
|
|
1386
|
-
lastIndexPriceTwap: BN;
|
|
1387
|
-
/** precision: PRICE_PRECISION */
|
|
1388
|
-
lastIndexPriceTwap5min: BN;
|
|
1389
|
-
/** unix_timestamp of last snapshot */
|
|
1390
|
-
lastIndexPriceTwapTs: BN;
|
|
1391
|
-
}
|
|
1392
|
-
interface HistoricalIndexDataJSON {
|
|
1393
|
-
/** precision: PRICE_PRECISION */
|
|
1394
|
-
lastIndexBidPrice: string;
|
|
1395
|
-
/** precision: PRICE_PRECISION */
|
|
1396
|
-
lastIndexAskPrice: string;
|
|
1397
|
-
/** precision: PRICE_PRECISION */
|
|
1398
|
-
lastIndexPriceTwap: string;
|
|
1399
|
-
/** precision: PRICE_PRECISION */
|
|
1400
|
-
lastIndexPriceTwap5min: string;
|
|
1401
|
-
/** unix_timestamp of last snapshot */
|
|
1402
|
-
lastIndexPriceTwapTs: string;
|
|
1403
|
-
}
|
|
1404
|
-
interface PoolBalance {
|
|
1405
|
-
/**
|
|
1406
|
-
* To get the pool's token amount, you must multiply the scaled balance by the market's cumulative
|
|
1407
|
-
* deposit interest
|
|
1408
|
-
* precision: SPOT_BALANCE_PRECISION
|
|
1409
|
-
*/
|
|
1410
|
-
scaledBalance: BN;
|
|
1411
|
-
/** The spot market the pool is for */
|
|
1412
|
-
marketIndex: number;
|
|
1413
|
-
padding: Array<number>;
|
|
1414
|
-
}
|
|
1415
|
-
interface PoolBalanceJSON {
|
|
1416
|
-
/**
|
|
1417
|
-
* To get the pool's token amount, you must multiply the scaled balance by the market's cumulative
|
|
1418
|
-
* deposit interest
|
|
1419
|
-
* precision: SPOT_BALANCE_PRECISION
|
|
1420
|
-
*/
|
|
1421
|
-
scaledBalance: string;
|
|
1422
|
-
/** The spot market the pool is for */
|
|
1423
|
-
marketIndex: number;
|
|
1424
|
-
padding: Array<number>;
|
|
1425
|
-
}
|
|
1426
|
-
interface InsuranceFund {
|
|
1427
|
-
vault: PublicKey;
|
|
1428
|
-
totalShares: BN;
|
|
1429
|
-
userShares: BN;
|
|
1430
|
-
sharesBase: BN;
|
|
1431
|
-
unstakingPeriod: BN;
|
|
1432
|
-
lastRevenueSettleTs: BN;
|
|
1433
|
-
revenueSettlePeriod: BN;
|
|
1434
|
-
totalFactor: number;
|
|
1435
|
-
userFactor: number;
|
|
1436
|
-
}
|
|
1437
|
-
interface InsuranceFundJSON {
|
|
1438
|
-
vault: string;
|
|
1439
|
-
totalShares: string;
|
|
1440
|
-
userShares: string;
|
|
1441
|
-
sharesBase: string;
|
|
1442
|
-
unstakingPeriod: string;
|
|
1443
|
-
lastRevenueSettleTs: string;
|
|
1444
|
-
revenueSettlePeriod: string;
|
|
1445
|
-
totalFactor: number;
|
|
1446
|
-
userFactor: number;
|
|
1447
|
-
}
|
|
1448
|
-
declare enum SpotBalanceType {
|
|
1449
|
-
Deposit = "Deposit",
|
|
1450
|
-
Borrow = "Borrow"
|
|
1451
|
-
}
|
|
1452
|
-
interface SpotPosition {
|
|
1453
|
-
/**
|
|
1454
|
-
* The scaled balance of the position. To get the token amount, multiply by the cumulative deposit/borrow
|
|
1455
|
-
* interest of corresponding market.
|
|
1456
|
-
* precision: SPOT_BALANCE_PRECISION
|
|
1457
|
-
*/
|
|
1458
|
-
scaledBalance: BN;
|
|
1459
|
-
/**
|
|
1460
|
-
* How many spot bids the user has open
|
|
1461
|
-
* precision: token mint precision
|
|
1462
|
-
*/
|
|
1463
|
-
openBids: BN;
|
|
1464
|
-
/**
|
|
1465
|
-
* How many spot asks the user has open
|
|
1466
|
-
* precision: token mint precision
|
|
1467
|
-
*/
|
|
1468
|
-
openAsks: BN;
|
|
1469
|
-
/**
|
|
1470
|
-
* The cumulative deposits/borrows a user has made into a market
|
|
1471
|
-
* precision: token mint precision
|
|
1472
|
-
*/
|
|
1473
|
-
cumulativeDeposits: BN;
|
|
1474
|
-
/** The market index of the corresponding spot market */
|
|
1475
|
-
marketIndex: number;
|
|
1476
|
-
/** Whether the position is deposit or borrow */
|
|
1477
|
-
balanceType: SpotBalanceType;
|
|
1478
|
-
/** Number of open orders */
|
|
1479
|
-
openOrders: number;
|
|
1480
|
-
padding: Array<number>;
|
|
1481
|
-
}
|
|
1482
|
-
interface SpotPositionJSON {
|
|
1483
|
-
/**
|
|
1484
|
-
* The scaled balance of the position. To get the token amount, multiply by the cumulative deposit/borrow
|
|
1485
|
-
* interest of corresponding market.
|
|
1486
|
-
* precision: SPOT_BALANCE_PRECISION
|
|
1487
|
-
*/
|
|
1488
|
-
scaledBalance: string;
|
|
1489
|
-
/**
|
|
1490
|
-
* How many spot bids the user has open
|
|
1491
|
-
* precision: token mint precision
|
|
1492
|
-
*/
|
|
1493
|
-
openBids: string;
|
|
1494
|
-
/**
|
|
1495
|
-
* How many spot asks the user has open
|
|
1496
|
-
* precision: token mint precision
|
|
1497
|
-
*/
|
|
1498
|
-
openAsks: string;
|
|
1499
|
-
/**
|
|
1500
|
-
* The cumulative deposits/borrows a user has made into a market
|
|
1501
|
-
* precision: token mint precision
|
|
1502
|
-
*/
|
|
1503
|
-
cumulativeDeposits: string;
|
|
1504
|
-
/** The market index of the corresponding spot market */
|
|
1505
|
-
marketIndex: number;
|
|
1506
|
-
/** Whether the position is deposit or borrow */
|
|
1507
|
-
balanceType: SpotBalanceType;
|
|
1508
|
-
/** Number of open orders */
|
|
1509
|
-
openOrders: number;
|
|
1510
|
-
padding: Array<number>;
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
interface DriftSpotMarket {
|
|
1514
|
-
pubkey: PublicKey;
|
|
1515
|
-
oracle: PublicKey;
|
|
1516
|
-
mint: PublicKey;
|
|
1517
|
-
decimals: number;
|
|
1518
|
-
cumulativeDepositInterest: BN;
|
|
1519
|
-
marketIndex: number;
|
|
1520
|
-
depositBalance: BN;
|
|
1521
|
-
borrowBalance: BN;
|
|
1522
|
-
cumulativeBorrowInterest: BN;
|
|
1523
|
-
optimalUtilization: number;
|
|
1524
|
-
optimalBorrowRate: number;
|
|
1525
|
-
maxBorrowRate: number;
|
|
1526
|
-
minBorrowRate: number;
|
|
1527
|
-
insuranceFund: {
|
|
1528
|
-
totalFactor: number;
|
|
1529
|
-
};
|
|
1530
|
-
poolId: number;
|
|
1531
|
-
}
|
|
1532
|
-
declare enum DriftSpotBalanceType {
|
|
1533
|
-
DEPOSIT = "deposit",
|
|
1534
|
-
BORROW = "borrow"
|
|
1535
|
-
}
|
|
1536
|
-
declare function isSpotBalanceTypeVariant(value: DriftSpotBalanceType, variant: "deposit" | "borrow"): boolean;
|
|
1537
|
-
|
|
1538
|
-
interface DriftUserJSON {
|
|
1539
|
-
authority: string;
|
|
1540
|
-
spotPositions: Array<SpotPositionJSON>;
|
|
1541
|
-
}
|
|
1542
|
-
|
|
1543
|
-
interface DriftUser {
|
|
1544
|
-
authority: PublicKey;
|
|
1545
|
-
spotPositions: Array<SpotPosition>;
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1548
|
-
type DriftRewards = {
|
|
1549
|
-
oracle: PublicKey;
|
|
1550
|
-
marketIndex: number;
|
|
1551
|
-
spotMarket: PublicKey;
|
|
1552
|
-
mint: PublicKey;
|
|
1553
|
-
spotPosition: SpotPosition;
|
|
1554
|
-
};
|
|
1555
|
-
type DriftRewardsJSON = {
|
|
1556
|
-
oracle: string;
|
|
1557
|
-
marketIndex: number;
|
|
1558
|
-
spotMarket: string;
|
|
1559
|
-
mint: string;
|
|
1560
|
-
spotPosition: SpotPositionJSON;
|
|
1561
|
-
};
|
|
1562
|
-
|
|
1563
|
-
/**
|
|
1564
|
-
* JSON-serializable DTO for the Lending account.
|
|
1565
|
-
* PublicKey → string, BN → string.
|
|
1566
|
-
*/
|
|
1567
|
-
interface JupLendingStateJSON {
|
|
1568
|
-
pubkey: string;
|
|
1569
|
-
mint: string;
|
|
1570
|
-
fTokenMint: string;
|
|
1571
|
-
lendingId: number;
|
|
1572
|
-
decimals: number;
|
|
1573
|
-
rewardsRateModel: string;
|
|
1574
|
-
liquidityExchangePrice: string;
|
|
1575
|
-
tokenExchangePrice: string;
|
|
1576
|
-
lastUpdateTimestamp: string;
|
|
1577
|
-
tokenReservesLiquidity: string;
|
|
1578
|
-
supplyPositionOnLiquidity: string;
|
|
1579
|
-
bump?: number;
|
|
1580
|
-
}
|
|
1581
|
-
|
|
1582
|
-
/**
|
|
1583
|
-
* Curated Lending State used throughout the codebase.
|
|
1584
|
-
*
|
|
1585
|
-
* integration_acc_1 – holds cToken/fToken exchange rates.
|
|
1586
|
-
* Analogous to a Kamino Reserve or Drift SpotMarket.
|
|
1587
|
-
*/
|
|
1588
|
-
interface JupLendingState {
|
|
1589
|
-
pubkey: PublicKey;
|
|
1590
|
-
mint: PublicKey;
|
|
1591
|
-
fTokenMint: PublicKey;
|
|
1592
|
-
lendingId: number;
|
|
1593
|
-
decimals: number;
|
|
1594
|
-
rewardsRateModel: PublicKey;
|
|
1595
|
-
/** Exchange price for the underlying asset in the liquidity protocol (without rewards) */
|
|
1596
|
-
liquidityExchangePrice: BN;
|
|
1597
|
-
/** Exchange price between fToken and the underlying asset (with rewards) */
|
|
1598
|
-
tokenExchangePrice: BN;
|
|
1599
|
-
lastUpdateTimestamp: BN;
|
|
1600
|
-
tokenReservesLiquidity: PublicKey;
|
|
1601
|
-
supplyPositionOnLiquidity: PublicKey;
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
/**
|
|
1605
|
-
* Curated TokenReserve used throughout the codebase.
|
|
1606
|
-
*
|
|
1607
|
-
* Liquidity-layer reserve account for a mint. Contains supply/borrow
|
|
1608
|
-
* exchange prices, utilization, and totals.
|
|
1609
|
-
*/
|
|
1610
|
-
interface JupTokenReserve {
|
|
1611
|
-
pubkey: PublicKey;
|
|
1612
|
-
mint: PublicKey;
|
|
1613
|
-
vault: PublicKey;
|
|
1614
|
-
borrowRate: number;
|
|
1615
|
-
feeOnInterest: number;
|
|
1616
|
-
lastUtilization: number;
|
|
1617
|
-
lastUpdateTimestamp: BN;
|
|
1618
|
-
supplyExchangePrice: BN;
|
|
1619
|
-
borrowExchangePrice: BN;
|
|
1620
|
-
maxUtilization: number;
|
|
1621
|
-
totalSupplyWithInterest: BN;
|
|
1622
|
-
totalSupplyInterestFree: BN;
|
|
1623
|
-
totalBorrowWithInterest: BN;
|
|
1624
|
-
totalBorrowInterestFree: BN;
|
|
1625
|
-
totalClaimAmount: BN;
|
|
1626
|
-
interactingProtocol: PublicKey;
|
|
1627
|
-
interactingTimestamp: BN;
|
|
1628
|
-
interactingBalance: BN;
|
|
1629
|
-
}
|
|
1630
|
-
|
|
1631
|
-
/**
|
|
1632
|
-
* JSON-serializable DTO for the TokenReserve account.
|
|
1633
|
-
* PublicKey → string, BN → string.
|
|
1634
|
-
*/
|
|
1635
|
-
interface JupTokenReserveJSON {
|
|
1636
|
-
pubkey: string;
|
|
1637
|
-
mint: string;
|
|
1638
|
-
vault: string;
|
|
1639
|
-
borrowRate: number;
|
|
1640
|
-
feeOnInterest: number;
|
|
1641
|
-
lastUtilization: number;
|
|
1642
|
-
lastUpdateTimestamp: string;
|
|
1643
|
-
supplyExchangePrice: string;
|
|
1644
|
-
borrowExchangePrice: string;
|
|
1645
|
-
maxUtilization: number;
|
|
1646
|
-
totalSupplyWithInterest: string;
|
|
1647
|
-
totalSupplyInterestFree: string;
|
|
1648
|
-
totalBorrowWithInterest: string;
|
|
1649
|
-
totalBorrowInterestFree: string;
|
|
1650
|
-
totalClaimAmount: string;
|
|
1651
|
-
interactingProtocol: string;
|
|
1652
|
-
interactingTimestamp: string;
|
|
1653
|
-
interactingBalance: string;
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
|
-
/**
|
|
1657
|
-
* Curated LendingRewardsRateModel used throughout the codebase.
|
|
1658
|
-
*
|
|
1659
|
-
* Controls the rewards distribution parameters for a jup-lend market.
|
|
1660
|
-
*/
|
|
1661
|
-
interface JupLendingRewardsRateModel {
|
|
1662
|
-
pubkey: PublicKey;
|
|
1663
|
-
/** Mint address */
|
|
1664
|
-
mint: PublicKey;
|
|
1665
|
-
/** TVL below which rewards rate is 0 */
|
|
1666
|
-
startTvl: BN;
|
|
1667
|
-
/** Duration for which current rewards should run */
|
|
1668
|
-
duration: BN;
|
|
1669
|
-
/** Timestamp when current rewards got started */
|
|
1670
|
-
startTime: BN;
|
|
1671
|
-
/** Annualized reward based on input params (duration, rewardAmount) */
|
|
1672
|
-
yearlyReward: BN;
|
|
1673
|
-
/** Duration for the next rewards phase */
|
|
1674
|
-
nextDuration: BN;
|
|
1675
|
-
/** Amount of rewards for the next phase */
|
|
1676
|
-
nextRewardAmount: BN;
|
|
1677
|
-
}
|
|
1678
|
-
|
|
1679
|
-
/**
|
|
1680
|
-
* JSON-serializable DTO for the LendingRewardsRateModel account.
|
|
1681
|
-
* PublicKey → string, BN → string.
|
|
1682
|
-
*/
|
|
1683
|
-
interface JupLendingRewardsRateModelJSON {
|
|
1684
|
-
pubkey: string;
|
|
1685
|
-
mint: string;
|
|
1686
|
-
startTvl: string;
|
|
1687
|
-
duration: string;
|
|
1688
|
-
startTime: string;
|
|
1689
|
-
yearlyReward: string;
|
|
1690
|
-
nextDuration: string;
|
|
1691
|
-
nextRewardAmount: string;
|
|
1692
|
-
bump?: number;
|
|
1693
|
-
}
|
|
1694
|
-
|
|
1695
|
-
/**
|
|
1696
|
-
* Curated RateModel — identical to raw since all fields are primitives + PublicKey.
|
|
1697
|
-
*/
|
|
1698
|
-
interface JupRateModel {
|
|
1699
|
-
pubkey: PublicKey;
|
|
1700
|
-
mint: PublicKey;
|
|
1701
|
-
version: number;
|
|
1702
|
-
rateAtZero: number;
|
|
1703
|
-
kink1Utilization: number;
|
|
1704
|
-
rateAtKink1: number;
|
|
1705
|
-
rateAtMax: number;
|
|
1706
|
-
kink2Utilization: number;
|
|
1707
|
-
rateAtKink2: number;
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
/**
|
|
1711
|
-
* JSON-serializable DTO for the RateModel account.
|
|
1712
|
-
* PublicKey → string.
|
|
1713
|
-
*/
|
|
1714
|
-
interface JupRateModelJSON {
|
|
1715
|
-
pubkey: string;
|
|
1716
|
-
mint: string;
|
|
1717
|
-
version: number;
|
|
1718
|
-
rateAtZero: number;
|
|
1719
|
-
kink1Utilization: number;
|
|
1720
|
-
rateAtKink1: number;
|
|
1721
|
-
rateAtMax: number;
|
|
1722
|
-
kink2Utilization: number;
|
|
1723
|
-
rateAtKink2: number;
|
|
1724
|
-
}
|
|
1725
|
-
|
|
1726
|
-
export { type ScopeConfigurationJSON as $, type ReserveConfigFields as A, type ReserveFeesFields as B, type CurvePointFields as C, type DriftSpotMarket as D, type BorrowRateCurveFields as E, type FarmStateRaw as F, type PriceHeuristicFields as G, type HistoricalOracleData as H, type InsuranceFund as I, type JupLendingState as J, type ScopeConfigurationFields as K, type SwitchboardConfigurationFields as L, type PythConfigurationFields as M, type ReserveLiquidityJSON as N, type ObligationRaw as O, type PoolBalance as P, type ReserveCollateralJSON as Q, type ReserveRaw as R, type SpotPosition as S, type TokenInfoFields$1 as T, type ReserveConfigJSON as U, type ReserveFeesJSON as V, type WithdrawalCapsFields as W, type BorrowRateCurveJSON as X, type CurvePointJSON as Y, type TokenInfoJSON$1 as Z, type PriceHeuristicJSON as _, type DriftUser as a, type SwitchboardConfigurationJSON as a0, type PythConfigurationJSON as a1, type WithdrawalCapsJSON as a2, type ObligationLiquidityJSON as a3, type ObligationCollateralJSON as a4, type ObligationOrderJSON as a5, type ObligationCollateralFields as a6, type ObligationLiquidityFields as a7, type ObligationOrderFields as a8, type LastUpdateFields as a9, type BigFractionBytesFields as aa, type LastUpdateJSON as ab, type BigFractionBytesJSON as ac, type RewardPerTimeUnitPointFields as ad, type RewardScheduleCurveFields as ae, type RewardScheduleCurveJSON as af, type RewardPerTimeUnitPointJSON as ag, type UserFeesJSON as ah, type UserFeesFields as ai, isSpotBalanceTypeVariant as aj, type FeeTier as ak, type FeeTierJSON as al, type OrderFillerRewardStructure as am, type OrderFillerRewardStructureJSON as an, type PriceDivergenceGuardRails as ao, type PriceDivergenceGuardRailsJSON as ap, type ValidityGuardRails as aq, type ValidityGuardRailsJSON as ar, type HistoricalOracleDataJSON as as, type HistoricalIndexDataJSON as at, type PoolBalanceJSON as au, type InsuranceFundJSON as av, SpotBalanceType as aw, type SpotPositionJSON as ax, type DriftRewards as b, type DriftUserStats as c, type JupTokenReserve as d, type JupLendingRewardsRateModel as e, type JupRateModel as f, type ReserveJSON as g, type ObligationJSON as h, type FarmStateJSON as i, type DriftSpotMarketJSON as j, type DriftUserJSON as k, type DriftRewardsJSON as l, type DriftUserStatsJSON as m, type JupLendingStateJSON as n, type JupTokenReserveJSON as o, type JupLendingRewardsRateModelJSON as p, type JupRateModelJSON as q, type RewardInfoFields as r, type HistoricalIndexData as s, type FeeStructureJSON as t, type OracleGuardRailsJSON as u, type FeeStructure as v, type OracleGuardRails as w, DriftSpotBalanceType as x, type ReserveLiquidityFields as y, type ReserveCollateralFields as z };
|