@mysten/deepbook-v3 2.0.0 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +100 -0
- package/PREDICT.md +256 -0
- package/README.md +116 -0
- package/dist/account.d.mts +139 -0
- package/dist/account.d.mts.map +1 -0
- package/dist/account.mjs +181 -0
- package/dist/account.mjs.map +1 -0
- package/dist/bcs/integers.mjs +23 -0
- package/dist/bcs/integers.mjs.map +1 -0
- package/dist/contracts/account/account.d.mts +382 -0
- package/dist/contracts/account/account.d.mts.map +1 -0
- package/dist/contracts/account/account.mjs +443 -0
- package/dist/contracts/account/account.mjs.map +1 -0
- package/dist/contracts/account/account_events.d.mts +41 -0
- package/dist/contracts/account/account_events.d.mts.map +1 -0
- package/dist/contracts/account/account_events.mjs +72 -0
- package/dist/contracts/account/account_events.mjs.map +1 -0
- package/dist/contracts/account/account_registry.d.mts +210 -0
- package/dist/contracts/account/account_registry.d.mts.map +1 -0
- package/dist/contracts/account/account_registry.mjs +263 -0
- package/dist/contracts/account/account_registry.mjs.map +1 -0
- package/dist/contracts/account/config-arguments.d.mts +10 -0
- package/dist/contracts/account/config-arguments.d.mts.map +1 -0
- package/dist/contracts/account/deps/sui/bag.mjs +44 -0
- package/dist/contracts/account/deps/sui/bag.mjs.map +1 -0
- package/dist/contracts/deepbook/account.d.mts +18 -18
- package/dist/contracts/deepbook/balance_manager.mjs.map +1 -1
- package/dist/contracts/deepbook/balances.d.mts +4 -4
- package/dist/contracts/deepbook/balances.d.mts.map +1 -1
- package/dist/contracts/deepbook/deep_price.d.mts +3 -3
- package/dist/contracts/deepbook/deep_price.d.mts.map +1 -1
- package/dist/contracts/deepbook/order.d.mts +12 -12
- package/dist/contracts/deepbook/pool.mjs.map +1 -1
- package/dist/contracts/deepbook/registry.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_pool.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_registry.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/protocol_config.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/tpsl.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/builder_code_events.mjs +38 -0
- package/dist/contracts/deepbook_predict/builder_code_events.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/config-arguments.d.mts +13 -0
- package/dist/contracts/deepbook_predict/config-arguments.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/deps/fixed_math/i64.mjs +25 -0
- package/dist/contracts/deepbook_predict/deps/fixed_math/i64.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/deps/sui/balance.mjs +25 -0
- package/dist/contracts/deepbook_predict/deps/sui/balance.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/deps/sui/coin.mjs +24 -0
- package/dist/contracts/deepbook_predict/deps/sui/coin.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/deps/sui/table.mjs +39 -0
- package/dist/contracts/deepbook_predict/deps/sui/table.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/deps/sui/vec_set.mjs +26 -0
- package/dist/contracts/deepbook_predict/deps/sui/vec_set.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/ewma.mjs +29 -0
- package/dist/contracts/deepbook_predict/ewma.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/expiry_cash.mjs +27 -0
- package/dist/contracts/deepbook_predict/expiry_cash.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/expiry_market.mjs +367 -0
- package/dist/contracts/deepbook_predict/expiry_market.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/lp_book.mjs +92 -0
- package/dist/contracts/deepbook_predict/lp_book.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/market_manager.mjs +59 -0
- package/dist/contracts/deepbook_predict/market_manager.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/order.mjs +26 -0
- package/dist/contracts/deepbook_predict/order.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/order_events.mjs +84 -0
- package/dist/contracts/deepbook_predict/order_events.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/plp.mjs +284 -0
- package/dist/contracts/deepbook_predict/plp.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/pool_accounting.mjs +58 -0
- package/dist/contracts/deepbook_predict/pool_accounting.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/predict_account.mjs +106 -0
- package/dist/contracts/deepbook_predict/predict_account.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/pricing.mjs +80 -0
- package/dist/contracts/deepbook_predict/pricing.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/range_codec.mjs +41 -0
- package/dist/contracts/deepbook_predict/range_codec.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/registry.mjs +55 -0
- package/dist/contracts/deepbook_predict/registry.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/strike_exposure.mjs +65 -0
- package/dist/contracts/deepbook_predict/strike_exposure.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/strike_exposure_config.mjs +33 -0
- package/dist/contracts/deepbook_predict/strike_exposure_config.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/strike_payout_tree.mjs +72 -0
- package/dist/contracts/deepbook_predict/strike_payout_tree.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/vault_events.mjs +184 -0
- package/dist/contracts/deepbook_predict/vault_events.mjs.map +1 -0
- package/dist/contracts/deepbook_sessions/config-arguments.d.mts +10 -0
- package/dist/contracts/deepbook_sessions/config-arguments.d.mts.map +1 -0
- package/dist/contracts/deepbook_sessions/deps/sui/vec_map.mjs +37 -0
- package/dist/contracts/deepbook_sessions/deps/sui/vec_map.mjs.map +1 -0
- package/dist/contracts/deepbook_sessions/session_config.d.mts +63 -0
- package/dist/contracts/deepbook_sessions/session_config.d.mts.map +1 -0
- package/dist/contracts/deepbook_sessions/session_config.mjs +82 -0
- package/dist/contracts/deepbook_sessions/session_config.mjs.map +1 -0
- package/dist/contracts/deepbook_sessions/sessions.d.mts +275 -0
- package/dist/contracts/deepbook_sessions/sessions.d.mts.map +1 -0
- package/dist/contracts/deepbook_sessions/sessions.mjs +443 -0
- package/dist/contracts/deepbook_sessions/sessions.mjs.map +1 -0
- package/dist/contracts/margin_liquidation/liquidation_vault.mjs.map +1 -1
- package/dist/contracts/utils/index.d.mts +18 -1
- package/dist/contracts/utils/index.d.mts.map +1 -1
- package/dist/deployments/index.d.mts +31 -0
- package/dist/deployments/index.d.mts.map +1 -0
- package/dist/deployments/index.mjs +30 -0
- package/dist/deployments/index.mjs.map +1 -0
- package/dist/deployments/testnet.d.mts +14 -0
- package/dist/deployments/testnet.d.mts.map +1 -0
- package/dist/deployments/testnet.mjs +73 -0
- package/dist/deployments/testnet.mjs.map +1 -0
- package/dist/deployments/types.d.mts +36 -0
- package/dist/deployments/types.d.mts.map +1 -0
- package/dist/index.mjs +0 -1
- package/dist/predict/client.d.mts +255 -0
- package/dist/predict/client.d.mts.map +1 -0
- package/dist/predict/client.mjs +436 -0
- package/dist/predict/client.mjs.map +1 -0
- package/dist/predict/config/generated.d.mts +29 -0
- package/dist/predict/config/generated.d.mts.map +1 -0
- package/dist/predict/config/generated.mjs +16 -0
- package/dist/predict/config/generated.mjs.map +1 -0
- package/dist/predict/config/index.d.mts +10 -0
- package/dist/predict/config/index.d.mts.map +1 -0
- package/dist/predict/config/index.mjs +13 -0
- package/dist/predict/config/index.mjs.map +1 -0
- package/dist/predict/config/testnet.d.mts +17 -0
- package/dist/predict/config/testnet.d.mts.map +1 -0
- package/dist/predict/config/testnet.mjs +26 -0
- package/dist/predict/config/testnet.mjs.map +1 -0
- package/dist/predict/config/types.d.mts +55 -0
- package/dist/predict/config/types.d.mts.map +1 -0
- package/dist/predict/decode.d.mts +162 -0
- package/dist/predict/decode.d.mts.map +1 -0
- package/dist/predict/decode.mjs +175 -0
- package/dist/predict/decode.mjs.map +1 -0
- package/dist/predict/errors.d.mts +42 -0
- package/dist/predict/errors.d.mts.map +1 -0
- package/dist/predict/errors.mjs +37 -0
- package/dist/predict/errors.mjs.map +1 -0
- package/dist/predict/index.d.mts +18 -0
- package/dist/predict/index.mjs +14 -0
- package/dist/predict/pricing.d.mts +73 -0
- package/dist/predict/pricing.d.mts.map +1 -0
- package/dist/predict/pricing.mjs +129 -0
- package/dist/predict/pricing.mjs.map +1 -0
- package/dist/predict/reads/balances.mjs +41 -0
- package/dist/predict/reads/balances.mjs.map +1 -0
- package/dist/predict/reads/inspect.d.mts +8 -0
- package/dist/predict/reads/inspect.d.mts.map +1 -0
- package/dist/predict/reads/inspect.mjs +37 -0
- package/dist/predict/reads/inspect.mjs.map +1 -0
- package/dist/predict/reads/markets.mjs +130 -0
- package/dist/predict/reads/markets.mjs.map +1 -0
- package/dist/predict/reads/parse.mjs +20 -0
- package/dist/predict/reads/parse.mjs.map +1 -0
- package/dist/predict/reads/pool.mjs +26 -0
- package/dist/predict/reads/pool.mjs.map +1 -0
- package/dist/predict/reads/positions.d.mts +12 -0
- package/dist/predict/reads/positions.d.mts.map +1 -0
- package/dist/predict/reads/positions.mjs +77 -0
- package/dist/predict/reads/positions.mjs.map +1 -0
- package/dist/predict/reads/pricing.d.mts +20 -0
- package/dist/predict/reads/pricing.d.mts.map +1 -0
- package/dist/predict/reads/pricing.mjs +43 -0
- package/dist/predict/reads/pricing.mjs.map +1 -0
- package/dist/predict/ticks.d.mts +11 -0
- package/dist/predict/ticks.d.mts.map +1 -0
- package/dist/predict/ticks.mjs +21 -0
- package/dist/predict/ticks.mjs.map +1 -0
- package/dist/predict/tx/authed.mjs +18 -0
- package/dist/predict/tx/authed.mjs.map +1 -0
- package/dist/predict/tx/common.d.mts +18 -0
- package/dist/predict/tx/common.d.mts.map +1 -0
- package/dist/predict/tx/common.mjs +52 -0
- package/dist/predict/tx/common.mjs.map +1 -0
- package/dist/predict/tx/trade.d.mts +15 -0
- package/dist/predict/tx/trade.d.mts.map +1 -0
- package/dist/predict/tx/trade.mjs +86 -0
- package/dist/predict/tx/trade.mjs.map +1 -0
- package/dist/predict/units.d.mts +11 -0
- package/dist/predict/units.d.mts.map +1 -0
- package/dist/predict/units.mjs +44 -0
- package/dist/predict/units.mjs.map +1 -0
- package/dist/queries/accountQueries.mjs +0 -1
- package/dist/queries/accountQueries.mjs.map +1 -1
- package/dist/queries/orderQueries.mjs +0 -1
- package/dist/queries/orderQueries.mjs.map +1 -1
- package/dist/queries/registryQueries.mjs +0 -1
- package/dist/queries/registryQueries.mjs.map +1 -1
- package/dist/sessions.d.mts +244 -0
- package/dist/sessions.d.mts.map +1 -0
- package/dist/sessions.mjs +291 -0
- package/dist/sessions.mjs.map +1 -0
- package/dist/transactions/balanceManager.d.mts +12 -12
- package/dist/transactions/deepbook.d.mts +20 -20
- package/dist/transactions/deepbookAdmin.d.mts +4 -4
- package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
- package/dist/transactions/marginAdmin.d.mts +7 -7
- package/dist/transactions/marginLiquidations.d.mts +3 -3
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginManager.d.mts +32 -32
- package/dist/transactions/marginPool.d.mts +18 -18
- package/dist/transactions/marginRegistry.d.mts +16 -16
- package/dist/transactions/marginTPSL.d.mts +10 -10
- package/dist/transactions/poolProxy.d.mts +8 -8
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/utils/constants.d.mts.map +1 -1
- package/dist/utils/constants.mjs +1 -1
- package/dist/utils/constants.mjs.map +1 -1
- package/package.json +33 -12
- package/src/account.ts +239 -0
- package/src/bcs/integers.ts +35 -0
- package/src/contracts/account/account.ts +706 -0
- package/src/contracts/account/account_events.ts +64 -0
- package/src/contracts/account/account_registry.ts +468 -0
- package/src/contracts/account/config-arguments.ts +8 -0
- package/src/contracts/account/deps/sui/bag.ts +42 -0
- package/src/contracts/deepbook/balance_manager.ts +1 -2
- package/src/contracts/deepbook/pool.ts +12 -24
- package/src/contracts/deepbook/registry.ts +1 -2
- package/src/contracts/deepbook_margin/margin_manager.ts +9 -18
- package/src/contracts/deepbook_margin/margin_manager_upgraded.ts +5 -10
- package/src/contracts/deepbook_margin/margin_pool.ts +2 -4
- package/src/contracts/deepbook_margin/margin_registry.ts +3 -6
- package/src/contracts/deepbook_margin/pool_proxy.ts +3 -6
- package/src/contracts/deepbook_margin/protocol_config.ts +1 -2
- package/src/contracts/deepbook_margin/tpsl.ts +1 -2
- package/src/contracts/deepbook_predict/admin.ts +44 -0
- package/src/contracts/deepbook_predict/builder_code.ts +155 -0
- package/src/contracts/deepbook_predict/builder_code_events.ts +34 -0
- package/src/contracts/deepbook_predict/config-arguments.ts +11 -0
- package/src/contracts/deepbook_predict/config_events.ts +140 -0
- package/src/contracts/deepbook_predict/deps/fixed_math/i64.ts +21 -0
- package/src/contracts/deepbook_predict/deps/sui/balance.ts +25 -0
- package/src/contracts/deepbook_predict/deps/sui/coin.ts +20 -0
- package/src/contracts/deepbook_predict/deps/sui/table.ts +37 -0
- package/src/contracts/deepbook_predict/deps/sui/vec_set.ts +22 -0
- package/src/contracts/deepbook_predict/ewma.ts +26 -0
- package/src/contracts/deepbook_predict/ewma_config.ts +28 -0
- package/src/contracts/deepbook_predict/expiry_cash.ts +24 -0
- package/src/contracts/deepbook_predict/expiry_market.ts +1549 -0
- package/src/contracts/deepbook_predict/lp_book.ts +105 -0
- package/src/contracts/deepbook_predict/market_lifecycle_cap.ts +75 -0
- package/src/contracts/deepbook_predict/market_manager.ts +218 -0
- package/src/contracts/deepbook_predict/order.ts +24 -0
- package/src/contracts/deepbook_predict/order_events.ts +129 -0
- package/src/contracts/deepbook_predict/pause_cap.ts +68 -0
- package/src/contracts/deepbook_predict/plp.ts +987 -0
- package/src/contracts/deepbook_predict/pool_accounting.ts +79 -0
- package/src/contracts/deepbook_predict/predict_account.ts +180 -0
- package/src/contracts/deepbook_predict/pricing.ts +124 -0
- package/src/contracts/deepbook_predict/pricing_config.ts +41 -0
- package/src/contracts/deepbook_predict/protocol_config.ts +1066 -0
- package/src/contracts/deepbook_predict/range_codec.ts +53 -0
- package/src/contracts/deepbook_predict/registry.ts +694 -0
- package/src/contracts/deepbook_predict/strike_exposure.ts +77 -0
- package/src/contracts/deepbook_predict/strike_exposure_config.ts +46 -0
- package/src/contracts/deepbook_predict/strike_payout_tree.ts +89 -0
- package/src/contracts/deepbook_predict/vault_events.ts +222 -0
- package/src/contracts/deepbook_sessions/config-arguments.ts +8 -0
- package/src/contracts/deepbook_sessions/deps/sui/vec_map.ts +33 -0
- package/src/contracts/deepbook_sessions/session_config.ts +130 -0
- package/src/contracts/deepbook_sessions/sessions.ts +663 -0
- package/src/contracts/margin_liquidation/liquidation_vault.ts +2 -4
- package/src/contracts/propbook/block_scholes_store.ts +842 -0
- package/src/contracts/propbook/deps/sui/table.ts +37 -0
- package/src/contracts/propbook/oracle_lane.ts +170 -0
- package/src/contracts/propbook/pyth_feed.ts +414 -0
- package/src/contracts/propbook/registry.ts +596 -0
- package/src/contracts/pyth/pyth.ts +2 -4
- package/src/deployments/index.ts +73 -0
- package/src/deployments/testnet.ts +107 -0
- package/src/deployments/types.ts +81 -0
- package/src/index.ts +5 -0
- package/src/predict/client.ts +941 -0
- package/src/predict/config/generated.ts +39 -0
- package/src/predict/config/index.ts +25 -0
- package/src/predict/config/testnet.ts +27 -0
- package/src/predict/config/types.ts +52 -0
- package/src/predict/decode.ts +476 -0
- package/src/predict/errors.ts +83 -0
- package/src/predict/index.ts +94 -0
- package/src/predict/pricing.ts +199 -0
- package/src/predict/reads/balances.ts +55 -0
- package/src/predict/reads/inspect.ts +78 -0
- package/src/predict/reads/markets.ts +222 -0
- package/src/predict/reads/parse.ts +30 -0
- package/src/predict/reads/pool.ts +37 -0
- package/src/predict/reads/positions.ts +144 -0
- package/src/predict/reads/pricing.ts +79 -0
- package/src/predict/ticks.ts +42 -0
- package/src/predict/tx/authed.ts +20 -0
- package/src/predict/tx/common.ts +92 -0
- package/src/predict/tx/trade.ts +183 -0
- package/src/predict/units.ts +49 -0
- package/src/sessions.ts +471 -0
- package/src/types/index.ts +1 -2
- package/src/utils/constants.ts +1 -7
- package/dist/types/bcs.mjs +0 -7
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LP request book and share issuance for the pool vault.
|
|
7
|
+
*
|
|
8
|
+
* `LpBook` owns the PLP treasury cap plus the async supply/withdraw queues. `plp`
|
|
9
|
+
* owns the shared `PoolVault`, valuation, and pool cash accounting; it delegates
|
|
10
|
+
* request/cancel and frozen-mark queue drains here.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { MoveStruct } from '../utils/index.js';
|
|
14
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
15
|
+
import { U64 } from '../../bcs/integers.js';
|
|
16
|
+
import * as table from './deps/sui/table.js';
|
|
17
|
+
import * as balance from './deps/sui/balance.js';
|
|
18
|
+
import * as coin from './deps/sui/coin.js';
|
|
19
|
+
const $moduleName = '@local-pkg/deepbook_predict::lp_book';
|
|
20
|
+
export const RequestQueue = new MoveStruct({
|
|
21
|
+
name: `${$moduleName}::RequestQueue<phantom T>`,
|
|
22
|
+
fields: {
|
|
23
|
+
pages: table.Table,
|
|
24
|
+
head_page_id: bcs.option(U64),
|
|
25
|
+
tail_page_id: bcs.option(U64),
|
|
26
|
+
next_index: U64,
|
|
27
|
+
pending: U64,
|
|
28
|
+
escrow: balance.Balance,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
export const LpBook = new MoveStruct({
|
|
32
|
+
name: `${$moduleName}::LpBook<phantom LP>`,
|
|
33
|
+
fields: {
|
|
34
|
+
treasury_cap: coin.TreasuryCap,
|
|
35
|
+
supply_queue: RequestQueue,
|
|
36
|
+
withdraw_queue: RequestQueue,
|
|
37
|
+
/**
|
|
38
|
+
* Permanent minimum-liquidity shares minted once at genesis (`plp::lock_capital`).
|
|
39
|
+
* Held here with no withdraw path, so `total_supply` stays > 0 for the life of the
|
|
40
|
+
* pool and the supply==0 bootstrap branch is unreachable. Withdrawal-rounding dust
|
|
41
|
+
* accrues to this position.
|
|
42
|
+
*/
|
|
43
|
+
locked_lp: balance.Balance,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
export const RequestEntry = new MoveStruct({
|
|
47
|
+
name: `${$moduleName}::RequestEntry`,
|
|
48
|
+
fields: {
|
|
49
|
+
index: U64,
|
|
50
|
+
/**
|
|
51
|
+
* Owning account, carried so a fill can attribute to the account directly rather
|
|
52
|
+
* than only the derived `recipient` address (address is not invertible).
|
|
53
|
+
*/
|
|
54
|
+
account_id: bcs.Address,
|
|
55
|
+
recipient: bcs.Address,
|
|
56
|
+
amount: U64,
|
|
57
|
+
min_output: U64,
|
|
58
|
+
/**
|
|
59
|
+
* Frozen marks this request has already missed. Only ever non-zero when the
|
|
60
|
+
* protocol allows more than one attempt (`ProtocolConfig`), since at one attempt a
|
|
61
|
+
* miss refunds immediately.
|
|
62
|
+
*/
|
|
63
|
+
missed_flushes: U64,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
export const RequestPage = new MoveStruct({
|
|
67
|
+
name: `${$moduleName}::RequestPage`,
|
|
68
|
+
fields: {
|
|
69
|
+
prev: bcs.option(U64),
|
|
70
|
+
next: bcs.option(U64),
|
|
71
|
+
entries: bcs.vector(RequestEntry),
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
export const FlushMark = new MoveStruct({
|
|
75
|
+
name: `${$moduleName}::FlushMark`,
|
|
76
|
+
fields: {
|
|
77
|
+
pool_value: U64,
|
|
78
|
+
total_supply: U64,
|
|
79
|
+
executable: bcs.bool(),
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
export const FeeRates = new MoveStruct({
|
|
83
|
+
name: `${$moduleName}::FeeRates`,
|
|
84
|
+
fields: {
|
|
85
|
+
/** Supply-leg rate. Ships at zero: a deposit dilutes the pool's risk per dollar. */
|
|
86
|
+
supply: U64,
|
|
87
|
+
/** Withdraw-leg rate, frozen with it so one flush charges one pair. */
|
|
88
|
+
withdraw: U64,
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
export const FillQuote = new MoveStruct({
|
|
92
|
+
name: `${$moduleName}::FillQuote`,
|
|
93
|
+
fields: {
|
|
94
|
+
output: U64,
|
|
95
|
+
fee: U64,
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
export const DrainSummary = new MoveStruct({
|
|
99
|
+
name: `${$moduleName}::DrainSummary`,
|
|
100
|
+
fields: {
|
|
101
|
+
supplies_filled: U64,
|
|
102
|
+
withdrawals_filled: U64,
|
|
103
|
+
requests_processed: U64,
|
|
104
|
+
},
|
|
105
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Defines revocable authority for market creation and coordinated pool valuation
|
|
7
|
+
* without granting oracle-write or root-admin power. `Registry` owns the allowlist
|
|
8
|
+
* and converts a valid capability into the ability-less proof consumed by
|
|
9
|
+
* cross-module lifecycle flows.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
13
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
14
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
15
|
+
const $moduleName = '@local-pkg/deepbook_predict::market_lifecycle_cap';
|
|
16
|
+
export const MarketLifecycleCap = new MoveStruct({
|
|
17
|
+
name: `${$moduleName}::MarketLifecycleCap`,
|
|
18
|
+
fields: {
|
|
19
|
+
id: bcs.Address,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
export const MarketLifecycleProof = new MoveStruct({
|
|
23
|
+
name: `${$moduleName}::MarketLifecycleProof`,
|
|
24
|
+
fields: {
|
|
25
|
+
dummy_field: bcs.bool(),
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
export interface IdArguments {
|
|
29
|
+
cap: RawTransactionArgument<string>;
|
|
30
|
+
}
|
|
31
|
+
export interface IdOptions {
|
|
32
|
+
package?: string;
|
|
33
|
+
arguments: IdArguments | [cap: RawTransactionArgument<string>];
|
|
34
|
+
config?: {
|
|
35
|
+
predictPackageId?: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** Returns the capability identity used by the registry allowlist. */
|
|
39
|
+
export function id(options: IdOptions) {
|
|
40
|
+
const packageAddress =
|
|
41
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
42
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
43
|
+
const parameterNames = ['cap'];
|
|
44
|
+
return (tx: Transaction) =>
|
|
45
|
+
tx.moveCall({
|
|
46
|
+
package: packageAddress,
|
|
47
|
+
module: 'market_lifecycle_cap',
|
|
48
|
+
function: 'id',
|
|
49
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export interface DestroyArguments {
|
|
53
|
+
cap: RawTransactionArgument<string>;
|
|
54
|
+
}
|
|
55
|
+
export interface DestroyOptions {
|
|
56
|
+
package?: string;
|
|
57
|
+
arguments: DestroyArguments | [cap: RawTransactionArgument<string>];
|
|
58
|
+
config?: {
|
|
59
|
+
predictPackageId?: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** Destroy a `MarketLifecycleCap` the holder no longer needs. */
|
|
63
|
+
export function destroy(options: DestroyOptions) {
|
|
64
|
+
const packageAddress =
|
|
65
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
66
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
67
|
+
const parameterNames = ['cap'];
|
|
68
|
+
return (tx: Transaction) =>
|
|
69
|
+
tx.moveCall({
|
|
70
|
+
package: packageAddress,
|
|
71
|
+
module: 'market_lifecycle_cap',
|
|
72
|
+
function: 'destroy',
|
|
73
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Market identity and deployment cadence manager for Predict.
|
|
7
|
+
*
|
|
8
|
+
* `Registry` owns this state and delegates market admission to it. Fixed cadence
|
|
9
|
+
* IDs, periods, and rank order are upgrade-required. Underlying rows, cadence
|
|
10
|
+
* deployment terms, and per-underlying watermarks are stored here.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { MoveStruct, normalizeMoveArguments } from '../utils/index.js';
|
|
14
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
15
|
+
import { U64 } from '../../bcs/integers.js';
|
|
16
|
+
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
17
|
+
import * as table from './deps/sui/table.js';
|
|
18
|
+
const $moduleName = '@local-pkg/deepbook_predict::market_manager';
|
|
19
|
+
export const MarketKey = new MoveStruct({
|
|
20
|
+
name: `${$moduleName}::MarketKey`,
|
|
21
|
+
fields: {
|
|
22
|
+
propbook_underlying_id: bcs.u32(),
|
|
23
|
+
expiry: U64,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
export const MarketManager = new MoveStruct({
|
|
27
|
+
name: `${$moduleName}::MarketManager`,
|
|
28
|
+
fields: {
|
|
29
|
+
/** Propbook underlying ID -> deployment watermarks. */
|
|
30
|
+
underlying_configs: table.Table,
|
|
31
|
+
/** Created markets keyed by `(propbook_underlying_id, expiry)`. */
|
|
32
|
+
market_ids: table.Table,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
export const CadenceConfig = new MoveStruct({
|
|
36
|
+
name: `${$moduleName}::CadenceConfig`,
|
|
37
|
+
fields: {
|
|
38
|
+
/** Raw-price-per-tick factor snapshotted into each created market. */
|
|
39
|
+
tick_size: U64,
|
|
40
|
+
/** Coarser raw-price step that new finite mint boundaries must align to. */
|
|
41
|
+
admission_tick_size: U64,
|
|
42
|
+
/**
|
|
43
|
+
* DUSDC pool allocation cap snapshotted into pool accounting for each created
|
|
44
|
+
* expiry.
|
|
45
|
+
*/
|
|
46
|
+
max_expiry_allocation: U64,
|
|
47
|
+
/**
|
|
48
|
+
* Minimum DUSDC cash target snapshotted into pool accounting for each created
|
|
49
|
+
* expiry.
|
|
50
|
+
*/
|
|
51
|
+
initial_expiry_cash: U64,
|
|
52
|
+
/**
|
|
53
|
+
* Number of cadence periods in the rolling future deployment horizon. Zero
|
|
54
|
+
* disables this cadence.
|
|
55
|
+
*/
|
|
56
|
+
window_size: U64,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
export const DeployableMarket = new MoveStruct({
|
|
60
|
+
name: `${$moduleName}::DeployableMarket`,
|
|
61
|
+
fields: {
|
|
62
|
+
expiry: U64,
|
|
63
|
+
cadence: CadenceConfig,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
export const UnderlyingMarketConfig = new MoveStruct({
|
|
67
|
+
name: `${$moduleName}::UnderlyingMarketConfig`,
|
|
68
|
+
fields: {
|
|
69
|
+
/** Deployment config indexed by cadence ID. */
|
|
70
|
+
cadences: bcs.vector(CadenceConfig),
|
|
71
|
+
/** Highest deployed expiry timestamp indexed by cadence ID. */
|
|
72
|
+
last_deployed_expiries: bcs.vector(U64),
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
export interface CadenceTickSizeArguments {
|
|
76
|
+
config: TransactionArgument;
|
|
77
|
+
}
|
|
78
|
+
export interface CadenceTickSizeOptions {
|
|
79
|
+
package?: string;
|
|
80
|
+
arguments: CadenceTickSizeArguments | [config: TransactionArgument];
|
|
81
|
+
config?: {
|
|
82
|
+
predictPackageId?: string;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** Return the raw-price-per-tick factor for SDK and devInspect cadence reads. */
|
|
86
|
+
export function cadenceTickSize(options: CadenceTickSizeOptions) {
|
|
87
|
+
const packageAddress =
|
|
88
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
89
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
90
|
+
const parameterNames = ['config'];
|
|
91
|
+
return (tx: Transaction) =>
|
|
92
|
+
tx.moveCall({
|
|
93
|
+
package: packageAddress,
|
|
94
|
+
module: 'market_manager',
|
|
95
|
+
function: 'cadence_tick_size',
|
|
96
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
export interface CadenceAdmissionTickSizeArguments {
|
|
100
|
+
config: TransactionArgument;
|
|
101
|
+
}
|
|
102
|
+
export interface CadenceAdmissionTickSizeOptions {
|
|
103
|
+
package?: string;
|
|
104
|
+
arguments: CadenceAdmissionTickSizeArguments | [config: TransactionArgument];
|
|
105
|
+
config?: {
|
|
106
|
+
predictPackageId?: string;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/** Return the admission-grid step for SDK and devInspect cadence reads. */
|
|
110
|
+
export function cadenceAdmissionTickSize(options: CadenceAdmissionTickSizeOptions) {
|
|
111
|
+
const packageAddress =
|
|
112
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
113
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
114
|
+
const parameterNames = ['config'];
|
|
115
|
+
return (tx: Transaction) =>
|
|
116
|
+
tx.moveCall({
|
|
117
|
+
package: packageAddress,
|
|
118
|
+
module: 'market_manager',
|
|
119
|
+
function: 'cadence_admission_tick_size',
|
|
120
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
export interface CadenceMaxExpiryAllocationArguments {
|
|
124
|
+
config: TransactionArgument;
|
|
125
|
+
}
|
|
126
|
+
export interface CadenceMaxExpiryAllocationOptions {
|
|
127
|
+
package?: string;
|
|
128
|
+
arguments: CadenceMaxExpiryAllocationArguments | [config: TransactionArgument];
|
|
129
|
+
config?: {
|
|
130
|
+
predictPackageId?: string;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/** Return the expiry allocation cap for SDK and devInspect cadence reads. */
|
|
134
|
+
export function cadenceMaxExpiryAllocation(options: CadenceMaxExpiryAllocationOptions) {
|
|
135
|
+
const packageAddress =
|
|
136
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
137
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
138
|
+
const parameterNames = ['config'];
|
|
139
|
+
return (tx: Transaction) =>
|
|
140
|
+
tx.moveCall({
|
|
141
|
+
package: packageAddress,
|
|
142
|
+
module: 'market_manager',
|
|
143
|
+
function: 'cadence_max_expiry_allocation',
|
|
144
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
export interface CadenceInitialExpiryCashArguments {
|
|
148
|
+
config: TransactionArgument;
|
|
149
|
+
}
|
|
150
|
+
export interface CadenceInitialExpiryCashOptions {
|
|
151
|
+
package?: string;
|
|
152
|
+
arguments: CadenceInitialExpiryCashArguments | [config: TransactionArgument];
|
|
153
|
+
config?: {
|
|
154
|
+
predictPackageId?: string;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/** Return the initial expiry cash target for SDK and devInspect cadence reads. */
|
|
158
|
+
export function cadenceInitialExpiryCash(options: CadenceInitialExpiryCashOptions) {
|
|
159
|
+
const packageAddress =
|
|
160
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
161
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
162
|
+
const parameterNames = ['config'];
|
|
163
|
+
return (tx: Transaction) =>
|
|
164
|
+
tx.moveCall({
|
|
165
|
+
package: packageAddress,
|
|
166
|
+
module: 'market_manager',
|
|
167
|
+
function: 'cadence_initial_expiry_cash',
|
|
168
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
export interface CadenceWindowSizeArguments {
|
|
172
|
+
config: TransactionArgument;
|
|
173
|
+
}
|
|
174
|
+
export interface CadenceWindowSizeOptions {
|
|
175
|
+
package?: string;
|
|
176
|
+
arguments: CadenceWindowSizeArguments | [config: TransactionArgument];
|
|
177
|
+
config?: {
|
|
178
|
+
predictPackageId?: string;
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
/** Return the rolling deployment horizon for SDK and devInspect cadence reads. */
|
|
182
|
+
export function cadenceWindowSize(options: CadenceWindowSizeOptions) {
|
|
183
|
+
const packageAddress =
|
|
184
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
185
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
186
|
+
const parameterNames = ['config'];
|
|
187
|
+
return (tx: Transaction) =>
|
|
188
|
+
tx.moveCall({
|
|
189
|
+
package: packageAddress,
|
|
190
|
+
module: 'market_manager',
|
|
191
|
+
function: 'cadence_window_size',
|
|
192
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
export interface CadenceEnabledArguments {
|
|
196
|
+
config: TransactionArgument;
|
|
197
|
+
}
|
|
198
|
+
export interface CadenceEnabledOptions {
|
|
199
|
+
package?: string;
|
|
200
|
+
arguments: CadenceEnabledArguments | [config: TransactionArgument];
|
|
201
|
+
config?: {
|
|
202
|
+
predictPackageId?: string;
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/** Return whether this cadence is enabled for SDK and devInspect discovery. */
|
|
206
|
+
export function cadenceEnabled(options: CadenceEnabledOptions) {
|
|
207
|
+
const packageAddress =
|
|
208
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
209
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
210
|
+
const parameterNames = ['config'];
|
|
211
|
+
return (tx: Transaction) =>
|
|
212
|
+
tx.moveCall({
|
|
213
|
+
package: packageAddress,
|
|
214
|
+
module: 'market_manager',
|
|
215
|
+
function: 'cadence_enabled',
|
|
216
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
217
|
+
});
|
|
218
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Immutable contract terms encoded in a Predict order ID.
|
|
7
|
+
*
|
|
8
|
+
* An `Order` represents the durable contract terms needed after mint: the lower
|
|
9
|
+
* and higher strike ticks, quantity, and the expiry-local sequence. Mint-only
|
|
10
|
+
* inputs such as entry probability, premium, and fee policy intentionally live
|
|
11
|
+
* outside this module. The packed ID is the single source of truth at protocol
|
|
12
|
+
* boundaries; raw strike conversion (through the owning market's `tick_size`) is
|
|
13
|
+
* interpreted by `StrikeExposure`.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { MoveStruct } from '../utils/index.js';
|
|
17
|
+
import { U256 } from '../../bcs/integers.js';
|
|
18
|
+
const $moduleName = '@local-pkg/deepbook_predict::order';
|
|
19
|
+
export const Order = new MoveStruct({
|
|
20
|
+
name: `${$moduleName}::Order`,
|
|
21
|
+
fields: {
|
|
22
|
+
id: U256,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Order-lifecycle events for Predict.
|
|
7
|
+
*
|
|
8
|
+
* Events carry transition identities and deltas rather than account or market
|
|
9
|
+
* balances. Partial closes link an old order ID to its replacement; the position
|
|
10
|
+
* root remains constant across that chain.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { MoveStruct } from '../utils/index.js';
|
|
14
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
15
|
+
import { U256, U64 } from '../../bcs/integers.js';
|
|
16
|
+
const $moduleName = '@local-pkg/deepbook_predict::order_events';
|
|
17
|
+
export const OrderMinted = new MoveStruct({
|
|
18
|
+
name: `${$moduleName}::OrderMinted`,
|
|
19
|
+
fields: {
|
|
20
|
+
expiry_market_id: bcs.Address,
|
|
21
|
+
account_id: bcs.Address,
|
|
22
|
+
order_id: U256,
|
|
23
|
+
/**
|
|
24
|
+
* Stable economic-position handle: the original mint's `order_id`, carried forward
|
|
25
|
+
* unchanged across partial-close replacements. Equals `order_id` here.
|
|
26
|
+
*/
|
|
27
|
+
position_root_id: U256,
|
|
28
|
+
owner: bcs.Address,
|
|
29
|
+
/**
|
|
30
|
+
* Canonical strike range as absolute ticks: `lower_tick` (`0` = `-inf`) and
|
|
31
|
+
* `higher_tick` (`pos_inf_tick` = `+inf`). Raw strikes are the derived display
|
|
32
|
+
* form, `tick * tick_size` with the `tick_size` from `MarketCreated`.
|
|
33
|
+
*/
|
|
34
|
+
lower_tick: U64,
|
|
35
|
+
higher_tick: U64,
|
|
36
|
+
/** 1e9-scaled range probability quoted at entry. */
|
|
37
|
+
entry_probability: U64,
|
|
38
|
+
quantity: U64,
|
|
39
|
+
/** Premium the user paid into LP backing, in DUSDC base units. */
|
|
40
|
+
premium: U64,
|
|
41
|
+
/** Full trading fee assessed for the mint, including any sponsor-paid subsidy. */
|
|
42
|
+
trading_fee: U64,
|
|
43
|
+
/** Portion of `trading_fee` paid from expiry-local fee incentives. */
|
|
44
|
+
fee_incentive_subsidy: U64,
|
|
45
|
+
builder_fee: U64,
|
|
46
|
+
/** EWMA gas-price congestion surcharge assessed for the mint, in DUSDC base units. */
|
|
47
|
+
penalty_fee: U64,
|
|
48
|
+
/**
|
|
49
|
+
* Portion of the trader-paid trading fee and congestion surcharge delivered to the
|
|
50
|
+
* referrer.
|
|
51
|
+
*/
|
|
52
|
+
referral_fee: U64,
|
|
53
|
+
/** Separate inventory-impact charge escrowed for live-close rebates. */
|
|
54
|
+
inventory_impact_charge: U64,
|
|
55
|
+
/**
|
|
56
|
+
* Builder credited for `builder_fee`; `none` when no builder fee was paid
|
|
57
|
+
* (attribution follows the fee — applied once, in the emit helper).
|
|
58
|
+
*/
|
|
59
|
+
builder_code_id: bcs.option(bcs.Address),
|
|
60
|
+
/** Referrer recorded on the minting account, independent of the fee paid. */
|
|
61
|
+
referrer_account_id: bcs.option(bcs.Address),
|
|
62
|
+
onchain_timestamp_ms: U64,
|
|
63
|
+
/**
|
|
64
|
+
* Oracle source timestamps present when this mint was priced: Pyth's canonical
|
|
65
|
+
* source time and the Block Scholes batch-envelope times used for freshness. The
|
|
66
|
+
* SVI one is also the roll-down anchor. Pyth is `0` only when unusable.
|
|
67
|
+
*/
|
|
68
|
+
pyth_spot_source_timestamp_ms: U64,
|
|
69
|
+
block_scholes_spot_source_timestamp_ms: U64,
|
|
70
|
+
block_scholes_forward_source_timestamp_ms: U64,
|
|
71
|
+
block_scholes_svi_source_timestamp_ms: U64,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
export const LiveOrderRedeemed = new MoveStruct({
|
|
75
|
+
name: `${$moduleName}::LiveOrderRedeemed`,
|
|
76
|
+
fields: {
|
|
77
|
+
expiry_market_id: bcs.Address,
|
|
78
|
+
account_id: bcs.Address,
|
|
79
|
+
order_id: U256,
|
|
80
|
+
/**
|
|
81
|
+
* Stable economic-position handle, constant across the replacement chain. On a
|
|
82
|
+
* partial close the replacement inherits this same root.
|
|
83
|
+
*/
|
|
84
|
+
position_root_id: U256,
|
|
85
|
+
owner: bcs.Address,
|
|
86
|
+
quantity_closed: U64,
|
|
87
|
+
/** `0` means the position was fully closed. */
|
|
88
|
+
remaining_quantity: U64,
|
|
89
|
+
/** New order ID minted to carry the remainder on a partial live close. */
|
|
90
|
+
replacement_order_id: bcs.option(U256),
|
|
91
|
+
/** Redeem value before fees. */
|
|
92
|
+
redeem_amount: U64,
|
|
93
|
+
trading_fee: U64,
|
|
94
|
+
builder_fee: U64,
|
|
95
|
+
/** EWMA gas-price congestion surcharge retained by the pool, in DUSDC base units. */
|
|
96
|
+
penalty_fee: U64,
|
|
97
|
+
/** Separate inventory-impact rebate paid from its isolated escrow. */
|
|
98
|
+
inventory_impact_rebate: U64,
|
|
99
|
+
/**
|
|
100
|
+
* Builder credited for `builder_fee`; `none` when no builder fee was paid
|
|
101
|
+
* (attribution follows the fee — applied once, in the emit helper).
|
|
102
|
+
*/
|
|
103
|
+
builder_code_id: bcs.option(bcs.Address),
|
|
104
|
+
onchain_timestamp_ms: U64,
|
|
105
|
+
/**
|
|
106
|
+
* Oracle source timestamps present when this redemption was priced: Pyth's
|
|
107
|
+
* canonical source time and the Block Scholes batch-envelope times used for
|
|
108
|
+
* freshness. The SVI one is also the roll-down anchor. Pyth is `0` only when
|
|
109
|
+
* unusable.
|
|
110
|
+
*/
|
|
111
|
+
pyth_spot_source_timestamp_ms: U64,
|
|
112
|
+
block_scholes_spot_source_timestamp_ms: U64,
|
|
113
|
+
block_scholes_forward_source_timestamp_ms: U64,
|
|
114
|
+
block_scholes_svi_source_timestamp_ms: U64,
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
export const SettledOrderRedeemed = new MoveStruct({
|
|
118
|
+
name: `${$moduleName}::SettledOrderRedeemed`,
|
|
119
|
+
fields: {
|
|
120
|
+
expiry_market_id: bcs.Address,
|
|
121
|
+
account_id: bcs.Address,
|
|
122
|
+
order_id: U256,
|
|
123
|
+
/** Stable economic-position handle, constant across the replacement chain. */
|
|
124
|
+
position_root_id: U256,
|
|
125
|
+
owner: bcs.Address,
|
|
126
|
+
payout_amount: U64,
|
|
127
|
+
onchain_timestamp_ms: U64,
|
|
128
|
+
},
|
|
129
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Defines revocable emergency authority that can engage global trading or
|
|
7
|
+
* per-market mint pauses but cannot unpause. `Registry` owns the allowlist and all
|
|
8
|
+
* state transitions authorized by this capability.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
12
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
13
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
14
|
+
const $moduleName = '@local-pkg/deepbook_predict::pause_cap';
|
|
15
|
+
export const PauseCap = new MoveStruct({
|
|
16
|
+
name: `${$moduleName}::PauseCap`,
|
|
17
|
+
fields: {
|
|
18
|
+
id: bcs.Address,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
export interface IdArguments {
|
|
22
|
+
cap: RawTransactionArgument<string>;
|
|
23
|
+
}
|
|
24
|
+
export interface IdOptions {
|
|
25
|
+
package?: string;
|
|
26
|
+
arguments: IdArguments | [cap: RawTransactionArgument<string>];
|
|
27
|
+
config?: {
|
|
28
|
+
predictPackageId?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** Returns the capability identity used by the registry allowlist. */
|
|
32
|
+
export function id(options: IdOptions) {
|
|
33
|
+
const packageAddress =
|
|
34
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
35
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
36
|
+
const parameterNames = ['cap'];
|
|
37
|
+
return (tx: Transaction) =>
|
|
38
|
+
tx.moveCall({
|
|
39
|
+
package: packageAddress,
|
|
40
|
+
module: 'pause_cap',
|
|
41
|
+
function: 'id',
|
|
42
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export interface DestroyArguments {
|
|
46
|
+
cap: RawTransactionArgument<string>;
|
|
47
|
+
}
|
|
48
|
+
export interface DestroyOptions {
|
|
49
|
+
package?: string;
|
|
50
|
+
arguments: DestroyArguments | [cap: RawTransactionArgument<string>];
|
|
51
|
+
config?: {
|
|
52
|
+
predictPackageId?: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** Destroy a `PauseCap` the holder no longer needs. */
|
|
56
|
+
export function destroy(options: DestroyOptions) {
|
|
57
|
+
const packageAddress =
|
|
58
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
59
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
60
|
+
const parameterNames = ['cap'];
|
|
61
|
+
return (tx: Transaction) =>
|
|
62
|
+
tx.moveCall({
|
|
63
|
+
package: packageAddress,
|
|
64
|
+
module: 'pause_cap',
|
|
65
|
+
function: 'destroy',
|
|
66
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
67
|
+
});
|
|
68
|
+
}
|