@win-trader/bindings 0.0.2 → 0.0.4
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 +226 -300
- package/config-manager/dist/index.js +28 -142
- package/mock-token/dist/index.d.ts +1 -1
- package/mock-token/dist/index.js +1 -1
- package/oracle/dist/index.d.ts +222 -88
- package/oracle/dist/index.js +19 -9
- package/oracle-router/dist/index.d.ts +278 -92
- package/oracle-router/dist/index.js +36 -14
- package/package.json +13 -11
- package/position-manager/dist/index.d.ts +441 -245
- package/position-manager/dist/index.js +122 -124
- package/request-router/dist/index.d.ts +546 -0
- package/request-router/dist/index.js +154 -0
- package/vault/dist/index.d.ts +296 -367
- package/vault/dist/index.js +72 -128
|
@@ -14,15 +14,9 @@ export declare const PositionManagerError: {
|
|
|
14
14
|
3: {
|
|
15
15
|
message: string;
|
|
16
16
|
};
|
|
17
|
-
/**
|
|
18
|
-
* New trade would push vault utilization past MaxUtilizationRatio (85%).
|
|
19
|
-
*/
|
|
20
17
|
4: {
|
|
21
18
|
message: string;
|
|
22
19
|
};
|
|
23
|
-
/**
|
|
24
|
-
* decrease_position called before MinPositionLifetime has elapsed.
|
|
25
|
-
*/
|
|
26
20
|
5: {
|
|
27
21
|
message: string;
|
|
28
22
|
};
|
|
@@ -35,271 +29,392 @@ export declare const PositionManagerError: {
|
|
|
35
29
|
8: {
|
|
36
30
|
message: string;
|
|
37
31
|
};
|
|
38
|
-
/**
|
|
39
|
-
* liquidate_position called but the position is still healthy.
|
|
40
|
-
*/
|
|
41
32
|
9: {
|
|
42
33
|
message: string;
|
|
43
34
|
};
|
|
44
|
-
/**
|
|
45
|
-
* deleverage_position called but ADL trigger conditions are not met.
|
|
46
|
-
*/
|
|
47
35
|
10: {
|
|
48
36
|
message: string;
|
|
49
37
|
};
|
|
50
|
-
/**
|
|
51
|
-
* Position leverage exceeds the per-market max leverage.
|
|
52
|
-
*/
|
|
53
38
|
11: {
|
|
54
39
|
message: string;
|
|
55
40
|
};
|
|
56
|
-
/**
|
|
57
|
-
* No max leverage configured for this market symbol.
|
|
58
|
-
*/
|
|
59
41
|
12: {
|
|
60
42
|
message: string;
|
|
61
43
|
};
|
|
62
|
-
/**
|
|
63
|
-
* execute_order called but neither TP nor SL trigger condition is met.
|
|
64
|
-
*/
|
|
65
44
|
13: {
|
|
66
45
|
message: string;
|
|
67
46
|
};
|
|
68
|
-
/**
|
|
69
|
-
* Invalid take-profit or stop-loss price for the position direction.
|
|
70
|
-
*/
|
|
71
47
|
14: {
|
|
72
48
|
message: string;
|
|
73
49
|
};
|
|
74
|
-
/**
|
|
75
|
-
* increase_position called with `is_long` opposite to the existing position's direction.
|
|
76
|
-
*/
|
|
77
50
|
15: {
|
|
78
51
|
message: string;
|
|
79
52
|
};
|
|
80
|
-
/**
|
|
81
|
-
* Collateral below the protocol's min_collateral limit.
|
|
82
|
-
*/
|
|
83
53
|
16: {
|
|
84
54
|
message: string;
|
|
85
55
|
};
|
|
86
|
-
/**
|
|
87
|
-
* ADL target position is not profitable (PnL <= 0).
|
|
88
|
-
*/
|
|
89
56
|
17: {
|
|
90
57
|
message: string;
|
|
91
58
|
};
|
|
92
|
-
/**
|
|
93
|
-
* Max leverage exceeds the absolute safety cap (200x).
|
|
94
|
-
*/
|
|
95
59
|
18: {
|
|
96
60
|
message: string;
|
|
97
61
|
};
|
|
98
|
-
/**
|
|
99
|
-
* Mark price at execution time exceeded the trader's `acceptable_price`.
|
|
100
|
-
*/
|
|
101
62
|
19: {
|
|
102
63
|
message: string;
|
|
103
64
|
};
|
|
104
|
-
/**
|
|
105
|
-
* `set_max_leverage` called with a value below `MIN_LEVERAGE`. Use
|
|
106
|
-
* `disable_market` to take a market offline instead.
|
|
107
|
-
*/
|
|
108
65
|
20: {
|
|
109
66
|
message: string;
|
|
110
67
|
};
|
|
111
68
|
/**
|
|
112
|
-
*
|
|
69
|
+
* The contract is operationally paused (distinct from a risk state).
|
|
113
70
|
*/
|
|
114
71
|
21: {
|
|
115
72
|
message: string;
|
|
116
73
|
};
|
|
117
74
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
75
|
+
* An accounting invariant broke — e.g. a negative pending fee, which
|
|
76
|
+
* means a decreasing index or corrupted debt baseline (§11.2).
|
|
120
77
|
*/
|
|
121
78
|
22: {
|
|
122
79
|
message: string;
|
|
123
80
|
};
|
|
124
81
|
/**
|
|
125
|
-
* `upgrade`
|
|
82
|
+
* `upgrade` called with no pending proposal.
|
|
126
83
|
*/
|
|
127
84
|
23: {
|
|
128
85
|
message: string;
|
|
129
86
|
};
|
|
130
87
|
/**
|
|
131
|
-
* `upgrade`
|
|
88
|
+
* `upgrade` called before the proposal's timelock eta.
|
|
132
89
|
*/
|
|
133
90
|
24: {
|
|
134
91
|
message: string;
|
|
135
92
|
};
|
|
136
93
|
/**
|
|
137
|
-
* `upgrade`
|
|
138
|
-
* `PendingUpgrade.wasm_hash`.
|
|
94
|
+
* `upgrade` called with a hash that differs from the proposal.
|
|
139
95
|
*/
|
|
140
96
|
25: {
|
|
141
97
|
message: string;
|
|
142
98
|
};
|
|
143
99
|
};
|
|
144
|
-
|
|
145
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Which collection routed revenue through the split (§13).
|
|
102
|
+
*/
|
|
103
|
+
export type FeeSource = {
|
|
104
|
+
tag: "Closing";
|
|
146
105
|
values: void;
|
|
147
106
|
} | {
|
|
148
|
-
tag: "
|
|
107
|
+
tag: "Borrow";
|
|
108
|
+
values: void;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Why a position left the book.
|
|
112
|
+
*/
|
|
113
|
+
export type CloseReason = {
|
|
114
|
+
tag: "Trader";
|
|
149
115
|
values: void;
|
|
150
116
|
} | {
|
|
151
|
-
tag: "
|
|
117
|
+
tag: "Liquidation";
|
|
152
118
|
values: void;
|
|
153
119
|
} | {
|
|
154
|
-
tag: "
|
|
120
|
+
tag: "Deleverage";
|
|
155
121
|
values: void;
|
|
156
122
|
} | {
|
|
157
|
-
tag: "
|
|
123
|
+
tag: "Order";
|
|
124
|
+
values: void;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* §5.1 global state: the five non-LP claim totals, the risk counters, and
|
|
128
|
+
* the global borrow accrual. The receiver-funding liability total is fed
|
|
129
|
+
* per-market by `checkpoint::checkpoint_market` (§8.3).
|
|
130
|
+
*/
|
|
131
|
+
export interface Ledger {
|
|
132
|
+
borrow_index: i128;
|
|
133
|
+
borrow_index_remainder: i128;
|
|
134
|
+
/**
|
|
135
|
+
* `INDEX_PRECISION`-scaled bps/day rate for the current interval.
|
|
136
|
+
*/
|
|
137
|
+
current_borrow_rate: i128;
|
|
138
|
+
execution_budget_total: i128;
|
|
139
|
+
last_global_checkpoint: u64;
|
|
140
|
+
lp_blocked_side_count: u32;
|
|
141
|
+
open_position_count: u64;
|
|
142
|
+
pending_receiver_funding_total: i128;
|
|
143
|
+
position_collateral_total: i128;
|
|
144
|
+
protocol_claimable_total: i128;
|
|
145
|
+
risk_keeper_reserve_total: i128;
|
|
146
|
+
total_risk_units: i128;
|
|
147
|
+
}
|
|
148
|
+
export type Key = {
|
|
149
|
+
tag: "ConfigManager";
|
|
158
150
|
values: void;
|
|
159
151
|
} | {
|
|
160
|
-
tag: "
|
|
152
|
+
tag: "OracleRouter";
|
|
161
153
|
values: void;
|
|
162
154
|
} | {
|
|
163
|
-
tag: "
|
|
155
|
+
tag: "Vault";
|
|
164
156
|
values: void;
|
|
165
157
|
} | {
|
|
166
|
-
tag: "
|
|
158
|
+
tag: "GlobalConfig";
|
|
167
159
|
values: void;
|
|
168
160
|
} | {
|
|
169
|
-
tag: "
|
|
170
|
-
values:
|
|
161
|
+
tag: "Initialized";
|
|
162
|
+
values: void;
|
|
171
163
|
} | {
|
|
172
|
-
tag: "
|
|
173
|
-
values:
|
|
164
|
+
tag: "Paused";
|
|
165
|
+
values: void;
|
|
174
166
|
} | {
|
|
175
|
-
tag: "
|
|
167
|
+
tag: "NextPositionId";
|
|
176
168
|
values: void;
|
|
177
169
|
} | {
|
|
178
|
-
tag: "
|
|
170
|
+
tag: "ActiveMarkets";
|
|
179
171
|
values: void;
|
|
180
172
|
} | {
|
|
181
|
-
tag: "
|
|
182
|
-
values:
|
|
173
|
+
tag: "Ledger";
|
|
174
|
+
values: void;
|
|
183
175
|
} | {
|
|
184
|
-
tag: "
|
|
185
|
-
values:
|
|
176
|
+
tag: "Version";
|
|
177
|
+
values: void;
|
|
186
178
|
} | {
|
|
187
179
|
tag: "Position";
|
|
188
|
-
values: readonly [
|
|
180
|
+
values: readonly [u64];
|
|
189
181
|
} | {
|
|
190
182
|
tag: "Market";
|
|
191
183
|
values: readonly [string];
|
|
192
184
|
} | {
|
|
193
|
-
tag: "
|
|
194
|
-
values:
|
|
185
|
+
tag: "MarketDisabled";
|
|
186
|
+
values: readonly [string];
|
|
195
187
|
};
|
|
196
188
|
/**
|
|
197
|
-
*
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
* Represents a single trader's open leveraged position.
|
|
189
|
+
* Authoritative per-market state: the side aggregates, the funding indices,
|
|
190
|
+
* the funding EMA, and the market configuration.
|
|
191
|
+
*
|
|
192
|
+
* Soroban limits UDT field names to 30 characters, so where a doc glossary
|
|
193
|
+
* term is longer the field drops the redundant qualifier and its doc
|
|
194
|
+
* comment carries the full term (e.g. `receiver_backed_index_long` is the
|
|
195
|
+
* doc's `receiver_backed_payer_index` for the long side).
|
|
205
196
|
*/
|
|
206
|
-
export interface
|
|
197
|
+
export interface Market {
|
|
198
|
+
config: MarketConfig;
|
|
199
|
+
/**
|
|
200
|
+
* `INDEX_PRECISION`-scaled bps/day payer rate as of the last refresh.
|
|
201
|
+
*/
|
|
202
|
+
current_payer_rate: i128;
|
|
203
|
+
current_payer_side: PayerSide;
|
|
204
|
+
last_funding_checkpoint: u64;
|
|
205
|
+
long: MarketSide;
|
|
207
206
|
/**
|
|
208
|
-
*
|
|
207
|
+
* Cumulative payer fee per unit of dominant-side size that is LP
|
|
208
|
+
* revenue on collection (§8.2).
|
|
209
209
|
*/
|
|
210
|
-
|
|
210
|
+
lp_backed_index_long: i128;
|
|
211
|
+
lp_backed_index_short: i128;
|
|
212
|
+
lp_payer_remainder: i128;
|
|
211
213
|
/**
|
|
212
|
-
*
|
|
214
|
+
* Sub-stroop carry of the receiver-liability accrual (§8.3).
|
|
213
215
|
*/
|
|
214
|
-
|
|
216
|
+
pending_remainder: i128;
|
|
215
217
|
/**
|
|
216
|
-
*
|
|
218
|
+
* Cumulative payer fee per unit of dominant-side size whose collection
|
|
219
|
+
* restores cash backing an already-accrued receiver claim (§8.2).
|
|
217
220
|
*/
|
|
218
|
-
|
|
221
|
+
receiver_backed_index_long: i128;
|
|
222
|
+
receiver_backed_index_short: i128;
|
|
219
223
|
/**
|
|
220
|
-
*
|
|
224
|
+
* Cumulative funding credit per unit of light-side size (§8.2).
|
|
221
225
|
*/
|
|
222
|
-
|
|
226
|
+
receiver_index_long: i128;
|
|
227
|
+
receiver_index_remainder: i128;
|
|
228
|
+
receiver_index_short: i128;
|
|
229
|
+
receiver_payer_remainder: i128;
|
|
230
|
+
short: MarketSide;
|
|
231
|
+
/**
|
|
232
|
+
* §8.1 signed EMA of the instantaneous skew: a fraction of one at
|
|
233
|
+
* `INDEX_PRECISION` scale, positive when history says longs dominate.
|
|
234
|
+
* Decays toward the current skew with the global half-life.
|
|
235
|
+
*/
|
|
236
|
+
skew_ema: i128;
|
|
237
|
+
}
|
|
238
|
+
export interface LpConfig {
|
|
239
|
+
lp_request_delay: u64;
|
|
240
|
+
max_withdraw_utilization_bps: u32;
|
|
241
|
+
min_deposit_nav_factor_bps: u32;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Represents a single trader's open leveraged position.
|
|
245
|
+
*/
|
|
246
|
+
export interface Position {
|
|
223
247
|
/**
|
|
224
|
-
*
|
|
248
|
+
* Asset units at `PRICE_PRECISION`.
|
|
225
249
|
*/
|
|
226
|
-
|
|
250
|
+
base_exposure: i128;
|
|
251
|
+
borrow_debt: i128;
|
|
227
252
|
/**
|
|
228
|
-
*
|
|
253
|
+
* Cash owned by an optional-order executor.
|
|
229
254
|
*/
|
|
255
|
+
execution_budget: i128;
|
|
256
|
+
funding_paid_to_lps_debt: i128;
|
|
257
|
+
funding_paid_to_receivers_debt: i128;
|
|
258
|
+
funding_received_debt: i128;
|
|
259
|
+
id: u64;
|
|
230
260
|
is_long: boolean;
|
|
261
|
+
last_increased_time: u64;
|
|
262
|
+
market: string;
|
|
263
|
+
owner: string;
|
|
231
264
|
/**
|
|
232
|
-
*
|
|
265
|
+
* Fixed gross capacity assigned when risk opens.
|
|
233
266
|
*/
|
|
234
|
-
|
|
267
|
+
risk_units: i128;
|
|
235
268
|
/**
|
|
236
|
-
*
|
|
269
|
+
* USD notional at `PRICE_PRECISION`.
|
|
237
270
|
*/
|
|
238
271
|
size: i128;
|
|
239
272
|
/**
|
|
240
|
-
*
|
|
273
|
+
* Trigger price for the optional stop-loss order; `0` = none.
|
|
241
274
|
*/
|
|
242
275
|
stop_loss: i128;
|
|
243
276
|
/**
|
|
244
|
-
*
|
|
277
|
+
* Trader-owned collateral recorded in contract state (the doc's
|
|
278
|
+
* "stored collateral"). Effective collateral — stored collateral after
|
|
279
|
+
* pending fees and funding credits — is always derived, never stored.
|
|
280
|
+
*/
|
|
281
|
+
stored_collateral: i128;
|
|
282
|
+
/**
|
|
283
|
+
* Trigger price for the optional take-profit order; `0` = none.
|
|
245
284
|
*/
|
|
246
285
|
take_profit: i128;
|
|
247
286
|
}
|
|
287
|
+
export interface LpRequest {
|
|
288
|
+
amount: i128;
|
|
289
|
+
execute_after: u64;
|
|
290
|
+
id: u64;
|
|
291
|
+
kind: LpRequestKind;
|
|
292
|
+
owner: string;
|
|
293
|
+
request_time: u64;
|
|
294
|
+
status: LpRequestStatus;
|
|
295
|
+
}
|
|
248
296
|
/**
|
|
249
|
-
*
|
|
297
|
+
* Which side currently pays funding (§8.1: the side the blended integral
|
|
298
|
+
* skew points at — under the EMA this can be the *lighter* side for a
|
|
299
|
+
* while after the book flips). `None` when the blend is exactly zero.
|
|
250
300
|
*/
|
|
251
|
-
export
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
301
|
+
export type PayerSide = {
|
|
302
|
+
tag: "None";
|
|
303
|
+
values: void;
|
|
304
|
+
} | {
|
|
305
|
+
tag: "Long";
|
|
306
|
+
values: void;
|
|
307
|
+
} | {
|
|
308
|
+
tag: "Short";
|
|
309
|
+
values: void;
|
|
310
|
+
};
|
|
311
|
+
export type RiskState = {
|
|
312
|
+
tag: "Normal";
|
|
313
|
+
values: void;
|
|
314
|
+
} | {
|
|
315
|
+
tag: "Warning";
|
|
316
|
+
values: void;
|
|
317
|
+
} | {
|
|
318
|
+
tag: "Adl";
|
|
319
|
+
values: void;
|
|
320
|
+
} | {
|
|
321
|
+
tag: "HardCap";
|
|
322
|
+
values: void;
|
|
323
|
+
};
|
|
324
|
+
export interface MarketSide {
|
|
325
|
+
base_exposure: i128;
|
|
326
|
+
risk_state: RiskState;
|
|
327
|
+
risk_units: i128;
|
|
328
|
+
size_open_interest: i128;
|
|
329
|
+
stored_collateral_total: i128;
|
|
330
|
+
}
|
|
331
|
+
export interface RoundPrice {
|
|
332
|
+
price: i128;
|
|
333
|
+
symbol: string;
|
|
334
|
+
}
|
|
335
|
+
export interface OracleRound {
|
|
336
|
+
id: u64;
|
|
337
|
+
previous_id: u64;
|
|
338
|
+
previous_timestamp: u64;
|
|
339
|
+
prices: Array<RoundPrice>;
|
|
340
|
+
timestamp: u64;
|
|
341
|
+
}
|
|
342
|
+
export interface GlobalConfig {
|
|
343
|
+
base_borrow_rate_bps_day: i128;
|
|
256
344
|
/**
|
|
257
|
-
*
|
|
345
|
+
* §8.1 half-life of the funding skew EMA, seconds (global: one memory
|
|
346
|
+
* horizon for every market).
|
|
258
347
|
*/
|
|
259
|
-
|
|
348
|
+
funding_half_life_seconds: u64;
|
|
349
|
+
hard_cap_factor_limit_bps: u32;
|
|
350
|
+
lp_revenue_share_bps: u32;
|
|
351
|
+
max_active_markets: u32;
|
|
352
|
+
max_adl_reward: i128;
|
|
353
|
+
max_insolvent_touch_reward: i128;
|
|
354
|
+
max_variable_borrow_bps_day: i128;
|
|
355
|
+
min_collateral: i128;
|
|
356
|
+
min_position_lifetime: u64;
|
|
357
|
+
risk_capacity_limit_bps: u32;
|
|
358
|
+
risk_keeper_revenue_share_bps: u32;
|
|
359
|
+
}
|
|
360
|
+
export interface MarketConfig {
|
|
361
|
+
adl_pnl_factor_bps: u32;
|
|
362
|
+
adl_reward_bps: u32;
|
|
260
363
|
/**
|
|
261
|
-
*
|
|
364
|
+
* §11.1 closing-fee tier when the close worsens skew.
|
|
262
365
|
*/
|
|
263
|
-
|
|
366
|
+
close_fee_high_bps: u32;
|
|
264
367
|
/**
|
|
265
|
-
*
|
|
368
|
+
* §11.1 closing-fee tier when the close improves or preserves skew.
|
|
266
369
|
*/
|
|
267
|
-
|
|
370
|
+
close_fee_low_bps: u32;
|
|
371
|
+
hard_cap_pnl_factor_bps: u32;
|
|
268
372
|
/**
|
|
269
|
-
*
|
|
373
|
+
* Margin required to open or add risk (§12.3). Divides max leverage:
|
|
374
|
+
* a position may not be created closer to liquidation than this.
|
|
270
375
|
*/
|
|
271
|
-
|
|
376
|
+
initial_margin_bps: u32;
|
|
272
377
|
/**
|
|
273
|
-
*
|
|
378
|
+
* §8.1 weight of the instantaneous skew in the funding blend, in bps;
|
|
379
|
+
* the rest is the half-life EMA. `BPS` reproduces pure instant skew.
|
|
274
380
|
*/
|
|
275
|
-
|
|
381
|
+
instant_weight_bps: u32;
|
|
382
|
+
liquidation_reward_bps: u32;
|
|
276
383
|
/**
|
|
277
|
-
*
|
|
384
|
+
* Margin below which the position is liquidatable (§12.3). Must not
|
|
385
|
+
* exceed `initial_margin_bps`; the gap is the entry buffer.
|
|
278
386
|
*/
|
|
279
|
-
|
|
387
|
+
maintenance_margin_bps: u32;
|
|
388
|
+
market_risk_factor_bps: u32;
|
|
389
|
+
max_funding_rate_bps_day: i128;
|
|
390
|
+
max_long_base_exposure: i128;
|
|
391
|
+
max_long_size_open_interest: i128;
|
|
392
|
+
max_short_base_exposure: i128;
|
|
393
|
+
max_short_size_open_interest: i128;
|
|
394
|
+
recovery_pnl_factor_bps: u32;
|
|
395
|
+
warning_pnl_factor_bps: u32;
|
|
280
396
|
}
|
|
281
397
|
/**
|
|
282
398
|
* Global safety thresholds for price validation.
|
|
283
399
|
*/
|
|
284
400
|
export interface OracleConfig {
|
|
285
401
|
/**
|
|
286
|
-
* How long a cached aggregated price remains valid
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
* source price and serve stale data).
|
|
402
|
+
* How long a cached aggregated price remains valid after the router
|
|
403
|
+
* fetch (in seconds). A cache hit also requires every source timestamp
|
|
404
|
+
* used for the cached median to remain within `staleness_threshold`.
|
|
405
|
+
* Must be > 0 and <= `staleness_threshold`.
|
|
291
406
|
*/
|
|
292
407
|
cache_duration: u64;
|
|
293
408
|
/**
|
|
294
409
|
* Maximum allowed spread between oracle sources in basis points
|
|
295
|
-
* (e.g., 100 = 1%). Bounded at `
|
|
410
|
+
* (e.g., 100 = 1%). Bounded at `crate::constants::MAX_DEVIATION_BPS_CEILING`.
|
|
296
411
|
*/
|
|
297
412
|
max_deviation_bps: i128;
|
|
298
413
|
/**
|
|
299
414
|
* Minimum number of source responses that must agree within
|
|
300
415
|
* `max_deviation_bps` for OracleRouter to return a price. Floored at
|
|
301
|
-
* `
|
|
302
|
-
* `
|
|
416
|
+
* `crate::constants::MIN_REQUIRED_SOURCES_FLOOR`, ceilinged at
|
|
417
|
+
* `crate::constants::MAX_ORACLE_SOURCES`.
|
|
303
418
|
*/
|
|
304
419
|
min_required_sources: u32;
|
|
305
420
|
/**
|
|
@@ -308,6 +423,13 @@ export interface OracleConfig {
|
|
|
308
423
|
*/
|
|
309
424
|
staleness_threshold: u64;
|
|
310
425
|
}
|
|
426
|
+
export type LpRequestKind = {
|
|
427
|
+
tag: "Deposit";
|
|
428
|
+
values: void;
|
|
429
|
+
} | {
|
|
430
|
+
tag: "Withdrawal";
|
|
431
|
+
values: void;
|
|
432
|
+
};
|
|
311
433
|
/**
|
|
312
434
|
* Data required during a WASM migration. Single definition for all contracts.
|
|
313
435
|
*/
|
|
@@ -317,15 +439,54 @@ export interface MigrationData {
|
|
|
317
439
|
/**
|
|
318
440
|
* Pending WASM upgrade — set by `propose_upgrade`, consumed by `upgrade`
|
|
319
441
|
* (cleared atomically on a successful install), or cleared by `cancel_upgrade`.
|
|
320
|
-
* Single shape across every protocol contract
|
|
442
|
+
* Single shape across every protocol contract. Contracts store it at
|
|
321
443
|
* the shared `pending_upgrade` Symbol key in their own instance storage (see
|
|
322
|
-
* `
|
|
444
|
+
* `crate::upgrade::pending_upgrade_key`). `upgrade` refuses to install
|
|
323
445
|
* unless `pending.wasm_hash` matches the supplied hash and `now >= eta`.
|
|
324
446
|
*/
|
|
325
447
|
export interface PendingUpgrade {
|
|
326
448
|
eta: u64;
|
|
327
449
|
wasm_hash: Buffer;
|
|
328
450
|
}
|
|
451
|
+
export type LpRequestStatus = {
|
|
452
|
+
tag: "Pending";
|
|
453
|
+
values: void;
|
|
454
|
+
} | {
|
|
455
|
+
tag: "Settled";
|
|
456
|
+
values: void;
|
|
457
|
+
} | {
|
|
458
|
+
tag: "Failed";
|
|
459
|
+
values: void;
|
|
460
|
+
} | {
|
|
461
|
+
tag: "Expired";
|
|
462
|
+
values: void;
|
|
463
|
+
};
|
|
464
|
+
export interface SettlementResult {
|
|
465
|
+
/**
|
|
466
|
+
* Shares minted for a deposit or assets paid for a withdrawal.
|
|
467
|
+
*/
|
|
468
|
+
amount: i128;
|
|
469
|
+
status: SettlementStatus;
|
|
470
|
+
}
|
|
471
|
+
export type SettlementStatus = {
|
|
472
|
+
tag: "Settled";
|
|
473
|
+
values: void;
|
|
474
|
+
} | {
|
|
475
|
+
tag: "Failed";
|
|
476
|
+
values: void;
|
|
477
|
+
};
|
|
478
|
+
export interface AccountingSnapshot {
|
|
479
|
+
cash_lp_equity: i128;
|
|
480
|
+
cash_shortfall: i128;
|
|
481
|
+
free_lp_capital: i128;
|
|
482
|
+
lp_blocked_side_count: u32;
|
|
483
|
+
non_lp_claims: i128;
|
|
484
|
+
open_position_count: u64;
|
|
485
|
+
physical_cash: i128;
|
|
486
|
+
required_risk_backing: i128;
|
|
487
|
+
total_risk_units: i128;
|
|
488
|
+
vault_nav: i128;
|
|
489
|
+
}
|
|
329
490
|
export declare const UpgradeableError: {
|
|
330
491
|
/**
|
|
331
492
|
* When migration is attempted but not allowed due to upgrade state.
|
|
@@ -432,48 +593,6 @@ export type PausableStorageKey = {
|
|
|
432
593
|
tag: "Paused";
|
|
433
594
|
values: void;
|
|
434
595
|
};
|
|
435
|
-
/**
|
|
436
|
-
* Execution-bounty and open-fee parameters charged to traders.
|
|
437
|
-
* `open_fee_bps` and `liquidation_bounty_bps` are in basis points;
|
|
438
|
-
* `tp_sl_execution_fee` is a flat USDC amount at PRECISION scale.
|
|
439
|
-
*/
|
|
440
|
-
export interface FeeConfig {
|
|
441
|
-
liquidation_bounty_bps: u32;
|
|
442
|
-
open_fee_bps: u32;
|
|
443
|
-
tp_sl_execution_fee: i128;
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Defines how protocol revenue is split between parties.
|
|
447
|
-
* All values are in basis points (bps). Must sum to 10_000.
|
|
448
|
-
*/
|
|
449
|
-
export interface FeeSplits {
|
|
450
|
-
dev_bps: u32;
|
|
451
|
-
lp_bps: u32;
|
|
452
|
-
staker_bps: u32;
|
|
453
|
-
}
|
|
454
|
-
/**
|
|
455
|
-
* Global protocol risk and timing parameters.
|
|
456
|
-
*/
|
|
457
|
-
export interface ProtocolLimits {
|
|
458
|
-
adl_pnl_bps: u32;
|
|
459
|
-
adl_utilization_bps: u32;
|
|
460
|
-
cooldown_duration: u64;
|
|
461
|
-
funding_cut_bps: u32;
|
|
462
|
-
liquidation_threshold_bps: u32;
|
|
463
|
-
max_utilization_ratio: i128;
|
|
464
|
-
min_collateral: i128;
|
|
465
|
-
min_position_lifetime: u64;
|
|
466
|
-
}
|
|
467
|
-
/**
|
|
468
|
-
* Borrow rate kink curve and funding rate parameters (all in basis points).
|
|
469
|
-
*/
|
|
470
|
-
export interface BorrowRateConfig {
|
|
471
|
-
base_borrow_rate_bps: i128;
|
|
472
|
-
base_funding_rate_bps: i128;
|
|
473
|
-
optimal_utilization_bps: i128;
|
|
474
|
-
slope1_bps: i128;
|
|
475
|
-
slope2_bps: i128;
|
|
476
|
-
}
|
|
477
596
|
export interface Client {
|
|
478
597
|
/**
|
|
479
598
|
* Construct and simulate a pause 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.
|
|
@@ -504,81 +623,110 @@ export interface Client {
|
|
|
504
623
|
/**
|
|
505
624
|
* Construct and simulate a set_tp_sl 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.
|
|
506
625
|
*/
|
|
507
|
-
set_tp_sl: ({
|
|
508
|
-
|
|
509
|
-
symbol: string;
|
|
626
|
+
set_tp_sl: ({ position_id, take_profit, stop_loss }: {
|
|
627
|
+
position_id: u64;
|
|
510
628
|
take_profit: i128;
|
|
511
629
|
stop_loss: i128;
|
|
512
630
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
513
631
|
/**
|
|
514
632
|
* Construct and simulate a set_vault 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.
|
|
515
|
-
* Wire the linked Vault. ADMIN-only and one-shot: reverts with
|
|
516
|
-
* `AlreadyInitialized` once the Vault is set, so the trusted Vault link
|
|
517
|
-
* is immutable after deploy. Called once by the deployer immediately
|
|
518
|
-
* after the Vault is deployed.
|
|
519
633
|
*/
|
|
520
|
-
set_vault: ({ caller,
|
|
634
|
+
set_vault: ({ caller, vault }: {
|
|
521
635
|
caller: string;
|
|
522
|
-
|
|
636
|
+
vault: string;
|
|
523
637
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
524
638
|
/**
|
|
525
639
|
* Construct and simulate a get_market 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.
|
|
526
640
|
*/
|
|
527
|
-
get_market: ({
|
|
528
|
-
|
|
529
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<
|
|
641
|
+
get_market: ({ market }: {
|
|
642
|
+
market: string;
|
|
643
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<Market>>;
|
|
530
644
|
/**
|
|
531
645
|
* Construct and simulate a get_position 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.
|
|
532
646
|
*/
|
|
533
|
-
get_position: ({
|
|
534
|
-
|
|
535
|
-
symbol: string;
|
|
647
|
+
get_position: ({ position_id }: {
|
|
648
|
+
position_id: u64;
|
|
536
649
|
}, options?: MethodOptions) => Promise<AssembledTransaction<Position>>;
|
|
537
650
|
/**
|
|
538
|
-
* Construct and simulate a
|
|
651
|
+
* Construct and simulate a recapitalize 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.
|
|
539
652
|
*/
|
|
540
|
-
|
|
653
|
+
recapitalize: ({ contributor, amount }: {
|
|
654
|
+
contributor: string;
|
|
655
|
+
amount: i128;
|
|
656
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
541
657
|
/**
|
|
542
658
|
* Construct and simulate a bump_position 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.
|
|
543
659
|
*/
|
|
544
|
-
bump_position: ({
|
|
545
|
-
|
|
546
|
-
symbol: string;
|
|
660
|
+
bump_position: ({ position_id }: {
|
|
661
|
+
position_id: u64;
|
|
547
662
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
548
663
|
/**
|
|
549
664
|
* Construct and simulate a enable_market 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.
|
|
550
665
|
*/
|
|
551
|
-
enable_market: ({ caller,
|
|
666
|
+
enable_market: ({ caller, market }: {
|
|
552
667
|
caller: string;
|
|
553
|
-
|
|
668
|
+
market: string;
|
|
554
669
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
555
670
|
/**
|
|
556
671
|
* Construct and simulate a execute_order 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.
|
|
557
672
|
*/
|
|
558
|
-
execute_order: ({ caller,
|
|
673
|
+
execute_order: ({ caller, position_id }: {
|
|
559
674
|
caller: string;
|
|
560
|
-
|
|
561
|
-
symbol: string;
|
|
675
|
+
position_id: u64;
|
|
562
676
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
677
|
+
/**
|
|
678
|
+
* Construct and simulate a global_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.
|
|
679
|
+
*/
|
|
680
|
+
global_config: (options?: MethodOptions) => Promise<AssembledTransaction<GlobalConfig>>;
|
|
681
|
+
/**
|
|
682
|
+
* Construct and simulate a non_lp_claims 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.
|
|
683
|
+
*/
|
|
684
|
+
non_lp_claims: (options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
|
|
685
|
+
/**
|
|
686
|
+
* Construct and simulate a open_position 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
|
+
open_position: ({ owner, market_symbol, is_long, size, collateral, execution_budget, take_profit, stop_loss, acceptable_price }: {
|
|
689
|
+
owner: string;
|
|
690
|
+
market_symbol: string;
|
|
691
|
+
is_long: boolean;
|
|
692
|
+
size: i128;
|
|
693
|
+
collateral: i128;
|
|
694
|
+
execution_budget: i128;
|
|
695
|
+
take_profit: i128;
|
|
696
|
+
stop_loss: i128;
|
|
697
|
+
acceptable_price: i128;
|
|
698
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
|
|
699
|
+
/**
|
|
700
|
+
* Construct and simulate a active_markets 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.
|
|
701
|
+
*/
|
|
702
|
+
active_markets: (options?: MethodOptions) => Promise<AssembledTransaction<Array<string>>>;
|
|
563
703
|
/**
|
|
564
704
|
* Construct and simulate a cancel_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.
|
|
565
705
|
*/
|
|
566
706
|
cancel_upgrade: ({ caller }: {
|
|
567
707
|
caller: string;
|
|
568
708
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
709
|
+
/**
|
|
710
|
+
* Construct and simulate a claim_protocol 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.
|
|
711
|
+
*/
|
|
712
|
+
claim_protocol: ({ caller, recipient, amount }: {
|
|
713
|
+
caller: string;
|
|
714
|
+
recipient: string;
|
|
715
|
+
amount: i128;
|
|
716
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
569
717
|
/**
|
|
570
718
|
* Construct and simulate a disable_market 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.
|
|
571
719
|
*/
|
|
572
|
-
disable_market: ({ caller,
|
|
720
|
+
disable_market: ({ caller, market }: {
|
|
573
721
|
caller: string;
|
|
574
|
-
|
|
722
|
+
market: string;
|
|
575
723
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
576
724
|
/**
|
|
577
725
|
* Construct and simulate a update_indices 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.
|
|
578
726
|
*/
|
|
579
|
-
update_indices: ({ caller,
|
|
727
|
+
update_indices: ({ caller, market_symbol }: {
|
|
580
728
|
caller: string;
|
|
581
|
-
|
|
729
|
+
market_symbol: string;
|
|
582
730
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
583
731
|
/**
|
|
584
732
|
* 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.
|
|
@@ -588,85 +736,122 @@ export interface Client {
|
|
|
588
736
|
wasm_hash: Buffer;
|
|
589
737
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
590
738
|
/**
|
|
591
|
-
* Construct and simulate a
|
|
739
|
+
* Construct and simulate a decrease_position 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.
|
|
592
740
|
*/
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
741
|
+
decrease_position: ({ position_id, size_removed, collateral_withdrawn, acceptable_price }: {
|
|
742
|
+
position_id: u64;
|
|
743
|
+
size_removed: i128;
|
|
744
|
+
collateral_withdrawn: i128;
|
|
745
|
+
acceptable_price: i128;
|
|
746
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
596
747
|
/**
|
|
597
|
-
* Construct and simulate a
|
|
748
|
+
* Construct and simulate a increase_position 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.
|
|
598
749
|
*/
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
750
|
+
increase_position: ({ position_id, size_added, collateral_added, acceptable_price }: {
|
|
751
|
+
position_id: u64;
|
|
752
|
+
size_added: i128;
|
|
753
|
+
collateral_added: i128;
|
|
754
|
+
acceptable_price: i128;
|
|
603
755
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
604
756
|
/**
|
|
605
|
-
* Construct and simulate a
|
|
757
|
+
* Construct and simulate a set_global_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.
|
|
606
758
|
*/
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
size_delta: i128;
|
|
611
|
-
acceptable_price: i128;
|
|
759
|
+
set_global_config: ({ caller, config }: {
|
|
760
|
+
caller: string;
|
|
761
|
+
config: GlobalConfig;
|
|
612
762
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
613
763
|
/**
|
|
614
|
-
* Construct and simulate a
|
|
764
|
+
* Construct and simulate a set_market_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.
|
|
615
765
|
*/
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
collateral: i128;
|
|
621
|
-
is_long: boolean;
|
|
622
|
-
take_profit: i128;
|
|
623
|
-
stop_loss: i128;
|
|
624
|
-
acceptable_price: i128;
|
|
766
|
+
set_market_config: ({ caller, market_symbol, config }: {
|
|
767
|
+
caller: string;
|
|
768
|
+
market_symbol: string;
|
|
769
|
+
config: MarketConfig;
|
|
625
770
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
626
771
|
/**
|
|
627
772
|
* Construct and simulate a is_market_disabled 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.
|
|
628
773
|
*/
|
|
629
|
-
is_market_disabled: ({
|
|
630
|
-
|
|
774
|
+
is_market_disabled: ({ market }: {
|
|
775
|
+
market: string;
|
|
631
776
|
}, options?: MethodOptions) => Promise<AssembledTransaction<boolean>>;
|
|
632
777
|
/**
|
|
633
778
|
* Construct and simulate a liquidate_position 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.
|
|
634
779
|
*/
|
|
635
|
-
liquidate_position: ({ caller,
|
|
780
|
+
liquidate_position: ({ caller, position_id }: {
|
|
636
781
|
caller: string;
|
|
637
|
-
|
|
638
|
-
symbol: string;
|
|
782
|
+
position_id: u64;
|
|
639
783
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
784
|
+
/**
|
|
785
|
+
* Construct and simulate a accounting_snapshot 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.
|
|
786
|
+
*/
|
|
787
|
+
accounting_snapshot: ({ round, physical }: {
|
|
788
|
+
round: OracleRound;
|
|
789
|
+
physical: i128;
|
|
790
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<AccountingSnapshot>>;
|
|
640
791
|
/**
|
|
641
792
|
* Construct and simulate a deleverage_position 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.
|
|
642
793
|
*/
|
|
643
|
-
deleverage_position: ({ caller,
|
|
794
|
+
deleverage_position: ({ caller, position_id }: {
|
|
795
|
+
caller: string;
|
|
796
|
+
position_id: u64;
|
|
797
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
798
|
+
/**
|
|
799
|
+
* Construct and simulate a prepare_lp_snapshot 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.
|
|
800
|
+
*/
|
|
801
|
+
prepare_lp_snapshot: ({ caller, round, physical }: {
|
|
802
|
+
caller: string;
|
|
803
|
+
round: OracleRound;
|
|
804
|
+
physical: i128;
|
|
805
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<AccountingSnapshot>>;
|
|
806
|
+
/**
|
|
807
|
+
* Construct and simulate a refresh_borrow_rate 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.
|
|
808
|
+
*/
|
|
809
|
+
refresh_borrow_rate: ({ caller, physical }: {
|
|
810
|
+
caller: string;
|
|
811
|
+
physical: i128;
|
|
812
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
813
|
+
/**
|
|
814
|
+
* Construct and simulate a can_create_lp_request 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.
|
|
815
|
+
*/
|
|
816
|
+
can_create_lp_request: ({ caller, physical }: {
|
|
644
817
|
caller: string;
|
|
645
|
-
|
|
646
|
-
|
|
818
|
+
physical: i128;
|
|
819
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<boolean>>;
|
|
820
|
+
/**
|
|
821
|
+
* Construct and simulate a fund_execution_budget 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.
|
|
822
|
+
*/
|
|
823
|
+
fund_execution_budget: ({ position_id, amount }: {
|
|
824
|
+
position_id: u64;
|
|
825
|
+
amount: i128;
|
|
647
826
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
648
827
|
/**
|
|
649
|
-
* Construct and simulate a
|
|
828
|
+
* Construct and simulate a protocol_claimable_total 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
829
|
*/
|
|
651
|
-
|
|
830
|
+
protocol_claimable_total: (options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
|
|
652
831
|
/**
|
|
653
|
-
* Construct and simulate a
|
|
832
|
+
* Construct and simulate a risk_keeper_reserve_total 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
833
|
*/
|
|
655
|
-
|
|
834
|
+
risk_keeper_reserve_total: (options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
|
|
835
|
+
/**
|
|
836
|
+
* Construct and simulate a withdraw_execution_budget 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.
|
|
837
|
+
*/
|
|
838
|
+
withdraw_execution_budget: ({ position_id, amount }: {
|
|
839
|
+
position_id: u64;
|
|
840
|
+
amount: i128;
|
|
841
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
656
842
|
/**
|
|
657
|
-
* Construct and simulate a
|
|
843
|
+
* Construct and simulate a pending_receiver_funding_total 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
844
|
*/
|
|
659
|
-
|
|
660
|
-
symbol: string;
|
|
661
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
|
|
845
|
+
pending_receiver_funding_total: (options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
|
|
662
846
|
}
|
|
663
847
|
export declare class Client extends ContractClient {
|
|
664
848
|
readonly options: ContractClientOptions;
|
|
665
849
|
static deploy<T = Client>(
|
|
666
850
|
/** Constructor/Initialization Args for the contract's `__constructor` method */
|
|
667
|
-
{ config_manager, oracle_router }: {
|
|
851
|
+
{ config_manager, oracle_router, config }: {
|
|
668
852
|
config_manager: string;
|
|
669
853
|
oracle_router: string;
|
|
854
|
+
config: GlobalConfig;
|
|
670
855
|
},
|
|
671
856
|
/** Options for initializing a Client as well as for calling a method, with extras specific to deploying. */
|
|
672
857
|
options: MethodOptions & Omit<ContractClientOptions, "contractId"> & {
|
|
@@ -685,25 +870,36 @@ export declare class Client extends ContractClient {
|
|
|
685
870
|
upgrade: (json: string) => AssembledTransaction<null>;
|
|
686
871
|
set_tp_sl: (json: string) => AssembledTransaction<null>;
|
|
687
872
|
set_vault: (json: string) => AssembledTransaction<null>;
|
|
688
|
-
get_market: (json: string) => AssembledTransaction<
|
|
873
|
+
get_market: (json: string) => AssembledTransaction<Market>;
|
|
689
874
|
get_position: (json: string) => AssembledTransaction<Position>;
|
|
690
|
-
|
|
875
|
+
recapitalize: (json: string) => AssembledTransaction<null>;
|
|
691
876
|
bump_position: (json: string) => AssembledTransaction<null>;
|
|
692
877
|
enable_market: (json: string) => AssembledTransaction<null>;
|
|
693
878
|
execute_order: (json: string) => AssembledTransaction<null>;
|
|
879
|
+
global_config: (json: string) => AssembledTransaction<GlobalConfig>;
|
|
880
|
+
non_lp_claims: (json: string) => AssembledTransaction<bigint>;
|
|
881
|
+
open_position: (json: string) => AssembledTransaction<bigint>;
|
|
882
|
+
active_markets: (json: string) => AssembledTransaction<string[]>;
|
|
694
883
|
cancel_upgrade: (json: string) => AssembledTransaction<null>;
|
|
884
|
+
claim_protocol: (json: string) => AssembledTransaction<null>;
|
|
695
885
|
disable_market: (json: string) => AssembledTransaction<null>;
|
|
696
886
|
update_indices: (json: string) => AssembledTransaction<null>;
|
|
697
887
|
propose_upgrade: (json: string) => AssembledTransaction<null>;
|
|
698
|
-
get_max_leverage: (json: string) => AssembledTransaction<bigint>;
|
|
699
|
-
set_max_leverage: (json: string) => AssembledTransaction<null>;
|
|
700
888
|
decrease_position: (json: string) => AssembledTransaction<null>;
|
|
701
889
|
increase_position: (json: string) => AssembledTransaction<null>;
|
|
890
|
+
set_global_config: (json: string) => AssembledTransaction<null>;
|
|
891
|
+
set_market_config: (json: string) => AssembledTransaction<null>;
|
|
702
892
|
is_market_disabled: (json: string) => AssembledTransaction<boolean>;
|
|
703
893
|
liquidate_position: (json: string) => AssembledTransaction<null>;
|
|
894
|
+
accounting_snapshot: (json: string) => AssembledTransaction<AccountingSnapshot>;
|
|
704
895
|
deleverage_position: (json: string) => AssembledTransaction<null>;
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
896
|
+
prepare_lp_snapshot: (json: string) => AssembledTransaction<AccountingSnapshot>;
|
|
897
|
+
refresh_borrow_rate: (json: string) => AssembledTransaction<null>;
|
|
898
|
+
can_create_lp_request: (json: string) => AssembledTransaction<boolean>;
|
|
899
|
+
fund_execution_budget: (json: string) => AssembledTransaction<null>;
|
|
900
|
+
protocol_claimable_total: (json: string) => AssembledTransaction<bigint>;
|
|
901
|
+
risk_keeper_reserve_total: (json: string) => AssembledTransaction<bigint>;
|
|
902
|
+
withdraw_execution_budget: (json: string) => AssembledTransaction<null>;
|
|
903
|
+
pending_receiver_funding_total: (json: string) => AssembledTransaction<bigint>;
|
|
708
904
|
};
|
|
709
905
|
}
|