@win-trader/bindings 0.0.2 → 0.0.3
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/config-manager/dist/index.d.ts +211 -310
- package/config-manager/dist/index.js +28 -142
- package/oracle/dist/index.d.ts +207 -98
- package/oracle/dist/index.js +19 -9
- package/oracle-router/dist/index.d.ts +263 -102
- package/oracle-router/dist/index.js +36 -14
- package/package.json +13 -11
- package/position-manager/dist/index.d.ts +430 -255
- package/position-manager/dist/index.js +122 -124
- package/request-router/dist/index.d.ts +521 -0
- package/request-router/dist/index.js +154 -0
- package/vault/dist/index.d.ts +281 -377
- package/vault/dist/index.js +72 -128
|
@@ -14,189 +14,37 @@ export declare const ConfigManagerError: {
|
|
|
14
14
|
3: {
|
|
15
15
|
message: string;
|
|
16
16
|
};
|
|
17
|
-
/**
|
|
18
|
-
* `set_upgrade_timelock` called with seconds below `MIN_UPGRADE_TIMELOCK`.
|
|
19
|
-
*/
|
|
20
17
|
6: {
|
|
21
18
|
message: string;
|
|
22
19
|
};
|
|
23
|
-
/**
|
|
24
|
-
* `propose_admin(caller, new_admin)` rejected because `caller == new_admin`.
|
|
25
|
-
*/
|
|
26
20
|
7: {
|
|
27
21
|
message: string;
|
|
28
22
|
};
|
|
29
|
-
/**
|
|
30
|
-
* `accept_admin` rejected — caller is not the currently pending admin.
|
|
31
|
-
*/
|
|
32
23
|
8: {
|
|
33
24
|
message: string;
|
|
34
25
|
};
|
|
35
|
-
/**
|
|
36
|
-
* `accept_admin` rejected — there is no pending admin proposal.
|
|
37
|
-
*/
|
|
38
26
|
9: {
|
|
39
27
|
message: string;
|
|
40
28
|
};
|
|
41
|
-
/**
|
|
42
|
-
* `upgrade` rejected — no `propose_upgrade` was made before commit.
|
|
43
|
-
* The two-step upgrade flow requires a prior proposal.
|
|
44
|
-
*/
|
|
45
29
|
10: {
|
|
46
30
|
message: string;
|
|
47
31
|
};
|
|
48
|
-
/**
|
|
49
|
-
* `upgrade` rejected — timelock has not elapsed yet.
|
|
50
|
-
*/
|
|
51
32
|
11: {
|
|
52
33
|
message: string;
|
|
53
34
|
};
|
|
54
|
-
/**
|
|
55
|
-
* `upgrade` rejected — `new_wasm_hash` does not match the proposed
|
|
56
|
-
* `PendingUpgrade.wasm_hash`.
|
|
57
|
-
*/
|
|
58
35
|
12: {
|
|
59
36
|
message: string;
|
|
60
37
|
};
|
|
61
|
-
/**
|
|
62
|
-
* `accept_admin` rejected — the proposal is older than
|
|
63
|
-
* `ADMIN_PROPOSAL_TTL_SECS`.
|
|
64
|
-
*/
|
|
65
38
|
13: {
|
|
66
39
|
message: string;
|
|
67
40
|
};
|
|
68
|
-
/**
|
|
69
|
-
* `set_upgrade_timelock` called with seconds above
|
|
70
|
-
* `MAX_UPGRADE_TIMELOCK_SECS`.
|
|
71
|
-
*/
|
|
72
41
|
14: {
|
|
73
42
|
message: string;
|
|
74
43
|
};
|
|
75
|
-
/**
|
|
76
|
-
* FeeSplits components (lp/dev/staker) do not sum to exactly BPS.
|
|
77
|
-
*/
|
|
78
|
-
22: {
|
|
79
|
-
message: string;
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* `min_collateral` is not strictly positive.
|
|
83
|
-
*/
|
|
84
|
-
30: {
|
|
85
|
-
message: string;
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* `max_utilization_ratio` is out of (0, BPS] range.
|
|
89
|
-
*/
|
|
90
|
-
31: {
|
|
91
|
-
message: string;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* `funding_cut_bps` exceeds `MAX_FUNDING_CUT_BPS`.
|
|
95
|
-
*/
|
|
96
|
-
32: {
|
|
97
|
-
message: string;
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* `adl_pnl_bps` is below `MIN_ADL_PNL_BPS` or above BPS.
|
|
101
|
-
*/
|
|
102
|
-
33: {
|
|
103
|
-
message: string;
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* `adl_utilization_bps` is out of (0, BPS] range.
|
|
107
|
-
*/
|
|
108
|
-
34: {
|
|
109
|
-
message: string;
|
|
110
|
-
};
|
|
111
|
-
/**
|
|
112
|
-
* `liquidation_threshold_bps` is below `MIN_LIQUIDATION_THRESHOLD_BPS`
|
|
113
|
-
* or exceeds 10% of collateral.
|
|
114
|
-
*/
|
|
115
|
-
35: {
|
|
116
|
-
message: string;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* `cooldown_duration` exceeds `MAX_COOLDOWN_DURATION`.
|
|
120
|
-
*/
|
|
121
|
-
36: {
|
|
122
|
-
message: string;
|
|
123
|
-
};
|
|
124
|
-
/**
|
|
125
|
-
* `min_position_lifetime` exceeds `MAX_MIN_POSITION_LIFETIME_SECS`.
|
|
126
|
-
*/
|
|
127
|
-
37: {
|
|
128
|
-
message: string;
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* A BorrowRateConfig rate is negative.
|
|
132
|
-
*/
|
|
133
|
-
40: {
|
|
134
|
-
message: string;
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* `optimal_utilization_bps` is out of (0, BPS] range.
|
|
138
|
-
*/
|
|
139
|
-
41: {
|
|
140
|
-
message: string;
|
|
141
|
-
};
|
|
142
|
-
/**
|
|
143
|
-
* `slope2_bps < slope1_bps` — kink curve must be non-decreasing.
|
|
144
|
-
*/
|
|
145
|
-
42: {
|
|
146
|
-
message: string;
|
|
147
|
-
};
|
|
148
|
-
/**
|
|
149
|
-
* `slope2_bps` exceeds `MAX_SLOPE2_BPS`.
|
|
150
|
-
*/
|
|
151
|
-
43: {
|
|
152
|
-
message: string;
|
|
153
|
-
};
|
|
154
|
-
/**
|
|
155
|
-
* `open_fee_bps` exceeds `MAX_OPEN_FEE_BPS`.
|
|
156
|
-
*/
|
|
157
|
-
44: {
|
|
158
|
-
message: string;
|
|
159
|
-
};
|
|
160
|
-
/**
|
|
161
|
-
* `liquidation_bounty_bps` exceeds `MAX_LIQUIDATION_BOUNTY_BPS`.
|
|
162
|
-
*/
|
|
163
|
-
45: {
|
|
164
|
-
message: string;
|
|
165
|
-
};
|
|
166
|
-
/**
|
|
167
|
-
* `tp_sl_execution_fee` is negative or exceeds `MAX_TP_SL_EXECUTION_FEE`.
|
|
168
|
-
*/
|
|
169
|
-
46: {
|
|
170
|
-
message: string;
|
|
171
|
-
};
|
|
172
|
-
/**
|
|
173
|
-
* `base_borrow_rate_bps` exceeds `MAX_BASE_BORROW_RATE_BPS`.
|
|
174
|
-
*/
|
|
175
|
-
47: {
|
|
176
|
-
message: string;
|
|
177
|
-
};
|
|
178
|
-
/**
|
|
179
|
-
* `base_funding_rate_bps` exceeds `MAX_BASE_FUNDING_RATE_BPS`.
|
|
180
|
-
*/
|
|
181
|
-
48: {
|
|
182
|
-
message: string;
|
|
183
|
-
};
|
|
184
44
|
};
|
|
185
45
|
export type StorageKey = {
|
|
186
46
|
tag: "Initialized";
|
|
187
47
|
values: void;
|
|
188
|
-
} | {
|
|
189
|
-
tag: "FeeSplits";
|
|
190
|
-
values: void;
|
|
191
|
-
} | {
|
|
192
|
-
tag: "FeeConfig";
|
|
193
|
-
values: void;
|
|
194
|
-
} | {
|
|
195
|
-
tag: "ProtocolLimits";
|
|
196
|
-
values: void;
|
|
197
|
-
} | {
|
|
198
|
-
tag: "BorrowRateConfig";
|
|
199
|
-
values: void;
|
|
200
48
|
} | {
|
|
201
49
|
tag: "UpgradeTimelock";
|
|
202
50
|
values: void;
|
|
@@ -207,10 +55,6 @@ export type StorageKey = {
|
|
|
207
55
|
tag: "Version";
|
|
208
56
|
values: void;
|
|
209
57
|
};
|
|
210
|
-
/**
|
|
211
|
-
* Pending admin transfer awaiting `accept_admin`. The proposal timestamp
|
|
212
|
-
* bounds its lifetime to `ADMIN_PROPOSAL_TTL_SECS`.
|
|
213
|
-
*/
|
|
214
58
|
export interface PendingAdminProposal {
|
|
215
59
|
admin: string;
|
|
216
60
|
proposed_at: u64;
|
|
@@ -315,105 +159,210 @@ export type OwnableStorageKey = {
|
|
|
315
159
|
values: void;
|
|
316
160
|
};
|
|
317
161
|
/**
|
|
318
|
-
*
|
|
162
|
+
* Authoritative per-market state: the side aggregates, the funding indices,
|
|
163
|
+
* the current funding flows, and the market configuration.
|
|
164
|
+
*
|
|
165
|
+
* Soroban limits UDT field names to 30 characters, so where a doc glossary
|
|
166
|
+
* term is longer the field drops the redundant qualifier and its doc
|
|
167
|
+
* comment carries the full term (e.g. `receiver_backed_index_long` is the
|
|
168
|
+
* doc's `receiver_backed_payer_index` for the long side).
|
|
319
169
|
*/
|
|
320
|
-
export interface
|
|
170
|
+
export interface Market {
|
|
171
|
+
config: MarketConfig;
|
|
321
172
|
/**
|
|
322
|
-
*
|
|
173
|
+
* `INDEX_PRECISION`-scaled bps/day payer rate for the current interval.
|
|
323
174
|
*/
|
|
324
|
-
|
|
175
|
+
current_payer_rate: i128;
|
|
176
|
+
current_payer_side: PayerSide;
|
|
177
|
+
last_funding_checkpoint: u64;
|
|
178
|
+
long: MarketSide;
|
|
325
179
|
/**
|
|
326
|
-
*
|
|
180
|
+
* Cumulative payer fee per unit of dominant-side size that is LP
|
|
181
|
+
* revenue on collection (§8.2).
|
|
327
182
|
*/
|
|
328
|
-
|
|
183
|
+
lp_backed_index_long: i128;
|
|
184
|
+
lp_backed_index_short: i128;
|
|
329
185
|
/**
|
|
330
|
-
*
|
|
186
|
+
* LP-allocated remainder of the payer flow, cash/second at
|
|
187
|
+
* `INDEX_PRECISION` (§8.1).
|
|
331
188
|
*/
|
|
332
|
-
|
|
189
|
+
lp_flow_per_second: i128;
|
|
190
|
+
lp_payer_remainder: i128;
|
|
333
191
|
/**
|
|
334
|
-
*
|
|
192
|
+
* Cumulative payer fee per unit of dominant-side size whose collection
|
|
193
|
+
* restores cash backing an already-accrued receiver claim (§8.2).
|
|
335
194
|
*/
|
|
336
|
-
|
|
195
|
+
receiver_backed_index_long: i128;
|
|
196
|
+
receiver_backed_index_short: i128;
|
|
337
197
|
/**
|
|
338
|
-
*
|
|
198
|
+
* Receiver-allocated share of the payer flow, cash/second at
|
|
199
|
+
* `INDEX_PRECISION` (§8.1).
|
|
339
200
|
*/
|
|
340
|
-
|
|
201
|
+
receiver_flow_per_second: i128;
|
|
202
|
+
receiver_flow_remainder: i128;
|
|
341
203
|
/**
|
|
342
|
-
*
|
|
204
|
+
* Cumulative funding credit per unit of light-side size (§8.2).
|
|
343
205
|
*/
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
* Stop-loss price (scaled by 1e7). 0 = not set.
|
|
355
|
-
*/
|
|
356
|
-
stop_loss: i128;
|
|
357
|
-
/**
|
|
358
|
-
* Take-profit price (scaled by 1e7). 0 = not set.
|
|
359
|
-
*/
|
|
360
|
-
take_profit: i128;
|
|
206
|
+
receiver_index_long: i128;
|
|
207
|
+
receiver_index_remainder: i128;
|
|
208
|
+
receiver_index_short: i128;
|
|
209
|
+
receiver_payer_remainder: i128;
|
|
210
|
+
short: MarketSide;
|
|
211
|
+
}
|
|
212
|
+
export interface LpConfig {
|
|
213
|
+
lp_request_delay: u64;
|
|
214
|
+
max_withdraw_utilization_bps: u32;
|
|
215
|
+
min_deposit_nav_factor_bps: u32;
|
|
361
216
|
}
|
|
362
217
|
/**
|
|
363
|
-
*
|
|
218
|
+
* Represents a single trader's open leveraged position.
|
|
364
219
|
*/
|
|
365
|
-
export interface
|
|
220
|
+
export interface Position {
|
|
366
221
|
/**
|
|
367
|
-
*
|
|
222
|
+
* Asset units at `PRICE_PRECISION`.
|
|
368
223
|
*/
|
|
369
|
-
|
|
224
|
+
base_exposure: i128;
|
|
225
|
+
borrow_debt: i128;
|
|
370
226
|
/**
|
|
371
|
-
*
|
|
227
|
+
* Cash owned by an optional-order executor.
|
|
372
228
|
*/
|
|
373
|
-
|
|
229
|
+
execution_budget: i128;
|
|
230
|
+
funding_paid_to_lps_debt: i128;
|
|
231
|
+
funding_paid_to_receivers_debt: i128;
|
|
232
|
+
funding_received_debt: i128;
|
|
233
|
+
id: u64;
|
|
234
|
+
is_long: boolean;
|
|
235
|
+
last_increased_time: u64;
|
|
236
|
+
market: string;
|
|
237
|
+
owner: string;
|
|
374
238
|
/**
|
|
375
|
-
*
|
|
239
|
+
* Fixed gross capacity assigned when risk opens.
|
|
376
240
|
*/
|
|
377
|
-
|
|
241
|
+
risk_units: i128;
|
|
378
242
|
/**
|
|
379
|
-
*
|
|
243
|
+
* USD notional at `PRICE_PRECISION`.
|
|
380
244
|
*/
|
|
381
|
-
|
|
245
|
+
size: i128;
|
|
382
246
|
/**
|
|
383
|
-
*
|
|
247
|
+
* Trigger price for the optional stop-loss order; `0` = none.
|
|
384
248
|
*/
|
|
385
|
-
|
|
249
|
+
stop_loss: i128;
|
|
386
250
|
/**
|
|
387
|
-
*
|
|
251
|
+
* Trader-owned collateral recorded in contract state (the doc's
|
|
252
|
+
* "stored collateral"). Effective collateral — stored collateral after
|
|
253
|
+
* pending fees and funding credits — is always derived, never stored.
|
|
388
254
|
*/
|
|
389
|
-
|
|
255
|
+
stored_collateral: i128;
|
|
390
256
|
/**
|
|
391
|
-
*
|
|
257
|
+
* Trigger price for the optional take-profit order; `0` = none.
|
|
392
258
|
*/
|
|
393
|
-
|
|
259
|
+
take_profit: i128;
|
|
260
|
+
}
|
|
261
|
+
export interface LpRequest {
|
|
262
|
+
amount: i128;
|
|
263
|
+
execute_after: u64;
|
|
264
|
+
id: u64;
|
|
265
|
+
kind: LpRequestKind;
|
|
266
|
+
owner: string;
|
|
267
|
+
request_time: u64;
|
|
268
|
+
status: LpRequestStatus;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Which side currently pays funding (§8.1: the side with more base
|
|
272
|
+
* exposure). `None` when the market is balanced or empty.
|
|
273
|
+
*/
|
|
274
|
+
export type PayerSide = {
|
|
275
|
+
tag: "None";
|
|
276
|
+
values: void;
|
|
277
|
+
} | {
|
|
278
|
+
tag: "Long";
|
|
279
|
+
values: void;
|
|
280
|
+
} | {
|
|
281
|
+
tag: "Short";
|
|
282
|
+
values: void;
|
|
283
|
+
};
|
|
284
|
+
export type RiskState = {
|
|
285
|
+
tag: "Normal";
|
|
286
|
+
values: void;
|
|
287
|
+
} | {
|
|
288
|
+
tag: "Warning";
|
|
289
|
+
values: void;
|
|
290
|
+
} | {
|
|
291
|
+
tag: "Adl";
|
|
292
|
+
values: void;
|
|
293
|
+
} | {
|
|
294
|
+
tag: "HardCap";
|
|
295
|
+
values: void;
|
|
296
|
+
};
|
|
297
|
+
export interface MarketSide {
|
|
298
|
+
base_exposure: i128;
|
|
299
|
+
risk_state: RiskState;
|
|
300
|
+
risk_units: i128;
|
|
301
|
+
size_open_interest: i128;
|
|
302
|
+
stored_collateral_total: i128;
|
|
303
|
+
}
|
|
304
|
+
export interface RoundPrice {
|
|
305
|
+
price: i128;
|
|
306
|
+
symbol: string;
|
|
307
|
+
}
|
|
308
|
+
export interface OracleRound {
|
|
309
|
+
id: u64;
|
|
310
|
+
previous_id: u64;
|
|
311
|
+
previous_timestamp: u64;
|
|
312
|
+
prices: Array<RoundPrice>;
|
|
313
|
+
timestamp: u64;
|
|
314
|
+
}
|
|
315
|
+
export interface GlobalConfig {
|
|
316
|
+
base_borrow_rate_bps_day: i128;
|
|
317
|
+
hard_cap_factor_limit_bps: u32;
|
|
318
|
+
lp_revenue_share_bps: u32;
|
|
319
|
+
max_active_markets: u32;
|
|
320
|
+
max_adl_reward: i128;
|
|
321
|
+
max_insolvent_touch_reward: i128;
|
|
322
|
+
max_variable_borrow_bps_day: i128;
|
|
323
|
+
min_collateral: i128;
|
|
324
|
+
min_position_lifetime: u64;
|
|
325
|
+
risk_capacity_limit_bps: u32;
|
|
326
|
+
risk_keeper_revenue_share_bps: u32;
|
|
327
|
+
}
|
|
328
|
+
export interface MarketConfig {
|
|
329
|
+
adl_pnl_factor_bps: u32;
|
|
330
|
+
adl_reward_bps: u32;
|
|
331
|
+
hard_cap_pnl_factor_bps: u32;
|
|
332
|
+
liquidation_reward_bps: u32;
|
|
333
|
+
maintenance_margin_bps: u32;
|
|
334
|
+
market_risk_factor_bps: u32;
|
|
335
|
+
max_funding_rate_bps_day: i128;
|
|
336
|
+
max_long_base_exposure: i128;
|
|
337
|
+
max_long_size_open_interest: i128;
|
|
338
|
+
max_short_base_exposure: i128;
|
|
339
|
+
max_short_size_open_interest: i128;
|
|
340
|
+
open_fee_high_bps: u32;
|
|
341
|
+
open_fee_low_bps: u32;
|
|
342
|
+
recovery_pnl_factor_bps: u32;
|
|
343
|
+
warning_pnl_factor_bps: u32;
|
|
394
344
|
}
|
|
395
345
|
/**
|
|
396
346
|
* Global safety thresholds for price validation.
|
|
397
347
|
*/
|
|
398
348
|
export interface OracleConfig {
|
|
399
349
|
/**
|
|
400
|
-
* How long a cached aggregated price remains valid
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
* source price and serve stale data).
|
|
350
|
+
* How long a cached aggregated price remains valid after the router
|
|
351
|
+
* fetch (in seconds). A cache hit also requires every source timestamp
|
|
352
|
+
* used for the cached median to remain within `staleness_threshold`.
|
|
353
|
+
* Must be > 0 and <= `staleness_threshold`.
|
|
405
354
|
*/
|
|
406
355
|
cache_duration: u64;
|
|
407
356
|
/**
|
|
408
357
|
* Maximum allowed spread between oracle sources in basis points
|
|
409
|
-
* (e.g., 100 = 1%). Bounded at `
|
|
358
|
+
* (e.g., 100 = 1%). Bounded at `crate::constants::MAX_DEVIATION_BPS_CEILING`.
|
|
410
359
|
*/
|
|
411
360
|
max_deviation_bps: i128;
|
|
412
361
|
/**
|
|
413
362
|
* Minimum number of source responses that must agree within
|
|
414
363
|
* `max_deviation_bps` for OracleRouter to return a price. Floored at
|
|
415
|
-
* `
|
|
416
|
-
* `
|
|
364
|
+
* `crate::constants::MIN_REQUIRED_SOURCES_FLOOR`, ceilinged at
|
|
365
|
+
* `crate::constants::MAX_ORACLE_SOURCES`.
|
|
417
366
|
*/
|
|
418
367
|
min_required_sources: u32;
|
|
419
368
|
/**
|
|
@@ -422,6 +371,13 @@ export interface OracleConfig {
|
|
|
422
371
|
*/
|
|
423
372
|
staleness_threshold: u64;
|
|
424
373
|
}
|
|
374
|
+
export type LpRequestKind = {
|
|
375
|
+
tag: "Deposit";
|
|
376
|
+
values: void;
|
|
377
|
+
} | {
|
|
378
|
+
tag: "Withdrawal";
|
|
379
|
+
values: void;
|
|
380
|
+
};
|
|
425
381
|
/**
|
|
426
382
|
* Data required during a WASM migration. Single definition for all contracts.
|
|
427
383
|
*/
|
|
@@ -431,15 +387,54 @@ export interface MigrationData {
|
|
|
431
387
|
/**
|
|
432
388
|
* Pending WASM upgrade — set by `propose_upgrade`, consumed by `upgrade`
|
|
433
389
|
* (cleared atomically on a successful install), or cleared by `cancel_upgrade`.
|
|
434
|
-
* Single shape across every protocol contract
|
|
390
|
+
* Single shape across every protocol contract. Contracts store it at
|
|
435
391
|
* the shared `pending_upgrade` Symbol key in their own instance storage (see
|
|
436
|
-
* `
|
|
392
|
+
* `crate::upgrade::pending_upgrade_key`). `upgrade` refuses to install
|
|
437
393
|
* unless `pending.wasm_hash` matches the supplied hash and `now >= eta`.
|
|
438
394
|
*/
|
|
439
395
|
export interface PendingUpgrade {
|
|
440
396
|
eta: u64;
|
|
441
397
|
wasm_hash: Buffer;
|
|
442
398
|
}
|
|
399
|
+
export type LpRequestStatus = {
|
|
400
|
+
tag: "Pending";
|
|
401
|
+
values: void;
|
|
402
|
+
} | {
|
|
403
|
+
tag: "Settled";
|
|
404
|
+
values: void;
|
|
405
|
+
} | {
|
|
406
|
+
tag: "Failed";
|
|
407
|
+
values: void;
|
|
408
|
+
} | {
|
|
409
|
+
tag: "Expired";
|
|
410
|
+
values: void;
|
|
411
|
+
};
|
|
412
|
+
export interface SettlementResult {
|
|
413
|
+
/**
|
|
414
|
+
* Shares minted for a deposit or assets paid for a withdrawal.
|
|
415
|
+
*/
|
|
416
|
+
amount: i128;
|
|
417
|
+
status: SettlementStatus;
|
|
418
|
+
}
|
|
419
|
+
export type SettlementStatus = {
|
|
420
|
+
tag: "Settled";
|
|
421
|
+
values: void;
|
|
422
|
+
} | {
|
|
423
|
+
tag: "Failed";
|
|
424
|
+
values: void;
|
|
425
|
+
};
|
|
426
|
+
export interface AccountingSnapshot {
|
|
427
|
+
cash_lp_equity: i128;
|
|
428
|
+
cash_shortfall: i128;
|
|
429
|
+
free_lp_capital: i128;
|
|
430
|
+
lp_blocked_side_count: u32;
|
|
431
|
+
non_lp_claims: i128;
|
|
432
|
+
open_position_count: u64;
|
|
433
|
+
physical_cash: i128;
|
|
434
|
+
required_risk_backing: i128;
|
|
435
|
+
total_risk_units: i128;
|
|
436
|
+
vault_nav: i128;
|
|
437
|
+
}
|
|
443
438
|
export declare const UpgradeableError: {
|
|
444
439
|
/**
|
|
445
440
|
* When migration is attempted but not allowed due to upgrade state.
|
|
@@ -546,54 +541,12 @@ export type PausableStorageKey = {
|
|
|
546
541
|
tag: "Paused";
|
|
547
542
|
values: void;
|
|
548
543
|
};
|
|
549
|
-
/**
|
|
550
|
-
* Execution-bounty and open-fee parameters charged to traders.
|
|
551
|
-
* `open_fee_bps` and `liquidation_bounty_bps` are in basis points;
|
|
552
|
-
* `tp_sl_execution_fee` is a flat USDC amount at PRECISION scale.
|
|
553
|
-
*/
|
|
554
|
-
export interface FeeConfig {
|
|
555
|
-
liquidation_bounty_bps: u32;
|
|
556
|
-
open_fee_bps: u32;
|
|
557
|
-
tp_sl_execution_fee: i128;
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* Defines how protocol revenue is split between parties.
|
|
561
|
-
* All values are in basis points (bps). Must sum to 10_000.
|
|
562
|
-
*/
|
|
563
|
-
export interface FeeSplits {
|
|
564
|
-
dev_bps: u32;
|
|
565
|
-
lp_bps: u32;
|
|
566
|
-
staker_bps: u32;
|
|
567
|
-
}
|
|
568
|
-
/**
|
|
569
|
-
* Global protocol risk and timing parameters.
|
|
570
|
-
*/
|
|
571
|
-
export interface ProtocolLimits {
|
|
572
|
-
adl_pnl_bps: u32;
|
|
573
|
-
adl_utilization_bps: u32;
|
|
574
|
-
cooldown_duration: u64;
|
|
575
|
-
funding_cut_bps: u32;
|
|
576
|
-
liquidation_threshold_bps: u32;
|
|
577
|
-
max_utilization_ratio: i128;
|
|
578
|
-
min_collateral: i128;
|
|
579
|
-
min_position_lifetime: u64;
|
|
580
|
-
}
|
|
581
|
-
/**
|
|
582
|
-
* Borrow rate kink curve and funding rate parameters (all in basis points).
|
|
583
|
-
*/
|
|
584
|
-
export interface BorrowRateConfig {
|
|
585
|
-
base_borrow_rate_bps: i128;
|
|
586
|
-
base_funding_rate_bps: i128;
|
|
587
|
-
optimal_utilization_bps: i128;
|
|
588
|
-
slope1_bps: i128;
|
|
589
|
-
slope2_bps: i128;
|
|
590
|
-
}
|
|
591
544
|
export interface Client {
|
|
592
545
|
/**
|
|
593
546
|
* Construct and simulate a migrate transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
594
547
|
*/
|
|
595
|
-
migrate: ({
|
|
596
|
-
|
|
548
|
+
migrate: ({ data, operator }: {
|
|
549
|
+
data: MigrationData;
|
|
597
550
|
operator: string;
|
|
598
551
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
599
552
|
/**
|
|
@@ -645,21 +598,6 @@ export interface Client {
|
|
|
645
598
|
cancel_upgrade: ({ caller }: {
|
|
646
599
|
caller: string;
|
|
647
600
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
648
|
-
/**
|
|
649
|
-
* Construct and simulate a get_fee_config transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
650
|
-
*/
|
|
651
|
-
get_fee_config: (options?: MethodOptions) => Promise<AssembledTransaction<FeeConfig>>;
|
|
652
|
-
/**
|
|
653
|
-
* Construct and simulate a get_fee_splits transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
654
|
-
*/
|
|
655
|
-
get_fee_splits: (options?: MethodOptions) => Promise<AssembledTransaction<FeeSplits>>;
|
|
656
|
-
/**
|
|
657
|
-
* Construct and simulate a set_fee_config transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
658
|
-
*/
|
|
659
|
-
set_fee_config: ({ caller, config }: {
|
|
660
|
-
caller: string;
|
|
661
|
-
config: FeeConfig;
|
|
662
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
663
601
|
/**
|
|
664
602
|
* Construct and simulate a propose_upgrade transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
665
603
|
*/
|
|
@@ -675,17 +613,6 @@ export interface Client {
|
|
|
675
613
|
* Construct and simulate a get_pending_admin transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
676
614
|
*/
|
|
677
615
|
get_pending_admin: (options?: MethodOptions) => Promise<AssembledTransaction<Option<string>>>;
|
|
678
|
-
/**
|
|
679
|
-
* Construct and simulate a update_fee_splits transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
680
|
-
*/
|
|
681
|
-
update_fee_splits: ({ caller, fee_splits }: {
|
|
682
|
-
caller: string;
|
|
683
|
-
fee_splits: FeeSplits;
|
|
684
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
685
|
-
/**
|
|
686
|
-
* Construct and simulate a get_protocol_limits transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
687
|
-
*/
|
|
688
|
-
get_protocol_limits: (options?: MethodOptions) => Promise<AssembledTransaction<ProtocolLimits>>;
|
|
689
616
|
/**
|
|
690
617
|
* Construct and simulate a get_upgrade_timelock transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
691
618
|
*/
|
|
@@ -703,31 +630,13 @@ export interface Client {
|
|
|
703
630
|
cancel_admin_proposal: ({ caller }: {
|
|
704
631
|
caller: string;
|
|
705
632
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
706
|
-
/**
|
|
707
|
-
* Construct and simulate a get_borrow_rate_config transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
708
|
-
*/
|
|
709
|
-
get_borrow_rate_config: (options?: MethodOptions) => Promise<AssembledTransaction<BorrowRateConfig>>;
|
|
710
|
-
/**
|
|
711
|
-
* Construct and simulate a update_protocol_limits transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
712
|
-
*/
|
|
713
|
-
update_protocol_limits: ({ caller, limits }: {
|
|
714
|
-
caller: string;
|
|
715
|
-
limits: ProtocolLimits;
|
|
716
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
717
|
-
/**
|
|
718
|
-
* Construct and simulate a update_borrow_rate_config transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
719
|
-
*/
|
|
720
|
-
update_borrow_rate_config: ({ caller, config }: {
|
|
721
|
-
caller: string;
|
|
722
|
-
config: BorrowRateConfig;
|
|
723
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
724
633
|
}
|
|
725
634
|
export declare class Client extends ContractClient {
|
|
726
635
|
readonly options: ContractClientOptions;
|
|
727
636
|
static deploy<T = Client>(
|
|
728
637
|
/** Constructor/Initialization Args for the contract's `__constructor` method */
|
|
729
|
-
{
|
|
730
|
-
|
|
638
|
+
{ admin }: {
|
|
639
|
+
admin: string;
|
|
731
640
|
},
|
|
732
641
|
/** Options for initializing a Client as well as for calling a method, with extras specific to deploying. */
|
|
733
642
|
options: MethodOptions & Omit<ContractClientOptions, "contractId"> & {
|
|
@@ -748,19 +657,11 @@ export declare class Client extends ContractClient {
|
|
|
748
657
|
accept_admin: (json: string) => AssembledTransaction<null>;
|
|
749
658
|
propose_admin: (json: string) => AssembledTransaction<null>;
|
|
750
659
|
cancel_upgrade: (json: string) => AssembledTransaction<null>;
|
|
751
|
-
get_fee_config: (json: string) => AssembledTransaction<FeeConfig>;
|
|
752
|
-
get_fee_splits: (json: string) => AssembledTransaction<FeeSplits>;
|
|
753
|
-
set_fee_config: (json: string) => AssembledTransaction<null>;
|
|
754
660
|
propose_upgrade: (json: string) => AssembledTransaction<null>;
|
|
755
661
|
bump_config_state: (json: string) => AssembledTransaction<null>;
|
|
756
662
|
get_pending_admin: (json: string) => AssembledTransaction<Option<string>>;
|
|
757
|
-
update_fee_splits: (json: string) => AssembledTransaction<null>;
|
|
758
|
-
get_protocol_limits: (json: string) => AssembledTransaction<ProtocolLimits>;
|
|
759
663
|
get_upgrade_timelock: (json: string) => AssembledTransaction<bigint>;
|
|
760
664
|
set_upgrade_timelock: (json: string) => AssembledTransaction<null>;
|
|
761
665
|
cancel_admin_proposal: (json: string) => AssembledTransaction<null>;
|
|
762
|
-
get_borrow_rate_config: (json: string) => AssembledTransaction<BorrowRateConfig>;
|
|
763
|
-
update_protocol_limits: (json: string) => AssembledTransaction<null>;
|
|
764
|
-
update_borrow_rate_config: (json: string) => AssembledTransaction<null>;
|
|
765
666
|
};
|
|
766
667
|
}
|