@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.
- package/cex-feed/dist/index.d.ts +662 -0
- package/cex-feed/dist/index.js +173 -0
- package/config-manager/dist/index.d.ts +266 -282
- package/config-manager/dist/index.js +67 -51
- package/market-governor/dist/index.d.ts +660 -0
- package/market-governor/dist/index.js +178 -0
- package/mock-oracle/dist/index.d.ts +84 -0
- package/mock-oracle/dist/index.js +37 -0
- package/mock-token/dist/index.d.ts +672 -672
- package/mock-token/dist/index.js +256 -253
- package/package.json +9 -22
- package/position-manager/dist/index.d.ts +491 -553
- package/position-manager/dist/index.js +172 -188
- package/request-router/dist/index.d.ts +274 -277
- package/request-router/dist/index.js +74 -58
- package/vault/dist/index.d.ts +916 -937
- package/vault/dist/index.js +310 -299
- package/oracle/dist/index.d.ts +0 -625
- package/oracle/dist/index.js +0 -152
- package/oracle-router/dist/index.d.ts +0 -743
- package/oracle-router/dist/index.js +0 -210
|
@@ -1,148 +1,101 @@
|
|
|
1
1
|
import { Buffer } from "buffer";
|
|
2
2
|
import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, MethodOptions } from "@stellar/stellar-sdk/contract";
|
|
3
|
-
import type { u32, u64, i128 } from "@stellar/stellar-sdk/contract";
|
|
3
|
+
import type { u32, u64, i128, Option } from "@stellar/stellar-sdk/contract";
|
|
4
4
|
export * from "@stellar/stellar-sdk";
|
|
5
5
|
export * as contract from "@stellar/stellar-sdk/contract";
|
|
6
6
|
export * as rpc from "@stellar/stellar-sdk/rpc";
|
|
7
7
|
export declare const RequestRouterError: {
|
|
8
|
-
|
|
8
|
+
400: {
|
|
9
9
|
message: string;
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
410: {
|
|
12
12
|
message: string;
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
420: {
|
|
15
15
|
message: string;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
430: {
|
|
18
18
|
message: string;
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
440: {
|
|
21
21
|
message: string;
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
441: {
|
|
24
24
|
message: string;
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
442: {
|
|
27
27
|
message: string;
|
|
28
28
|
};
|
|
29
|
-
|
|
30
|
-
* `upgrade` called with no pending proposal.
|
|
31
|
-
*/
|
|
32
|
-
8: {
|
|
33
|
-
message: string;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* `upgrade` called before the proposal's timelock eta.
|
|
37
|
-
*/
|
|
38
|
-
9: {
|
|
39
|
-
message: string;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* `upgrade` called with a hash that differs from the proposal.
|
|
43
|
-
*/
|
|
44
|
-
10: {
|
|
29
|
+
450: {
|
|
45
30
|
message: string;
|
|
46
31
|
};
|
|
47
32
|
};
|
|
48
33
|
/**
|
|
49
|
-
*
|
|
50
|
-
* the funding EMA, and the market configuration.
|
|
51
|
-
*
|
|
52
|
-
* Soroban limits UDT field names to 30 characters, so where a doc glossary
|
|
53
|
-
* term is longer the field drops the redundant qualifier and its doc
|
|
54
|
-
* comment carries the full term (e.g. `receiver_backed_index_long` is the
|
|
55
|
-
* doc's `receiver_backed_payer_index` for the long side).
|
|
34
|
+
* SEP-40 asset identifier. Markets are quoted as `Other(market symbol)`.
|
|
56
35
|
*/
|
|
36
|
+
export type Asset = {
|
|
37
|
+
tag: "Stellar";
|
|
38
|
+
values: readonly [string];
|
|
39
|
+
} | {
|
|
40
|
+
tag: "Other";
|
|
41
|
+
values: readonly [string];
|
|
42
|
+
};
|
|
43
|
+
export interface PriceData {
|
|
44
|
+
price: i128;
|
|
45
|
+
timestamp: u64;
|
|
46
|
+
}
|
|
47
|
+
export interface StampedPrice {
|
|
48
|
+
observed_at: u64;
|
|
49
|
+
price: i128;
|
|
50
|
+
}
|
|
57
51
|
export interface Market {
|
|
58
52
|
config: MarketConfig;
|
|
59
|
-
/**
|
|
60
|
-
* `INDEX_PRECISION`-scaled bps/day payer rate as of the last refresh.
|
|
61
|
-
*/
|
|
62
53
|
current_payer_rate: i128;
|
|
63
54
|
current_payer_side: PayerSide;
|
|
64
55
|
last_funding_checkpoint: u64;
|
|
65
56
|
long: MarketSide;
|
|
66
|
-
|
|
67
|
-
* Cumulative payer fee per unit of dominant-side size that is LP
|
|
68
|
-
* revenue on collection (§8.2).
|
|
69
|
-
*/
|
|
57
|
+
long_payer_remainders: RemainderGroup;
|
|
70
58
|
lp_backed_index_long: i128;
|
|
71
59
|
lp_backed_index_short: i128;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Sub-stroop carry of the receiver-liability accrual (§8.3).
|
|
75
|
-
*/
|
|
76
|
-
pending_remainder: i128;
|
|
77
|
-
/**
|
|
78
|
-
* Cumulative payer fee per unit of dominant-side size whose collection
|
|
79
|
-
* restores cash backing an already-accrued receiver claim (§8.2).
|
|
80
|
-
*/
|
|
60
|
+
pending_receiver_funding: i128;
|
|
81
61
|
receiver_backed_index_long: i128;
|
|
82
62
|
receiver_backed_index_short: i128;
|
|
83
|
-
/**
|
|
84
|
-
* Cumulative funding credit per unit of light-side size (§8.2).
|
|
85
|
-
*/
|
|
86
63
|
receiver_index_long: i128;
|
|
87
|
-
receiver_index_remainder: i128;
|
|
88
64
|
receiver_index_short: i128;
|
|
89
|
-
receiver_payer_remainder: i128;
|
|
90
65
|
short: MarketSide;
|
|
91
|
-
|
|
92
|
-
* §8.1 signed EMA of the instantaneous skew: a fraction of one at
|
|
93
|
-
* `INDEX_PRECISION` scale, positive when history says longs dominate.
|
|
94
|
-
* Decays toward the current skew with the global half-life.
|
|
95
|
-
*/
|
|
66
|
+
short_payer_remainders: RemainderGroup;
|
|
96
67
|
skew_ema: i128;
|
|
97
68
|
}
|
|
69
|
+
export type Trigger = {
|
|
70
|
+
tag: "None";
|
|
71
|
+
values: void;
|
|
72
|
+
} | {
|
|
73
|
+
tag: "Attached";
|
|
74
|
+
values: readonly [TriggerInstruction];
|
|
75
|
+
};
|
|
98
76
|
export interface LpConfig {
|
|
99
|
-
|
|
77
|
+
lp_request_delay_seconds: u64;
|
|
100
78
|
max_withdraw_utilization_bps: u32;
|
|
101
79
|
min_deposit_nav_factor_bps: u32;
|
|
102
80
|
}
|
|
103
|
-
/**
|
|
104
|
-
* Represents a single trader's open leveraged position.
|
|
105
|
-
*/
|
|
106
81
|
export interface Position {
|
|
107
|
-
/**
|
|
108
|
-
* Asset units at `PRICE_PRECISION`.
|
|
109
|
-
*/
|
|
110
82
|
base_exposure: i128;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Cash owned by an optional-order executor.
|
|
114
|
-
*/
|
|
115
|
-
execution_budget: i128;
|
|
116
|
-
funding_paid_to_lps_debt: i128;
|
|
117
|
-
funding_paid_to_receivers_debt: i128;
|
|
118
|
-
funding_received_debt: i128;
|
|
83
|
+
borrow_index_snapshot: i128;
|
|
119
84
|
id: u64;
|
|
120
85
|
is_long: boolean;
|
|
121
|
-
|
|
86
|
+
lp_payer_index_snapshot: i128;
|
|
122
87
|
market: string;
|
|
88
|
+
opened_at: u64;
|
|
123
89
|
owner: string;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
90
|
+
pending_mutation_action_id: Option<u64>;
|
|
91
|
+
receiver_index_snapshot: i128;
|
|
92
|
+
receiver_payer_index_snapshot: i128;
|
|
127
93
|
risk_units: i128;
|
|
128
|
-
/**
|
|
129
|
-
* USD notional at `PRICE_PRECISION`.
|
|
130
|
-
*/
|
|
131
94
|
size: i128;
|
|
132
|
-
|
|
133
|
-
* Trigger price for the optional stop-loss order; `0` = none.
|
|
134
|
-
*/
|
|
135
|
-
stop_loss: i128;
|
|
136
|
-
/**
|
|
137
|
-
* Trader-owned collateral recorded in contract state (the doc's
|
|
138
|
-
* "stored collateral"). Effective collateral — stored collateral after
|
|
139
|
-
* pending fees and funding credits — is always derived, never stored.
|
|
140
|
-
*/
|
|
95
|
+
stop_loss: Trigger;
|
|
141
96
|
stored_collateral: i128;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
*/
|
|
145
|
-
take_profit: i128;
|
|
97
|
+
stored_minimum_borrow_fee: i128;
|
|
98
|
+
take_profit: Trigger;
|
|
146
99
|
}
|
|
147
100
|
export interface LpRequest {
|
|
148
101
|
amount: i128;
|
|
@@ -151,13 +104,12 @@ export interface LpRequest {
|
|
|
151
104
|
kind: LpRequestKind;
|
|
152
105
|
owner: string;
|
|
153
106
|
request_time: u64;
|
|
107
|
+
/**
|
|
108
|
+
* The resolve reward fixed when the request was made.
|
|
109
|
+
*/
|
|
110
|
+
reward: i128;
|
|
154
111
|
status: LpRequestStatus;
|
|
155
112
|
}
|
|
156
|
-
/**
|
|
157
|
-
* Which side currently pays funding (§8.1: the side the blended integral
|
|
158
|
-
* skew points at — under the EMA this can be the *lighter* side for a
|
|
159
|
-
* while after the book flips). `None` when the blend is exactly zero.
|
|
160
|
-
*/
|
|
161
113
|
export type PayerSide = {
|
|
162
114
|
tag: "None";
|
|
163
115
|
values: void;
|
|
@@ -181,122 +133,67 @@ export type RiskState = {
|
|
|
181
133
|
tag: "HardCap";
|
|
182
134
|
values: void;
|
|
183
135
|
};
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
* touch (user-configurable max TTL).
|
|
198
|
-
*/
|
|
199
|
-
expires_at: u64;
|
|
200
|
-
id: u64;
|
|
201
|
-
is_long: boolean;
|
|
202
|
-
market: string;
|
|
203
|
-
owner: string;
|
|
204
|
-
size: i128;
|
|
205
|
-
stop_loss: i128;
|
|
206
|
-
take_profit: i128;
|
|
207
|
-
/**
|
|
208
|
-
* True → fill when price ≥ trigger (stop/breakout entry); false → fill
|
|
209
|
-
* when price ≤ trigger (limit/dip entry). Inferred at placement from
|
|
210
|
-
* the trigger vs. the current price.
|
|
211
|
-
*/
|
|
212
|
-
trigger_above: boolean;
|
|
213
|
-
/**
|
|
214
|
-
* The oracle price at which the order becomes fillable.
|
|
215
|
-
*/
|
|
216
|
-
trigger_price: i128;
|
|
217
|
-
}
|
|
136
|
+
export type ActionKind = {
|
|
137
|
+
tag: "MarketOpen";
|
|
138
|
+
values: void;
|
|
139
|
+
} | {
|
|
140
|
+
tag: "LimitOpen";
|
|
141
|
+
values: void;
|
|
142
|
+
} | {
|
|
143
|
+
tag: "Decrease";
|
|
144
|
+
values: void;
|
|
145
|
+
} | {
|
|
146
|
+
tag: "Close";
|
|
147
|
+
values: void;
|
|
148
|
+
};
|
|
218
149
|
export interface MarketSide {
|
|
219
150
|
base_exposure: i128;
|
|
151
|
+
hard_cap_payout_factor: i128;
|
|
152
|
+
hard_cap_reference_pnl: i128;
|
|
220
153
|
risk_state: RiskState;
|
|
221
154
|
risk_units: i128;
|
|
222
155
|
size_open_interest: i128;
|
|
223
156
|
stored_collateral_total: i128;
|
|
224
157
|
}
|
|
225
|
-
export interface
|
|
226
|
-
|
|
227
|
-
|
|
158
|
+
export interface OpenPayload {
|
|
159
|
+
acceptable_price: i128;
|
|
160
|
+
expires_at: u64;
|
|
161
|
+
is_long: boolean;
|
|
162
|
+
size: i128;
|
|
163
|
+
stop_loss: i128;
|
|
164
|
+
submitted_collateral: i128;
|
|
165
|
+
take_profit: i128;
|
|
228
166
|
}
|
|
229
|
-
export interface
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
previous_timestamp: u64;
|
|
233
|
-
prices: Array<RoundPrice>;
|
|
234
|
-
timestamp: u64;
|
|
167
|
+
export interface ClosePayload {
|
|
168
|
+
acceptable_price: i128;
|
|
169
|
+
position_id: u64;
|
|
235
170
|
}
|
|
236
171
|
export interface GlobalConfig {
|
|
237
172
|
base_borrow_rate_bps_day: i128;
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
*/
|
|
242
|
-
borrow_exponent_bps: u32;
|
|
243
|
-
/**
|
|
244
|
-
* §8.1 half-life of the funding skew EMA, seconds (global: one memory
|
|
245
|
-
* horizon for every market).
|
|
246
|
-
*/
|
|
173
|
+
borrow_lp_revenue_share_bps: u32;
|
|
174
|
+
config_timelock_seconds: u64;
|
|
175
|
+
fee_lp_revenue_share_bps: u32;
|
|
247
176
|
funding_half_life_seconds: u64;
|
|
248
|
-
|
|
249
|
-
|
|
177
|
+
global_hard_cap_limit_bps: u32;
|
|
178
|
+
hard_cap_relatch_band_bps: u32;
|
|
179
|
+
keeper_rewards: KeeperRewards;
|
|
250
180
|
max_active_markets: u32;
|
|
251
|
-
|
|
252
|
-
|
|
181
|
+
max_market_order_lifetime: u64;
|
|
182
|
+
max_order_lifetime_seconds: u64;
|
|
183
|
+
max_price_age_seconds: u64;
|
|
253
184
|
max_variable_borrow_bps_day: i128;
|
|
254
|
-
|
|
255
|
-
* §11.2 minimum borrow charge per capitalization: an index delta at
|
|
256
|
-
* `INDEX_PRECISION` scale applied to the position's risk units
|
|
257
|
-
* (2e11 = 2 bps of notional at a 10% market risk factor). Zero
|
|
258
|
-
* disables the floor.
|
|
259
|
-
*/
|
|
260
|
-
min_borrow_index_delta: i128;
|
|
185
|
+
min_borrow_fee_seconds: u64;
|
|
261
186
|
min_collateral: i128;
|
|
262
187
|
min_position_lifetime: u64;
|
|
263
|
-
/**
|
|
264
|
-
* §11.1 share of a closing fee routed to the trader's referrer, carved
|
|
265
|
-
* from the protocol slice (keeper and LP shares are untouched). `0`
|
|
266
|
-
* disables referral accrual globally — a kill switch. Validated so
|
|
267
|
-
* `lp + keeper + referral ≤ BPS`, keeping the protocol remainder ≥ 0.
|
|
268
|
-
*/
|
|
269
|
-
referral_fee_share_bps: u32;
|
|
270
188
|
risk_capacity_limit_bps: u32;
|
|
271
|
-
risk_keeper_revenue_share_bps: u32;
|
|
272
189
|
}
|
|
273
190
|
export interface MarketConfig {
|
|
274
191
|
adl_pnl_factor_bps: u32;
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
* §11.1 closing-fee tier when the close worsens skew.
|
|
278
|
-
*/
|
|
279
|
-
close_fee_high_bps: u32;
|
|
280
|
-
/**
|
|
281
|
-
* §11.1 closing-fee tier when the close improves or preserves skew.
|
|
282
|
-
*/
|
|
283
|
-
close_fee_low_bps: u32;
|
|
192
|
+
close_pnl_fee_bps: u32;
|
|
193
|
+
close_size_fee_bps: u32;
|
|
284
194
|
hard_cap_pnl_factor_bps: u32;
|
|
285
|
-
/**
|
|
286
|
-
* Margin required to open or add risk (§12.3). Divides max leverage:
|
|
287
|
-
* a position may not be created closer to liquidation than this.
|
|
288
|
-
*/
|
|
289
195
|
initial_margin_bps: u32;
|
|
290
|
-
/**
|
|
291
|
-
* §8.1 weight of the instantaneous skew in the funding blend, in bps;
|
|
292
|
-
* the rest is the half-life EMA. `BPS` reproduces pure instant skew.
|
|
293
|
-
*/
|
|
294
196
|
instant_weight_bps: u32;
|
|
295
|
-
liquidation_reward_bps: u32;
|
|
296
|
-
/**
|
|
297
|
-
* Margin below which the position is liquidatable (§12.3). Must not
|
|
298
|
-
* exceed `initial_margin_bps`; the gap is the entry buffer.
|
|
299
|
-
*/
|
|
300
197
|
maintenance_margin_bps: u32;
|
|
301
198
|
market_risk_factor_bps: u32;
|
|
302
199
|
max_funding_rate_bps_day: i128;
|
|
@@ -304,37 +201,88 @@ export interface MarketConfig {
|
|
|
304
201
|
max_long_size_open_interest: i128;
|
|
305
202
|
max_short_base_exposure: i128;
|
|
306
203
|
max_short_size_open_interest: i128;
|
|
204
|
+
open_fee_bps: u32;
|
|
205
|
+
order_execution_delay_seconds: u64;
|
|
307
206
|
recovery_pnl_factor_bps: u32;
|
|
308
207
|
warning_pnl_factor_bps: u32;
|
|
309
208
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
209
|
+
export type ActionOutcome = {
|
|
210
|
+
tag: "Executed";
|
|
211
|
+
values: void;
|
|
212
|
+
} | {
|
|
213
|
+
tag: "Failed";
|
|
214
|
+
values: void;
|
|
215
|
+
} | {
|
|
216
|
+
tag: "Cancelled";
|
|
217
|
+
values: void;
|
|
218
|
+
} | {
|
|
219
|
+
tag: "Expired";
|
|
220
|
+
values: void;
|
|
221
|
+
} | {
|
|
222
|
+
tag: "Superseded";
|
|
223
|
+
values: void;
|
|
224
|
+
} | {
|
|
225
|
+
tag: "NotReady";
|
|
226
|
+
values: void;
|
|
227
|
+
} | {
|
|
228
|
+
tag: "Pending";
|
|
229
|
+
values: void;
|
|
230
|
+
} | {
|
|
231
|
+
tag: "RequiresLiquidation";
|
|
232
|
+
values: void;
|
|
233
|
+
};
|
|
234
|
+
export type ActionPayload = {
|
|
235
|
+
tag: "MarketOpen";
|
|
236
|
+
values: readonly [OpenPayload];
|
|
237
|
+
} | {
|
|
238
|
+
tag: "LimitOpen";
|
|
239
|
+
values: readonly [OpenPayload, TriggerCondition];
|
|
240
|
+
} | {
|
|
241
|
+
tag: "Decrease";
|
|
242
|
+
values: readonly [DecreasePayload];
|
|
243
|
+
} | {
|
|
244
|
+
tag: "Close";
|
|
245
|
+
values: readonly [ClosePayload];
|
|
246
|
+
};
|
|
247
|
+
export type FailureReason = {
|
|
248
|
+
tag: "PriceBoundExceeded";
|
|
249
|
+
values: void;
|
|
250
|
+
} | {
|
|
251
|
+
tag: "CapacityExceeded";
|
|
252
|
+
values: void;
|
|
253
|
+
} | {
|
|
254
|
+
tag: "ExposureCapExceeded";
|
|
255
|
+
values: void;
|
|
256
|
+
} | {
|
|
257
|
+
tag: "SideRestricted";
|
|
258
|
+
values: void;
|
|
259
|
+
} | {
|
|
260
|
+
tag: "InsufficientCollateral";
|
|
261
|
+
values: void;
|
|
262
|
+
} | {
|
|
263
|
+
tag: "UnpayableProfit";
|
|
264
|
+
values: void;
|
|
265
|
+
} | {
|
|
266
|
+
tag: "PositionGone";
|
|
267
|
+
values: void;
|
|
268
|
+
} | {
|
|
269
|
+
tag: "MarketPaused";
|
|
270
|
+
values: void;
|
|
271
|
+
} | {
|
|
272
|
+
tag: "SizeTooSmall";
|
|
273
|
+
values: void;
|
|
274
|
+
};
|
|
275
|
+
export interface KeeperRewards {
|
|
276
|
+
adl: i128;
|
|
277
|
+
close: i128;
|
|
278
|
+
decrease: i128;
|
|
279
|
+
expiry: i128;
|
|
280
|
+
limit_order: i128;
|
|
281
|
+
liquidation: i128;
|
|
282
|
+
lp_resolve: i128;
|
|
283
|
+
open: i128;
|
|
284
|
+
sl: i128;
|
|
285
|
+
tp: i128;
|
|
338
286
|
}
|
|
339
287
|
export type LpRequestKind = {
|
|
340
288
|
tag: "Deposit";
|
|
@@ -343,24 +291,35 @@ export type LpRequestKind = {
|
|
|
343
291
|
tag: "Withdrawal";
|
|
344
292
|
values: void;
|
|
345
293
|
};
|
|
346
|
-
/**
|
|
347
|
-
* Data required during a WASM migration. Single definition for all contracts.
|
|
348
|
-
*/
|
|
349
294
|
export interface MigrationData {
|
|
350
295
|
version: u32;
|
|
351
296
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
297
|
+
export interface PendingAction {
|
|
298
|
+
action_id: u64;
|
|
299
|
+
commit_observed_at: u64;
|
|
300
|
+
created_at: u64;
|
|
301
|
+
escrowed_collateral: i128;
|
|
302
|
+
execute_after: u64;
|
|
303
|
+
kind: ActionKind;
|
|
304
|
+
market_id: string;
|
|
305
|
+
owner: string;
|
|
306
|
+
payload: ActionPayload;
|
|
307
|
+
}
|
|
360
308
|
export interface PendingUpgrade {
|
|
361
309
|
eta: u64;
|
|
362
310
|
wasm_hash: Buffer;
|
|
363
311
|
}
|
|
312
|
+
export interface RemainderGroup {
|
|
313
|
+
distribution_remainder: i128;
|
|
314
|
+
lp_payer_remainder: i128;
|
|
315
|
+
receiver_liability_remainder: i128;
|
|
316
|
+
receiver_payer_remainder: i128;
|
|
317
|
+
}
|
|
318
|
+
export interface DecreasePayload {
|
|
319
|
+
acceptable_price: i128;
|
|
320
|
+
position_id: u64;
|
|
321
|
+
size_removed: i128;
|
|
322
|
+
}
|
|
364
323
|
export type LpRequestStatus = {
|
|
365
324
|
tag: "Pending";
|
|
366
325
|
values: void;
|
|
@@ -370,32 +329,20 @@ export type LpRequestStatus = {
|
|
|
370
329
|
} | {
|
|
371
330
|
tag: "Failed";
|
|
372
331
|
values: void;
|
|
373
|
-
} | {
|
|
374
|
-
tag: "Expired";
|
|
375
|
-
values: void;
|
|
376
332
|
};
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
export interface
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
execution_budget: i128;
|
|
387
|
-
expires_at: u64;
|
|
388
|
-
is_long: boolean;
|
|
389
|
-
size: i128;
|
|
390
|
-
stop_loss: i128;
|
|
391
|
-
take_profit: i128;
|
|
392
|
-
trigger_price: i128;
|
|
333
|
+
export interface PendingFeesView {
|
|
334
|
+
borrow: i128;
|
|
335
|
+
funding_paid_to_lps: i128;
|
|
336
|
+
funding_paid_to_receivers: i128;
|
|
337
|
+
funding_received: i128;
|
|
338
|
+
}
|
|
339
|
+
export interface PendingPriceFeed {
|
|
340
|
+
effective_at: u64;
|
|
341
|
+
price_feed: string;
|
|
393
342
|
}
|
|
394
343
|
export interface SettlementResult {
|
|
395
|
-
/**
|
|
396
|
-
* Shares minted for a deposit or assets paid for a withdrawal.
|
|
397
|
-
*/
|
|
398
344
|
amount: i128;
|
|
345
|
+
reward: i128;
|
|
399
346
|
status: SettlementStatus;
|
|
400
347
|
}
|
|
401
348
|
export type SettlementStatus = {
|
|
@@ -404,19 +351,49 @@ export type SettlementStatus = {
|
|
|
404
351
|
} | {
|
|
405
352
|
tag: "Failed";
|
|
406
353
|
values: void;
|
|
354
|
+
} | {
|
|
355
|
+
tag: "NotReady";
|
|
356
|
+
values: void;
|
|
407
357
|
};
|
|
358
|
+
export interface TriggerCondition {
|
|
359
|
+
trigger_above: boolean;
|
|
360
|
+
trigger_price: i128;
|
|
361
|
+
}
|
|
408
362
|
export interface AccountingSnapshot {
|
|
409
363
|
cash_lp_equity: i128;
|
|
410
364
|
cash_shortfall: i128;
|
|
365
|
+
deleveraging_side_count: u32;
|
|
411
366
|
free_lp_capital: i128;
|
|
412
|
-
|
|
367
|
+
min_equity_clear_of_adl: i128;
|
|
413
368
|
non_lp_claims: i128;
|
|
414
369
|
open_position_count: u64;
|
|
415
370
|
physical_cash: i128;
|
|
416
371
|
required_risk_backing: i128;
|
|
372
|
+
restricted_side_count: u32;
|
|
417
373
|
total_risk_units: i128;
|
|
418
374
|
vault_nav: i128;
|
|
419
375
|
}
|
|
376
|
+
export interface TriggerInstruction {
|
|
377
|
+
acceptable_price: i128;
|
|
378
|
+
commit_observed_at: u64;
|
|
379
|
+
committed_at: u64;
|
|
380
|
+
execute_after: u64;
|
|
381
|
+
trigger_price: i128;
|
|
382
|
+
}
|
|
383
|
+
export interface PendingGlobalConfig {
|
|
384
|
+
config: GlobalConfig;
|
|
385
|
+
effective_at: u64;
|
|
386
|
+
}
|
|
387
|
+
export interface PendingMarketConfig {
|
|
388
|
+
config: MarketConfig;
|
|
389
|
+
effective_at: u64;
|
|
390
|
+
}
|
|
391
|
+
export interface EventHeader {
|
|
392
|
+
actor: string;
|
|
393
|
+
event_version: u32;
|
|
394
|
+
ledger_timestamp: u64;
|
|
395
|
+
market: string;
|
|
396
|
+
}
|
|
420
397
|
export declare const UpgradeableError: {
|
|
421
398
|
/**
|
|
422
399
|
* When migration is attempted but not allowed due to upgrade state.
|
|
@@ -445,16 +422,6 @@ export declare const MerkleDistributorError: {
|
|
|
445
422
|
message: string;
|
|
446
423
|
};
|
|
447
424
|
};
|
|
448
|
-
/**
|
|
449
|
-
* Storage keys for the data associated with `MerkleDistributor`
|
|
450
|
-
*/
|
|
451
|
-
export type MerkleDistributorStorageKey = {
|
|
452
|
-
tag: "Root";
|
|
453
|
-
values: void;
|
|
454
|
-
} | {
|
|
455
|
-
tag: "Claimed";
|
|
456
|
-
values: readonly [u32];
|
|
457
|
-
};
|
|
458
425
|
/**
|
|
459
426
|
* Rounding direction for division operations
|
|
460
427
|
*/
|
|
@@ -482,37 +449,47 @@ export declare const SorobanFixedPointError: {
|
|
|
482
449
|
message: string;
|
|
483
450
|
};
|
|
484
451
|
};
|
|
485
|
-
export declare const
|
|
452
|
+
export declare const PausableError: {
|
|
486
453
|
/**
|
|
487
|
-
* The
|
|
454
|
+
* The operation failed because the contract is paused.
|
|
488
455
|
*/
|
|
489
|
-
|
|
456
|
+
1000: {
|
|
490
457
|
message: string;
|
|
491
458
|
};
|
|
492
459
|
/**
|
|
493
|
-
* The
|
|
460
|
+
* The operation failed because the contract is not paused.
|
|
494
461
|
*/
|
|
495
|
-
|
|
462
|
+
1001: {
|
|
496
463
|
message: string;
|
|
497
464
|
};
|
|
465
|
+
};
|
|
466
|
+
/**
|
|
467
|
+
* Storage keys for the data associated with `MerkleDistributor`
|
|
468
|
+
*/
|
|
469
|
+
export type MerkleDistributorStorageKey = {
|
|
470
|
+
tag: "Root";
|
|
471
|
+
values: void;
|
|
472
|
+
} | {
|
|
473
|
+
tag: "Claimed";
|
|
474
|
+
values: readonly [u32];
|
|
475
|
+
};
|
|
476
|
+
export declare const CryptoError: {
|
|
498
477
|
/**
|
|
499
|
-
*
|
|
478
|
+
* The merkle proof length is out of bounds.
|
|
500
479
|
*/
|
|
501
|
-
|
|
480
|
+
1400: {
|
|
502
481
|
message: string;
|
|
503
482
|
};
|
|
504
|
-
};
|
|
505
|
-
export declare const PausableError: {
|
|
506
483
|
/**
|
|
507
|
-
* The
|
|
484
|
+
* The index of the leaf is out of bounds.
|
|
508
485
|
*/
|
|
509
|
-
|
|
486
|
+
1401: {
|
|
510
487
|
message: string;
|
|
511
488
|
};
|
|
512
489
|
/**
|
|
513
|
-
*
|
|
490
|
+
* No data in hasher state.
|
|
514
491
|
*/
|
|
515
|
-
|
|
492
|
+
1402: {
|
|
516
493
|
message: string;
|
|
517
494
|
};
|
|
518
495
|
};
|
|
@@ -538,6 +515,12 @@ export interface Client {
|
|
|
538
515
|
new_wasm_hash: Buffer;
|
|
539
516
|
operator: string;
|
|
540
517
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
518
|
+
/**
|
|
519
|
+
* Construct and simulate a skip_head 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.
|
|
520
|
+
*/
|
|
521
|
+
skip_head: ({ caller }: {
|
|
522
|
+
caller: string;
|
|
523
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
541
524
|
/**
|
|
542
525
|
* Construct and simulate a get_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.
|
|
543
526
|
*/
|
|
@@ -556,6 +539,12 @@ export interface Client {
|
|
|
556
539
|
cancel_upgrade: ({ caller }: {
|
|
557
540
|
caller: string;
|
|
558
541
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
542
|
+
/**
|
|
543
|
+
* Construct and simulate a claim_lp_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.
|
|
544
|
+
*/
|
|
545
|
+
claim_lp_payout: ({ owner }: {
|
|
546
|
+
owner: string;
|
|
547
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
|
|
559
548
|
/**
|
|
560
549
|
* 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.
|
|
561
550
|
*/
|
|
@@ -577,6 +566,12 @@ export interface Client {
|
|
|
577
566
|
owner: string;
|
|
578
567
|
shares: i128;
|
|
579
568
|
}, options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
|
|
569
|
+
/**
|
|
570
|
+
* Construct and simulate a lp_payout_claimable 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
|
+
*/
|
|
572
|
+
lp_payout_claimable: ({ owner }: {
|
|
573
|
+
owner: string;
|
|
574
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
|
|
580
575
|
/**
|
|
581
576
|
* Construct and simulate a next_request_to_resolve 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.
|
|
582
577
|
*/
|
|
@@ -586,10 +581,9 @@ export declare class Client extends ContractClient {
|
|
|
586
581
|
readonly options: ContractClientOptions;
|
|
587
582
|
static deploy<T = Client>(
|
|
588
583
|
/** Constructor/Initialization Args for the contract's `__constructor` method */
|
|
589
|
-
{ asset_address, vault_address,
|
|
584
|
+
{ asset_address, vault_address, config_manager_address }: {
|
|
590
585
|
asset_address: string;
|
|
591
586
|
vault_address: string;
|
|
592
|
-
oracle_router: string;
|
|
593
587
|
config_manager_address: string;
|
|
594
588
|
},
|
|
595
589
|
/** Options for initializing a Client as well as for calling a method, with extras specific to deploying. */
|
|
@@ -605,12 +599,15 @@ export declare class Client extends ContractClient {
|
|
|
605
599
|
readonly fromJSON: {
|
|
606
600
|
migrate: (json: string) => AssembledTransaction<null>;
|
|
607
601
|
upgrade: (json: string) => AssembledTransaction<null>;
|
|
602
|
+
skip_head: (json: string) => AssembledTransaction<null>;
|
|
608
603
|
get_request: (json: string) => AssembledTransaction<LpRequest>;
|
|
609
604
|
resolve_next: (json: string) => AssembledTransaction<SettlementResult>;
|
|
610
605
|
cancel_upgrade: (json: string) => AssembledTransaction<null>;
|
|
606
|
+
claim_lp_payout: (json: string) => AssembledTransaction<bigint>;
|
|
611
607
|
propose_upgrade: (json: string) => AssembledTransaction<null>;
|
|
612
608
|
request_deposit: (json: string) => AssembledTransaction<bigint>;
|
|
613
609
|
request_withdrawal: (json: string) => AssembledTransaction<bigint>;
|
|
610
|
+
lp_payout_claimable: (json: string) => AssembledTransaction<bigint>;
|
|
614
611
|
next_request_to_resolve: (json: string) => AssembledTransaction<bigint>;
|
|
615
612
|
};
|
|
616
613
|
}
|