@mysten/deepbook-v3 2.1.4 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/PREDICT.md +154 -48
- package/README.md +18 -13
- package/dist/account.d.mts.map +1 -1
- package/dist/account.mjs +3 -1
- package/dist/account.mjs.map +1 -1
- package/dist/client.d.mts +2 -2
- package/dist/contracts/account/account.d.mts +23 -23
- package/dist/contracts/account/account.d.mts.map +1 -1
- package/dist/contracts/account/account_events.d.mts +20 -20
- package/dist/contracts/account/account_registry.d.mts +19 -19
- package/dist/contracts/deepbook/account.d.mts +18 -18
- package/dist/contracts/deepbook/account.d.mts.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_predict/admin.d.mts +27 -0
- package/dist/contracts/deepbook_predict/admin.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/admin.mjs +38 -0
- package/dist/contracts/deepbook_predict/admin.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/builder_code.d.mts +81 -0
- package/dist/contracts/deepbook_predict/builder_code.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/builder_code.mjs +103 -0
- package/dist/contracts/deepbook_predict/builder_code.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/builder_code_events.d.mts +25 -0
- package/dist/contracts/deepbook_predict/builder_code_events.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/builder_code_events.mjs +7 -1
- package/dist/contracts/deepbook_predict/builder_code_events.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/config_events.d.mts +104 -0
- package/dist/contracts/deepbook_predict/config_events.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/config_events.mjs +155 -0
- package/dist/contracts/deepbook_predict/config_events.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/deps/sui/vec_map.mjs +37 -0
- package/dist/contracts/deepbook_predict/deps/sui/vec_map.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/ewma_config.mjs +28 -0
- package/dist/contracts/deepbook_predict/ewma_config.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/expiry_cash.mjs +1 -1
- package/dist/contracts/deepbook_predict/expiry_cash.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/expiry_market.d.mts +859 -0
- package/dist/contracts/deepbook_predict/expiry_market.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/expiry_market.mjs +662 -7
- package/dist/contracts/deepbook_predict/expiry_market.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/market_lifecycle_cap.d.mts +39 -0
- package/dist/contracts/deepbook_predict/market_lifecycle_cap.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/market_lifecycle_cap.mjs +51 -0
- package/dist/contracts/deepbook_predict/market_lifecycle_cap.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/market_manager.d.mts +159 -0
- package/dist/contracts/deepbook_predict/market_manager.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/market_manager.mjs +88 -2
- package/dist/contracts/deepbook_predict/market_manager.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/order_events.d.mts +101 -0
- package/dist/contracts/deepbook_predict/order_events.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/order_events.mjs +7 -1
- package/dist/contracts/deepbook_predict/order_events.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pause_cap.d.mts +39 -0
- package/dist/contracts/deepbook_predict/pause_cap.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/pause_cap.mjs +51 -0
- package/dist/contracts/deepbook_predict/pause_cap.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/plp.d.mts +801 -0
- package/dist/contracts/deepbook_predict/plp.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/plp.mjs +511 -32
- package/dist/contracts/deepbook_predict/plp.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pool_accounting.mjs +7 -7
- package/dist/contracts/deepbook_predict/pool_accounting.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pool_valuation_cap.d.mts +39 -0
- package/dist/contracts/deepbook_predict/pool_valuation_cap.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/pool_valuation_cap.mjs +52 -0
- package/dist/contracts/deepbook_predict/pool_valuation_cap.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/predict_account.d.mts +90 -0
- package/dist/contracts/deepbook_predict/predict_account.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/predict_account.mjs +25 -2
- package/dist/contracts/deepbook_predict/predict_account.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pricing.d.mts +127 -0
- package/dist/contracts/deepbook_predict/pricing.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/pricing.mjs +37 -1
- package/dist/contracts/deepbook_predict/pricing.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pricing_config.mjs +28 -0
- package/dist/contracts/deepbook_predict/pricing_config.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/protocol_config.d.mts +665 -0
- package/dist/contracts/deepbook_predict/protocol_config.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/protocol_config.mjs +841 -0
- package/dist/contracts/deepbook_predict/protocol_config.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/range_codec.d.mts +30 -0
- package/dist/contracts/deepbook_predict/range_codec.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/range_codec.mjs +6 -1
- package/dist/contracts/deepbook_predict/range_codec.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/registry.d.mts +382 -0
- package/dist/contracts/deepbook_predict/registry.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/registry.mjs +458 -2
- package/dist/contracts/deepbook_predict/registry.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/strike_exposure.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/strike_payout_tree.mjs +13 -1
- package/dist/contracts/deepbook_predict/strike_payout_tree.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/vault_events.d.mts +199 -0
- package/dist/contracts/deepbook_predict/vault_events.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/vault_events.mjs +38 -8
- package/dist/contracts/deepbook_predict/vault_events.mjs.map +1 -1
- package/dist/contracts/deepbook_sessions/session_config.d.mts +8 -8
- package/dist/contracts/deepbook_sessions/session_config.d.mts.map +1 -1
- package/dist/contracts/deepbook_sessions/sessions.d.mts +22 -22
- package/dist/contracts/deepbook_sessions/sessions.d.mts.map +1 -1
- package/dist/deployments/index.d.mts +3 -2
- package/dist/deployments/index.d.mts.map +1 -1
- package/dist/deployments/index.mjs +4 -1
- package/dist/deployments/index.mjs.map +1 -1
- package/dist/deployments/mainnet.d.mts +14 -0
- package/dist/deployments/mainnet.d.mts.map +1 -0
- package/dist/deployments/mainnet.mjs +73 -0
- package/dist/deployments/mainnet.mjs.map +1 -0
- package/dist/deployments/testnet.mjs +23 -23
- package/dist/deployments/testnet.mjs.map +1 -1
- package/dist/deployments/types.d.mts +1 -1
- package/dist/predict/client.d.mts +28 -6
- package/dist/predict/client.d.mts.map +1 -1
- package/dist/predict/client.mjs +7 -6
- package/dist/predict/client.mjs.map +1 -1
- package/dist/predict/config/index.d.mts +2 -0
- package/dist/predict/config/index.d.mts.map +1 -1
- package/dist/predict/config/index.mjs +4 -1
- package/dist/predict/config/index.mjs.map +1 -1
- package/dist/predict/config/mainnet.d.mts +17 -0
- package/dist/predict/config/mainnet.d.mts.map +1 -0
- package/dist/predict/config/mainnet.mjs +26 -0
- package/dist/predict/config/mainnet.mjs.map +1 -0
- package/dist/predict/config/types.d.mts +6 -0
- package/dist/predict/config/types.d.mts.map +1 -1
- package/dist/predict/index.d.mts +21 -2
- package/dist/predict/index.mjs +20 -1
- package/dist/predict/pricing.d.mts +6 -6
- package/dist/predict/pricing.d.mts.map +1 -1
- package/dist/predict/pricing.mjs +6 -6
- package/dist/predict/pricing.mjs.map +1 -1
- package/dist/predict/reads/balances.mjs.map +1 -1
- package/dist/predict/reads/markets.mjs +1 -1
- package/dist/predict/reads/markets.mjs.map +1 -1
- package/dist/predict/reads/pricing.d.mts +2 -1
- package/dist/predict/reads/pricing.d.mts.map +1 -1
- package/dist/predict/reads/pricing.mjs.map +1 -1
- package/dist/sessions.d.mts.map +1 -1
- package/dist/sessions.mjs +3 -1
- package/dist/sessions.mjs.map +1 -1
- package/dist/transactions/balanceManager.d.mts +12 -12
- package/dist/transactions/balanceManager.d.mts.map +1 -1
- package/dist/transactions/deepbook.d.mts +20 -20
- package/dist/transactions/deepbook.d.mts.map +1 -1
- 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/marginPool.d.mts.map +1 -1
- 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/package.json +3 -3
- package/src/account.ts +3 -1
- package/src/contracts/deepbook_predict/builder_code.ts +3 -3
- package/src/contracts/deepbook_predict/config_events.ts +9 -2
- package/src/contracts/deepbook_predict/deps/sui/vec_map.ts +33 -0
- package/src/contracts/deepbook_predict/expiry_cash.ts +1 -1
- package/src/contracts/deepbook_predict/expiry_market.ts +70 -11
- package/src/contracts/deepbook_predict/market_lifecycle_cap.ts +3 -10
- package/src/contracts/deepbook_predict/market_manager.ts +2 -2
- package/src/contracts/deepbook_predict/order_events.ts +6 -6
- package/src/contracts/deepbook_predict/plp.ts +263 -81
- package/src/contracts/deepbook_predict/pool_accounting.ts +14 -14
- package/src/contracts/deepbook_predict/pool_valuation_cap.ts +69 -0
- package/src/contracts/deepbook_predict/predict_account.ts +1 -1
- package/src/contracts/deepbook_predict/pricing.ts +16 -4
- package/src/contracts/deepbook_predict/protocol_config.ts +202 -7
- package/src/contracts/deepbook_predict/registry.ts +91 -17
- package/src/contracts/deepbook_predict/strike_exposure.ts +1 -1
- package/src/contracts/deepbook_predict/strike_payout_tree.ts +27 -0
- package/src/contracts/deepbook_predict/vault_events.ts +45 -14
- package/src/contracts/propbook/block_scholes_store.ts +8 -42
- package/src/deployments/index.ts +13 -3
- package/src/deployments/mainnet.ts +107 -0
- package/src/deployments/testnet.ts +25 -25
- package/src/deployments/types.ts +1 -1
- package/src/predict/client.ts +48 -17
- package/src/predict/config/index.ts +7 -2
- package/src/predict/config/mainnet.ts +27 -0
- package/src/predict/config/types.ts +7 -1
- package/src/predict/index.ts +31 -2
- package/src/predict/pricing.ts +11 -9
- package/src/predict/reads/balances.ts +1 -1
- package/src/predict/reads/markets.ts +1 -1
- package/src/predict/reads/pricing.ts +2 -1
- package/src/sessions.ts +4 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/rolldown_runtime.mjs";
|
|
1
2
|
import { MoveStruct, normalizeMoveArguments } from "../utils/index.mjs";
|
|
2
3
|
import { U64 } from "../../bcs/integers.mjs";
|
|
3
4
|
import { Balance } from "./deps/sui/balance.mjs";
|
|
@@ -20,7 +21,65 @@ import { bcs } from "@mysten/sui/bcs";
|
|
|
20
21
|
* loaded `Pricer` snapshots into exposure business logic. Pool-wide PLP accounting
|
|
21
22
|
* and profit accounting remain outside this module.
|
|
22
23
|
*/
|
|
24
|
+
var expiry_market_exports = /* @__PURE__ */ __exportAll({
|
|
25
|
+
ExpiryMarket: () => ExpiryMarket,
|
|
26
|
+
MintQuote: () => MintQuote,
|
|
27
|
+
ValuationStamp: () => ValuationStamp,
|
|
28
|
+
admissionTickSize: () => admissionTickSize,
|
|
29
|
+
allInCost: () => allInCost,
|
|
30
|
+
backingBufferLambda: () => backingBufferLambda,
|
|
31
|
+
builderFee: () => builderFee,
|
|
32
|
+
cashBalance: () => cashBalance,
|
|
33
|
+
currentNav: () => currentNav,
|
|
34
|
+
entryProbability: () => entryProbability,
|
|
35
|
+
expiry: () => expiry,
|
|
36
|
+
expiryFeeMaxMultiplier: () => expiryFeeMaxMultiplier,
|
|
37
|
+
expiryFeeWindowMs: () => expiryFeeWindowMs,
|
|
38
|
+
feeIncentiveBalance: () => feeIncentiveBalance,
|
|
39
|
+
feeIncentiveSubsidy: () => feeIncentiveSubsidy,
|
|
40
|
+
id: () => id,
|
|
41
|
+
inventoryImpactCharge: () => inventoryImpactCharge,
|
|
42
|
+
inventoryImpactMaxRate: () => inventoryImpactMaxRate,
|
|
43
|
+
inventoryImpactReserve: () => inventoryImpactReserve,
|
|
44
|
+
inventoryImpactScale: () => inventoryImpactScale,
|
|
45
|
+
isPendingValuation: () => isPendingValuation,
|
|
46
|
+
isSettled: () => isSettled,
|
|
47
|
+
liveOrderValue: () => liveOrderValue,
|
|
48
|
+
loadLivePricer: () => loadLivePricer,
|
|
49
|
+
mintExactAmount: () => mintExactAmount,
|
|
50
|
+
mintExactQuantity: () => mintExactQuantity,
|
|
51
|
+
mintPaused: () => mintPaused,
|
|
52
|
+
payoutLiability: () => payoutLiability,
|
|
53
|
+
penaltyFee: () => penaltyFee,
|
|
54
|
+
premium: () => premium,
|
|
55
|
+
propbookUnderlyingId: () => propbookUnderlyingId,
|
|
56
|
+
quantity: () => quantity,
|
|
57
|
+
quoteMint: () => quoteMint,
|
|
58
|
+
quoteMintForAccount: () => quoteMintForAccount,
|
|
59
|
+
redeemLive: () => redeemLive,
|
|
60
|
+
redeemSettled: () => redeemSettled,
|
|
61
|
+
redeemSettledPermissionless: () => redeemSettledPermissionless,
|
|
62
|
+
referenceTick: () => referenceTick,
|
|
63
|
+
referenceTickSourceTimestampMs: () => referenceTickSourceTimestampMs,
|
|
64
|
+
requiredCash: () => requiredCash,
|
|
65
|
+
setMintPaused: () => setMintPaused,
|
|
66
|
+
setReferenceTick: () => setReferenceTick,
|
|
67
|
+
settledOrderPayout: () => settledOrderPayout,
|
|
68
|
+
settlementPrice: () => settlementPrice,
|
|
69
|
+
tickSize: () => tickSize,
|
|
70
|
+
tradingFee: () => tradingFee,
|
|
71
|
+
trySettle: () => trySettle,
|
|
72
|
+
trySettlementPrice: () => trySettlementPrice
|
|
73
|
+
});
|
|
23
74
|
const $moduleName = "@local-pkg/deepbook_predict::expiry_market";
|
|
75
|
+
const ValuationStamp = new MoveStruct({
|
|
76
|
+
name: `${$moduleName}::ValuationStamp`,
|
|
77
|
+
fields: {
|
|
78
|
+
flush_seq: U64,
|
|
79
|
+
snapshot_cash: U64,
|
|
80
|
+
snapshot_impact_reserve: U64
|
|
81
|
+
}
|
|
82
|
+
});
|
|
24
83
|
const ExpiryMarket = new MoveStruct({
|
|
25
84
|
name: `${$moduleName}::ExpiryMarket`,
|
|
26
85
|
fields: {
|
|
@@ -31,7 +90,8 @@ const ExpiryMarket = new MoveStruct({
|
|
|
31
90
|
fee_incentive_balance: Balance,
|
|
32
91
|
strike_exposure: StrikeExposure,
|
|
33
92
|
ewma: EwmaState,
|
|
34
|
-
mint_paused: bcs.bool()
|
|
93
|
+
mint_paused: bcs.bool(),
|
|
94
|
+
valuation_stamp: bcs.option(ValuationStamp)
|
|
35
95
|
}
|
|
36
96
|
});
|
|
37
97
|
const MintQuote = new MoveStruct({
|
|
@@ -48,6 +108,30 @@ const MintQuote = new MoveStruct({
|
|
|
48
108
|
all_in_cost: U64
|
|
49
109
|
}
|
|
50
110
|
});
|
|
111
|
+
/** Return the market object ID for external discovery and PTB construction. */
|
|
112
|
+
function id(options) {
|
|
113
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
114
|
+
const argumentsTypes = [null];
|
|
115
|
+
const parameterNames = ["market"];
|
|
116
|
+
return (tx) => tx.moveCall({
|
|
117
|
+
package: packageAddress,
|
|
118
|
+
module: "expiry_market",
|
|
119
|
+
function: "id",
|
|
120
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/** Return the Propbook underlying for SDK and devInspect market reads. */
|
|
124
|
+
function propbookUnderlyingId(options) {
|
|
125
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
126
|
+
const argumentsTypes = [null];
|
|
127
|
+
const parameterNames = ["market"];
|
|
128
|
+
return (tx) => tx.moveCall({
|
|
129
|
+
package: packageAddress,
|
|
130
|
+
module: "expiry_market",
|
|
131
|
+
function: "propbook_underlying_id",
|
|
132
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
133
|
+
});
|
|
134
|
+
}
|
|
51
135
|
/** Return the expiry timestamp for SDK and devInspect market reads. */
|
|
52
136
|
function expiry(options) {
|
|
53
137
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -60,6 +144,150 @@ function expiry(options) {
|
|
|
60
144
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
61
145
|
});
|
|
62
146
|
}
|
|
147
|
+
/** Return the recorded settlement price. Aborts if the market is not settled. */
|
|
148
|
+
function settlementPrice(options) {
|
|
149
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
150
|
+
const argumentsTypes = [null];
|
|
151
|
+
const parameterNames = ["market"];
|
|
152
|
+
return (tx) => tx.moveCall({
|
|
153
|
+
package: packageAddress,
|
|
154
|
+
module: "expiry_market",
|
|
155
|
+
function: "settlement_price",
|
|
156
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Return whether terminal settlement has been recorded for this market. Public
|
|
161
|
+
* read for SDK/devInspect settlement-state checks.
|
|
162
|
+
*/
|
|
163
|
+
function isSettled(options) {
|
|
164
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
165
|
+
const argumentsTypes = [null];
|
|
166
|
+
const parameterNames = ["market"];
|
|
167
|
+
return (tx) => tx.moveCall({
|
|
168
|
+
package: packageAddress,
|
|
169
|
+
module: "expiry_market",
|
|
170
|
+
function: "is_settled",
|
|
171
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Return the recorded settlement price, or `none` while the market is live.
|
|
176
|
+
* Non-aborting companion to `settlement_price` for SDK/devInspect reads.
|
|
177
|
+
*/
|
|
178
|
+
function trySettlementPrice(options) {
|
|
179
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
180
|
+
const argumentsTypes = [null];
|
|
181
|
+
const parameterNames = ["market"];
|
|
182
|
+
return (tx) => tx.moveCall({
|
|
183
|
+
package: packageAddress,
|
|
184
|
+
module: "expiry_market",
|
|
185
|
+
function: "try_settlement_price",
|
|
186
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/** Return expiry USDC custody for SDK and devInspect state reads. */
|
|
190
|
+
function cashBalance(options) {
|
|
191
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
192
|
+
const argumentsTypes = [null];
|
|
193
|
+
const parameterNames = ["market"];
|
|
194
|
+
return (tx) => tx.moveCall({
|
|
195
|
+
package: packageAddress,
|
|
196
|
+
module: "expiry_market",
|
|
197
|
+
function: "cash_balance",
|
|
198
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/** Return the isolated inventory-impact escrow for SDK and devInspect state reads. */
|
|
202
|
+
function inventoryImpactReserve(options) {
|
|
203
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
204
|
+
const argumentsTypes = [null];
|
|
205
|
+
const parameterNames = ["market"];
|
|
206
|
+
return (tx) => tx.moveCall({
|
|
207
|
+
package: packageAddress,
|
|
208
|
+
module: "expiry_market",
|
|
209
|
+
function: "inventory_impact_reserve",
|
|
210
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/** Return local fee incentives for SDK and devInspect state reads. */
|
|
214
|
+
function feeIncentiveBalance(options) {
|
|
215
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
216
|
+
const argumentsTypes = [null];
|
|
217
|
+
const parameterNames = ["market"];
|
|
218
|
+
return (tx) => tx.moveCall({
|
|
219
|
+
package: packageAddress,
|
|
220
|
+
module: "expiry_market",
|
|
221
|
+
function: "fee_incentive_balance",
|
|
222
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
/** Return the snapshotted backing-buffer lambda for SDK and devInspect reads. */
|
|
226
|
+
function backingBufferLambda(options) {
|
|
227
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
228
|
+
const argumentsTypes = [null];
|
|
229
|
+
const parameterNames = ["market"];
|
|
230
|
+
return (tx) => tx.moveCall({
|
|
231
|
+
package: packageAddress,
|
|
232
|
+
module: "expiry_market",
|
|
233
|
+
function: "backing_buffer_lambda",
|
|
234
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
/** Return the snapshotted fee-ramp window for SDK and devInspect reads. */
|
|
238
|
+
function expiryFeeWindowMs(options) {
|
|
239
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
240
|
+
const argumentsTypes = [null];
|
|
241
|
+
const parameterNames = ["market"];
|
|
242
|
+
return (tx) => tx.moveCall({
|
|
243
|
+
package: packageAddress,
|
|
244
|
+
module: "expiry_market",
|
|
245
|
+
function: "expiry_fee_window_ms",
|
|
246
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
/** Return the snapshotted fee-ramp multiplier for SDK and devInspect reads. */
|
|
250
|
+
function expiryFeeMaxMultiplier(options) {
|
|
251
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
252
|
+
const argumentsTypes = [null];
|
|
253
|
+
const parameterNames = ["market"];
|
|
254
|
+
return (tx) => tx.moveCall({
|
|
255
|
+
package: packageAddress,
|
|
256
|
+
module: "expiry_market",
|
|
257
|
+
function: "expiry_fee_max_multiplier",
|
|
258
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Return this market's immutable maximum marginal inventory-impact rate for SDK
|
|
263
|
+
* and devInspect state reads.
|
|
264
|
+
*/
|
|
265
|
+
function inventoryImpactMaxRate(options) {
|
|
266
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
267
|
+
const argumentsTypes = [null];
|
|
268
|
+
const parameterNames = ["market"];
|
|
269
|
+
return (tx) => tx.moveCall({
|
|
270
|
+
package: packageAddress,
|
|
271
|
+
module: "expiry_market",
|
|
272
|
+
function: "inventory_impact_max_rate",
|
|
273
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Return the immutable USDC scale of this market's inventory-impact curve for SDK
|
|
278
|
+
* and devInspect state reads.
|
|
279
|
+
*/
|
|
280
|
+
function inventoryImpactScale(options) {
|
|
281
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
282
|
+
const argumentsTypes = [null];
|
|
283
|
+
const parameterNames = ["market"];
|
|
284
|
+
return (tx) => tx.moveCall({
|
|
285
|
+
package: packageAddress,
|
|
286
|
+
module: "expiry_market",
|
|
287
|
+
function: "inventory_impact_scale",
|
|
288
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
289
|
+
});
|
|
290
|
+
}
|
|
63
291
|
/**
|
|
64
292
|
* Return the strike tick size for SDK and devInspect range construction. Raw
|
|
65
293
|
* strikes are `tick * tick_size`.
|
|
@@ -99,6 +327,45 @@ function referenceTick(options) {
|
|
|
99
327
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
100
328
|
});
|
|
101
329
|
}
|
|
330
|
+
/** Return the reference observation timestamp for SDK and devInspect reads. */
|
|
331
|
+
function referenceTickSourceTimestampMs(options) {
|
|
332
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
333
|
+
const argumentsTypes = [null];
|
|
334
|
+
const parameterNames = ["market"];
|
|
335
|
+
return (tx) => tx.moveCall({
|
|
336
|
+
package: packageAddress,
|
|
337
|
+
module: "expiry_market",
|
|
338
|
+
function: "reference_tick_source_timestamp_ms",
|
|
339
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Return payout reserve or settled liability for external accounting
|
|
344
|
+
* observability.
|
|
345
|
+
*/
|
|
346
|
+
function payoutLiability(options) {
|
|
347
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
348
|
+
const argumentsTypes = [null];
|
|
349
|
+
const parameterNames = ["market"];
|
|
350
|
+
return (tx) => tx.moveCall({
|
|
351
|
+
package: packageAddress,
|
|
352
|
+
module: "expiry_market",
|
|
353
|
+
function: "payout_liability",
|
|
354
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
/** Return required expiry cash for external accounting observability. */
|
|
358
|
+
function requiredCash(options) {
|
|
359
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
360
|
+
const argumentsTypes = [null];
|
|
361
|
+
const parameterNames = ["market"];
|
|
362
|
+
return (tx) => tx.moveCall({
|
|
363
|
+
package: packageAddress,
|
|
364
|
+
module: "expiry_market",
|
|
365
|
+
function: "required_cash",
|
|
366
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
367
|
+
});
|
|
368
|
+
}
|
|
102
369
|
/**
|
|
103
370
|
* Load a PTB-local live pricing snapshot for this market.
|
|
104
371
|
*
|
|
@@ -142,6 +409,27 @@ function loadLivePricer(options) {
|
|
|
142
409
|
});
|
|
143
410
|
}
|
|
144
411
|
/**
|
|
412
|
+
* Return whether this market is snapshotted into the in-flight flush and still
|
|
413
|
+
* awaiting its `value_expiry`. For SDK, keeper, and devInspect reads. It gates
|
|
414
|
+
* nothing: settlement and trading both run regardless — the frozen mark is
|
|
415
|
+
* settlement-invariant, so a stamped market settles the instant it expires. Do not
|
|
416
|
+
* defer a settlement attempt on this read.
|
|
417
|
+
*/
|
|
418
|
+
function isPendingValuation(options) {
|
|
419
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
420
|
+
const argumentsTypes = [null, null];
|
|
421
|
+
const parameterNames = ["market", "config"];
|
|
422
|
+
return (tx) => tx.moveCall({
|
|
423
|
+
package: packageAddress,
|
|
424
|
+
module: "expiry_market",
|
|
425
|
+
function: "is_pending_valuation",
|
|
426
|
+
arguments: normalizeMoveArguments({
|
|
427
|
+
...options.arguments,
|
|
428
|
+
config: options.arguments?.config ?? options.config?.protocolConfig
|
|
429
|
+
}, argumentsTypes, parameterNames)
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
145
433
|
* Return live marked NAV as free expiry cash minus the exposure book's marked
|
|
146
434
|
* liability, floored at zero. This read requires a market-bound pre-expiry
|
|
147
435
|
* `Pricer`; an expired but unsettled market cannot be valued through this path.
|
|
@@ -158,6 +446,45 @@ function currentNav(options) {
|
|
|
158
446
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
159
447
|
});
|
|
160
448
|
}
|
|
449
|
+
/**
|
|
450
|
+
* Return one live order's full-close range value before fees. Requires a
|
|
451
|
+
* market-bound `Pricer` and does not prove account ownership of `order_id`. Public
|
|
452
|
+
* for SDK, PTB, and devInspect position valuation.
|
|
453
|
+
*/
|
|
454
|
+
function liveOrderValue(options) {
|
|
455
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
456
|
+
const argumentsTypes = [
|
|
457
|
+
null,
|
|
458
|
+
null,
|
|
459
|
+
"u256"
|
|
460
|
+
];
|
|
461
|
+
const parameterNames = [
|
|
462
|
+
"market",
|
|
463
|
+
"pricer",
|
|
464
|
+
"orderId"
|
|
465
|
+
];
|
|
466
|
+
return (tx) => tx.moveCall({
|
|
467
|
+
package: packageAddress,
|
|
468
|
+
module: "expiry_market",
|
|
469
|
+
function: "live_order_value",
|
|
470
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Return one settled order's terminal payout. This function does not prove account
|
|
475
|
+
* ownership of `order_id`. Public for SDK, PTB, and devInspect position valuation.
|
|
476
|
+
*/
|
|
477
|
+
function settledOrderPayout(options) {
|
|
478
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
479
|
+
const argumentsTypes = [null, "u256"];
|
|
480
|
+
const parameterNames = ["market", "orderId"];
|
|
481
|
+
return (tx) => tx.moveCall({
|
|
482
|
+
package: packageAddress,
|
|
483
|
+
module: "expiry_market",
|
|
484
|
+
function: "settled_order_payout",
|
|
485
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
486
|
+
});
|
|
487
|
+
}
|
|
161
488
|
/** Return the market mint-pause state for SDK and devInspect reads. */
|
|
162
489
|
function mintPaused(options) {
|
|
163
490
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -171,6 +498,202 @@ function mintPaused(options) {
|
|
|
171
498
|
});
|
|
172
499
|
}
|
|
173
500
|
/**
|
|
501
|
+
* Quote the all-in cost of a mint request for an anonymous taker (no builder code)
|
|
502
|
+
* without mutating any market state. Exact-quantity mode uses `min_quantity`;
|
|
503
|
+
* budget mode conservatively sizes a lot-rounded fill under `max_premium`. The
|
|
504
|
+
* quote applies live-mint and admission gates but does not preflight account
|
|
505
|
+
* balance, slippage caps, or exposure-index capacity. Its penalty uses the current
|
|
506
|
+
* pre-update EWMA state. Public for SDK and devInspect pre-trade pricing.
|
|
507
|
+
*/
|
|
508
|
+
function quoteMint(options) {
|
|
509
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
510
|
+
const argumentsTypes = [
|
|
511
|
+
null,
|
|
512
|
+
null,
|
|
513
|
+
null,
|
|
514
|
+
"u64",
|
|
515
|
+
"u64",
|
|
516
|
+
"u64",
|
|
517
|
+
"u64",
|
|
518
|
+
"bool",
|
|
519
|
+
"0x2::clock::Clock"
|
|
520
|
+
];
|
|
521
|
+
const parameterNames = [
|
|
522
|
+
"market",
|
|
523
|
+
"config",
|
|
524
|
+
"pricer",
|
|
525
|
+
"lowerTick",
|
|
526
|
+
"higherTick",
|
|
527
|
+
"maxPremium",
|
|
528
|
+
"minQuantity",
|
|
529
|
+
"exactQuantity"
|
|
530
|
+
];
|
|
531
|
+
return (tx) => tx.moveCall({
|
|
532
|
+
package: packageAddress,
|
|
533
|
+
module: "expiry_market",
|
|
534
|
+
function: "quote_mint",
|
|
535
|
+
arguments: normalizeMoveArguments({
|
|
536
|
+
...options.arguments,
|
|
537
|
+
config: options.arguments?.config ?? options.config?.protocolConfig
|
|
538
|
+
}, argumentsTypes, parameterNames)
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Quote the all-in cost of a mint request for one account, reading its builder
|
|
543
|
+
* code. Budget mode caps premium by total account balance, including unsettled
|
|
544
|
+
* accumulator funds. Public for SDK and devInspect pre-trade pricing.
|
|
545
|
+
*/
|
|
546
|
+
function quoteMintForAccount(options) {
|
|
547
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
548
|
+
const argumentsTypes = [
|
|
549
|
+
null,
|
|
550
|
+
null,
|
|
551
|
+
null,
|
|
552
|
+
null,
|
|
553
|
+
"u64",
|
|
554
|
+
"u64",
|
|
555
|
+
"u64",
|
|
556
|
+
"u64",
|
|
557
|
+
"bool",
|
|
558
|
+
"0x2::accumulator::AccumulatorRoot",
|
|
559
|
+
"0x2::clock::Clock"
|
|
560
|
+
];
|
|
561
|
+
const parameterNames = [
|
|
562
|
+
"market",
|
|
563
|
+
"wrapper",
|
|
564
|
+
"config",
|
|
565
|
+
"pricer",
|
|
566
|
+
"lowerTick",
|
|
567
|
+
"higherTick",
|
|
568
|
+
"maxPremium",
|
|
569
|
+
"minQuantity",
|
|
570
|
+
"exactQuantity"
|
|
571
|
+
];
|
|
572
|
+
return (tx) => tx.moveCall({
|
|
573
|
+
package: packageAddress,
|
|
574
|
+
module: "expiry_market",
|
|
575
|
+
function: "quote_mint_for_account",
|
|
576
|
+
arguments: normalizeMoveArguments({
|
|
577
|
+
...options.arguments,
|
|
578
|
+
config: options.arguments?.config ?? options.config?.protocolConfig
|
|
579
|
+
}, argumentsTypes, parameterNames)
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
/** Return the sized quantity for SDK and devInspect quote consumers. */
|
|
583
|
+
function quantity(options) {
|
|
584
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
585
|
+
const argumentsTypes = [null];
|
|
586
|
+
const parameterNames = ["quote"];
|
|
587
|
+
return (tx) => tx.moveCall({
|
|
588
|
+
package: packageAddress,
|
|
589
|
+
module: "expiry_market",
|
|
590
|
+
function: "quantity",
|
|
591
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
/** Return the quoted range probability for SDK and devInspect consumers. */
|
|
595
|
+
function entryProbability(options) {
|
|
596
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
597
|
+
const argumentsTypes = [null];
|
|
598
|
+
const parameterNames = ["quote"];
|
|
599
|
+
return (tx) => tx.moveCall({
|
|
600
|
+
package: packageAddress,
|
|
601
|
+
module: "expiry_market",
|
|
602
|
+
function: "entry_probability",
|
|
603
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
/** Return the quoted premium for SDK and devInspect consumers. */
|
|
607
|
+
function premium(options) {
|
|
608
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
609
|
+
const argumentsTypes = [null];
|
|
610
|
+
const parameterNames = ["quote"];
|
|
611
|
+
return (tx) => tx.moveCall({
|
|
612
|
+
package: packageAddress,
|
|
613
|
+
module: "expiry_market",
|
|
614
|
+
function: "premium",
|
|
615
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
/** Return the quoted trading fee before subsidy for SDK and devInspect consumers. */
|
|
619
|
+
function tradingFee(options) {
|
|
620
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
621
|
+
const argumentsTypes = [null];
|
|
622
|
+
const parameterNames = ["quote"];
|
|
623
|
+
return (tx) => tx.moveCall({
|
|
624
|
+
package: packageAddress,
|
|
625
|
+
module: "expiry_market",
|
|
626
|
+
function: "trading_fee",
|
|
627
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Return the sponsor-funded portion of the quoted fee for SDK and devInspect
|
|
632
|
+
* consumers.
|
|
633
|
+
*/
|
|
634
|
+
function feeIncentiveSubsidy(options) {
|
|
635
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
636
|
+
const argumentsTypes = [null];
|
|
637
|
+
const parameterNames = ["quote"];
|
|
638
|
+
return (tx) => tx.moveCall({
|
|
639
|
+
package: packageAddress,
|
|
640
|
+
module: "expiry_market",
|
|
641
|
+
function: "fee_incentive_subsidy",
|
|
642
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
/** Return the quoted builder fee for SDK and devInspect consumers. */
|
|
646
|
+
function builderFee(options) {
|
|
647
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
648
|
+
const argumentsTypes = [null];
|
|
649
|
+
const parameterNames = ["quote"];
|
|
650
|
+
return (tx) => tx.moveCall({
|
|
651
|
+
package: packageAddress,
|
|
652
|
+
module: "expiry_market",
|
|
653
|
+
function: "builder_fee",
|
|
654
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
/** Return the quoted EWMA congestion surcharge for SDK and devInspect consumers. */
|
|
658
|
+
function penaltyFee(options) {
|
|
659
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
660
|
+
const argumentsTypes = [null];
|
|
661
|
+
const parameterNames = ["quote"];
|
|
662
|
+
return (tx) => tx.moveCall({
|
|
663
|
+
package: packageAddress,
|
|
664
|
+
module: "expiry_market",
|
|
665
|
+
function: "penalty_fee",
|
|
666
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Return the separate inventory-impact charge for SDK and devInspect quote
|
|
671
|
+
* consumers.
|
|
672
|
+
*/
|
|
673
|
+
function inventoryImpactCharge(options) {
|
|
674
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
675
|
+
const argumentsTypes = [null];
|
|
676
|
+
const parameterNames = ["quote"];
|
|
677
|
+
return (tx) => tx.moveCall({
|
|
678
|
+
package: packageAddress,
|
|
679
|
+
module: "expiry_market",
|
|
680
|
+
function: "inventory_impact_charge",
|
|
681
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
/** Return the total quoted account withdrawal for SDK and devInspect consumers. */
|
|
685
|
+
function allInCost(options) {
|
|
686
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
687
|
+
const argumentsTypes = [null];
|
|
688
|
+
const parameterNames = ["quote"];
|
|
689
|
+
return (tx) => tx.moveCall({
|
|
690
|
+
package: packageAddress,
|
|
691
|
+
module: "expiry_market",
|
|
692
|
+
function: "all_in_cost",
|
|
693
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
174
697
|
* Mint an exact live position quantity against this expiry market.
|
|
175
698
|
*
|
|
176
699
|
* Requires the running package version to be at or above the protocol version
|
|
@@ -180,7 +703,7 @@ function mintPaused(options) {
|
|
|
180
703
|
* withdraw through the loaded account. The position's strike range is the tick
|
|
181
704
|
* pair `(lower_tick, higher_tick]` (`lower_tick = 0` is `-inf`,
|
|
182
705
|
* `higher_tick = pos_inf_tick` is `+inf`); the SDK converts raw strikes to ticks.
|
|
183
|
-
* `max_cost` caps the all-in
|
|
706
|
+
* `max_cost` caps the all-in USDC withdrawal, while `max_probability` caps the
|
|
184
707
|
* quoted per-contract probability before fees. Callers can pass
|
|
185
708
|
* `std::u64::max_value!()` for either uncapped guard. Returns the minted order ID
|
|
186
709
|
* for future order-scoped flows.
|
|
@@ -229,12 +752,12 @@ function mintExactQuantity(options) {
|
|
|
229
752
|
* must meet `min_quantity`.
|
|
230
753
|
*
|
|
231
754
|
* Fees, builder fees, and EWMA congestion penalties are charged on top of
|
|
232
|
-
* `max_premium`, so `max_cost` — not `max_premium` — bounds the all-in
|
|
755
|
+
* `max_premium`, so `max_cost` — not `max_premium` — bounds the all-in USDC
|
|
233
756
|
* withdrawal (`premium + trader-paid fee + builder_fee + EWMA penalty`).
|
|
234
757
|
* `max_cost` is required: unlike `mint_exact_quantity`'s guards there is no value
|
|
235
758
|
* that disables it, because the budget shape exists to bound spend. The sizing
|
|
236
|
-
* budget is first capped to the account's available
|
|
237
|
-
* still require additional available
|
|
759
|
+
* budget is first capped to the account's available USDC after settlement; fees
|
|
760
|
+
* still require additional available USDC at payment time. Any unspent premium
|
|
238
761
|
* dust remains in the account because order quantity must be an integer number of
|
|
239
762
|
* `position_lot_size` lots.
|
|
240
763
|
*/
|
|
@@ -286,7 +809,7 @@ function mintExactAmount(options) {
|
|
|
286
809
|
* Two close-side slippage floors, the mirror of mint's `max_probability` /
|
|
287
810
|
* `max_cost` pair; pass `0` to disable either. `min_probability` floors the quoted
|
|
288
811
|
* per-contract range probability (same units as mint's `max_probability`).
|
|
289
|
-
* `min_proceeds` floors the all-in net
|
|
812
|
+
* `min_proceeds` floors the all-in net USDC credited to the account
|
|
290
813
|
* (`redeem_amount` minus trading fee, builder fee, and EWMA penalty), the mirror
|
|
291
814
|
* of mint's all-in `max_cost`.
|
|
292
815
|
*/
|
|
@@ -361,7 +884,139 @@ function redeemSettled(options) {
|
|
|
361
884
|
}, argumentsTypes, parameterNames)
|
|
362
885
|
});
|
|
363
886
|
}
|
|
887
|
+
/**
|
|
888
|
+
* Permissionlessly redeem a settled order without account-owner authority.
|
|
889
|
+
*
|
|
890
|
+
* This keeper path uses Predict app-auth from the account registry, so
|
|
891
|
+
* `deauthorize_app<PredictApp>` disables this automation. Owners can still use
|
|
892
|
+
* `redeem_settled` with owner auth to redeem their own settled positions.
|
|
893
|
+
*/
|
|
894
|
+
function redeemSettledPermissionless(options) {
|
|
895
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
896
|
+
const argumentsTypes = [
|
|
897
|
+
null,
|
|
898
|
+
null,
|
|
899
|
+
null,
|
|
900
|
+
null,
|
|
901
|
+
"u256",
|
|
902
|
+
"0x2::accumulator::AccumulatorRoot",
|
|
903
|
+
"0x2::clock::Clock"
|
|
904
|
+
];
|
|
905
|
+
const parameterNames = [
|
|
906
|
+
"market",
|
|
907
|
+
"accountRegistry",
|
|
908
|
+
"wrapper",
|
|
909
|
+
"config",
|
|
910
|
+
"orderId"
|
|
911
|
+
];
|
|
912
|
+
return (tx) => tx.moveCall({
|
|
913
|
+
package: packageAddress,
|
|
914
|
+
module: "expiry_market",
|
|
915
|
+
function: "redeem_settled_permissionless",
|
|
916
|
+
arguments: normalizeMoveArguments({
|
|
917
|
+
...options.arguments,
|
|
918
|
+
config: options.arguments?.config ?? options.config?.protocolConfig
|
|
919
|
+
}, argumentsTypes, parameterNames)
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* Set this expiry's reference fine-grid tick from the exact previous-window
|
|
924
|
+
* Propbook Pyth observation. The source observation must be inserted into the feed
|
|
925
|
+
* at `reference_tick_source_timestamp_ms` before this call, and the normalized
|
|
926
|
+
* spot is floored to the market's `tick_size`. Not gated on the valuation lock:
|
|
927
|
+
* the reference tick shapes mint admission only, and a mint it admits mid-flush is
|
|
928
|
+
* invisible to the captured snapshot like any other.
|
|
929
|
+
*/
|
|
930
|
+
function setReferenceTick(options) {
|
|
931
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
932
|
+
const argumentsTypes = [
|
|
933
|
+
null,
|
|
934
|
+
null,
|
|
935
|
+
null,
|
|
936
|
+
null,
|
|
937
|
+
"0x2::clock::Clock"
|
|
938
|
+
];
|
|
939
|
+
const parameterNames = [
|
|
940
|
+
"market",
|
|
941
|
+
"config",
|
|
942
|
+
"propbookRegistry",
|
|
943
|
+
"pyth"
|
|
944
|
+
];
|
|
945
|
+
return (tx) => tx.moveCall({
|
|
946
|
+
package: packageAddress,
|
|
947
|
+
module: "expiry_market",
|
|
948
|
+
function: "set_reference_tick",
|
|
949
|
+
arguments: normalizeMoveArguments({
|
|
950
|
+
...options.arguments,
|
|
951
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
952
|
+
propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry
|
|
953
|
+
}, argumentsTypes, parameterNames)
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Set whether new mints are paused on this expiry market. Admin-only and
|
|
958
|
+
* version-gated. A `PauseCap` holder can force-engage the pause one-way under a
|
|
959
|
+
* version freeze via `registry::pause_expiry_market_mint_pause_cap`.
|
|
960
|
+
*/
|
|
961
|
+
function setMintPaused(options) {
|
|
962
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
963
|
+
const argumentsTypes = [
|
|
964
|
+
null,
|
|
965
|
+
null,
|
|
966
|
+
null,
|
|
967
|
+
"bool"
|
|
968
|
+
];
|
|
969
|
+
const parameterNames = [
|
|
970
|
+
"market",
|
|
971
|
+
"config",
|
|
972
|
+
"AdminCap",
|
|
973
|
+
"paused"
|
|
974
|
+
];
|
|
975
|
+
return (tx) => tx.moveCall({
|
|
976
|
+
package: packageAddress,
|
|
977
|
+
module: "expiry_market",
|
|
978
|
+
function: "set_mint_paused",
|
|
979
|
+
arguments: normalizeMoveArguments({
|
|
980
|
+
...options.arguments,
|
|
981
|
+
config: options.arguments?.config ?? options.config?.protocolConfig
|
|
982
|
+
}, argumentsTypes, parameterNames)
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* Settle from Propbook's exact positive Pyth spot at expiry, or from the exact
|
|
987
|
+
* Block Scholes minute-boundary spot when Pyth remains unavailable after the
|
|
988
|
+
* compiled grace period. Permissionless and idempotent; missing or unusable
|
|
989
|
+
* observations leave the market unsettled.
|
|
990
|
+
*/
|
|
991
|
+
function trySettle(options) {
|
|
992
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
993
|
+
const argumentsTypes = [
|
|
994
|
+
null,
|
|
995
|
+
null,
|
|
996
|
+
null,
|
|
997
|
+
null,
|
|
998
|
+
null,
|
|
999
|
+
"0x2::clock::Clock"
|
|
1000
|
+
];
|
|
1001
|
+
const parameterNames = [
|
|
1002
|
+
"market",
|
|
1003
|
+
"config",
|
|
1004
|
+
"propbookRegistry",
|
|
1005
|
+
"pyth",
|
|
1006
|
+
"bsValues"
|
|
1007
|
+
];
|
|
1008
|
+
return (tx) => tx.moveCall({
|
|
1009
|
+
package: packageAddress,
|
|
1010
|
+
module: "expiry_market",
|
|
1011
|
+
function: "try_settle",
|
|
1012
|
+
arguments: normalizeMoveArguments({
|
|
1013
|
+
...options.arguments,
|
|
1014
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
1015
|
+
propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry
|
|
1016
|
+
}, argumentsTypes, parameterNames)
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
364
1019
|
|
|
365
1020
|
//#endregion
|
|
366
|
-
export { admissionTickSize, currentNav, expiry, loadLivePricer, mintExactAmount, mintExactQuantity, mintPaused, redeemLive, redeemSettled, referenceTick, tickSize };
|
|
1021
|
+
export { admissionTickSize, currentNav, expiry, expiry_market_exports, loadLivePricer, mintExactAmount, mintExactQuantity, mintPaused, redeemLive, redeemSettled, referenceTick, tickSize };
|
|
367
1022
|
//# sourceMappingURL=expiry_market.mjs.map
|