@win-trader/bindings 0.1.0 → 0.3.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.
@@ -11,201 +11,108 @@ export declare const PositionManagerError: {
11
11
  2: {
12
12
  message: string;
13
13
  };
14
- 3: {
14
+ 10: {
15
15
  message: string;
16
16
  };
17
- 4: {
17
+ 11: {
18
18
  message: string;
19
19
  };
20
- 5: {
20
+ 12: {
21
21
  message: string;
22
22
  };
23
- 6: {
23
+ 14: {
24
24
  message: string;
25
25
  };
26
- 7: {
26
+ 16: {
27
27
  message: string;
28
28
  };
29
- 8: {
29
+ 20: {
30
30
  message: string;
31
31
  };
32
- 9: {
32
+ 21: {
33
33
  message: string;
34
34
  };
35
- 10: {
35
+ 22: {
36
36
  message: string;
37
37
  };
38
- 11: {
38
+ 23: {
39
39
  message: string;
40
40
  };
41
- 12: {
41
+ 24: {
42
42
  message: string;
43
43
  };
44
- 13: {
44
+ 25: {
45
45
  message: string;
46
46
  };
47
- 14: {
47
+ 26: {
48
48
  message: string;
49
49
  };
50
- 15: {
50
+ 27: {
51
51
  message: string;
52
52
  };
53
- 16: {
53
+ 28: {
54
54
  message: string;
55
55
  };
56
- 17: {
56
+ 29: {
57
57
  message: string;
58
58
  };
59
- 18: {
59
+ 31: {
60
60
  message: string;
61
61
  };
62
- 19: {
62
+ 32: {
63
63
  message: string;
64
64
  };
65
- 20: {
65
+ 33: {
66
66
  message: string;
67
67
  };
68
- /**
69
- * The contract is operationally paused (distinct from a risk state).
70
- */
71
- 21: {
68
+ 40: {
72
69
  message: string;
73
70
  };
74
- /**
75
- * An accounting invariant broke — e.g. a negative pending fee, which
76
- * means a decreasing index or corrupted debt baseline (§11.2).
77
- */
78
- 22: {
71
+ 41: {
79
72
  message: string;
80
73
  };
81
- /**
82
- * `upgrade` called with no pending proposal.
83
- */
84
- 23: {
74
+ 42: {
85
75
  message: string;
86
76
  };
87
- /**
88
- * `upgrade` called before the proposal's timelock eta.
89
- */
90
- 24: {
91
- message: string;
92
- };
93
- /**
94
- * `upgrade` called with a hash that differs from the proposal.
95
- */
96
- 25: {
77
+ 46: {
97
78
  message: string;
98
79
  };
99
- /**
100
- * No entry order exists for the given id.
101
- */
102
- 26: {
103
- message: string;
104
- };
105
- /**
106
- * `execute_entry_order` called before the trigger price was crossed.
107
- */
108
- 27: {
80
+ 47: {
109
81
  message: string;
110
82
  };
111
- /**
112
- * `register_referral_code` for a code that is already owned.
113
- */
114
- 28: {
83
+ 60: {
115
84
  message: string;
116
85
  };
117
- /**
118
- * A referral code failed the length/format bounds.
119
- */
120
- 29: {
86
+ 61: {
121
87
  message: string;
122
88
  };
123
- /**
124
- * `set_referrer` for a code no one has registered.
125
- */
126
- 30: {
89
+ 70: {
127
90
  message: string;
128
91
  };
129
- /**
130
- * A trader tried to set their own code as their referrer.
131
- */
132
- 31: {
92
+ 80: {
133
93
  message: string;
134
94
  };
135
95
  };
136
- /**
137
- * Which collection routed revenue through the split (§13).
138
- */
139
- export type FeeSource = {
140
- tag: "Closing";
141
- values: void;
142
- } | {
143
- tag: "Borrow";
144
- values: void;
145
- };
146
- /**
147
- * Why a position left the book.
148
- */
149
- export type CloseReason = {
150
- tag: "Trader";
151
- values: void;
152
- } | {
153
- tag: "Liquidation";
154
- values: void;
155
- } | {
156
- tag: "Deleverage";
157
- values: void;
158
- } | {
159
- tag: "Order";
160
- values: void;
161
- };
162
- /**
163
- * Why an entry order was removed before filling.
164
- */
165
- export type CancelReason = {
166
- tag: "Owner";
167
- values: void;
168
- } | {
169
- tag: "Expired";
170
- values: void;
171
- } | {
172
- tag: "PullFailed";
173
- values: void;
174
- };
175
- /**
176
- * §5.1 global state: the five non-LP claim totals, the risk counters, and
177
- * the global borrow accrual. The receiver-funding liability total is fed
178
- * per-market by `funding::accrue` (§8.3).
179
- */
180
96
  export interface Ledger {
97
+ action_escrow_total: i128;
181
98
  borrow_index: i128;
182
99
  borrow_index_remainder: i128;
183
- /**
184
- * `INDEX_PRECISION`-scaled bps/day rate for the current interval.
185
- */
186
100
  current_borrow_rate: i128;
187
- execution_budget_total: i128;
188
101
  last_global_checkpoint: u64;
189
- lp_blocked_side_count: u32;
190
102
  open_position_count: u64;
191
103
  pending_receiver_funding_total: i128;
192
104
  position_collateral_total: i128;
193
105
  protocol_claimable_total: i128;
194
- /**
195
- * §11.1 referral rewards accrued but not yet claimed — the aggregate
196
- * backing the per-referrer `ReferralBalance` map (their sum is this
197
- * total). Like every claim here it is a label on cash already in the
198
- * vault, so NAV and the solvency checks net it out automatically.
199
- */
200
- referral_claimable_total: i128;
201
- risk_keeper_reserve_total: i128;
106
+ restricted_market_side_count: u32;
107
+ state_version: u32;
202
108
  total_risk_units: i128;
109
+ unclaimed_payout_total: i128;
203
110
  }
204
111
  export type StorageKey = {
205
112
  tag: "ConfigManager";
206
113
  values: void;
207
114
  } | {
208
- tag: "OracleRouter";
115
+ tag: "PriceFeed";
209
116
  values: void;
210
117
  } | {
211
118
  tag: "Vault";
@@ -213,9 +120,6 @@ export type StorageKey = {
213
120
  } | {
214
121
  tag: "GlobalConfig";
215
122
  values: void;
216
- } | {
217
- tag: "Initialized";
218
- values: void;
219
123
  } | {
220
124
  tag: "Paused";
221
125
  values: void;
@@ -241,119 +145,113 @@ export type StorageKey = {
241
145
  tag: "MarketDisabled";
242
146
  values: readonly [string];
243
147
  } | {
244
- tag: "EntryOrder";
148
+ tag: "PendingAction";
245
149
  values: readonly [u64];
246
150
  } | {
247
- tag: "NextEntryOrderId";
151
+ tag: "NextActionId";
248
152
  values: void;
249
153
  } | {
250
- tag: "ReferralCode";
154
+ tag: "UnclaimedPayout";
251
155
  values: readonly [string];
252
156
  } | {
253
- tag: "Referrer";
254
- values: readonly [string];
157
+ tag: "Governor";
158
+ values: void;
255
159
  } | {
256
- tag: "ReferralBalance";
257
- values: readonly [string];
160
+ tag: "PriceFeedDecimals";
161
+ values: void;
162
+ };
163
+ export type FeeSource = {
164
+ tag: "Opening";
165
+ values: void;
166
+ } | {
167
+ tag: "Closing";
168
+ values: void;
169
+ } | {
170
+ tag: "Borrow";
171
+ values: void;
172
+ };
173
+ export type CloseReason = {
174
+ tag: "VoluntaryClose";
175
+ values: void;
176
+ } | {
177
+ tag: "TakeProfit";
178
+ values: void;
179
+ } | {
180
+ tag: "StopLoss";
181
+ values: void;
182
+ } | {
183
+ tag: "Liquidation";
184
+ values: void;
185
+ } | {
186
+ tag: "Adl";
187
+ values: void;
258
188
  };
259
189
  /**
260
- * Authoritative per-market state: the side aggregates, the funding indices,
261
- * the funding EMA, and the market configuration.
262
- *
263
- * Soroban limits UDT field names to 30 characters, so where a doc glossary
264
- * term is longer the field drops the redundant qualifier and its doc
265
- * comment carries the full term (e.g. `receiver_backed_index_long` is the
266
- * doc's `receiver_backed_payer_index` for the long side).
190
+ * SEP-40 asset identifier. Markets are quoted as `Other(market symbol)`.
267
191
  */
192
+ export type Asset = {
193
+ tag: "Stellar";
194
+ values: readonly [string];
195
+ } | {
196
+ tag: "Other";
197
+ values: readonly [string];
198
+ };
199
+ export interface PriceData {
200
+ price: i128;
201
+ timestamp: u64;
202
+ }
203
+ export interface StampedPrice {
204
+ observed_at: u64;
205
+ price: i128;
206
+ }
268
207
  export interface Market {
269
208
  config: MarketConfig;
270
- /**
271
- * `INDEX_PRECISION`-scaled bps/day payer rate as of the last refresh.
272
- */
273
209
  current_payer_rate: i128;
274
210
  current_payer_side: PayerSide;
275
211
  last_funding_checkpoint: u64;
276
212
  long: MarketSide;
277
- /**
278
- * Cumulative payer fee per unit of dominant-side size that is LP
279
- * revenue on collection (§8.2).
280
- */
213
+ long_payer_remainders: RemainderGroup;
281
214
  lp_backed_index_long: i128;
282
215
  lp_backed_index_short: i128;
283
- lp_payer_remainder: i128;
284
- /**
285
- * Sub-stroop carry of the receiver-liability accrual (§8.3).
286
- */
287
- pending_remainder: i128;
288
- /**
289
- * Cumulative payer fee per unit of dominant-side size whose collection
290
- * restores cash backing an already-accrued receiver claim (§8.2).
291
- */
216
+ pending_receiver_funding: i128;
292
217
  receiver_backed_index_long: i128;
293
218
  receiver_backed_index_short: i128;
294
- /**
295
- * Cumulative funding credit per unit of light-side size (§8.2).
296
- */
297
219
  receiver_index_long: i128;
298
- receiver_index_remainder: i128;
299
220
  receiver_index_short: i128;
300
- receiver_payer_remainder: i128;
301
221
  short: MarketSide;
302
- /**
303
- * §8.1 signed EMA of the instantaneous skew: a fraction of one at
304
- * `INDEX_PRECISION` scale, positive when history says longs dominate.
305
- * Decays toward the current skew with the global half-life.
306
- */
222
+ short_payer_remainders: RemainderGroup;
307
223
  skew_ema: i128;
308
224
  }
225
+ export type Trigger = {
226
+ tag: "None";
227
+ values: void;
228
+ } | {
229
+ tag: "Attached";
230
+ values: readonly [TriggerInstruction];
231
+ };
309
232
  export interface LpConfig {
310
- lp_request_delay: u64;
233
+ lp_request_delay_seconds: u64;
311
234
  max_withdraw_utilization_bps: u32;
312
235
  min_deposit_nav_factor_bps: u32;
313
236
  }
314
- /**
315
- * Represents a single trader's open leveraged position.
316
- */
317
237
  export interface Position {
318
- /**
319
- * Asset units at `PRICE_PRECISION`.
320
- */
321
238
  base_exposure: i128;
322
- borrow_debt: i128;
323
- /**
324
- * Cash owned by an optional-order executor.
325
- */
326
- execution_budget: i128;
327
- funding_paid_to_lps_debt: i128;
328
- funding_paid_to_receivers_debt: i128;
329
- funding_received_debt: i128;
239
+ borrow_index_snapshot: i128;
330
240
  id: u64;
331
241
  is_long: boolean;
332
- last_increased_time: u64;
242
+ lp_payer_index_snapshot: i128;
333
243
  market: string;
244
+ opened_at: u64;
334
245
  owner: string;
335
- /**
336
- * Fixed gross capacity assigned when risk opens.
337
- */
246
+ pending_mutation_action_id: Option<u64>;
247
+ receiver_index_snapshot: i128;
248
+ receiver_payer_index_snapshot: i128;
338
249
  risk_units: i128;
339
- /**
340
- * USD notional at `PRICE_PRECISION`.
341
- */
342
250
  size: i128;
343
- /**
344
- * Trigger price for the optional stop-loss order; `0` = none.
345
- */
346
- stop_loss: i128;
347
- /**
348
- * Trader-owned collateral recorded in contract state (the doc's
349
- * "stored collateral"). Effective collateral — stored collateral after
350
- * pending fees and funding credits — is always derived, never stored.
351
- */
251
+ stop_loss: Trigger;
352
252
  stored_collateral: i128;
353
- /**
354
- * Trigger price for the optional take-profit order; `0` = none.
355
- */
356
- take_profit: i128;
253
+ stored_minimum_borrow_fee: i128;
254
+ take_profit: Trigger;
357
255
  }
358
256
  export interface LpRequest {
359
257
  amount: i128;
@@ -362,13 +260,12 @@ export interface LpRequest {
362
260
  kind: LpRequestKind;
363
261
  owner: string;
364
262
  request_time: u64;
263
+ /**
264
+ * The resolve reward fixed when the request was made.
265
+ */
266
+ reward: i128;
365
267
  status: LpRequestStatus;
366
268
  }
367
- /**
368
- * Which side currently pays funding (§8.1: the side the blended integral
369
- * skew points at — under the EMA this can be the *lighter* side for a
370
- * while after the book flips). `None` when the blend is exactly zero.
371
- */
372
269
  export type PayerSide = {
373
270
  tag: "None";
374
271
  values: void;
@@ -392,122 +289,67 @@ export type RiskState = {
392
289
  tag: "HardCap";
393
290
  values: void;
394
291
  };
395
- /**
396
- * A pending limit/stop entry order: the frozen `open_position` arguments
397
- * plus a trigger condition and an expiry. Placing one only writes this
398
- * record — no funds move. A keeper's `execute_entry_order` pulls the
399
- * collateral via the owner's token allowance and opens the position
400
- * exactly as a market open would.
401
- */
402
- export interface EntryOrder {
403
- acceptable_price: i128;
404
- collateral: i128;
405
- execution_budget: i128;
406
- /**
407
- * Ledger timestamp after which the order is dead and swept on the next
408
- * touch (user-configurable max TTL).
409
- */
410
- expires_at: u64;
411
- id: u64;
412
- is_long: boolean;
413
- market: string;
414
- owner: string;
415
- size: i128;
416
- stop_loss: i128;
417
- take_profit: i128;
418
- /**
419
- * True → fill when price ≥ trigger (stop/breakout entry); false → fill
420
- * when price ≤ trigger (limit/dip entry). Inferred at placement from
421
- * the trigger vs. the current price.
422
- */
423
- trigger_above: boolean;
424
- /**
425
- * The oracle price at which the order becomes fillable.
426
- */
427
- trigger_price: i128;
428
- }
292
+ export type ActionKind = {
293
+ tag: "MarketOpen";
294
+ values: void;
295
+ } | {
296
+ tag: "LimitOpen";
297
+ values: void;
298
+ } | {
299
+ tag: "Decrease";
300
+ values: void;
301
+ } | {
302
+ tag: "Close";
303
+ values: void;
304
+ };
429
305
  export interface MarketSide {
430
306
  base_exposure: i128;
307
+ hard_cap_payout_factor: i128;
308
+ hard_cap_reference_pnl: i128;
431
309
  risk_state: RiskState;
432
310
  risk_units: i128;
433
311
  size_open_interest: i128;
434
312
  stored_collateral_total: i128;
435
313
  }
436
- export interface RoundPrice {
437
- price: i128;
438
- symbol: string;
314
+ export interface OpenPayload {
315
+ acceptable_price: i128;
316
+ expires_at: u64;
317
+ is_long: boolean;
318
+ size: i128;
319
+ stop_loss: i128;
320
+ submitted_collateral: i128;
321
+ take_profit: i128;
439
322
  }
440
- export interface OracleRound {
441
- id: u64;
442
- previous_id: u64;
443
- previous_timestamp: u64;
444
- prices: Array<RoundPrice>;
445
- timestamp: u64;
323
+ export interface ClosePayload {
324
+ acceptable_price: i128;
325
+ position_id: u64;
446
326
  }
447
327
  export interface GlobalConfig {
448
328
  base_borrow_rate_bps_day: i128;
449
- /**
450
- * §9.2 borrow-curve exponent, bps: 20_000 = u² (legacy quadratic),
451
- * 10_000 = linear. Bounded to ≤ 100_000 (e ≤ 10) by validation.
452
- */
453
- borrow_exponent_bps: u32;
454
- /**
455
- * §8.1 half-life of the funding skew EMA, seconds (global: one memory
456
- * horizon for every market).
457
- */
329
+ borrow_lp_revenue_share_bps: u32;
330
+ config_timelock_seconds: u64;
331
+ fee_lp_revenue_share_bps: u32;
458
332
  funding_half_life_seconds: u64;
459
- hard_cap_factor_limit_bps: u32;
460
- lp_revenue_share_bps: u32;
333
+ global_hard_cap_limit_bps: u32;
334
+ hard_cap_relatch_band_bps: u32;
335
+ keeper_rewards: KeeperRewards;
461
336
  max_active_markets: u32;
462
- max_adl_reward: i128;
463
- max_insolvent_touch_reward: i128;
337
+ max_market_order_lifetime: u64;
338
+ max_order_lifetime_seconds: u64;
339
+ max_price_age_seconds: u64;
464
340
  max_variable_borrow_bps_day: i128;
465
- /**
466
- * §11.2 minimum borrow charge per capitalization: an index delta at
467
- * `INDEX_PRECISION` scale applied to the position's risk units
468
- * (2e11 = 2 bps of notional at a 10% market risk factor). Zero
469
- * disables the floor.
470
- */
471
- min_borrow_index_delta: i128;
341
+ min_borrow_fee_seconds: u64;
472
342
  min_collateral: i128;
473
343
  min_position_lifetime: u64;
474
- /**
475
- * §11.1 share of a closing fee routed to the trader's referrer, carved
476
- * from the protocol slice (keeper and LP shares are untouched). `0`
477
- * disables referral accrual globally — a kill switch. Validated so
478
- * `lp + keeper + referral ≤ BPS`, keeping the protocol remainder ≥ 0.
479
- */
480
- referral_fee_share_bps: u32;
481
344
  risk_capacity_limit_bps: u32;
482
- risk_keeper_revenue_share_bps: u32;
483
345
  }
484
346
  export interface MarketConfig {
485
347
  adl_pnl_factor_bps: u32;
486
- adl_reward_bps: u32;
487
- /**
488
- * §11.1 closing-fee tier when the close worsens skew.
489
- */
490
- close_fee_high_bps: u32;
491
- /**
492
- * §11.1 closing-fee tier when the close improves or preserves skew.
493
- */
494
- close_fee_low_bps: u32;
348
+ close_pnl_fee_bps: u32;
349
+ close_size_fee_bps: u32;
495
350
  hard_cap_pnl_factor_bps: u32;
496
- /**
497
- * Margin required to open or add risk (§12.3). Divides max leverage:
498
- * a position may not be created closer to liquidation than this.
499
- */
500
351
  initial_margin_bps: u32;
501
- /**
502
- * §8.1 weight of the instantaneous skew in the funding blend, in bps;
503
- * the rest is the half-life EMA. `BPS` reproduces pure instant skew.
504
- */
505
352
  instant_weight_bps: u32;
506
- liquidation_reward_bps: u32;
507
- /**
508
- * Margin below which the position is liquidatable (§12.3). Must not
509
- * exceed `initial_margin_bps`; the gap is the entry buffer.
510
- */
511
353
  maintenance_margin_bps: u32;
512
354
  market_risk_factor_bps: u32;
513
355
  max_funding_rate_bps_day: i128;
@@ -515,37 +357,88 @@ export interface MarketConfig {
515
357
  max_long_size_open_interest: i128;
516
358
  max_short_base_exposure: i128;
517
359
  max_short_size_open_interest: i128;
360
+ open_fee_bps: u32;
361
+ order_execution_delay_seconds: u64;
518
362
  recovery_pnl_factor_bps: u32;
519
363
  warning_pnl_factor_bps: u32;
520
364
  }
521
- /**
522
- * Global safety thresholds for price validation.
523
- */
524
- export interface OracleConfig {
525
- /**
526
- * How long a cached aggregated price remains valid after the router
527
- * fetch (in seconds). A cache hit also requires every source timestamp
528
- * used for the cached median to remain within `staleness_threshold`.
529
- * Must be > 0 and <= `staleness_threshold`.
530
- */
531
- cache_duration: u64;
532
- /**
533
- * Maximum allowed spread between oracle sources in basis points
534
- * (e.g., 100 = 1%). Bounded at `crate::constants::MAX_DEVIATION_BPS_CEILING`.
535
- */
536
- max_deviation_bps: i128;
537
- /**
538
- * Minimum number of source responses that must agree within
539
- * `max_deviation_bps` for OracleRouter to return a price. Floored at
540
- * `crate::constants::MIN_REQUIRED_SOURCES_FLOOR`, ceilinged at
541
- * `crate::constants::MAX_ORACLE_SOURCES`.
542
- */
543
- min_required_sources: u32;
544
- /**
545
- * Maximum age of an external SEP-40 price feed before it is rejected
546
- * as stale (in seconds).
547
- */
548
- staleness_threshold: u64;
365
+ export type ActionOutcome = {
366
+ tag: "Executed";
367
+ values: void;
368
+ } | {
369
+ tag: "Failed";
370
+ values: void;
371
+ } | {
372
+ tag: "Cancelled";
373
+ values: void;
374
+ } | {
375
+ tag: "Expired";
376
+ values: void;
377
+ } | {
378
+ tag: "Superseded";
379
+ values: void;
380
+ } | {
381
+ tag: "NotReady";
382
+ values: void;
383
+ } | {
384
+ tag: "Pending";
385
+ values: void;
386
+ } | {
387
+ tag: "RequiresLiquidation";
388
+ values: void;
389
+ };
390
+ export type ActionPayload = {
391
+ tag: "MarketOpen";
392
+ values: readonly [OpenPayload];
393
+ } | {
394
+ tag: "LimitOpen";
395
+ values: readonly [OpenPayload, TriggerCondition];
396
+ } | {
397
+ tag: "Decrease";
398
+ values: readonly [DecreasePayload];
399
+ } | {
400
+ tag: "Close";
401
+ values: readonly [ClosePayload];
402
+ };
403
+ export type FailureReason = {
404
+ tag: "PriceBoundExceeded";
405
+ values: void;
406
+ } | {
407
+ tag: "CapacityExceeded";
408
+ values: void;
409
+ } | {
410
+ tag: "ExposureCapExceeded";
411
+ values: void;
412
+ } | {
413
+ tag: "SideRestricted";
414
+ values: void;
415
+ } | {
416
+ tag: "InsufficientCollateral";
417
+ values: void;
418
+ } | {
419
+ tag: "UnpayableProfit";
420
+ values: void;
421
+ } | {
422
+ tag: "PositionGone";
423
+ values: void;
424
+ } | {
425
+ tag: "MarketPaused";
426
+ values: void;
427
+ } | {
428
+ tag: "SizeTooSmall";
429
+ values: void;
430
+ };
431
+ export interface KeeperRewards {
432
+ adl: i128;
433
+ close: i128;
434
+ decrease: i128;
435
+ expiry: i128;
436
+ limit_order: i128;
437
+ liquidation: i128;
438
+ lp_resolve: i128;
439
+ open: i128;
440
+ sl: i128;
441
+ tp: i128;
549
442
  }
550
443
  export type LpRequestKind = {
551
444
  tag: "Deposit";
@@ -554,24 +447,35 @@ export type LpRequestKind = {
554
447
  tag: "Withdrawal";
555
448
  values: void;
556
449
  };
557
- /**
558
- * Data required during a WASM migration. Single definition for all contracts.
559
- */
560
450
  export interface MigrationData {
561
451
  version: u32;
562
452
  }
563
- /**
564
- * Pending WASM upgrade — set by `propose_upgrade`, consumed by `upgrade`
565
- * (cleared atomically on a successful install), or cleared by `cancel_upgrade`.
566
- * Single shape across every protocol contract. Contracts store it at
567
- * the shared `pending_upgrade` Symbol key in their own instance storage (see
568
- * `crate::upgrade::pending_upgrade_key`). `upgrade` refuses to install
569
- * unless `pending.wasm_hash` matches the supplied hash and `now >= eta`.
570
- */
453
+ export interface PendingAction {
454
+ action_id: u64;
455
+ commit_observed_at: u64;
456
+ created_at: u64;
457
+ escrowed_collateral: i128;
458
+ execute_after: u64;
459
+ kind: ActionKind;
460
+ market_id: string;
461
+ owner: string;
462
+ payload: ActionPayload;
463
+ }
571
464
  export interface PendingUpgrade {
572
465
  eta: u64;
573
466
  wasm_hash: Buffer;
574
467
  }
468
+ export interface RemainderGroup {
469
+ distribution_remainder: i128;
470
+ lp_payer_remainder: i128;
471
+ receiver_liability_remainder: i128;
472
+ receiver_payer_remainder: i128;
473
+ }
474
+ export interface DecreasePayload {
475
+ acceptable_price: i128;
476
+ position_id: u64;
477
+ size_removed: i128;
478
+ }
575
479
  export type LpRequestStatus = {
576
480
  tag: "Pending";
577
481
  values: void;
@@ -581,32 +485,20 @@ export type LpRequestStatus = {
581
485
  } | {
582
486
  tag: "Failed";
583
487
  values: void;
584
- } | {
585
- tag: "Expired";
586
- values: void;
587
488
  };
588
- /**
589
- * The caller-supplied fields of a `place_entry_order` request, bundled so
590
- * the entry point stays within Soroban's parameter limit. `owner` and
591
- * `market` are passed alongside; `id` and `trigger_above` are derived at
592
- * placement.
593
- */
594
- export interface EntryOrderParams {
595
- acceptable_price: i128;
596
- collateral: i128;
597
- execution_budget: i128;
598
- expires_at: u64;
599
- is_long: boolean;
600
- size: i128;
601
- stop_loss: i128;
602
- take_profit: i128;
603
- trigger_price: i128;
489
+ export interface PendingFeesView {
490
+ borrow: i128;
491
+ funding_paid_to_lps: i128;
492
+ funding_paid_to_receivers: i128;
493
+ funding_received: i128;
494
+ }
495
+ export interface PendingPriceFeed {
496
+ effective_at: u64;
497
+ price_feed: string;
604
498
  }
605
499
  export interface SettlementResult {
606
- /**
607
- * Shares minted for a deposit or assets paid for a withdrawal.
608
- */
609
500
  amount: i128;
501
+ reward: i128;
610
502
  status: SettlementStatus;
611
503
  }
612
504
  export type SettlementStatus = {
@@ -615,19 +507,49 @@ export type SettlementStatus = {
615
507
  } | {
616
508
  tag: "Failed";
617
509
  values: void;
510
+ } | {
511
+ tag: "NotReady";
512
+ values: void;
618
513
  };
514
+ export interface TriggerCondition {
515
+ trigger_above: boolean;
516
+ trigger_price: i128;
517
+ }
619
518
  export interface AccountingSnapshot {
620
519
  cash_lp_equity: i128;
621
520
  cash_shortfall: i128;
521
+ deleveraging_side_count: u32;
622
522
  free_lp_capital: i128;
623
- lp_blocked_side_count: u32;
523
+ min_equity_clear_of_adl: i128;
624
524
  non_lp_claims: i128;
625
525
  open_position_count: u64;
626
526
  physical_cash: i128;
627
527
  required_risk_backing: i128;
528
+ restricted_side_count: u32;
628
529
  total_risk_units: i128;
629
530
  vault_nav: i128;
630
531
  }
532
+ export interface TriggerInstruction {
533
+ acceptable_price: i128;
534
+ commit_observed_at: u64;
535
+ committed_at: u64;
536
+ execute_after: u64;
537
+ trigger_price: i128;
538
+ }
539
+ export interface PendingGlobalConfig {
540
+ config: GlobalConfig;
541
+ effective_at: u64;
542
+ }
543
+ export interface PendingMarketConfig {
544
+ config: MarketConfig;
545
+ effective_at: u64;
546
+ }
547
+ export interface EventHeader {
548
+ actor: string;
549
+ event_version: u32;
550
+ ledger_timestamp: u64;
551
+ market: string;
552
+ }
631
553
  export declare const UpgradeableError: {
632
554
  /**
633
555
  * When migration is attempted but not allowed due to upgrade state.
@@ -656,16 +578,6 @@ export declare const MerkleDistributorError: {
656
578
  message: string;
657
579
  };
658
580
  };
659
- /**
660
- * Storage keys for the data associated with `MerkleDistributor`
661
- */
662
- export type MerkleDistributorStorageKey = {
663
- tag: "Root";
664
- values: void;
665
- } | {
666
- tag: "Claimed";
667
- values: readonly [u32];
668
- };
669
581
  /**
670
582
  * Rounding direction for division operations
671
583
  */
@@ -693,37 +605,47 @@ export declare const SorobanFixedPointError: {
693
605
  message: string;
694
606
  };
695
607
  };
696
- export declare const CryptoError: {
608
+ export declare const PausableError: {
697
609
  /**
698
- * The merkle proof length is out of bounds.
610
+ * The operation failed because the contract is paused.
699
611
  */
700
- 1400: {
612
+ 1000: {
701
613
  message: string;
702
614
  };
703
615
  /**
704
- * The index of the leaf is out of bounds.
616
+ * The operation failed because the contract is not paused.
705
617
  */
706
- 1401: {
618
+ 1001: {
707
619
  message: string;
708
620
  };
621
+ };
622
+ /**
623
+ * Storage keys for the data associated with `MerkleDistributor`
624
+ */
625
+ export type MerkleDistributorStorageKey = {
626
+ tag: "Root";
627
+ values: void;
628
+ } | {
629
+ tag: "Claimed";
630
+ values: readonly [u32];
631
+ };
632
+ export declare const CryptoError: {
709
633
  /**
710
- * No data in hasher state.
634
+ * The merkle proof length is out of bounds.
711
635
  */
712
- 1402: {
636
+ 1400: {
713
637
  message: string;
714
638
  };
715
- };
716
- export declare const PausableError: {
717
639
  /**
718
- * The operation failed because the contract is paused.
640
+ * The index of the leaf is out of bounds.
719
641
  */
720
- 1000: {
642
+ 1401: {
721
643
  message: string;
722
644
  };
723
645
  /**
724
- * The operation failed because the contract is not paused.
646
+ * No data in hasher state.
725
647
  */
726
- 1001: {
648
+ 1402: {
727
649
  message: string;
728
650
  };
729
651
  };
@@ -762,13 +684,13 @@ export interface Client {
762
684
  operator: string;
763
685
  }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
764
686
  /**
765
- * 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.
687
+ * Construct and simulate a governor 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.
766
688
  */
767
- set_tp_sl: ({ position_id, take_profit, stop_loss }: {
768
- position_id: u64;
769
- take_profit: i128;
770
- stop_loss: i128;
771
- }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
689
+ governor: (options?: MethodOptions) => Promise<AssembledTransaction<string>>;
690
+ /**
691
+ * Construct and simulate a is_paused 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.
692
+ */
693
+ is_paused: (options?: MethodOptions) => Promise<AssembledTransaction<boolean>>;
772
694
  /**
773
695
  * 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.
774
696
  */
@@ -782,18 +704,36 @@ export interface Client {
782
704
  get_market: ({ market }: {
783
705
  market: string;
784
706
  }, options?: MethodOptions) => Promise<AssembledTransaction<Market>>;
707
+ /**
708
+ * Construct and simulate a price_feed 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.
709
+ */
710
+ price_feed: (options?: MethodOptions) => Promise<AssembledTransaction<string>>;
711
+ /**
712
+ * Construct and simulate a execute_adl 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.
713
+ */
714
+ execute_adl: ({ keeper, position_id }: {
715
+ keeper: string;
716
+ position_id: u64;
717
+ }, options?: MethodOptions) => Promise<AssembledTransaction<ActionOutcome>>;
718
+ /**
719
+ * Construct and simulate a claim_payout 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.
720
+ */
721
+ claim_payout: ({ owner }: {
722
+ owner: string;
723
+ }, options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
724
+ /**
725
+ * Construct and simulate a create_close 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.
726
+ */
727
+ create_close: ({ position_id, acceptable_price }: {
728
+ position_id: u64;
729
+ acceptable_price: i128;
730
+ }, options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
785
731
  /**
786
732
  * 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.
787
733
  */
788
734
  get_position: ({ position_id }: {
789
735
  position_id: u64;
790
736
  }, options?: MethodOptions) => Promise<AssembledTransaction<Position>>;
791
- /**
792
- * Construct and simulate a get_referrer 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.
793
- */
794
- get_referrer: ({ trader }: {
795
- trader: string;
796
- }, options?: MethodOptions) => Promise<AssembledTransaction<Option<string>>>;
797
737
  /**
798
738
  * 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.
799
739
  */
@@ -802,18 +742,12 @@ export interface Client {
802
742
  amount: i128;
803
743
  }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
804
744
  /**
805
- * Construct and simulate a set_referrer 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.
745
+ * Construct and simulate a settle_close 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.
806
746
  */
807
- set_referrer: ({ trader, code }: {
808
- trader: string;
809
- code: string;
810
- }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
811
- /**
812
- * 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.
813
- */
814
- bump_position: ({ position_id }: {
815
- position_id: u64;
816
- }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
747
+ settle_close: ({ keeper, action_id }: {
748
+ keeper: string;
749
+ action_id: u64;
750
+ }, options?: MethodOptions) => Promise<AssembledTransaction<ActionOutcome>>;
817
751
  /**
818
752
  * 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.
819
753
  */
@@ -821,13 +755,6 @@ export interface Client {
821
755
  caller: string;
822
756
  market: string;
823
757
  }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
824
- /**
825
- * 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.
826
- */
827
- execute_order: ({ caller, position_id }: {
828
- caller: string;
829
- position_id: u64;
830
- }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
831
758
  /**
832
759
  * 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.
833
760
  */
@@ -837,23 +764,24 @@ export interface Client {
837
764
  */
838
765
  non_lp_claims: (options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
839
766
  /**
840
- * 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.
767
+ * Construct and simulate a set_stop_loss 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.
841
768
  */
842
- open_position: ({ owner, market_symbol, is_long, size, collateral, execution_budget, take_profit, stop_loss, acceptable_price }: {
843
- owner: string;
844
- market_symbol: string;
845
- is_long: boolean;
846
- size: i128;
847
- collateral: i128;
848
- execution_budget: i128;
849
- take_profit: i128;
850
- stop_loss: i128;
769
+ set_stop_loss: ({ position_id, trigger_price, acceptable_price }: {
770
+ position_id: u64;
771
+ trigger_price: i128;
851
772
  acceptable_price: i128;
852
- }, options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
773
+ }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
853
774
  /**
854
775
  * 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.
855
776
  */
856
777
  active_markets: (options?: MethodOptions) => Promise<AssembledTransaction<Array<string>>>;
778
+ /**
779
+ * Construct and simulate a add_collateral 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.
780
+ */
781
+ add_collateral: ({ position_id, amount }: {
782
+ position_id: u64;
783
+ amount: i128;
784
+ }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
857
785
  /**
858
786
  * 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.
859
787
  */
@@ -868,12 +796,6 @@ export interface Client {
868
796
  recipient: string;
869
797
  amount: i128;
870
798
  }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
871
- /**
872
- * Construct and simulate a claim_referral 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.
873
- */
874
- claim_referral: ({ referrer }: {
875
- referrer: string;
876
- }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
877
799
  /**
878
800
  * 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.
879
801
  */
@@ -889,11 +811,19 @@ export interface Client {
889
811
  market_symbol: string;
890
812
  }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
891
813
  /**
892
- * Construct and simulate a get_entry_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.
814
+ * Construct and simulate a clear_stop_loss 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.
893
815
  */
894
- get_entry_order: ({ order_id }: {
895
- order_id: u64;
896
- }, options?: MethodOptions) => Promise<AssembledTransaction<EntryOrder>>;
816
+ clear_stop_loss: ({ position_id }: {
817
+ position_id: u64;
818
+ }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
819
+ /**
820
+ * Construct and simulate a create_decrease 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.
821
+ */
822
+ create_decrease: ({ position_id, size_removed, acceptable_price }: {
823
+ position_id: u64;
824
+ size_removed: i128;
825
+ acceptable_price: i128;
826
+ }, options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
897
827
  /**
898
828
  * 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.
899
829
  */
@@ -902,57 +832,90 @@ export interface Client {
902
832
  wasm_hash: Buffer;
903
833
  }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
904
834
  /**
905
- * Construct and simulate a referral_balance 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.
835
+ * Construct and simulate a set_take_profit 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.
906
836
  */
907
- referral_balance: ({ referrer }: {
908
- referrer: string;
909
- }, options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
910
- /**
911
- * 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.
912
- */
913
- decrease_position: ({ position_id, size_removed, collateral_withdrawn, acceptable_price }: {
837
+ set_take_profit: ({ position_id, trigger_price, acceptable_price }: {
914
838
  position_id: u64;
915
- size_removed: i128;
916
- collateral_withdrawn: i128;
839
+ trigger_price: i128;
917
840
  acceptable_price: i128;
918
841
  }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
919
842
  /**
920
- * 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.
843
+ * Construct and simulate a settle_decrease 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.
844
+ */
845
+ settle_decrease: ({ keeper, action_id }: {
846
+ keeper: string;
847
+ action_id: u64;
848
+ }, options?: MethodOptions) => Promise<AssembledTransaction<ActionOutcome>>;
849
+ /**
850
+ * Construct and simulate a unclaimed_payout 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.
851
+ */
852
+ unclaimed_payout: ({ owner }: {
853
+ owner: string;
854
+ }, options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
855
+ /**
856
+ * Construct and simulate a cancel_limit_open 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.
857
+ */
858
+ cancel_limit_open: ({ action_id }: {
859
+ action_id: u64;
860
+ }, options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
861
+ /**
862
+ * Construct and simulate a clear_take_profit 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.
921
863
  */
922
- increase_position: ({ position_id, size_added, collateral_added, acceptable_price }: {
864
+ clear_take_profit: ({ position_id }: {
923
865
  position_id: u64;
924
- size_added: i128;
925
- collateral_added: i128;
926
- acceptable_price: i128;
927
866
  }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
928
867
  /**
929
- * Construct and simulate a place_entry_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.
868
+ * Construct and simulate a create_limit_open 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.
930
869
  */
931
- place_entry_order: ({ owner, market, params }: {
870
+ create_limit_open: ({ owner, market, request, trigger_price }: {
932
871
  owner: string;
933
872
  market: string;
934
- params: EntryOrderParams;
873
+ request: OpenPayload;
874
+ trigger_price: i128;
935
875
  }, options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
936
876
  /**
937
- * 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.
877
+ * Construct and simulate a deregister_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.
938
878
  */
939
- set_global_config: ({ caller, config }: {
879
+ deregister_market: ({ caller, actor, market_symbol }: {
940
880
  caller: string;
941
- config: GlobalConfig;
881
+ actor: string;
882
+ market_symbol: string;
942
883
  }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
943
884
  /**
944
- * 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.
885
+ * Construct and simulate a execute_stop_loss 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.
945
886
  */
946
- set_market_config: ({ caller, market_symbol, config }: {
947
- caller: string;
948
- market_symbol: string;
949
- config: MarketConfig;
950
- }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
887
+ execute_stop_loss: ({ keeper, position_id }: {
888
+ keeper: string;
889
+ position_id: u64;
890
+ }, options?: MethodOptions) => Promise<AssembledTransaction<ActionOutcome>>;
891
+ /**
892
+ * Construct and simulate a settle_limit_open 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.
893
+ */
894
+ settle_limit_open: ({ keeper, action_id }: {
895
+ keeper: string;
896
+ action_id: u64;
897
+ }, options?: MethodOptions) => Promise<AssembledTransaction<ActionOutcome>>;
898
+ /**
899
+ * Construct and simulate a create_market_open 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.
900
+ */
901
+ create_market_open: ({ owner, market, request }: {
902
+ owner: string;
903
+ market: string;
904
+ request: OpenPayload;
905
+ }, options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
951
906
  /**
952
- * Construct and simulate a cancel_entry_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.
907
+ * Construct and simulate a get_pending_action 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.
953
908
  */
954
- cancel_entry_order: ({ order_id }: {
955
- order_id: u64;
909
+ get_pending_action: ({ action_id }: {
910
+ action_id: u64;
911
+ }, options?: MethodOptions) => Promise<AssembledTransaction<PendingAction>>;
912
+ /**
913
+ * Construct and simulate a install_price_feed 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.
914
+ */
915
+ install_price_feed: ({ caller, actor, price_feed }: {
916
+ caller: string;
917
+ actor: string;
918
+ price_feed: string;
956
919
  }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
957
920
  /**
958
921
  * 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.
@@ -963,45 +926,44 @@ export interface Client {
963
926
  /**
964
927
  * 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.
965
928
  */
966
- liquidate_position: ({ caller, position_id }: {
967
- caller: string;
929
+ liquidate_position: ({ keeper, position_id }: {
930
+ keeper: string;
968
931
  position_id: u64;
969
932
  }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
933
+ /**
934
+ * Construct and simulate a settle_market_open 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.
935
+ */
936
+ settle_market_open: ({ keeper, action_id }: {
937
+ keeper: string;
938
+ action_id: u64;
939
+ }, options?: MethodOptions) => Promise<AssembledTransaction<ActionOutcome>>;
970
940
  /**
971
941
  * 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.
972
942
  */
973
- accounting_snapshot: ({ round, physical }: {
974
- round: OracleRound;
943
+ accounting_snapshot: ({ physical }: {
975
944
  physical: i128;
976
945
  }, options?: MethodOptions) => Promise<AssembledTransaction<AccountingSnapshot>>;
977
946
  /**
978
- * 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.
947
+ * Construct and simulate a clean_expired_entry 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.
979
948
  */
980
- deleverage_position: ({ caller, position_id }: {
981
- caller: string;
982
- position_id: u64;
949
+ clean_expired_entry: ({ keeper, action_id }: {
950
+ keeper: string;
951
+ action_id: u64;
983
952
  }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
984
953
  /**
985
- * Construct and simulate a execute_entry_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.
954
+ * Construct and simulate a execute_take_profit 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.
986
955
  */
987
- execute_entry_order: ({ caller, order_id }: {
988
- caller: string;
989
- order_id: u64;
990
- }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
956
+ execute_take_profit: ({ keeper, position_id }: {
957
+ keeper: string;
958
+ position_id: u64;
959
+ }, options?: MethodOptions) => Promise<AssembledTransaction<ActionOutcome>>;
991
960
  /**
992
961
  * 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.
993
962
  */
994
- prepare_lp_snapshot: ({ caller, round, physical }: {
963
+ prepare_lp_snapshot: ({ caller, physical }: {
995
964
  caller: string;
996
- round: OracleRound;
997
965
  physical: i128;
998
966
  }, options?: MethodOptions) => Promise<AssembledTransaction<AccountingSnapshot>>;
999
- /**
1000
- * Construct and simulate a referral_code_owner 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.
1001
- */
1002
- referral_code_owner: ({ code }: {
1003
- code: string;
1004
- }, options?: MethodOptions) => Promise<AssembledTransaction<Option<string>>>;
1005
967
  /**
1006
968
  * 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.
1007
969
  */
@@ -1010,57 +972,31 @@ export interface Client {
1010
972
  physical: i128;
1011
973
  }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
1012
974
  /**
1013
- * 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.
975
+ * Construct and simulate a install_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.
1014
976
  */
1015
- can_create_lp_request: ({ caller, physical }: {
977
+ install_global_config: ({ caller, actor, config }: {
1016
978
  caller: string;
1017
- physical: i128;
1018
- }, options?: MethodOptions) => Promise<AssembledTransaction<boolean>>;
1019
- /**
1020
- * 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.
1021
- */
1022
- fund_execution_budget: ({ position_id, amount }: {
1023
- position_id: u64;
1024
- amount: i128;
1025
- }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
1026
- /**
1027
- * Construct and simulate a register_referral_code 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.
1028
- */
1029
- register_referral_code: ({ owner, code }: {
1030
- owner: string;
1031
- code: string;
979
+ actor: string;
980
+ config: GlobalConfig;
1032
981
  }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
1033
982
  /**
1034
- * 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.
1035
- */
1036
- protocol_claimable_total: (options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
1037
- /**
1038
- * Construct and simulate a referral_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.
1039
- */
1040
- referral_claimable_total: (options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
1041
- /**
1042
- * 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.
1043
- */
1044
- risk_keeper_reserve_total: (options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
1045
- /**
1046
- * 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.
983
+ * Construct and simulate a install_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.
1047
984
  */
1048
- withdraw_execution_budget: ({ position_id, amount }: {
1049
- position_id: u64;
1050
- amount: i128;
985
+ install_market_config: ({ caller, actor, market_symbol, config }: {
986
+ caller: string;
987
+ actor: string;
988
+ market_symbol: string;
989
+ config: MarketConfig;
1051
990
  }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
1052
- /**
1053
- * 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.
1054
- */
1055
- pending_receiver_funding_total: (options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
1056
991
  }
1057
992
  export declare class Client extends ContractClient {
1058
993
  readonly options: ContractClientOptions;
1059
994
  static deploy<T = Client>(
1060
995
  /** Constructor/Initialization Args for the contract's `__constructor` method */
1061
- { config_manager, oracle_router, config }: {
996
+ { config_manager, governor, price_feed, config }: {
1062
997
  config_manager: string;
1063
- oracle_router: string;
998
+ governor: string;
999
+ price_feed: string;
1064
1000
  config: GlobalConfig;
1065
1001
  },
1066
1002
  /** Options for initializing a Client as well as for calling a method, with extras specific to deploying. */
@@ -1078,49 +1014,51 @@ export declare class Client extends ContractClient {
1078
1014
  migrate: (json: string) => AssembledTransaction<null>;
1079
1015
  unpause: (json: string) => AssembledTransaction<null>;
1080
1016
  upgrade: (json: string) => AssembledTransaction<null>;
1081
- set_tp_sl: (json: string) => AssembledTransaction<null>;
1017
+ governor: (json: string) => AssembledTransaction<string>;
1018
+ is_paused: (json: string) => AssembledTransaction<boolean>;
1082
1019
  set_vault: (json: string) => AssembledTransaction<null>;
1083
1020
  get_market: (json: string) => AssembledTransaction<Market>;
1021
+ price_feed: (json: string) => AssembledTransaction<string>;
1022
+ execute_adl: (json: string) => AssembledTransaction<ActionOutcome>;
1023
+ claim_payout: (json: string) => AssembledTransaction<bigint>;
1024
+ create_close: (json: string) => AssembledTransaction<bigint>;
1084
1025
  get_position: (json: string) => AssembledTransaction<Position>;
1085
- get_referrer: (json: string) => AssembledTransaction<Option<string>>;
1086
1026
  recapitalize: (json: string) => AssembledTransaction<null>;
1087
- set_referrer: (json: string) => AssembledTransaction<null>;
1088
- bump_position: (json: string) => AssembledTransaction<null>;
1027
+ settle_close: (json: string) => AssembledTransaction<ActionOutcome>;
1089
1028
  enable_market: (json: string) => AssembledTransaction<null>;
1090
- execute_order: (json: string) => AssembledTransaction<null>;
1091
1029
  global_config: (json: string) => AssembledTransaction<GlobalConfig>;
1092
1030
  non_lp_claims: (json: string) => AssembledTransaction<bigint>;
1093
- open_position: (json: string) => AssembledTransaction<bigint>;
1031
+ set_stop_loss: (json: string) => AssembledTransaction<null>;
1094
1032
  active_markets: (json: string) => AssembledTransaction<string[]>;
1033
+ add_collateral: (json: string) => AssembledTransaction<null>;
1095
1034
  cancel_upgrade: (json: string) => AssembledTransaction<null>;
1096
1035
  claim_protocol: (json: string) => AssembledTransaction<null>;
1097
- claim_referral: (json: string) => AssembledTransaction<null>;
1098
1036
  disable_market: (json: string) => AssembledTransaction<null>;
1099
1037
  update_indices: (json: string) => AssembledTransaction<null>;
1100
- get_entry_order: (json: string) => AssembledTransaction<EntryOrder>;
1038
+ clear_stop_loss: (json: string) => AssembledTransaction<null>;
1039
+ create_decrease: (json: string) => AssembledTransaction<bigint>;
1101
1040
  propose_upgrade: (json: string) => AssembledTransaction<null>;
1102
- referral_balance: (json: string) => AssembledTransaction<bigint>;
1103
- decrease_position: (json: string) => AssembledTransaction<null>;
1104
- increase_position: (json: string) => AssembledTransaction<null>;
1105
- place_entry_order: (json: string) => AssembledTransaction<bigint>;
1106
- set_global_config: (json: string) => AssembledTransaction<null>;
1107
- set_market_config: (json: string) => AssembledTransaction<null>;
1108
- cancel_entry_order: (json: string) => AssembledTransaction<null>;
1041
+ set_take_profit: (json: string) => AssembledTransaction<null>;
1042
+ settle_decrease: (json: string) => AssembledTransaction<ActionOutcome>;
1043
+ unclaimed_payout: (json: string) => AssembledTransaction<bigint>;
1044
+ cancel_limit_open: (json: string) => AssembledTransaction<bigint>;
1045
+ clear_take_profit: (json: string) => AssembledTransaction<null>;
1046
+ create_limit_open: (json: string) => AssembledTransaction<bigint>;
1047
+ deregister_market: (json: string) => AssembledTransaction<null>;
1048
+ execute_stop_loss: (json: string) => AssembledTransaction<ActionOutcome>;
1049
+ settle_limit_open: (json: string) => AssembledTransaction<ActionOutcome>;
1050
+ create_market_open: (json: string) => AssembledTransaction<bigint>;
1051
+ get_pending_action: (json: string) => AssembledTransaction<PendingAction>;
1052
+ install_price_feed: (json: string) => AssembledTransaction<null>;
1109
1053
  is_market_disabled: (json: string) => AssembledTransaction<boolean>;
1110
1054
  liquidate_position: (json: string) => AssembledTransaction<null>;
1055
+ settle_market_open: (json: string) => AssembledTransaction<ActionOutcome>;
1111
1056
  accounting_snapshot: (json: string) => AssembledTransaction<AccountingSnapshot>;
1112
- deleverage_position: (json: string) => AssembledTransaction<null>;
1113
- execute_entry_order: (json: string) => AssembledTransaction<null>;
1057
+ clean_expired_entry: (json: string) => AssembledTransaction<null>;
1058
+ execute_take_profit: (json: string) => AssembledTransaction<ActionOutcome>;
1114
1059
  prepare_lp_snapshot: (json: string) => AssembledTransaction<AccountingSnapshot>;
1115
- referral_code_owner: (json: string) => AssembledTransaction<Option<string>>;
1116
1060
  refresh_borrow_rate: (json: string) => AssembledTransaction<null>;
1117
- can_create_lp_request: (json: string) => AssembledTransaction<boolean>;
1118
- fund_execution_budget: (json: string) => AssembledTransaction<null>;
1119
- register_referral_code: (json: string) => AssembledTransaction<null>;
1120
- protocol_claimable_total: (json: string) => AssembledTransaction<bigint>;
1121
- referral_claimable_total: (json: string) => AssembledTransaction<bigint>;
1122
- risk_keeper_reserve_total: (json: string) => AssembledTransaction<bigint>;
1123
- withdraw_execution_budget: (json: string) => AssembledTransaction<null>;
1124
- pending_receiver_funding_total: (json: string) => AssembledTransaction<bigint>;
1061
+ install_global_config: (json: string) => AssembledTransaction<null>;
1062
+ install_market_config: (json: string) => AssembledTransaction<null>;
1125
1063
  };
1126
1064
  }