@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,77 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Expiry-local exposure book for one expiry market.
|
|
7
|
+
*
|
|
8
|
+
* This module interprets `Order` terms against the expiry's `tick_size`,
|
|
9
|
+
* recovering raw strikes from order ticks only at the pricing/settlement boundary.
|
|
10
|
+
* It owns the payout-liability view of the active contracts used for cash backing.
|
|
11
|
+
* Order accounting is static and needs no clock: a winning order pays its full
|
|
12
|
+
* quantity. Expiry-market cash custody, account positions, and payout movement
|
|
13
|
+
* stay outside this module.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { MoveStruct } from '../utils/index.js';
|
|
17
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
18
|
+
import { U64 } from '../../bcs/integers.js';
|
|
19
|
+
import * as strike_exposure_config from './strike_exposure_config.js';
|
|
20
|
+
import * as strike_payout_tree from './strike_payout_tree.js';
|
|
21
|
+
import * as order from './order.js';
|
|
22
|
+
const $moduleName = '@local-pkg/deepbook_predict::strike_exposure';
|
|
23
|
+
export const StrikeExposure = new MoveStruct({
|
|
24
|
+
name: `${$moduleName}::StrikeExposure`,
|
|
25
|
+
fields: {
|
|
26
|
+
/** Expiry market that owns this exposure book. */
|
|
27
|
+
expiry_market_id: bcs.Address,
|
|
28
|
+
/** Raw-price-per-tick conversion factor; `raw_strike = tick * tick_size`. */
|
|
29
|
+
tick_size: U64,
|
|
30
|
+
/** Coarser raw-price step that new finite mint boundaries must align to. */
|
|
31
|
+
admission_tick_size: U64,
|
|
32
|
+
/** Exact Propbook Pyth source timestamp used to derive the reference tick. */
|
|
33
|
+
reference_tick_source_timestamp_ms: U64,
|
|
34
|
+
/** Reference fine-grid tick that may bypass the coarser admission grid once set. */
|
|
35
|
+
reference_tick: bcs.option(U64),
|
|
36
|
+
/** Snapshotted exposure and fee policy for this expiry. */
|
|
37
|
+
config: strike_exposure_config.StrikeExposureConfig,
|
|
38
|
+
/**
|
|
39
|
+
* Immutable DUSDC scale for the inventory-impact curve. This is the expiry's
|
|
40
|
+
* snapshotted maximum pool allocation: a risk-capacity parameter, not live pool
|
|
41
|
+
* equity, so LP flows cannot reprice an existing book.
|
|
42
|
+
*/
|
|
43
|
+
inventory_impact_scale: U64,
|
|
44
|
+
next_order_sequence: U64,
|
|
45
|
+
/** Terminal settlement price once the exposure has entered its settled phase. */
|
|
46
|
+
settlement_price: bcs.option(U64),
|
|
47
|
+
/** Remaining payout liability in the settled phase. */
|
|
48
|
+
settled_payout_liability: U64,
|
|
49
|
+
/** Sparse payout tree for live cash backing and settled liability. */
|
|
50
|
+
payout: strike_payout_tree.StrikePayoutTree,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
export const MintTerms = new MoveStruct({
|
|
54
|
+
name: `${$moduleName}::MintTerms`,
|
|
55
|
+
fields: {
|
|
56
|
+
expiry_market_id: bcs.Address,
|
|
57
|
+
lower_tick: U64,
|
|
58
|
+
higher_tick: U64,
|
|
59
|
+
quantity: U64,
|
|
60
|
+
entry_probability: U64,
|
|
61
|
+
premium: U64,
|
|
62
|
+
/** Separate inventory-impact charge, sampled against the pre-mint book. */
|
|
63
|
+
inventory_impact_charge: U64,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
export const LiveCloseTerms = new MoveStruct({
|
|
67
|
+
name: `${$moduleName}::LiveCloseTerms`,
|
|
68
|
+
fields: {
|
|
69
|
+
expiry_market_id: bcs.Address,
|
|
70
|
+
order: order.Order,
|
|
71
|
+
close_quantity: U64,
|
|
72
|
+
redeem_amount: U64,
|
|
73
|
+
range_probability: U64,
|
|
74
|
+
/** Separate inventory-impact rebate, sampled against the pre-close book. */
|
|
75
|
+
inventory_impact_rebate: U64,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Stored strike-exposure policy config.
|
|
7
|
+
*
|
|
8
|
+
* ProtocolConfig owns the current global template. Each StrikeExposure stores a
|
|
9
|
+
* snapshot initialized from that template, so later admin updates do not reprice
|
|
10
|
+
* active markets. Fee policy lives here because fees consume prices but are not
|
|
11
|
+
* themselves contract probability.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { MoveStruct } from '../utils/index.js';
|
|
15
|
+
import { U64 } from '../../bcs/integers.js';
|
|
16
|
+
const $moduleName = '@local-pkg/deepbook_predict::strike_exposure_config';
|
|
17
|
+
export const StrikeExposureConfig = new MoveStruct({
|
|
18
|
+
name: `${$moduleName}::StrikeExposureConfig`,
|
|
19
|
+
fields: {
|
|
20
|
+
/**
|
|
21
|
+
* Fraction of the disjoint-book backing gap reserved for early exits. A value of
|
|
22
|
+
* 1.0 reserves the full gap.
|
|
23
|
+
*/
|
|
24
|
+
backing_buffer_lambda: U64,
|
|
25
|
+
/**
|
|
26
|
+
* Base fee multiplier for Bernoulli scaling. Effective base fee = base_fee *
|
|
27
|
+
* sqrt(price * (1 - price)).
|
|
28
|
+
*/
|
|
29
|
+
base_fee: U64,
|
|
30
|
+
/** Minimum per-unit fee floor; live trade fees never go below this value. */
|
|
31
|
+
min_fee: U64,
|
|
32
|
+
/** Minimum raw entry probability allowed for mint admission. */
|
|
33
|
+
min_entry_probability: U64,
|
|
34
|
+
/** Maximum raw entry probability allowed for mint admission. */
|
|
35
|
+
max_entry_probability: U64,
|
|
36
|
+
/** Window before expiry over which trade fees ramp up. */
|
|
37
|
+
expiry_fee_window_ms: U64,
|
|
38
|
+
/** Fee multiplier reached at expiry, in FLOAT_SCALING; 1x disables the ramp. */
|
|
39
|
+
expiry_fee_max_multiplier: U64,
|
|
40
|
+
/**
|
|
41
|
+
* Maximum marginal rate of the path-independent inventory-impact curve, in
|
|
42
|
+
* FLOAT_SCALING. `0` disables both charges and rebates.
|
|
43
|
+
*/
|
|
44
|
+
inventory_impact_max_rate: U64,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Sparse strike exposure index for payout-liability accounting.
|
|
7
|
+
*
|
|
8
|
+
* The tree keys finite interval boundaries by absolute tick, matching the tick
|
|
9
|
+
* pair packed into the durable order ID. Raw strikes are recovered only at the
|
|
10
|
+
* pricing/settlement boundary, where callers pass the owning market's `tick_size`
|
|
11
|
+
* (`raw_strike = tick * tick_size`); the tree stores no grid geometry.
|
|
12
|
+
*
|
|
13
|
+
* This height-balanced (AVL) tree stores finite interval boundaries touched by
|
|
14
|
+
* positions. Boundary ticks are caller-chosen, so the balancing rule must not read
|
|
15
|
+
* anything the caller supplies: rotations are driven by measured subtree height,
|
|
16
|
+
* which bounds depth at `O(log n)` for _every_ tick set rather than in expectation
|
|
17
|
+
* over a random one. Depth is the cost model that matters — each node is a
|
|
18
|
+
* dynamic-field child, and `apply_at` and `settlement_prefix_payout` touch one per
|
|
19
|
+
* level against a per-transaction cached-object ceiling.
|
|
20
|
+
*
|
|
21
|
+
* It tracks each order's quantity, which is also its settled payout: a winning
|
|
22
|
+
* order pays its full quantity. Live cash backing is the max-point payout plus a
|
|
23
|
+
* buffer over the disjoint-book gap; the tree's max-point term is the floor anchor
|
|
24
|
+
* of that enforced reserve.
|
|
25
|
+
*
|
|
26
|
+
* Shape carries no value for a consistent index: `combine_summaries` is
|
|
27
|
+
* associative over the in-order sequence, so any arrangement of the same
|
|
28
|
+
* boundaries yields identical summaries, settlement prefixes, and linear-walk
|
|
29
|
+
* totals. That holds only while every prefix is non-negative, which a consistent
|
|
30
|
+
* book guarantees. Under a caller/index desync the settlement walk's underflow
|
|
31
|
+
* abort depends on which prefixes a given shape happens to visit, so it is not a
|
|
32
|
+
* desync detector — the per-boundary underflow in `apply_net_delta` is the
|
|
33
|
+
* authority.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
import { MoveStruct } from '../utils/index.js';
|
|
37
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
38
|
+
import { U64 } from '../../bcs/integers.js';
|
|
39
|
+
import * as table from './deps/sui/table.js';
|
|
40
|
+
const $moduleName = '@local-pkg/deepbook_predict::strike_payout_tree';
|
|
41
|
+
export const StrikePayoutTree = new MoveStruct({
|
|
42
|
+
name: `${$moduleName}::StrikePayoutTree`,
|
|
43
|
+
fields: {
|
|
44
|
+
root: bcs.option(U64),
|
|
45
|
+
nodes: table.Table,
|
|
46
|
+
node_count: U64,
|
|
47
|
+
/**
|
|
48
|
+
* Aggregate order quantity over the open-lower prefix, which is also its aggregate
|
|
49
|
+
* settled payout.
|
|
50
|
+
*/
|
|
51
|
+
base: U64,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
export const PayoutSummary = new MoveStruct({
|
|
55
|
+
name: `${$moduleName}::PayoutSummary`,
|
|
56
|
+
fields: {
|
|
57
|
+
start: U64,
|
|
58
|
+
end: U64,
|
|
59
|
+
/**
|
|
60
|
+
* Never exceeds `start`, by construction in `boundary_summary` and
|
|
61
|
+
* `combine_summaries`. That bound is what makes `combine_summaries` associative at
|
|
62
|
+
* u64 scale — and therefore what makes the tree's shape irrelevant to every value
|
|
63
|
+
* it reports. A summary term that could outgrow `start` would break
|
|
64
|
+
* shape-independence with no test to catch it, and would also abort
|
|
65
|
+
* `strike_exposure`'s plain `total - max` subtraction.
|
|
66
|
+
*/
|
|
67
|
+
max_payout_prefix_gain: U64,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
export const PayoutNode = new MoveStruct({
|
|
71
|
+
name: `${$moduleName}::PayoutNode`,
|
|
72
|
+
fields: {
|
|
73
|
+
/**
|
|
74
|
+
* Longest root-to-leaf path in this subtree, counting this node. A leaf is 1; an
|
|
75
|
+
* absent child is 0. Maintained by `resummarize` alongside `summary`, and read
|
|
76
|
+
* only by `rebalance` — never by a caller, and never derived from a tick.
|
|
77
|
+
*/
|
|
78
|
+
height: U64,
|
|
79
|
+
left: bcs.option(U64),
|
|
80
|
+
right: bcs.option(U64),
|
|
81
|
+
/**
|
|
82
|
+
* This node's own boundary terms, stored so the subtree `summary` can be
|
|
83
|
+
* recomputed without deriving locals by subtracting child summaries.
|
|
84
|
+
*/
|
|
85
|
+
local_start: U64,
|
|
86
|
+
local_end: U64,
|
|
87
|
+
summary: PayoutSummary,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Pool-vault events for expiry cash and profit, fee incentives, and the queued LP
|
|
7
|
+
* request lifecycle. A flush records the frozen pool mark used by fills.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { MoveStruct } from '../utils/index.js';
|
|
11
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
12
|
+
import { U64 } from '../../bcs/integers.js';
|
|
13
|
+
const $moduleName = '@local-pkg/deepbook_predict::vault_events';
|
|
14
|
+
export const ExpiryCashReceived = new MoveStruct({
|
|
15
|
+
name: `${$moduleName}::ExpiryCashReceived`,
|
|
16
|
+
fields: {
|
|
17
|
+
pool_vault_id: bcs.Address,
|
|
18
|
+
expiry_market_id: bcs.Address,
|
|
19
|
+
settlement_price: U64,
|
|
20
|
+
amount: U64,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export const ExpiryCashRebalanced = new MoveStruct({
|
|
24
|
+
name: `${$moduleName}::ExpiryCashRebalanced`,
|
|
25
|
+
fields: {
|
|
26
|
+
pool_vault_id: bcs.Address,
|
|
27
|
+
expiry_market_id: bcs.Address,
|
|
28
|
+
amount: U64,
|
|
29
|
+
to_expiry: bcs.bool(),
|
|
30
|
+
target_cash: U64,
|
|
31
|
+
protocol_profit_realized: U64,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
export const ExpiryProfitMaterialized = new MoveStruct({
|
|
35
|
+
name: `${$moduleName}::ExpiryProfitMaterialized`,
|
|
36
|
+
fields: {
|
|
37
|
+
pool_vault_id: bcs.Address,
|
|
38
|
+
expiry_market_id: bcs.Address,
|
|
39
|
+
lp_profit: U64,
|
|
40
|
+
protocol_profit: U64,
|
|
41
|
+
protocol_reserve_balance_after: U64,
|
|
42
|
+
profit_basis_after: U64,
|
|
43
|
+
pending_protocol_profit_after: U64,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
export const SupplyRequested = new MoveStruct({
|
|
47
|
+
name: `${$moduleName}::SupplyRequested`,
|
|
48
|
+
fields: {
|
|
49
|
+
pool_vault_id: bcs.Address,
|
|
50
|
+
account_id: bcs.Address,
|
|
51
|
+
recipient: bcs.Address,
|
|
52
|
+
index: U64,
|
|
53
|
+
amount: U64,
|
|
54
|
+
min_plp_out: U64,
|
|
55
|
+
requests_pending_after: U64,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
export const WithdrawRequested = new MoveStruct({
|
|
59
|
+
name: `${$moduleName}::WithdrawRequested`,
|
|
60
|
+
fields: {
|
|
61
|
+
pool_vault_id: bcs.Address,
|
|
62
|
+
account_id: bcs.Address,
|
|
63
|
+
recipient: bcs.Address,
|
|
64
|
+
index: U64,
|
|
65
|
+
amount: U64,
|
|
66
|
+
min_dusdc_out: U64,
|
|
67
|
+
requests_pending_after: U64,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
export const RequestCancelled = new MoveStruct({
|
|
71
|
+
name: `${$moduleName}::RequestCancelled`,
|
|
72
|
+
fields: {
|
|
73
|
+
pool_vault_id: bcs.Address,
|
|
74
|
+
account_id: bcs.Address,
|
|
75
|
+
recipient: bcs.Address,
|
|
76
|
+
index: U64,
|
|
77
|
+
amount: U64,
|
|
78
|
+
is_supply: bcs.bool(),
|
|
79
|
+
/**
|
|
80
|
+
* 0=user, 1=non-executable frozen mark, 2=quote below the request's minimum
|
|
81
|
+
* output.
|
|
82
|
+
*/
|
|
83
|
+
reason: bcs.u8(),
|
|
84
|
+
requests_pending_after: U64,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
export const RequestLimitMissed = new MoveStruct({
|
|
88
|
+
name: `${$moduleName}::RequestLimitMissed`,
|
|
89
|
+
fields: {
|
|
90
|
+
pool_vault_id: bcs.Address,
|
|
91
|
+
account_id: bcs.Address,
|
|
92
|
+
recipient: bcs.Address,
|
|
93
|
+
index: U64,
|
|
94
|
+
amount: U64,
|
|
95
|
+
is_supply: bcs.bool(),
|
|
96
|
+
quoted_output: U64,
|
|
97
|
+
min_output: U64,
|
|
98
|
+
missed_flushes: U64,
|
|
99
|
+
max_misses: U64,
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
export const SupplyFilled = new MoveStruct({
|
|
103
|
+
name: `${$moduleName}::SupplyFilled`,
|
|
104
|
+
fields: {
|
|
105
|
+
pool_vault_id: bcs.Address,
|
|
106
|
+
account_id: bcs.Address,
|
|
107
|
+
recipient: bcs.Address,
|
|
108
|
+
index: U64,
|
|
109
|
+
/**
|
|
110
|
+
* DUSDC actually taken into the pool, which is less than the request's escrow when
|
|
111
|
+
* the supply cap left only part of it room. Shares were priced on
|
|
112
|
+
* `dusdc_amount - fee_dusdc`.
|
|
113
|
+
*/
|
|
114
|
+
dusdc_amount: U64,
|
|
115
|
+
shares_minted: U64,
|
|
116
|
+
/** Supply fee withheld from `dusdc_amount` and retained by the pool. */
|
|
117
|
+
fee_dusdc: U64,
|
|
118
|
+
/**
|
|
119
|
+
* Escrow still queued at the head after a partial fill; `0` on a full fill, in
|
|
120
|
+
* which case the request is gone. `dusdc_amount + dusdc_remaining` is the amount
|
|
121
|
+
* the request carried into this flush.
|
|
122
|
+
*/
|
|
123
|
+
dusdc_remaining: U64,
|
|
124
|
+
requests_pending_after: U64,
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
export const WithdrawFilled = new MoveStruct({
|
|
128
|
+
name: `${$moduleName}::WithdrawFilled`,
|
|
129
|
+
fields: {
|
|
130
|
+
pool_vault_id: bcs.Address,
|
|
131
|
+
account_id: bcs.Address,
|
|
132
|
+
recipient: bcs.Address,
|
|
133
|
+
index: U64,
|
|
134
|
+
shares_burned: U64,
|
|
135
|
+
/**
|
|
136
|
+
* Net DUSDC delivered to `recipient`. The gross marked value of `shares_burned`
|
|
137
|
+
* was `dusdc_amount + fee_dusdc`.
|
|
138
|
+
*/
|
|
139
|
+
dusdc_amount: U64,
|
|
140
|
+
/** Withdraw fee withheld from the payout and retained by the pool. */
|
|
141
|
+
fee_dusdc: U64,
|
|
142
|
+
/**
|
|
143
|
+
* Escrowed PLP still queued at the head after a partial fill; `0` on a full fill,
|
|
144
|
+
* in which case the request is gone. `shares_burned + shares_remaining` is the
|
|
145
|
+
* amount the request carried into this flush.
|
|
146
|
+
*/
|
|
147
|
+
shares_remaining: U64,
|
|
148
|
+
requests_pending_after: U64,
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
export const FlushExecuted = new MoveStruct({
|
|
152
|
+
name: `${$moduleName}::FlushExecuted`,
|
|
153
|
+
fields: {
|
|
154
|
+
pool_vault_id: bcs.Address,
|
|
155
|
+
epoch: U64,
|
|
156
|
+
/**
|
|
157
|
+
* LP-attributable pool NAV every fill was priced at: idle plus
|
|
158
|
+
* `active_market_nav`, excluding unrealized and pending protocol profit.
|
|
159
|
+
*/
|
|
160
|
+
pool_value: U64,
|
|
161
|
+
/** PLP supply in the frozen pre-drain mark used to price every fill. */
|
|
162
|
+
total_supply: U64,
|
|
163
|
+
/**
|
|
164
|
+
* Supply-leg fee rate in FLOAT_SCALING, frozen with the mark and charged on every
|
|
165
|
+
* supply fill in this flush.
|
|
166
|
+
*/
|
|
167
|
+
supply_fee_rate: U64,
|
|
168
|
+
/** Withdraw-leg fee rate in FLOAT_SCALING, frozen alongside it. */
|
|
169
|
+
withdraw_fee_rate: U64,
|
|
170
|
+
/**
|
|
171
|
+
* Sum of the marked NAV contributed by each active market; settled markets add
|
|
172
|
+
* zero.
|
|
173
|
+
*/
|
|
174
|
+
active_market_nav: U64,
|
|
175
|
+
/** Number of active markets valued for this flush. */
|
|
176
|
+
market_count: U64,
|
|
177
|
+
/** Idle DUSDC held by the pool at valuation time, before the drain. */
|
|
178
|
+
idle_balance_before: U64,
|
|
179
|
+
supplies_filled: U64,
|
|
180
|
+
withdrawals_filled: U64,
|
|
181
|
+
requests_processed: U64,
|
|
182
|
+
idle_balance_after: U64,
|
|
183
|
+
/** PLP supply after the drain's completed mints and burns. */
|
|
184
|
+
total_supply_after: U64,
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
export const CapitalLocked = new MoveStruct({
|
|
188
|
+
name: `${$moduleName}::CapitalLocked`,
|
|
189
|
+
fields: {
|
|
190
|
+
pool_vault_id: bcs.Address,
|
|
191
|
+
amount: U64,
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
export const FeeIncentivesSponsored = new MoveStruct({
|
|
195
|
+
name: `${$moduleName}::FeeIncentivesSponsored`,
|
|
196
|
+
fields: {
|
|
197
|
+
pool_vault_id: bcs.Address,
|
|
198
|
+
sponsor: bcs.Address,
|
|
199
|
+
amount: U64,
|
|
200
|
+
reserve_after: U64,
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
export const FeeIncentivesAllocated = new MoveStruct({
|
|
204
|
+
name: `${$moduleName}::FeeIncentivesAllocated`,
|
|
205
|
+
fields: {
|
|
206
|
+
pool_vault_id: bcs.Address,
|
|
207
|
+
expiry_market_id: bcs.Address,
|
|
208
|
+
amount: U64,
|
|
209
|
+
pool_reserve_after: U64,
|
|
210
|
+
expiry_incentive_balance_after: U64,
|
|
211
|
+
expiry_incentives_allocated_after: U64,
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
export const FeeIncentivesReturned = new MoveStruct({
|
|
215
|
+
name: `${$moduleName}::FeeIncentivesReturned`,
|
|
216
|
+
fields: {
|
|
217
|
+
pool_vault_id: bcs.Address,
|
|
218
|
+
expiry_market_id: bcs.Address,
|
|
219
|
+
amount: U64,
|
|
220
|
+
pool_reserve_after: U64,
|
|
221
|
+
},
|
|
222
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { type ConfigValue } from '../utils/index.js';
|
|
5
|
+
export interface DeepbookSessionsConfig {
|
|
6
|
+
sessionsPackageId?: string;
|
|
7
|
+
sessionsConfig: ConfigValue;
|
|
8
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { type BcsType, bcs } from '@mysten/sui/bcs';
|
|
5
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
6
|
+
const $moduleName = '0x2::vec_map';
|
|
7
|
+
/** An entry in the map */
|
|
8
|
+
export function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]) {
|
|
9
|
+
return new MoveStruct({
|
|
10
|
+
name: `${$moduleName}::Entry<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`,
|
|
11
|
+
fields: {
|
|
12
|
+
key: typeParameters[0],
|
|
13
|
+
value: typeParameters[1],
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A map data structure backed by a vector. The map is guaranteed not to contain
|
|
19
|
+
* duplicate keys, but entries are _not_ sorted by key--entries are included in
|
|
20
|
+
* insertion order. All operations are O(N) in the size of the map--the intention
|
|
21
|
+
* of this data structure is only to provide the convenience of programming against
|
|
22
|
+
* a map API. Large maps should use handwritten parent/child relationships instead.
|
|
23
|
+
* Maps that need sorted iteration rather than insertion order iteration should
|
|
24
|
+
* also be handwritten.
|
|
25
|
+
*/
|
|
26
|
+
export function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]) {
|
|
27
|
+
return new MoveStruct({
|
|
28
|
+
name: `${$moduleName}::VecMap<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`,
|
|
29
|
+
fields: {
|
|
30
|
+
contents: bcs.vector(Entry(typeParameters[0], typeParameters[1])),
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/** Owns the Sessions package version floor and the authority that advances it. */
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
MoveStruct,
|
|
9
|
+
normalizeMoveArguments,
|
|
10
|
+
type RawTransactionArgument,
|
|
11
|
+
type ConfigValue,
|
|
12
|
+
} from '../utils/index.js';
|
|
13
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
14
|
+
import { U64 } from '../../bcs/integers.js';
|
|
15
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
16
|
+
const $moduleName = '@local-pkg/deepbook_sessions::session_config';
|
|
17
|
+
export const SessionsConfig = new MoveStruct({
|
|
18
|
+
name: `${$moduleName}::SessionsConfig`,
|
|
19
|
+
fields: {
|
|
20
|
+
id: bcs.Address,
|
|
21
|
+
version_watermark: U64,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
export const SessionsAdminCap = new MoveStruct({
|
|
25
|
+
name: `${$moduleName}::SessionsAdminCap`,
|
|
26
|
+
fields: {
|
|
27
|
+
id: bcs.Address,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
export interface IdArguments {
|
|
31
|
+
config?: RawTransactionArgument<string>;
|
|
32
|
+
}
|
|
33
|
+
export interface IdOptions {
|
|
34
|
+
package?: string;
|
|
35
|
+
arguments?: IdArguments;
|
|
36
|
+
config?: {
|
|
37
|
+
sessionsConfig: ConfigValue;
|
|
38
|
+
sessionsPackageId?: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Return the config object ID for external PTB construction. */
|
|
42
|
+
export function id(options: IdOptions) {
|
|
43
|
+
const packageAddress =
|
|
44
|
+
options.package ?? options.config?.sessionsPackageId ?? '@local-pkg/deepbook_sessions';
|
|
45
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
46
|
+
const parameterNames = ['config'];
|
|
47
|
+
return (tx: Transaction) =>
|
|
48
|
+
tx.moveCall({
|
|
49
|
+
package: packageAddress,
|
|
50
|
+
module: 'session_config',
|
|
51
|
+
function: 'id',
|
|
52
|
+
arguments: normalizeMoveArguments(
|
|
53
|
+
{
|
|
54
|
+
...options.arguments,
|
|
55
|
+
config: options.arguments?.config ?? options.config?.sessionsConfig,
|
|
56
|
+
},
|
|
57
|
+
argumentsTypes,
|
|
58
|
+
parameterNames,
|
|
59
|
+
),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export interface VersionWatermarkArguments {
|
|
63
|
+
config?: RawTransactionArgument<string>;
|
|
64
|
+
}
|
|
65
|
+
export interface VersionWatermarkOptions {
|
|
66
|
+
package?: string;
|
|
67
|
+
arguments?: VersionWatermarkArguments;
|
|
68
|
+
config?: {
|
|
69
|
+
sessionsConfig: ConfigValue;
|
|
70
|
+
sessionsPackageId?: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** Return the minimum Sessions package version accepted by gated entrypoints. */
|
|
74
|
+
export function versionWatermark(options: VersionWatermarkOptions) {
|
|
75
|
+
const packageAddress =
|
|
76
|
+
options.package ?? options.config?.sessionsPackageId ?? '@local-pkg/deepbook_sessions';
|
|
77
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
78
|
+
const parameterNames = ['config'];
|
|
79
|
+
return (tx: Transaction) =>
|
|
80
|
+
tx.moveCall({
|
|
81
|
+
package: packageAddress,
|
|
82
|
+
module: 'session_config',
|
|
83
|
+
function: 'version_watermark',
|
|
84
|
+
arguments: normalizeMoveArguments(
|
|
85
|
+
{
|
|
86
|
+
...options.arguments,
|
|
87
|
+
config: options.arguments?.config ?? options.config?.sessionsConfig,
|
|
88
|
+
},
|
|
89
|
+
argumentsTypes,
|
|
90
|
+
parameterNames,
|
|
91
|
+
),
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
export interface BumpVersionWatermarkArguments {
|
|
95
|
+
config?: RawTransactionArgument<string>;
|
|
96
|
+
AdminCap: RawTransactionArgument<string>;
|
|
97
|
+
}
|
|
98
|
+
export interface BumpVersionWatermarkOptions {
|
|
99
|
+
package?: string;
|
|
100
|
+
arguments: BumpVersionWatermarkArguments;
|
|
101
|
+
config?: {
|
|
102
|
+
sessionsConfig: ConfigValue;
|
|
103
|
+
sessionsPackageId?: string;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Advance the version floor to this package's compiled-in version. This is ungated
|
|
108
|
+
* so an upgraded package can retire older versions, and it cannot accept a
|
|
109
|
+
* caller-selected target.
|
|
110
|
+
*/
|
|
111
|
+
export function bumpVersionWatermark(options: BumpVersionWatermarkOptions) {
|
|
112
|
+
const packageAddress =
|
|
113
|
+
options.package ?? options.config?.sessionsPackageId ?? '@local-pkg/deepbook_sessions';
|
|
114
|
+
const argumentsTypes = [null, null] satisfies (string | null)[];
|
|
115
|
+
const parameterNames = ['config', 'AdminCap'];
|
|
116
|
+
return (tx: Transaction) =>
|
|
117
|
+
tx.moveCall({
|
|
118
|
+
package: packageAddress,
|
|
119
|
+
module: 'session_config',
|
|
120
|
+
function: 'bump_version_watermark',
|
|
121
|
+
arguments: normalizeMoveArguments(
|
|
122
|
+
{
|
|
123
|
+
...options.arguments,
|
|
124
|
+
config: options.arguments?.config ?? options.config?.sessionsConfig,
|
|
125
|
+
},
|
|
126
|
+
argumentsTypes,
|
|
127
|
+
parameterNames,
|
|
128
|
+
),
|
|
129
|
+
});
|
|
130
|
+
}
|