@win-trader/bindings 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config-manager/dist/index.d.ts +766 -0
- package/config-manager/dist/index.js +313 -0
- package/mock-token/dist/index.d.ts +1448 -0
- package/mock-token/dist/index.js +635 -0
- package/oracle/dist/index.d.ts +421 -0
- package/oracle/dist/index.js +140 -0
- package/oracle-router/dist/index.d.ts +487 -0
- package/oracle-router/dist/index.js +186 -0
- package/package.json +36 -0
- package/position-manager/dist/index.d.ts +709 -0
- package/position-manager/dist/index.js +256 -0
- package/vault/dist/index.d.ts +1914 -0
- package/vault/dist/index.js +776 -0
|
@@ -0,0 +1,766 @@
|
|
|
1
|
+
import { Buffer } from "buffer";
|
|
2
|
+
import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, MethodOptions } from "@stellar/stellar-sdk/contract";
|
|
3
|
+
import type { u32, u64, i128, Option } from "@stellar/stellar-sdk/contract";
|
|
4
|
+
export * from "@stellar/stellar-sdk";
|
|
5
|
+
export * as contract from "@stellar/stellar-sdk/contract";
|
|
6
|
+
export * as rpc from "@stellar/stellar-sdk/rpc";
|
|
7
|
+
export declare const ConfigManagerError: {
|
|
8
|
+
1: {
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
2: {
|
|
12
|
+
message: string;
|
|
13
|
+
};
|
|
14
|
+
3: {
|
|
15
|
+
message: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* `set_upgrade_timelock` called with seconds below `MIN_UPGRADE_TIMELOCK`.
|
|
19
|
+
*/
|
|
20
|
+
6: {
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* `propose_admin(caller, new_admin)` rejected because `caller == new_admin`.
|
|
25
|
+
*/
|
|
26
|
+
7: {
|
|
27
|
+
message: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* `accept_admin` rejected — caller is not the currently pending admin.
|
|
31
|
+
*/
|
|
32
|
+
8: {
|
|
33
|
+
message: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* `accept_admin` rejected — there is no pending admin proposal.
|
|
37
|
+
*/
|
|
38
|
+
9: {
|
|
39
|
+
message: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* `upgrade` rejected — no `propose_upgrade` was made before commit.
|
|
43
|
+
* The two-step upgrade flow requires a prior proposal.
|
|
44
|
+
*/
|
|
45
|
+
10: {
|
|
46
|
+
message: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* `upgrade` rejected — timelock has not elapsed yet.
|
|
50
|
+
*/
|
|
51
|
+
11: {
|
|
52
|
+
message: string;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* `upgrade` rejected — `new_wasm_hash` does not match the proposed
|
|
56
|
+
* `PendingUpgrade.wasm_hash`.
|
|
57
|
+
*/
|
|
58
|
+
12: {
|
|
59
|
+
message: string;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* `accept_admin` rejected — the proposal is older than
|
|
63
|
+
* `ADMIN_PROPOSAL_TTL_SECS`.
|
|
64
|
+
*/
|
|
65
|
+
13: {
|
|
66
|
+
message: string;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* `set_upgrade_timelock` called with seconds above
|
|
70
|
+
* `MAX_UPGRADE_TIMELOCK_SECS`.
|
|
71
|
+
*/
|
|
72
|
+
14: {
|
|
73
|
+
message: string;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* FeeSplits components (lp/dev/staker) do not sum to exactly BPS.
|
|
77
|
+
*/
|
|
78
|
+
22: {
|
|
79
|
+
message: string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* `min_collateral` is not strictly positive.
|
|
83
|
+
*/
|
|
84
|
+
30: {
|
|
85
|
+
message: string;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* `max_utilization_ratio` is out of (0, BPS] range.
|
|
89
|
+
*/
|
|
90
|
+
31: {
|
|
91
|
+
message: string;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* `funding_cut_bps` exceeds `MAX_FUNDING_CUT_BPS`.
|
|
95
|
+
*/
|
|
96
|
+
32: {
|
|
97
|
+
message: string;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* `adl_pnl_bps` is below `MIN_ADL_PNL_BPS` or above BPS.
|
|
101
|
+
*/
|
|
102
|
+
33: {
|
|
103
|
+
message: string;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* `adl_utilization_bps` is out of (0, BPS] range.
|
|
107
|
+
*/
|
|
108
|
+
34: {
|
|
109
|
+
message: string;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* `liquidation_threshold_bps` is below `MIN_LIQUIDATION_THRESHOLD_BPS`
|
|
113
|
+
* or exceeds 10% of collateral.
|
|
114
|
+
*/
|
|
115
|
+
35: {
|
|
116
|
+
message: string;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* `cooldown_duration` exceeds `MAX_COOLDOWN_DURATION`.
|
|
120
|
+
*/
|
|
121
|
+
36: {
|
|
122
|
+
message: string;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* `min_position_lifetime` exceeds `MAX_MIN_POSITION_LIFETIME_SECS`.
|
|
126
|
+
*/
|
|
127
|
+
37: {
|
|
128
|
+
message: string;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* A BorrowRateConfig rate is negative.
|
|
132
|
+
*/
|
|
133
|
+
40: {
|
|
134
|
+
message: string;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* `optimal_utilization_bps` is out of (0, BPS] range.
|
|
138
|
+
*/
|
|
139
|
+
41: {
|
|
140
|
+
message: string;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* `slope2_bps < slope1_bps` — kink curve must be non-decreasing.
|
|
144
|
+
*/
|
|
145
|
+
42: {
|
|
146
|
+
message: string;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* `slope2_bps` exceeds `MAX_SLOPE2_BPS`.
|
|
150
|
+
*/
|
|
151
|
+
43: {
|
|
152
|
+
message: string;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* `open_fee_bps` exceeds `MAX_OPEN_FEE_BPS`.
|
|
156
|
+
*/
|
|
157
|
+
44: {
|
|
158
|
+
message: string;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* `liquidation_bounty_bps` exceeds `MAX_LIQUIDATION_BOUNTY_BPS`.
|
|
162
|
+
*/
|
|
163
|
+
45: {
|
|
164
|
+
message: string;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* `tp_sl_execution_fee` is negative or exceeds `MAX_TP_SL_EXECUTION_FEE`.
|
|
168
|
+
*/
|
|
169
|
+
46: {
|
|
170
|
+
message: string;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* `base_borrow_rate_bps` exceeds `MAX_BASE_BORROW_RATE_BPS`.
|
|
174
|
+
*/
|
|
175
|
+
47: {
|
|
176
|
+
message: string;
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* `base_funding_rate_bps` exceeds `MAX_BASE_FUNDING_RATE_BPS`.
|
|
180
|
+
*/
|
|
181
|
+
48: {
|
|
182
|
+
message: string;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
export type StorageKey = {
|
|
186
|
+
tag: "Initialized";
|
|
187
|
+
values: void;
|
|
188
|
+
} | {
|
|
189
|
+
tag: "FeeSplits";
|
|
190
|
+
values: void;
|
|
191
|
+
} | {
|
|
192
|
+
tag: "FeeConfig";
|
|
193
|
+
values: void;
|
|
194
|
+
} | {
|
|
195
|
+
tag: "ProtocolLimits";
|
|
196
|
+
values: void;
|
|
197
|
+
} | {
|
|
198
|
+
tag: "BorrowRateConfig";
|
|
199
|
+
values: void;
|
|
200
|
+
} | {
|
|
201
|
+
tag: "UpgradeTimelock";
|
|
202
|
+
values: void;
|
|
203
|
+
} | {
|
|
204
|
+
tag: "PendingAdmin";
|
|
205
|
+
values: void;
|
|
206
|
+
} | {
|
|
207
|
+
tag: "Version";
|
|
208
|
+
values: void;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* Pending admin transfer awaiting `accept_admin`. The proposal timestamp
|
|
212
|
+
* bounds its lifetime to `ADMIN_PROPOSAL_TTL_SECS`.
|
|
213
|
+
*/
|
|
214
|
+
export interface PendingAdminProposal {
|
|
215
|
+
admin: string;
|
|
216
|
+
proposed_at: u64;
|
|
217
|
+
}
|
|
218
|
+
export declare const RoleTransferError: {
|
|
219
|
+
2200: {
|
|
220
|
+
message: string;
|
|
221
|
+
};
|
|
222
|
+
2201: {
|
|
223
|
+
message: string;
|
|
224
|
+
};
|
|
225
|
+
2202: {
|
|
226
|
+
message: string;
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
export declare const AccessControlError: {
|
|
230
|
+
2000: {
|
|
231
|
+
message: string;
|
|
232
|
+
};
|
|
233
|
+
2001: {
|
|
234
|
+
message: string;
|
|
235
|
+
};
|
|
236
|
+
2002: {
|
|
237
|
+
message: string;
|
|
238
|
+
};
|
|
239
|
+
2003: {
|
|
240
|
+
message: string;
|
|
241
|
+
};
|
|
242
|
+
2004: {
|
|
243
|
+
message: string;
|
|
244
|
+
};
|
|
245
|
+
2005: {
|
|
246
|
+
message: string;
|
|
247
|
+
};
|
|
248
|
+
2006: {
|
|
249
|
+
message: string;
|
|
250
|
+
};
|
|
251
|
+
2007: {
|
|
252
|
+
message: string;
|
|
253
|
+
};
|
|
254
|
+
2008: {
|
|
255
|
+
message: string;
|
|
256
|
+
};
|
|
257
|
+
2009: {
|
|
258
|
+
message: string;
|
|
259
|
+
};
|
|
260
|
+
2010: {
|
|
261
|
+
message: string;
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Storage key for enumeration of accounts per role.
|
|
266
|
+
*/
|
|
267
|
+
export interface RoleAccountKey {
|
|
268
|
+
index: u32;
|
|
269
|
+
role: string;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Storage keys for the data associated with the access control
|
|
273
|
+
*/
|
|
274
|
+
export type AccessControlStorageKey = {
|
|
275
|
+
tag: "ExistingRoles";
|
|
276
|
+
values: void;
|
|
277
|
+
} | {
|
|
278
|
+
tag: "RoleAccounts";
|
|
279
|
+
values: readonly [RoleAccountKey];
|
|
280
|
+
} | {
|
|
281
|
+
tag: "HasRole";
|
|
282
|
+
values: readonly [string, string];
|
|
283
|
+
} | {
|
|
284
|
+
tag: "RoleAccountsCount";
|
|
285
|
+
values: readonly [string];
|
|
286
|
+
} | {
|
|
287
|
+
tag: "RoleAdmin";
|
|
288
|
+
values: readonly [string];
|
|
289
|
+
} | {
|
|
290
|
+
tag: "Admin";
|
|
291
|
+
values: void;
|
|
292
|
+
} | {
|
|
293
|
+
tag: "PendingAdmin";
|
|
294
|
+
values: void;
|
|
295
|
+
};
|
|
296
|
+
export declare const OwnableError: {
|
|
297
|
+
2100: {
|
|
298
|
+
message: string;
|
|
299
|
+
};
|
|
300
|
+
2101: {
|
|
301
|
+
message: string;
|
|
302
|
+
};
|
|
303
|
+
2102: {
|
|
304
|
+
message: string;
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* Storage keys for `Ownable` utility.
|
|
309
|
+
*/
|
|
310
|
+
export type OwnableStorageKey = {
|
|
311
|
+
tag: "Owner";
|
|
312
|
+
values: void;
|
|
313
|
+
} | {
|
|
314
|
+
tag: "PendingOwner";
|
|
315
|
+
values: void;
|
|
316
|
+
};
|
|
317
|
+
/**
|
|
318
|
+
* Represents a single trader's open leveraged position.
|
|
319
|
+
*/
|
|
320
|
+
export interface Position {
|
|
321
|
+
/**
|
|
322
|
+
* USDC collateral deposited by the trader.
|
|
323
|
+
*/
|
|
324
|
+
collateral: i128;
|
|
325
|
+
/**
|
|
326
|
+
* Global borrow accumulator index at position open (for lazy fee calc).
|
|
327
|
+
*/
|
|
328
|
+
entry_borrow_index: i128;
|
|
329
|
+
/**
|
|
330
|
+
* Global funding accumulator index at position open (for lazy fee calc).
|
|
331
|
+
*/
|
|
332
|
+
entry_funding_index: i128;
|
|
333
|
+
/**
|
|
334
|
+
* Oracle price at the time the position was opened (scaled by 1e7).
|
|
335
|
+
*/
|
|
336
|
+
entry_price: i128;
|
|
337
|
+
/**
|
|
338
|
+
* Flat USDC fee escrowed when TP or SL is set. Paid to executor on trigger, refunded on user close / ADL, forfeited to revenue on liquidation.
|
|
339
|
+
*/
|
|
340
|
+
execution_fee_escrow: i128;
|
|
341
|
+
/**
|
|
342
|
+
* True for a long position, false for a short.
|
|
343
|
+
*/
|
|
344
|
+
is_long: boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Block timestamp when the position was last increased (anti-front-running lock).
|
|
347
|
+
*/
|
|
348
|
+
last_increased_time: u64;
|
|
349
|
+
/**
|
|
350
|
+
* Notional size of the position in USDC.
|
|
351
|
+
*/
|
|
352
|
+
size: i128;
|
|
353
|
+
/**
|
|
354
|
+
* Stop-loss price (scaled by 1e7). 0 = not set.
|
|
355
|
+
*/
|
|
356
|
+
stop_loss: i128;
|
|
357
|
+
/**
|
|
358
|
+
* Take-profit price (scaled by 1e7). 0 = not set.
|
|
359
|
+
*/
|
|
360
|
+
take_profit: i128;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Global market state for a single tradeable asset symbol.
|
|
364
|
+
*/
|
|
365
|
+
export interface MarketInfo {
|
|
366
|
+
/**
|
|
367
|
+
* Cumulative borrow fee index (grows monotonically with time).
|
|
368
|
+
*/
|
|
369
|
+
acc_borrow_index: i128;
|
|
370
|
+
/**
|
|
371
|
+
* Cumulative funding rate index (signed; positive = longs pay shorts).
|
|
372
|
+
*/
|
|
373
|
+
acc_funding_index: i128;
|
|
374
|
+
/**
|
|
375
|
+
* Volume-weighted average entry price of all active long positions.
|
|
376
|
+
*/
|
|
377
|
+
global_long_avg_price: i128;
|
|
378
|
+
/**
|
|
379
|
+
* Volume-weighted average entry price of all active short positions.
|
|
380
|
+
*/
|
|
381
|
+
global_short_avg_price: i128;
|
|
382
|
+
/**
|
|
383
|
+
* Timestamp of the last keeper index update.
|
|
384
|
+
*/
|
|
385
|
+
last_index_update: u64;
|
|
386
|
+
/**
|
|
387
|
+
* Total notional size of all open long positions.
|
|
388
|
+
*/
|
|
389
|
+
long_open_interest: i128;
|
|
390
|
+
/**
|
|
391
|
+
* Total notional size of all open short positions.
|
|
392
|
+
*/
|
|
393
|
+
short_open_interest: i128;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Global safety thresholds for price validation.
|
|
397
|
+
*/
|
|
398
|
+
export interface OracleConfig {
|
|
399
|
+
/**
|
|
400
|
+
* How long a cached aggregated price remains valid (in seconds). A
|
|
401
|
+
* `get_price` call within this window of the last fetch returns the
|
|
402
|
+
* cached value without re-querying sources. Must be > 0 and
|
|
403
|
+
* <= `staleness_threshold` (otherwise the cache could outlive a fresh
|
|
404
|
+
* source price and serve stale data).
|
|
405
|
+
*/
|
|
406
|
+
cache_duration: u64;
|
|
407
|
+
/**
|
|
408
|
+
* Maximum allowed spread between oracle sources in basis points
|
|
409
|
+
* (e.g., 100 = 1%). Bounded at `shared::constants::MAX_DEVIATION_BPS_CEILING`.
|
|
410
|
+
*/
|
|
411
|
+
max_deviation_bps: i128;
|
|
412
|
+
/**
|
|
413
|
+
* Minimum number of source responses that must agree within
|
|
414
|
+
* `max_deviation_bps` for OracleRouter to return a price. Floored at
|
|
415
|
+
* `shared::constants::MIN_REQUIRED_SOURCES_FLOOR`, ceilinged at
|
|
416
|
+
* `shared::constants::MAX_ORACLE_SOURCES`.
|
|
417
|
+
*/
|
|
418
|
+
min_required_sources: u32;
|
|
419
|
+
/**
|
|
420
|
+
* Maximum age of an external SEP-40 price feed before it is rejected
|
|
421
|
+
* as stale (in seconds).
|
|
422
|
+
*/
|
|
423
|
+
staleness_threshold: u64;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Data required during a WASM migration. Single definition for all contracts.
|
|
427
|
+
*/
|
|
428
|
+
export interface MigrationData {
|
|
429
|
+
version: u32;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Pending WASM upgrade — set by `propose_upgrade`, consumed by `upgrade`
|
|
433
|
+
* (cleared atomically on a successful install), or cleared by `cancel_upgrade`.
|
|
434
|
+
* Single shape across every protocol contract; all four contracts store it at
|
|
435
|
+
* the shared `pending_upgrade` Symbol key in their own instance storage (see
|
|
436
|
+
* `interfaces::upgrade::pending_upgrade_key`). `upgrade` refuses to install
|
|
437
|
+
* unless `pending.wasm_hash` matches the supplied hash and `now >= eta`.
|
|
438
|
+
*/
|
|
439
|
+
export interface PendingUpgrade {
|
|
440
|
+
eta: u64;
|
|
441
|
+
wasm_hash: Buffer;
|
|
442
|
+
}
|
|
443
|
+
export declare const UpgradeableError: {
|
|
444
|
+
/**
|
|
445
|
+
* When migration is attempted but not allowed due to upgrade state.
|
|
446
|
+
*/
|
|
447
|
+
1100: {
|
|
448
|
+
message: string;
|
|
449
|
+
};
|
|
450
|
+
};
|
|
451
|
+
export declare const MerkleDistributorError: {
|
|
452
|
+
/**
|
|
453
|
+
* The merkle root is not set.
|
|
454
|
+
*/
|
|
455
|
+
1300: {
|
|
456
|
+
message: string;
|
|
457
|
+
};
|
|
458
|
+
/**
|
|
459
|
+
* The provided index was already claimed.
|
|
460
|
+
*/
|
|
461
|
+
1301: {
|
|
462
|
+
message: string;
|
|
463
|
+
};
|
|
464
|
+
/**
|
|
465
|
+
* The proof is invalid.
|
|
466
|
+
*/
|
|
467
|
+
1302: {
|
|
468
|
+
message: string;
|
|
469
|
+
};
|
|
470
|
+
};
|
|
471
|
+
/**
|
|
472
|
+
* Storage keys for the data associated with `MerkleDistributor`
|
|
473
|
+
*/
|
|
474
|
+
export type MerkleDistributorStorageKey = {
|
|
475
|
+
tag: "Root";
|
|
476
|
+
values: void;
|
|
477
|
+
} | {
|
|
478
|
+
tag: "Claimed";
|
|
479
|
+
values: readonly [u32];
|
|
480
|
+
};
|
|
481
|
+
/**
|
|
482
|
+
* Rounding direction for division operations
|
|
483
|
+
*/
|
|
484
|
+
export type Rounding = {
|
|
485
|
+
tag: "Floor";
|
|
486
|
+
values: void;
|
|
487
|
+
} | {
|
|
488
|
+
tag: "Ceil";
|
|
489
|
+
values: void;
|
|
490
|
+
} | {
|
|
491
|
+
tag: "Truncate";
|
|
492
|
+
values: void;
|
|
493
|
+
};
|
|
494
|
+
export declare const SorobanFixedPointError: {
|
|
495
|
+
/**
|
|
496
|
+
* Arithmetic overflow occurred
|
|
497
|
+
*/
|
|
498
|
+
1500: {
|
|
499
|
+
message: string;
|
|
500
|
+
};
|
|
501
|
+
/**
|
|
502
|
+
* Division by zero
|
|
503
|
+
*/
|
|
504
|
+
1501: {
|
|
505
|
+
message: string;
|
|
506
|
+
};
|
|
507
|
+
};
|
|
508
|
+
export declare const CryptoError: {
|
|
509
|
+
/**
|
|
510
|
+
* The merkle proof length is out of bounds.
|
|
511
|
+
*/
|
|
512
|
+
1400: {
|
|
513
|
+
message: string;
|
|
514
|
+
};
|
|
515
|
+
/**
|
|
516
|
+
* The index of the leaf is out of bounds.
|
|
517
|
+
*/
|
|
518
|
+
1401: {
|
|
519
|
+
message: string;
|
|
520
|
+
};
|
|
521
|
+
/**
|
|
522
|
+
* No data in hasher state.
|
|
523
|
+
*/
|
|
524
|
+
1402: {
|
|
525
|
+
message: string;
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
export declare const PausableError: {
|
|
529
|
+
/**
|
|
530
|
+
* The operation failed because the contract is paused.
|
|
531
|
+
*/
|
|
532
|
+
1000: {
|
|
533
|
+
message: string;
|
|
534
|
+
};
|
|
535
|
+
/**
|
|
536
|
+
* The operation failed because the contract is not paused.
|
|
537
|
+
*/
|
|
538
|
+
1001: {
|
|
539
|
+
message: string;
|
|
540
|
+
};
|
|
541
|
+
};
|
|
542
|
+
/**
|
|
543
|
+
* Storage key for the pausable state
|
|
544
|
+
*/
|
|
545
|
+
export type PausableStorageKey = {
|
|
546
|
+
tag: "Paused";
|
|
547
|
+
values: void;
|
|
548
|
+
};
|
|
549
|
+
/**
|
|
550
|
+
* Execution-bounty and open-fee parameters charged to traders.
|
|
551
|
+
* `open_fee_bps` and `liquidation_bounty_bps` are in basis points;
|
|
552
|
+
* `tp_sl_execution_fee` is a flat USDC amount at PRECISION scale.
|
|
553
|
+
*/
|
|
554
|
+
export interface FeeConfig {
|
|
555
|
+
liquidation_bounty_bps: u32;
|
|
556
|
+
open_fee_bps: u32;
|
|
557
|
+
tp_sl_execution_fee: i128;
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Defines how protocol revenue is split between parties.
|
|
561
|
+
* All values are in basis points (bps). Must sum to 10_000.
|
|
562
|
+
*/
|
|
563
|
+
export interface FeeSplits {
|
|
564
|
+
dev_bps: u32;
|
|
565
|
+
lp_bps: u32;
|
|
566
|
+
staker_bps: u32;
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Global protocol risk and timing parameters.
|
|
570
|
+
*/
|
|
571
|
+
export interface ProtocolLimits {
|
|
572
|
+
adl_pnl_bps: u32;
|
|
573
|
+
adl_utilization_bps: u32;
|
|
574
|
+
cooldown_duration: u64;
|
|
575
|
+
funding_cut_bps: u32;
|
|
576
|
+
liquidation_threshold_bps: u32;
|
|
577
|
+
max_utilization_ratio: i128;
|
|
578
|
+
min_collateral: i128;
|
|
579
|
+
min_position_lifetime: u64;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Borrow rate kink curve and funding rate parameters (all in basis points).
|
|
583
|
+
*/
|
|
584
|
+
export interface BorrowRateConfig {
|
|
585
|
+
base_borrow_rate_bps: i128;
|
|
586
|
+
base_funding_rate_bps: i128;
|
|
587
|
+
optimal_utilization_bps: i128;
|
|
588
|
+
slope1_bps: i128;
|
|
589
|
+
slope2_bps: i128;
|
|
590
|
+
}
|
|
591
|
+
export interface Client {
|
|
592
|
+
/**
|
|
593
|
+
* Construct and simulate a migrate transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
594
|
+
*/
|
|
595
|
+
migrate: ({ migration_data, operator }: {
|
|
596
|
+
migration_data: MigrationData;
|
|
597
|
+
operator: string;
|
|
598
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
599
|
+
/**
|
|
600
|
+
* Construct and simulate a 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.
|
|
601
|
+
*/
|
|
602
|
+
upgrade: ({ new_wasm_hash, operator }: {
|
|
603
|
+
new_wasm_hash: Buffer;
|
|
604
|
+
operator: string;
|
|
605
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
606
|
+
/**
|
|
607
|
+
* Construct and simulate a has_role 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.
|
|
608
|
+
*/
|
|
609
|
+
has_role: ({ role, account }: {
|
|
610
|
+
role: string;
|
|
611
|
+
account: string;
|
|
612
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<boolean>>;
|
|
613
|
+
/**
|
|
614
|
+
* Construct and simulate a grant_role transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
615
|
+
*/
|
|
616
|
+
grant_role: ({ caller, role, account }: {
|
|
617
|
+
caller: string;
|
|
618
|
+
role: string;
|
|
619
|
+
account: string;
|
|
620
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
621
|
+
/**
|
|
622
|
+
* Construct and simulate a revoke_role 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.
|
|
623
|
+
*/
|
|
624
|
+
revoke_role: ({ caller, role, account }: {
|
|
625
|
+
caller: string;
|
|
626
|
+
role: string;
|
|
627
|
+
account: string;
|
|
628
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
629
|
+
/**
|
|
630
|
+
* Construct and simulate a accept_admin transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
631
|
+
*/
|
|
632
|
+
accept_admin: ({ new_admin }: {
|
|
633
|
+
new_admin: string;
|
|
634
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
635
|
+
/**
|
|
636
|
+
* Construct and simulate a propose_admin transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
637
|
+
*/
|
|
638
|
+
propose_admin: ({ caller, new_admin }: {
|
|
639
|
+
caller: string;
|
|
640
|
+
new_admin: string;
|
|
641
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
642
|
+
/**
|
|
643
|
+
* 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.
|
|
644
|
+
*/
|
|
645
|
+
cancel_upgrade: ({ caller }: {
|
|
646
|
+
caller: string;
|
|
647
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
648
|
+
/**
|
|
649
|
+
* Construct and simulate a get_fee_config transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
650
|
+
*/
|
|
651
|
+
get_fee_config: (options?: MethodOptions) => Promise<AssembledTransaction<FeeConfig>>;
|
|
652
|
+
/**
|
|
653
|
+
* Construct and simulate a get_fee_splits transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
654
|
+
*/
|
|
655
|
+
get_fee_splits: (options?: MethodOptions) => Promise<AssembledTransaction<FeeSplits>>;
|
|
656
|
+
/**
|
|
657
|
+
* Construct and simulate a set_fee_config transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
658
|
+
*/
|
|
659
|
+
set_fee_config: ({ caller, config }: {
|
|
660
|
+
caller: string;
|
|
661
|
+
config: FeeConfig;
|
|
662
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
663
|
+
/**
|
|
664
|
+
* Construct and simulate a propose_upgrade transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
665
|
+
*/
|
|
666
|
+
propose_upgrade: ({ caller, wasm_hash }: {
|
|
667
|
+
caller: string;
|
|
668
|
+
wasm_hash: Buffer;
|
|
669
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
670
|
+
/**
|
|
671
|
+
* Construct and simulate a bump_config_state 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.
|
|
672
|
+
*/
|
|
673
|
+
bump_config_state: (options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
674
|
+
/**
|
|
675
|
+
* Construct and simulate a get_pending_admin transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
676
|
+
*/
|
|
677
|
+
get_pending_admin: (options?: MethodOptions) => Promise<AssembledTransaction<Option<string>>>;
|
|
678
|
+
/**
|
|
679
|
+
* Construct and simulate a update_fee_splits transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
680
|
+
*/
|
|
681
|
+
update_fee_splits: ({ caller, fee_splits }: {
|
|
682
|
+
caller: string;
|
|
683
|
+
fee_splits: FeeSplits;
|
|
684
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
685
|
+
/**
|
|
686
|
+
* Construct and simulate a get_protocol_limits transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
687
|
+
*/
|
|
688
|
+
get_protocol_limits: (options?: MethodOptions) => Promise<AssembledTransaction<ProtocolLimits>>;
|
|
689
|
+
/**
|
|
690
|
+
* Construct and simulate a get_upgrade_timelock transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
691
|
+
*/
|
|
692
|
+
get_upgrade_timelock: (options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
|
|
693
|
+
/**
|
|
694
|
+
* Construct and simulate a set_upgrade_timelock transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
695
|
+
*/
|
|
696
|
+
set_upgrade_timelock: ({ caller, seconds }: {
|
|
697
|
+
caller: string;
|
|
698
|
+
seconds: u64;
|
|
699
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
700
|
+
/**
|
|
701
|
+
* Construct and simulate a cancel_admin_proposal 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.
|
|
702
|
+
*/
|
|
703
|
+
cancel_admin_proposal: ({ caller }: {
|
|
704
|
+
caller: string;
|
|
705
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
706
|
+
/**
|
|
707
|
+
* Construct and simulate a get_borrow_rate_config transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
708
|
+
*/
|
|
709
|
+
get_borrow_rate_config: (options?: MethodOptions) => Promise<AssembledTransaction<BorrowRateConfig>>;
|
|
710
|
+
/**
|
|
711
|
+
* Construct and simulate a update_protocol_limits transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
712
|
+
*/
|
|
713
|
+
update_protocol_limits: ({ caller, limits }: {
|
|
714
|
+
caller: string;
|
|
715
|
+
limits: ProtocolLimits;
|
|
716
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
717
|
+
/**
|
|
718
|
+
* Construct and simulate a update_borrow_rate_config transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
719
|
+
*/
|
|
720
|
+
update_borrow_rate_config: ({ caller, config }: {
|
|
721
|
+
caller: string;
|
|
722
|
+
config: BorrowRateConfig;
|
|
723
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
724
|
+
}
|
|
725
|
+
export declare class Client extends ContractClient {
|
|
726
|
+
readonly options: ContractClientOptions;
|
|
727
|
+
static deploy<T = Client>(
|
|
728
|
+
/** Constructor/Initialization Args for the contract's `__constructor` method */
|
|
729
|
+
{ admin_address }: {
|
|
730
|
+
admin_address: string;
|
|
731
|
+
},
|
|
732
|
+
/** Options for initializing a Client as well as for calling a method, with extras specific to deploying. */
|
|
733
|
+
options: MethodOptions & Omit<ContractClientOptions, "contractId"> & {
|
|
734
|
+
/** The hash of the Wasm blob, which must already be installed on-chain. */
|
|
735
|
+
wasmHash: Buffer | string;
|
|
736
|
+
/** Salt used to generate the contract's ID. Passed through to {@link Operation.createCustomContract}. Default: random. */
|
|
737
|
+
salt?: Buffer | Uint8Array;
|
|
738
|
+
/** The format used to decode `wasmHash`, if it's provided as a string. */
|
|
739
|
+
format?: "hex" | "base64";
|
|
740
|
+
}): Promise<AssembledTransaction<T>>;
|
|
741
|
+
constructor(options: ContractClientOptions);
|
|
742
|
+
readonly fromJSON: {
|
|
743
|
+
migrate: (json: string) => AssembledTransaction<null>;
|
|
744
|
+
upgrade: (json: string) => AssembledTransaction<null>;
|
|
745
|
+
has_role: (json: string) => AssembledTransaction<boolean>;
|
|
746
|
+
grant_role: (json: string) => AssembledTransaction<null>;
|
|
747
|
+
revoke_role: (json: string) => AssembledTransaction<null>;
|
|
748
|
+
accept_admin: (json: string) => AssembledTransaction<null>;
|
|
749
|
+
propose_admin: (json: string) => AssembledTransaction<null>;
|
|
750
|
+
cancel_upgrade: (json: string) => AssembledTransaction<null>;
|
|
751
|
+
get_fee_config: (json: string) => AssembledTransaction<FeeConfig>;
|
|
752
|
+
get_fee_splits: (json: string) => AssembledTransaction<FeeSplits>;
|
|
753
|
+
set_fee_config: (json: string) => AssembledTransaction<null>;
|
|
754
|
+
propose_upgrade: (json: string) => AssembledTransaction<null>;
|
|
755
|
+
bump_config_state: (json: string) => AssembledTransaction<null>;
|
|
756
|
+
get_pending_admin: (json: string) => AssembledTransaction<Option<string>>;
|
|
757
|
+
update_fee_splits: (json: string) => AssembledTransaction<null>;
|
|
758
|
+
get_protocol_limits: (json: string) => AssembledTransaction<ProtocolLimits>;
|
|
759
|
+
get_upgrade_timelock: (json: string) => AssembledTransaction<bigint>;
|
|
760
|
+
set_upgrade_timelock: (json: string) => AssembledTransaction<null>;
|
|
761
|
+
cancel_admin_proposal: (json: string) => AssembledTransaction<null>;
|
|
762
|
+
get_borrow_rate_config: (json: string) => AssembledTransaction<BorrowRateConfig>;
|
|
763
|
+
update_protocol_limits: (json: string) => AssembledTransaction<null>;
|
|
764
|
+
update_borrow_rate_config: (json: string) => AssembledTransaction<null>;
|
|
765
|
+
};
|
|
766
|
+
}
|