@mysten/deepbook-v3 2.6.4 → 2.8.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 +153 -0
- package/PREDICT.md +389 -61
- package/dist/contracts/account/account.d.mts +23 -23
- package/dist/contracts/account/account.d.mts.map +1 -1
- package/dist/contracts/account/account_registry.d.mts +13 -13
- package/dist/contracts/deepbook/account.d.mts +18 -18
- package/dist/contracts/deepbook/balances.d.mts +4 -4
- package/dist/contracts/deepbook/deep_price.d.mts +3 -3
- package/dist/contracts/deepbook/order.d.mts +12 -12
- package/dist/contracts/deepbook_predict/admin.d.mts +4 -4
- package/dist/contracts/deepbook_predict/builder_code.d.mts +11 -11
- package/dist/contracts/deepbook_predict/builder_code_events.d.mts +10 -10
- package/dist/contracts/deepbook_predict/config_events.d.mts +93 -68
- package/dist/contracts/deepbook_predict/config_events.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/config_events.mjs +45 -1
- package/dist/contracts/deepbook_predict/config_events.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/deps/std/type_name.mjs +17 -0
- package/dist/contracts/deepbook_predict/deps/std/type_name.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/expiry_market.d.mts +652 -235
- package/dist/contracts/deepbook_predict/expiry_market.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/expiry_market.mjs +652 -186
- package/dist/contracts/deepbook_predict/expiry_market.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/lp_book.mjs +1 -1
- package/dist/contracts/deepbook_predict/market_lifecycle_cap.d.mts +5 -5
- package/dist/contracts/deepbook_predict/market_manager.d.mts +27 -27
- package/dist/contracts/deepbook_predict/order_events.d.mts +50 -50
- package/dist/contracts/deepbook_predict/order_events.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/order_events.mjs +3 -1
- package/dist/contracts/deepbook_predict/order_events.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pause_cap.d.mts +5 -5
- package/dist/contracts/deepbook_predict/plp.d.mts +184 -82
- package/dist/contracts/deepbook_predict/plp.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/plp.mjs +126 -7
- package/dist/contracts/deepbook_predict/plp.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pool_accounting.mjs +1 -1
- package/dist/contracts/deepbook_predict/pool_valuation_cap.d.mts +5 -5
- package/dist/contracts/deepbook_predict/predict_account.d.mts +14 -14
- package/dist/contracts/deepbook_predict/pricing.d.mts +91 -58
- package/dist/contracts/deepbook_predict/pricing.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/pricing.mjs +30 -3
- package/dist/contracts/deepbook_predict/pricing.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pricing_config.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/protocol_config.d.mts +400 -92
- package/dist/contracts/deepbook_predict/protocol_config.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/protocol_config.mjs +451 -61
- package/dist/contracts/deepbook_predict/protocol_config.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/range_codec.d.mts +2 -2
- package/dist/contracts/deepbook_predict/registry.d.mts +28 -28
- package/dist/contracts/deepbook_predict/strike_exposure.mjs +1 -1
- package/dist/contracts/deepbook_predict/strike_payout_tree.mjs +17 -12
- package/dist/contracts/deepbook_predict/strike_payout_tree.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/vault_events.d.mts +154 -106
- package/dist/contracts/deepbook_predict/vault_events.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/vault_events.mjs +57 -1
- package/dist/contracts/deepbook_predict/vault_events.mjs.map +1 -1
- package/dist/contracts/deepbook_predict_math/config-arguments.d.mts +10 -0
- package/dist/contracts/deepbook_predict_math/config-arguments.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_math/lazer_price.d.mts +106 -0
- package/dist/contracts/deepbook_predict_math/lazer_price.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_math/lazer_price.mjs +125 -0
- package/dist/contracts/deepbook_predict_math/lazer_price.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_math/math.d.mts +284 -0
- package/dist/contracts/deepbook_predict_math/math.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_math/math.mjs +364 -0
- package/dist/contracts/deepbook_predict_math/math.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/config-arguments.d.mts +13 -0
- package/dist/contracts/deepbook_predict_orders/config-arguments.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_orders/delayed_execution_config.d.mts +215 -0
- package/dist/contracts/deepbook_predict_orders/delayed_execution_config.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_orders/delayed_execution_config.mjs +215 -0
- package/dist/contracts/deepbook_predict_orders/delayed_execution_config.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.mjs +87 -0
- package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/pricing.mjs +52 -0
- package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/pricing.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/deps/fixed_math/i64.mjs +25 -0
- package/dist/contracts/deepbook_predict_orders/deps/fixed_math/i64.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/deps/sui/balance.mjs +21 -0
- package/dist/contracts/deepbook_predict_orders/deps/sui/balance.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/deps/sui/table.mjs +39 -0
- package/dist/contracts/deepbook_predict_orders/deps/sui/table.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/desk.d.mts +187 -0
- package/dist/contracts/deepbook_predict_orders/desk.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_orders/desk.mjs +261 -0
- package/dist/contracts/deepbook_predict_orders/desk.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/order_queue.d.mts +1042 -0
- package/dist/contracts/deepbook_predict_orders/order_queue.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_orders/order_queue.mjs +849 -0
- package/dist/contracts/deepbook_predict_orders/order_queue.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/queue.d.mts +683 -0
- package/dist/contracts/deepbook_predict_orders/queue.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_orders/queue.mjs +912 -0
- package/dist/contracts/deepbook_predict_orders/queue.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/queue_events.d.mts +195 -0
- package/dist/contracts/deepbook_predict_orders/queue_events.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_orders/queue_events.mjs +187 -0
- package/dist/contracts/deepbook_predict_orders/queue_events.mjs.map +1 -0
- package/dist/contracts/deepbook_sessions/session_config.d.mts +8 -8
- package/dist/contracts/deepbook_sessions/sessions.d.mts +163 -28
- package/dist/contracts/deepbook_sessions/sessions.d.mts.map +1 -1
- package/dist/contracts/deepbook_sessions/sessions.mjs +234 -5
- package/dist/contracts/deepbook_sessions/sessions.mjs.map +1 -1
- package/dist/deployments/mainnet.mjs +7 -4
- package/dist/deployments/mainnet.mjs.map +1 -1
- package/dist/deployments/testnet.mjs +7 -4
- package/dist/deployments/testnet.mjs.map +1 -1
- package/dist/predict/bindings/expiry-market.d.mts +77 -0
- package/dist/predict/bindings/expiry-market.d.mts.map +1 -0
- package/dist/predict/bindings/expiry-market.mjs +139 -0
- package/dist/predict/bindings/expiry-market.mjs.map +1 -0
- package/dist/predict/bindings/protocol-config.d.mts +39 -0
- package/dist/predict/bindings/protocol-config.d.mts.map +1 -0
- package/dist/predict/bindings/protocol-config.mjs +90 -0
- package/dist/predict/bindings/protocol-config.mjs.map +1 -0
- package/dist/predict/bindings/rename.mjs +9 -0
- package/dist/predict/bindings/rename.mjs.map +1 -0
- package/dist/predict/client.d.mts +595 -16
- package/dist/predict/client.d.mts.map +1 -1
- package/dist/predict/client.mjs +986 -10
- package/dist/predict/client.mjs.map +1 -1
- package/dist/predict/config/generated.d.mts +22 -1
- package/dist/predict/config/generated.d.mts.map +1 -1
- package/dist/predict/config/generated.mjs +30 -1
- package/dist/predict/config/generated.mjs.map +1 -1
- package/dist/predict/config/mainnet.mjs +11 -3
- package/dist/predict/config/mainnet.mjs.map +1 -1
- package/dist/predict/config/testnet.mjs +11 -3
- package/dist/predict/config/testnet.mjs.map +1 -1
- package/dist/predict/config/types.d.mts +50 -1
- package/dist/predict/config/types.d.mts.map +1 -1
- package/dist/predict/cost.d.mts +38 -11
- package/dist/predict/cost.d.mts.map +1 -1
- package/dist/predict/cost.mjs +37 -11
- package/dist/predict/cost.mjs.map +1 -1
- package/dist/predict/decode.d.mts +251 -1
- package/dist/predict/decode.d.mts.map +1 -1
- package/dist/predict/decode.mjs +342 -4
- package/dist/predict/decode.mjs.map +1 -1
- package/dist/predict/errors.d.mts +69 -6
- package/dist/predict/errors.d.mts.map +1 -1
- package/dist/predict/errors.mjs +277 -4
- package/dist/predict/errors.mjs.map +1 -1
- package/dist/predict/index.d.mts +21 -10
- package/dist/predict/index.mjs +24 -12
- package/dist/predict/queue-id.d.mts +13 -0
- package/dist/predict/queue-id.d.mts.map +1 -0
- package/dist/predict/queue-id.mjs +19 -0
- package/dist/predict/queue-id.mjs.map +1 -0
- package/dist/predict/queue.d.mts +505 -0
- package/dist/predict/queue.d.mts.map +1 -0
- package/dist/predict/queue.mjs +774 -0
- package/dist/predict/queue.mjs.map +1 -0
- package/dist/predict/reads/balances.mjs +1 -1
- package/dist/predict/reads/markets.mjs +46 -5
- package/dist/predict/reads/markets.mjs.map +1 -1
- package/dist/predict/reads/pool.mjs +1 -1
- package/dist/predict/reads/pricing.d.mts +1 -1
- package/dist/predict/reads/queue.d.mts +105 -0
- package/dist/predict/reads/queue.d.mts.map +1 -0
- package/dist/predict/reads/queue.mjs +445 -0
- package/dist/predict/reads/queue.mjs.map +1 -0
- package/dist/predict/ticks.d.mts +9 -1
- package/dist/predict/ticks.d.mts.map +1 -1
- package/dist/predict/ticks.mjs +18 -1
- package/dist/predict/ticks.mjs.map +1 -1
- package/dist/predict/tx/authed.mjs +1 -1
- package/dist/predict/tx/common.d.mts.map +1 -1
- package/dist/predict/tx/common.mjs +12 -1
- package/dist/predict/tx/common.mjs.map +1 -1
- package/dist/predict/tx/queue.d.mts +220 -0
- package/dist/predict/tx/queue.d.mts.map +1 -0
- package/dist/predict/tx/queue.mjs +399 -0
- package/dist/predict/tx/queue.mjs.map +1 -0
- package/dist/predict/tx/trade.d.mts.map +1 -1
- package/dist/predict/tx/trade.mjs +61 -43
- package/dist/predict/tx/trade.mjs.map +1 -1
- package/dist/sessions.d.mts +90 -2
- package/dist/sessions.d.mts.map +1 -1
- package/dist/sessions.mjs +107 -2
- 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/marginAdmin.d.mts.map +1 -1
- package/dist/transactions/marginLiquidations.d.mts +3 -3
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginMaintainer.d.mts.map +1 -1
- package/dist/transactions/marginManager.d.mts +32 -32
- package/dist/transactions/marginManager.d.mts.map +1 -1
- 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/marginTPSL.d.mts.map +1 -1
- package/dist/transactions/poolProxy.d.mts +8 -8
- package/dist/transactions/poolProxy.d.mts.map +1 -1
- package/package.json +4 -4
- package/src/contracts/deepbook_predict/config_events.ts +39 -0
- package/src/contracts/deepbook_predict/deps/std/type_name.ts +24 -0
- package/src/contracts/deepbook_predict/expiry_market.ts +960 -169
- package/src/contracts/deepbook_predict/order_events.ts +3 -1
- package/src/contracts/deepbook_predict/plp.ts +150 -9
- package/src/contracts/deepbook_predict/pricing.ts +46 -7
- package/src/contracts/deepbook_predict/pricing_config.ts +3 -1
- package/src/contracts/deepbook_predict/protocol_config.ts +648 -33
- package/src/contracts/deepbook_predict/strike_payout_tree.ts +25 -21
- package/src/contracts/deepbook_predict/vault_events.ts +65 -0
- package/src/contracts/deepbook_predict_math/config-arguments.ts +6 -0
- package/src/contracts/deepbook_predict_math/lazer_price.ts +196 -0
- package/src/contracts/deepbook_predict_math/math.ts +553 -0
- package/src/contracts/deepbook_predict_orders/config-arguments.ts +11 -0
- package/src/contracts/deepbook_predict_orders/delayed_execution_config.ts +430 -0
- package/src/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.ts +108 -0
- package/src/contracts/deepbook_predict_orders/deps/deepbook_predict/pricing.ts +58 -0
- package/src/contracts/deepbook_predict_orders/deps/fixed_math/i64.ts +21 -0
- package/src/contracts/deepbook_predict_orders/deps/sui/balance.ts +19 -0
- package/src/contracts/deepbook_predict_orders/deps/sui/table.ts +37 -0
- package/src/contracts/deepbook_predict_orders/desk.ts +419 -0
- package/src/contracts/deepbook_predict_orders/order_flow.ts +19 -0
- package/src/contracts/deepbook_predict_orders/order_queue.ts +1670 -0
- package/src/contracts/deepbook_predict_orders/queue.ts +1394 -0
- package/src/contracts/deepbook_predict_orders/queue_events.ts +189 -0
- package/src/contracts/deepbook_sessions/sessions.ts +355 -4
- package/src/deployments/mainnet.ts +7 -2
- package/src/deployments/testnet.ts +7 -2
- package/src/deployments/types.ts +14 -1
- package/src/predict/bindings/expiry-market.ts +127 -0
- package/src/predict/bindings/protocol-config.ts +59 -0
- package/src/predict/bindings/rename.ts +14 -0
- package/src/predict/client.ts +2076 -13
- package/src/predict/config/generated.ts +50 -0
- package/src/predict/config/mainnet.ts +16 -2
- package/src/predict/config/testnet.ts +16 -2
- package/src/predict/config/types.ts +51 -1
- package/src/predict/cost.ts +62 -14
- package/src/predict/decode.ts +691 -2
- package/src/predict/errors.ts +391 -14
- package/src/predict/index.ts +87 -6
- package/src/predict/queue-id.ts +22 -0
- package/src/predict/queue.ts +1231 -0
- package/src/predict/reads/markets.ts +30 -0
- package/src/predict/reads/queue.ts +606 -0
- package/src/predict/ticks.ts +35 -0
- package/src/predict/tx/common.ts +25 -1
- package/src/predict/tx/queue.ts +525 -0
- package/src/predict/tx/trade.ts +80 -49
- package/src/sessions.ts +206 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { MoveStruct, MoveTuple, normalizeMoveArguments } from "../utils/index.mjs";
|
|
2
|
+
import { U256, U64 } from "../../bcs/integers.mjs";
|
|
3
|
+
import { VecMap } from "./deps/sui/vec_map.mjs";
|
|
4
|
+
import { VolSnapshot } from "./pricing.mjs";
|
|
4
5
|
import { Balance } from "./deps/sui/balance.mjs";
|
|
5
6
|
import { ExpiryCash } from "./expiry_cash.mjs";
|
|
6
7
|
import { StrikeExposure } from "./strike_exposure.mjs";
|
|
@@ -20,59 +21,25 @@ import { bcs } from "@mysten/sui/bcs";
|
|
|
20
21
|
* `pricing::load_live_pricer`; this module owns market flow policy and then passes
|
|
21
22
|
* loaded `Pricer` snapshots into exposure business logic. Pool-wide PLP accounting
|
|
22
23
|
* and profit accounting remain outside this module.
|
|
24
|
+
*
|
|
25
|
+
* It also owns the order-flow primitives an order-flow companion package drives.
|
|
26
|
+
* `admit_mint` and `admit_sell` admit one queued order, pin a mint's boundary
|
|
27
|
+
* nodes, record the order's cash need in the market's `OrderFlowLedger`, and issue
|
|
28
|
+
* or advance its `OrderReceipt`. `commit` stores the bounded Pyth price the order
|
|
29
|
+
* fills at, `try_fill` fills or refunds it, `release` takes it out without
|
|
30
|
+
* filling, and `try_pay_settled` pays a queue-held position after settlement. A
|
|
31
|
+
* queued fill never enters the account: its position stays in the receipt.
|
|
32
|
+
* Admission, commit, and fill need an allowlisted companion witness; release and
|
|
33
|
+
* the settled payout need only the receipt. The queue itself, its escrow, its
|
|
34
|
+
* policy, and its events live in the companion.
|
|
35
|
+
*
|
|
36
|
+
* Mainnet USDC is a regulated coin: Sui aborts a transaction that sends it to an
|
|
37
|
+
* address on its deny list, or to anyone while it is globally paused. So the fill,
|
|
38
|
+
* the fee routing, and the settled payout read `sui::deny_list` first and never
|
|
39
|
+
* send to such an address. A fill for a denied receive address is refused, a
|
|
40
|
+
* denied builder or referrer's fee stays in market cash, and a denied winner's
|
|
41
|
+
* payout is skipped for a later `try_pay_settled`.
|
|
23
42
|
*/
|
|
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
|
-
mintExactCost: () => mintExactCost,
|
|
51
|
-
mintExactQuantity: () => mintExactQuantity,
|
|
52
|
-
mintPaused: () => mintPaused,
|
|
53
|
-
payoutLiability: () => payoutLiability,
|
|
54
|
-
penaltyFee: () => penaltyFee,
|
|
55
|
-
premium: () => premium,
|
|
56
|
-
propbookUnderlyingId: () => propbookUnderlyingId,
|
|
57
|
-
quantity: () => quantity,
|
|
58
|
-
quoteMint: () => quoteMint,
|
|
59
|
-
quoteMintExactCostForAccount: () => quoteMintExactCostForAccount,
|
|
60
|
-
quoteMintForAccount: () => quoteMintForAccount,
|
|
61
|
-
redeemLive: () => redeemLive,
|
|
62
|
-
redeemSettled: () => redeemSettled,
|
|
63
|
-
redeemSettledPermissionless: () => redeemSettledPermissionless,
|
|
64
|
-
referenceTick: () => referenceTick,
|
|
65
|
-
referenceTickSourceTimestampMs: () => referenceTickSourceTimestampMs,
|
|
66
|
-
requiredCash: () => requiredCash,
|
|
67
|
-
setMintPaused: () => setMintPaused,
|
|
68
|
-
setReferenceTick: () => setReferenceTick,
|
|
69
|
-
settledOrderPayout: () => settledOrderPayout,
|
|
70
|
-
settlementPrice: () => settlementPrice,
|
|
71
|
-
tickSize: () => tickSize,
|
|
72
|
-
tradingFee: () => tradingFee,
|
|
73
|
-
trySettle: () => trySettle,
|
|
74
|
-
trySettlementPrice: () => trySettlementPrice
|
|
75
|
-
});
|
|
76
43
|
const $moduleName = "@local-pkg/deepbook_predict::expiry_market";
|
|
77
44
|
const ValuationStamp = new MoveStruct({
|
|
78
45
|
name: `${$moduleName}::ValuationStamp`,
|
|
@@ -110,6 +77,73 @@ const MintQuote = new MoveStruct({
|
|
|
110
77
|
all_in_cost: U64
|
|
111
78
|
}
|
|
112
79
|
});
|
|
80
|
+
const RedeemQuote = new MoveStruct({
|
|
81
|
+
name: `${$moduleName}::RedeemQuote`,
|
|
82
|
+
fields: {
|
|
83
|
+
close_quantity: U64,
|
|
84
|
+
probability: U64,
|
|
85
|
+
proceeds: U64,
|
|
86
|
+
trading_fee: U64,
|
|
87
|
+
builder_fee: U64,
|
|
88
|
+
inventory_impact_rebate: U64
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
const OrderParties = new MoveStruct({
|
|
92
|
+
name: `${$moduleName}::OrderParties`,
|
|
93
|
+
fields: {
|
|
94
|
+
account_id: bcs.Address,
|
|
95
|
+
owner: bcs.Address,
|
|
96
|
+
receive_address: bcs.Address,
|
|
97
|
+
referrer_account_id: bcs.option(bcs.Address),
|
|
98
|
+
referrer_receive_address: bcs.option(bcs.Address),
|
|
99
|
+
builder_code_id: bcs.option(bcs.Address)
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
const OrderReceipt = new MoveStruct({
|
|
103
|
+
name: `${$moduleName}::OrderReceipt`,
|
|
104
|
+
fields: {
|
|
105
|
+
expiry_market_id: bcs.Address,
|
|
106
|
+
stage: bcs.u8(),
|
|
107
|
+
kind: bcs.u8(),
|
|
108
|
+
parties: OrderParties,
|
|
109
|
+
lower_tick: U64,
|
|
110
|
+
higher_tick: U64,
|
|
111
|
+
quantity: U64,
|
|
112
|
+
max_premium: U64,
|
|
113
|
+
min_quantity: U64,
|
|
114
|
+
max_probability: U64,
|
|
115
|
+
min_probability: U64,
|
|
116
|
+
min_proceeds: U64,
|
|
117
|
+
tau_ms: U64,
|
|
118
|
+
deadline_ms: U64,
|
|
119
|
+
channel: bcs.u8(),
|
|
120
|
+
vol: VolSnapshot,
|
|
121
|
+
budget: U64,
|
|
122
|
+
order_fee: U64,
|
|
123
|
+
cash_need: U64,
|
|
124
|
+
subsidy_bound: U64,
|
|
125
|
+
subsidy_rate: U64,
|
|
126
|
+
subsidy_reserved: U64,
|
|
127
|
+
spot: U64,
|
|
128
|
+
tick_ms: U64,
|
|
129
|
+
generation_us: U64,
|
|
130
|
+
order_id: U256,
|
|
131
|
+
root_id: U256,
|
|
132
|
+
opened_at_ms: U64,
|
|
133
|
+
held_quantity: U64
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
const OrderFlowLedgerKey = new MoveTuple({
|
|
137
|
+
name: `${$moduleName}::OrderFlowLedgerKey`,
|
|
138
|
+
fields: [bcs.bool()]
|
|
139
|
+
});
|
|
140
|
+
const OrderFlowLedger = new MoveStruct({
|
|
141
|
+
name: `${$moduleName}::OrderFlowLedger`,
|
|
142
|
+
fields: {
|
|
143
|
+
pins: VecMap(U64, U64),
|
|
144
|
+
waiting_cash_need: U64
|
|
145
|
+
}
|
|
146
|
+
});
|
|
113
147
|
/** Return the market object ID for external discovery and PTB construction. */
|
|
114
148
|
function id(options) {
|
|
115
149
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -500,12 +534,14 @@ function mintPaused(options) {
|
|
|
500
534
|
});
|
|
501
535
|
}
|
|
502
536
|
/**
|
|
503
|
-
* Quote
|
|
504
|
-
*
|
|
505
|
-
*
|
|
506
|
-
*
|
|
507
|
-
*
|
|
508
|
-
*
|
|
537
|
+
* Quote a prospective mint at a market-bound `Pricer`, priced like a queued fill
|
|
538
|
+
* at the clock, for SDK and devInspect previews. `exact_quantity` quotes
|
|
539
|
+
* `min_quantity` exactly; otherwise the largest quantity whose premium fits
|
|
540
|
+
* `max_premium`, at least `min_quantity`. No builder fee. The fee subsidy is the
|
|
541
|
+
* configured rate capped by the market's incentive balance, and `penalty_fee` is
|
|
542
|
+
* always 0. Gated only on the pricer binding (`EWrongPricer`) and `now < expiry`
|
|
543
|
+
* (`EInvalidOrderTiming`). Aborts `EOrderFailsLimits` when the mint would be
|
|
544
|
+
* refused at the clock.
|
|
509
545
|
*/
|
|
510
546
|
function quoteMint(options) {
|
|
511
547
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -541,9 +577,8 @@ function quoteMint(options) {
|
|
|
541
577
|
});
|
|
542
578
|
}
|
|
543
579
|
/**
|
|
544
|
-
*
|
|
545
|
-
*
|
|
546
|
-
* accumulator funds. Public for SDK and devInspect pre-trade pricing.
|
|
580
|
+
* `quote_mint` for the wrapper's account: `max_premium` is capped at the account's
|
|
581
|
+
* balance and the account's builder fee is charged.
|
|
547
582
|
*/
|
|
548
583
|
function quoteMintForAccount(options) {
|
|
549
584
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -582,13 +617,10 @@ function quoteMintForAccount(options) {
|
|
|
582
617
|
});
|
|
583
618
|
}
|
|
584
619
|
/**
|
|
585
|
-
* Quote
|
|
586
|
-
* `
|
|
587
|
-
*
|
|
588
|
-
*
|
|
589
|
-
* exposure-index capacity or cash backing. `quantity` is the figure to derive a
|
|
590
|
-
* `min_quantity` slippage floor from. Public for SDK and devInspect pre-trade
|
|
591
|
-
* pricing.
|
|
620
|
+
* Quote the largest mint whose all-in cost fits `min(max_cost, account balance)`,
|
|
621
|
+
* at least `min_quantity`, for the wrapper's account, priced like a queued
|
|
622
|
+
* exact-cost fill at the clock. Charges the account's builder fee, and otherwise
|
|
623
|
+
* prices and gates like `quote_mint`.
|
|
592
624
|
*/
|
|
593
625
|
function quoteMintExactCostForAccount(options) {
|
|
594
626
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -624,6 +656,42 @@ function quoteMintExactCostForAccount(options) {
|
|
|
624
656
|
}, argumentsTypes, parameterNames)
|
|
625
657
|
});
|
|
626
658
|
}
|
|
659
|
+
/**
|
|
660
|
+
* Return `(waiting_cash_need, payout_tree_node_count, min_entry_probability)`: the
|
|
661
|
+
* summed cash need of the market's admitted orders, above required cash, that
|
|
662
|
+
* `rebalance_expiry_cash` keeps a live market funded with; the payout tree's node
|
|
663
|
+
* count, pinned zero nodes included, which sizes the keeper's fill batches; and
|
|
664
|
+
* the snapshotted minimum entry probability the SDK computes a queued mint's cash
|
|
665
|
+
* need from. For SDK, keeper, and devInspect reads.
|
|
666
|
+
*/
|
|
667
|
+
function orderFlowState(options) {
|
|
668
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
669
|
+
const argumentsTypes = [null];
|
|
670
|
+
const parameterNames = ["market"];
|
|
671
|
+
return (tx) => tx.moveCall({
|
|
672
|
+
package: packageAddress,
|
|
673
|
+
module: "expiry_market",
|
|
674
|
+
function: "order_flow_state",
|
|
675
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Return a receipt's
|
|
680
|
+
* `(expiry_market_id, stage, account_id, order_id, pyth_source_id, cash_need, subsidy_bound, vol)`.
|
|
681
|
+
* For the order-flow companion's queue events and Lazer decoding, and devInspect
|
|
682
|
+
* reads of queue records.
|
|
683
|
+
*/
|
|
684
|
+
function receiptInfo(options) {
|
|
685
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
686
|
+
const argumentsTypes = [null];
|
|
687
|
+
const parameterNames = ["receipt"];
|
|
688
|
+
return (tx) => tx.moveCall({
|
|
689
|
+
package: packageAddress,
|
|
690
|
+
module: "expiry_market",
|
|
691
|
+
function: "receipt_info",
|
|
692
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
693
|
+
});
|
|
694
|
+
}
|
|
627
695
|
/** Return the sized quantity for SDK and devInspect quote consumers. */
|
|
628
696
|
function quantity(options) {
|
|
629
697
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -738,20 +806,109 @@ function allInCost(options) {
|
|
|
738
806
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
739
807
|
});
|
|
740
808
|
}
|
|
809
|
+
function redeemCloseQuantity(options) {
|
|
810
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
811
|
+
const argumentsTypes = [null];
|
|
812
|
+
const parameterNames = ["quote"];
|
|
813
|
+
return (tx) => tx.moveCall({
|
|
814
|
+
package: packageAddress,
|
|
815
|
+
module: "expiry_market",
|
|
816
|
+
function: "redeem_close_quantity",
|
|
817
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
function redeemProbability(options) {
|
|
821
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
822
|
+
const argumentsTypes = [null];
|
|
823
|
+
const parameterNames = ["quote"];
|
|
824
|
+
return (tx) => tx.moveCall({
|
|
825
|
+
package: packageAddress,
|
|
826
|
+
module: "expiry_market",
|
|
827
|
+
function: "redeem_probability",
|
|
828
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
function redeemProceeds(options) {
|
|
832
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
833
|
+
const argumentsTypes = [null];
|
|
834
|
+
const parameterNames = ["quote"];
|
|
835
|
+
return (tx) => tx.moveCall({
|
|
836
|
+
package: packageAddress,
|
|
837
|
+
module: "expiry_market",
|
|
838
|
+
function: "redeem_proceeds",
|
|
839
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
function redeemTradingFee(options) {
|
|
843
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
844
|
+
const argumentsTypes = [null];
|
|
845
|
+
const parameterNames = ["quote"];
|
|
846
|
+
return (tx) => tx.moveCall({
|
|
847
|
+
package: packageAddress,
|
|
848
|
+
module: "expiry_market",
|
|
849
|
+
function: "redeem_trading_fee",
|
|
850
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
function redeemBuilderFee(options) {
|
|
854
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
855
|
+
const argumentsTypes = [null];
|
|
856
|
+
const parameterNames = ["quote"];
|
|
857
|
+
return (tx) => tx.moveCall({
|
|
858
|
+
package: packageAddress,
|
|
859
|
+
module: "expiry_market",
|
|
860
|
+
function: "redeem_builder_fee",
|
|
861
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
function redeemInventoryImpactRebate(options) {
|
|
865
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
866
|
+
const argumentsTypes = [null];
|
|
867
|
+
const parameterNames = ["quote"];
|
|
868
|
+
return (tx) => tx.moveCall({
|
|
869
|
+
package: packageAddress,
|
|
870
|
+
module: "expiry_market",
|
|
871
|
+
function: "redeem_inventory_impact_rebate",
|
|
872
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
873
|
+
});
|
|
874
|
+
}
|
|
741
875
|
/**
|
|
742
|
-
*
|
|
743
|
-
*
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
748
|
-
*
|
|
749
|
-
*
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
876
|
+
* Quote an early sell of `close_quantity` of an open receipt's position at a
|
|
877
|
+
* market-bound `Pricer` and the clock, charging `builder_code_id`'s builder fee:
|
|
878
|
+
* the close a sell fill prices, without the trader's floors. `proceeds` is before
|
|
879
|
+
* the order fee. Changes nothing. Aborts on the pricer binding (`EWrongPricer`),
|
|
880
|
+
* another market's receipt (`EWrongMarket`), a receipt that is not open
|
|
881
|
+
* (`EWrongStage`), `now >= expiry` (`EInvalidOrderTiming`), or a close that cannot
|
|
882
|
+
* be priced (`EOrderFailsLimits`). Public for the order-flow companion's sell
|
|
883
|
+
* preview and SDK reads.
|
|
884
|
+
*/
|
|
885
|
+
function quoteClose(options) {
|
|
886
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
887
|
+
const argumentsTypes = [
|
|
888
|
+
null,
|
|
889
|
+
null,
|
|
890
|
+
null,
|
|
891
|
+
"u64",
|
|
892
|
+
"0x1::option::Option<0x2::object::ID>",
|
|
893
|
+
"0x2::clock::Clock"
|
|
894
|
+
];
|
|
895
|
+
const parameterNames = [
|
|
896
|
+
"market",
|
|
897
|
+
"pricer",
|
|
898
|
+
"receipt",
|
|
899
|
+
"closeQuantity",
|
|
900
|
+
"builderCodeId"
|
|
901
|
+
];
|
|
902
|
+
return (tx) => tx.moveCall({
|
|
903
|
+
package: packageAddress,
|
|
904
|
+
module: "expiry_market",
|
|
905
|
+
function: "quote_close",
|
|
906
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Retired by delayed execution: always aborts `EDelayedExecutionRequired`. Mints
|
|
911
|
+
* are queued through the order-flow companion.
|
|
755
912
|
*/
|
|
756
913
|
function mintExactQuantity(options) {
|
|
757
914
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -770,16 +927,16 @@ function mintExactQuantity(options) {
|
|
|
770
927
|
"0x2::clock::Clock"
|
|
771
928
|
];
|
|
772
929
|
const parameterNames = [
|
|
773
|
-
"
|
|
774
|
-
"
|
|
775
|
-
"
|
|
776
|
-
"
|
|
777
|
-
"
|
|
778
|
-
"
|
|
779
|
-
"
|
|
780
|
-
"
|
|
781
|
-
"
|
|
782
|
-
"
|
|
930
|
+
"Market",
|
|
931
|
+
"Wrapper",
|
|
932
|
+
"Auth",
|
|
933
|
+
"Config",
|
|
934
|
+
"Pricer",
|
|
935
|
+
"LowerTick",
|
|
936
|
+
"HigherTick",
|
|
937
|
+
"Quantity",
|
|
938
|
+
"MaxCost",
|
|
939
|
+
"MaxProbability"
|
|
783
940
|
];
|
|
784
941
|
return (tx) => tx.moveCall({
|
|
785
942
|
package: packageAddress,
|
|
@@ -787,24 +944,13 @@ function mintExactQuantity(options) {
|
|
|
787
944
|
function: "mint_exact_quantity",
|
|
788
945
|
arguments: normalizeMoveArguments({
|
|
789
946
|
...options.arguments,
|
|
790
|
-
|
|
947
|
+
Config: options.arguments?.Config ?? options.config?.protocolConfig
|
|
791
948
|
}, argumentsTypes, parameterNames)
|
|
792
949
|
});
|
|
793
950
|
}
|
|
794
951
|
/**
|
|
795
|
-
*
|
|
796
|
-
*
|
|
797
|
-
* must meet `min_quantity`.
|
|
798
|
-
*
|
|
799
|
-
* Fees, builder fees, and EWMA congestion penalties are charged on top of
|
|
800
|
-
* `max_premium`, so `max_cost` — not `max_premium` — bounds the all-in USDC
|
|
801
|
-
* withdrawal (`premium + trader-paid fee + builder_fee + EWMA penalty`).
|
|
802
|
-
* `max_cost` is required: unlike `mint_exact_quantity`'s guards there is no value
|
|
803
|
-
* that disables it, because the budget shape exists to bound spend. The sizing
|
|
804
|
-
* budget is first capped to the account's available USDC after settlement; fees
|
|
805
|
-
* still require additional available USDC at payment time. Any unspent premium
|
|
806
|
-
* dust remains in the account because order quantity must be an integer number of
|
|
807
|
-
* `position_lot_size` lots.
|
|
952
|
+
* Retired by delayed execution: always aborts `EDelayedExecutionRequired`. Mints
|
|
953
|
+
* are queued through the order-flow companion.
|
|
808
954
|
*/
|
|
809
955
|
function mintExactAmount(options) {
|
|
810
956
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -823,16 +969,16 @@ function mintExactAmount(options) {
|
|
|
823
969
|
"0x2::clock::Clock"
|
|
824
970
|
];
|
|
825
971
|
const parameterNames = [
|
|
826
|
-
"
|
|
827
|
-
"
|
|
828
|
-
"
|
|
829
|
-
"
|
|
830
|
-
"
|
|
831
|
-
"
|
|
832
|
-
"
|
|
833
|
-
"
|
|
834
|
-
"
|
|
835
|
-
"
|
|
972
|
+
"Market",
|
|
973
|
+
"Wrapper",
|
|
974
|
+
"Auth",
|
|
975
|
+
"Config",
|
|
976
|
+
"Pricer",
|
|
977
|
+
"LowerTick",
|
|
978
|
+
"HigherTick",
|
|
979
|
+
"MaxPremium",
|
|
980
|
+
"MinQuantity",
|
|
981
|
+
"MaxCost"
|
|
836
982
|
];
|
|
837
983
|
return (tx) => tx.moveCall({
|
|
838
984
|
package: packageAddress,
|
|
@@ -840,41 +986,13 @@ function mintExactAmount(options) {
|
|
|
840
986
|
function: "mint_exact_amount",
|
|
841
987
|
arguments: normalizeMoveArguments({
|
|
842
988
|
...options.arguments,
|
|
843
|
-
|
|
989
|
+
Config: options.arguments?.Config ?? options.config?.protocolConfig
|
|
844
990
|
}, argumentsTypes, parameterNames)
|
|
845
991
|
});
|
|
846
992
|
}
|
|
847
993
|
/**
|
|
848
|
-
*
|
|
849
|
-
*
|
|
850
|
-
* Unlike `mint_exact_amount`, fees are sized inside the budget: the quantity
|
|
851
|
-
* search evaluates the all-in withdrawal the mint charges
|
|
852
|
-
* (`premium + trader-paid fee + builder_fee + EWMA penalty + inventory_impact_charge`)
|
|
853
|
-
* against the fee-incentive, congestion, and book state at execution, so the debit
|
|
854
|
-
* never exceeds `max_cost`. `max_cost` is first capped to the account's available
|
|
855
|
-
* USDC after settlement, so `std::u64::max_value!()` sizes against the whole
|
|
856
|
-
* balance.
|
|
857
|
-
*
|
|
858
|
-
* The budget search finds the largest fitting quantity. If that quantity costs
|
|
859
|
-
* more than its maximum payout, a conservative search tries a smaller fill;
|
|
860
|
-
* rounding can make that fallback miss a larger admissible fill. Only when the
|
|
861
|
-
* budget is the limiting constraint is the remainder less than the incremental
|
|
862
|
-
* all-in cost of one more lot. Payout-limited fills and lot-cap saturation can
|
|
863
|
-
* leave more. Insufficient expiry cash backing aborts the mint; sizing does not
|
|
864
|
-
* shrink the fill to available backing, and the quote does not preflight it.
|
|
865
|
-
*
|
|
866
|
-
* `min_quantity` is this entrypoint's slippage guard. The budget is fixed, so
|
|
867
|
-
* every adverse move between building the transaction and executing it — the
|
|
868
|
-
* price, the congestion surcharge, the sponsor subsidy, the inventory-impact
|
|
869
|
-
* charge — shows up as fewer contracts, and a fill below `min_quantity` aborts
|
|
870
|
-
* `EMintQuantityBelowMin`. It bounds the all-in price per contract at
|
|
871
|
-
* `max_cost / min_quantity`, which is why the shape carries no separate
|
|
872
|
-
* probability cap; passing `0` accepts any fill the budget buys. A budget too
|
|
873
|
-
* small to admit `constants::min_premium` aborts `EPremiumBelowMinimum` rather
|
|
874
|
-
* than minting nothing, and zero is such a budget: unlike `mint_exact_amount`
|
|
875
|
-
* there is no `max_cost` cap to require, because here the budget IS the sizing
|
|
876
|
-
* input. Other requirements match `mint_exact_quantity`. Returns the minted order
|
|
877
|
-
* ID.
|
|
994
|
+
* Retired by delayed execution: always aborts `EDelayedExecutionRequired`. Mints
|
|
995
|
+
* are queued through the order-flow companion.
|
|
878
996
|
*/
|
|
879
997
|
function mintExactCost(options) {
|
|
880
998
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -892,15 +1010,15 @@ function mintExactCost(options) {
|
|
|
892
1010
|
"0x2::clock::Clock"
|
|
893
1011
|
];
|
|
894
1012
|
const parameterNames = [
|
|
895
|
-
"
|
|
896
|
-
"
|
|
897
|
-
"
|
|
898
|
-
"
|
|
899
|
-
"
|
|
900
|
-
"
|
|
901
|
-
"
|
|
902
|
-
"
|
|
903
|
-
"
|
|
1013
|
+
"Market",
|
|
1014
|
+
"Wrapper",
|
|
1015
|
+
"Auth",
|
|
1016
|
+
"Config",
|
|
1017
|
+
"Pricer",
|
|
1018
|
+
"LowerTick",
|
|
1019
|
+
"HigherTick",
|
|
1020
|
+
"MaxCost",
|
|
1021
|
+
"MinQuantity"
|
|
904
1022
|
];
|
|
905
1023
|
return (tx) => tx.moveCall({
|
|
906
1024
|
package: packageAddress,
|
|
@@ -908,23 +1026,14 @@ function mintExactCost(options) {
|
|
|
908
1026
|
function: "mint_exact_cost",
|
|
909
1027
|
arguments: normalizeMoveArguments({
|
|
910
1028
|
...options.arguments,
|
|
911
|
-
|
|
1029
|
+
Config: options.arguments?.Config ?? options.config?.protocolConfig
|
|
912
1030
|
}, argumentsTypes, parameterNames)
|
|
913
1031
|
});
|
|
914
1032
|
}
|
|
915
1033
|
/**
|
|
916
|
-
*
|
|
917
|
-
*
|
|
918
|
-
*
|
|
919
|
-
* `redeem_settled`. Returns a replacement order ID only when a partial close
|
|
920
|
-
* leaves quantity open.
|
|
921
|
-
*
|
|
922
|
-
* Two close-side slippage floors, the mirror of mint's `max_probability` /
|
|
923
|
-
* `max_cost` pair; pass `0` to disable either. `min_probability` floors the quoted
|
|
924
|
-
* per-contract range probability (same units as mint's `max_probability`).
|
|
925
|
-
* `min_proceeds` floors the all-in net USDC credited to the account
|
|
926
|
-
* (`redeem_amount` minus trading fee, builder fee, and EWMA penalty), the mirror
|
|
927
|
-
* of mint's all-in `max_cost`.
|
|
1034
|
+
* Retired by delayed execution: always aborts `EDelayedExecutionRequired`. Early
|
|
1035
|
+
* sells of queue-held positions go through the order-flow companion; account-held
|
|
1036
|
+
* positions exit through `redeem_settled` after settlement.
|
|
928
1037
|
*/
|
|
929
1038
|
function redeemLive(options) {
|
|
930
1039
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -942,15 +1051,15 @@ function redeemLive(options) {
|
|
|
942
1051
|
"0x2::clock::Clock"
|
|
943
1052
|
];
|
|
944
1053
|
const parameterNames = [
|
|
945
|
-
"
|
|
946
|
-
"
|
|
947
|
-
"
|
|
948
|
-
"
|
|
949
|
-
"
|
|
950
|
-
"
|
|
951
|
-
"
|
|
952
|
-
"
|
|
953
|
-
"
|
|
1054
|
+
"Market",
|
|
1055
|
+
"Wrapper",
|
|
1056
|
+
"Auth",
|
|
1057
|
+
"Config",
|
|
1058
|
+
"Pricer",
|
|
1059
|
+
"OrderId",
|
|
1060
|
+
"CloseQuantity",
|
|
1061
|
+
"MinProbability",
|
|
1062
|
+
"MinProceeds"
|
|
954
1063
|
];
|
|
955
1064
|
return (tx) => tx.moveCall({
|
|
956
1065
|
package: packageAddress,
|
|
@@ -958,7 +1067,7 @@ function redeemLive(options) {
|
|
|
958
1067
|
function: "redeem_live",
|
|
959
1068
|
arguments: normalizeMoveArguments({
|
|
960
1069
|
...options.arguments,
|
|
961
|
-
|
|
1070
|
+
Config: options.arguments?.Config ?? options.config?.protocolConfig
|
|
962
1071
|
}, argumentsTypes, parameterNames)
|
|
963
1072
|
});
|
|
964
1073
|
}
|
|
@@ -998,11 +1107,15 @@ function redeemSettled(options) {
|
|
|
998
1107
|
});
|
|
999
1108
|
}
|
|
1000
1109
|
/**
|
|
1001
|
-
*
|
|
1110
|
+
* Redeem a settled order without account-owner authority, as an allowlisted
|
|
1111
|
+
* keeper.
|
|
1002
1112
|
*
|
|
1003
|
-
*
|
|
1004
|
-
* `
|
|
1005
|
-
*
|
|
1113
|
+
* Despite the name, only a sender admin has added through
|
|
1114
|
+
* `protocol_config::add_settled_redeem_keeper` may call this; the allowlist starts
|
|
1115
|
+
* empty. The payout still goes to the order's account. This keeper path uses
|
|
1116
|
+
* Predict app-auth from the account registry, so `deauthorize_app<PredictApp>`
|
|
1117
|
+
* also disables it. Owners can still use `redeem_settled` with owner auth to
|
|
1118
|
+
* redeem their own settled positions.
|
|
1006
1119
|
*/
|
|
1007
1120
|
function redeemSettledPermissionless(options) {
|
|
1008
1121
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -1100,6 +1213,12 @@ function setMintPaused(options) {
|
|
|
1100
1213
|
* Block Scholes minute-boundary spot when Pyth remains unavailable after the
|
|
1101
1214
|
* compiled grace period. Permissionless and idempotent; missing or unusable
|
|
1102
1215
|
* observations leave the market unsettled.
|
|
1216
|
+
*
|
|
1217
|
+
* Settlement reads nothing from the order-flow queue. Every admission's deadline
|
|
1218
|
+
* is at least `constants::deadline_expiry_margin_ms!()` before expiry, so at
|
|
1219
|
+
* expiry a waiting order can only be released, and the settled liability already
|
|
1220
|
+
* covers every queue-held position, which lives in the payout tree. The companion
|
|
1221
|
+
* drains and pays its queue afterwards.
|
|
1103
1222
|
*/
|
|
1104
1223
|
function trySettle(options) {
|
|
1105
1224
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -1129,7 +1248,354 @@ function trySettle(options) {
|
|
|
1129
1248
|
}, argumentsTypes, parameterNames)
|
|
1130
1249
|
});
|
|
1131
1250
|
}
|
|
1251
|
+
/**
|
|
1252
|
+
* Admit one queued mint for the order-flow companion and return its receipt.
|
|
1253
|
+
*
|
|
1254
|
+
* `kind` is a `constants` mint kind. The companion has already taken
|
|
1255
|
+
* `budget + order_fee` from the account and escrows it. `budget` caps the fill's
|
|
1256
|
+
* all-in cost; the companion sets it to `min(max_cost, balance - order_fee)`, and
|
|
1257
|
+
* to at most `quantity` for an exact-quantity mint. The order prices at a Pyth
|
|
1258
|
+
* price on Lazer channel `channel`, generated at or after `tau_ms`, and must fill
|
|
1259
|
+
* before `deadline_ms`.
|
|
1260
|
+
*
|
|
1261
|
+
* Aborts unless `W` is allowlisted, the version and cutover gates pass, trading
|
|
1262
|
+
* and this market's mints are unpaused, and the snapshot stage is closed. The
|
|
1263
|
+
* timing must fit (`EInvalidOrderTiming`): `channel` a supported fixed-rate
|
|
1264
|
+
* channel (`lazer_price::channel_fixed_rate_*`), `tau_ms` on its grid, at most one
|
|
1265
|
+
* of its ticks before now, and before `deadline_ms`, τ before the no-trade window,
|
|
1266
|
+
* and the deadline at least `constants::deadline_expiry_margin_ms!()` before
|
|
1267
|
+
* expiry. Then `svi_max_age_ms` must be within `constants::max_svi_max_age_ms!()`
|
|
1268
|
+
* and `kind` a mint kind (`EInvalidOrderTerms`), the volatility snapshot must
|
|
1269
|
+
* load, `budget` must be positive (`EMintCostCapRequired`), the order must pass
|
|
1270
|
+
* its own limits at the clock without subsidy (`EOrderFailsLimits`), and its cash
|
|
1271
|
+
* need must fit the market's spare cash (`EInsufficientMarketCash`). Admission
|
|
1272
|
+
* then pins both boundary nodes, creating them under the node cap, and adds the
|
|
1273
|
+
* cash need to the ledger.
|
|
1274
|
+
*/
|
|
1275
|
+
function admitMint(options) {
|
|
1276
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
1277
|
+
const argumentsTypes = [
|
|
1278
|
+
`${options.typeArguments[0]}`,
|
|
1279
|
+
null,
|
|
1280
|
+
null,
|
|
1281
|
+
null,
|
|
1282
|
+
null,
|
|
1283
|
+
null,
|
|
1284
|
+
null,
|
|
1285
|
+
null,
|
|
1286
|
+
"u8",
|
|
1287
|
+
"u64",
|
|
1288
|
+
"u64",
|
|
1289
|
+
"u64",
|
|
1290
|
+
"u64",
|
|
1291
|
+
"u64",
|
|
1292
|
+
"u64",
|
|
1293
|
+
"u64",
|
|
1294
|
+
"u64",
|
|
1295
|
+
"u64",
|
|
1296
|
+
"u8",
|
|
1297
|
+
"u64",
|
|
1298
|
+
"u64",
|
|
1299
|
+
"0x2::clock::Clock"
|
|
1300
|
+
];
|
|
1301
|
+
const parameterNames = [
|
|
1302
|
+
"W",
|
|
1303
|
+
"market",
|
|
1304
|
+
"config",
|
|
1305
|
+
"account",
|
|
1306
|
+
"propbookRegistry",
|
|
1307
|
+
"pyth",
|
|
1308
|
+
"bsValues",
|
|
1309
|
+
"bsSvi",
|
|
1310
|
+
"kind",
|
|
1311
|
+
"lowerTick",
|
|
1312
|
+
"higherTick",
|
|
1313
|
+
"quantity",
|
|
1314
|
+
"maxPremium",
|
|
1315
|
+
"minQuantity",
|
|
1316
|
+
"maxProbability",
|
|
1317
|
+
"budget",
|
|
1318
|
+
"orderFee",
|
|
1319
|
+
"sviMaxAgeMs",
|
|
1320
|
+
"channel",
|
|
1321
|
+
"tauMs",
|
|
1322
|
+
"deadlineMs"
|
|
1323
|
+
];
|
|
1324
|
+
return (tx) => tx.moveCall({
|
|
1325
|
+
package: packageAddress,
|
|
1326
|
+
module: "expiry_market",
|
|
1327
|
+
function: "admit_mint",
|
|
1328
|
+
arguments: normalizeMoveArguments({
|
|
1329
|
+
...options.arguments,
|
|
1330
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
1331
|
+
propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry
|
|
1332
|
+
}, argumentsTypes, parameterNames),
|
|
1333
|
+
typeArguments: options.typeArguments
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* Admit an early sell of `close_quantity` of an open receipt's position: the
|
|
1338
|
+
* receipt moves to the sell stage in place, with the sell's request, the account's
|
|
1339
|
+
* current owner and builder code, a fresh volatility snapshot, τ, the deadline,
|
|
1340
|
+
* and no price. The companion escrows `order_fee` and owns the minimum-sell
|
|
1341
|
+
* checks.
|
|
1342
|
+
*
|
|
1343
|
+
* Open during the trading pause and a market mint pause. Aborts unless `W` is
|
|
1344
|
+
* allowlisted, the version, cutover, and snapshot-stage gates and `admit_mint`'s
|
|
1345
|
+
* timing and SVI-age checks pass, the receipt is this market's (`EWrongMarket`),
|
|
1346
|
+
* open (`EWrongStage`), and `account`'s (`ENotRecordOwner`), the volatility
|
|
1347
|
+
* snapshot loads, and the close passes its own floors at the clock
|
|
1348
|
+
* (`EOrderFailsLimits`). Then adds the sell's cash need,
|
|
1349
|
+
* `ceil(close_quantity * (1 - backing_buffer_lambda)) + 1`, to the ledger: a close
|
|
1350
|
+
* lowers payout liability by at least `lambda * close_quantity` and pays at most
|
|
1351
|
+
* `close_quantity`. There is no spare-cash check. The keeper funds the market
|
|
1352
|
+
* before τ, and the fill refunds a sell the market cannot cover.
|
|
1353
|
+
*/
|
|
1354
|
+
function admitSell(options) {
|
|
1355
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
1356
|
+
const argumentsTypes = [
|
|
1357
|
+
`${options.typeArguments[0]}`,
|
|
1358
|
+
null,
|
|
1359
|
+
null,
|
|
1360
|
+
null,
|
|
1361
|
+
null,
|
|
1362
|
+
null,
|
|
1363
|
+
null,
|
|
1364
|
+
null,
|
|
1365
|
+
null,
|
|
1366
|
+
"u64",
|
|
1367
|
+
"u64",
|
|
1368
|
+
"u64",
|
|
1369
|
+
"u64",
|
|
1370
|
+
"u64",
|
|
1371
|
+
"u8",
|
|
1372
|
+
"u64",
|
|
1373
|
+
"u64",
|
|
1374
|
+
"0x2::clock::Clock"
|
|
1375
|
+
];
|
|
1376
|
+
const parameterNames = [
|
|
1377
|
+
"W",
|
|
1378
|
+
"market",
|
|
1379
|
+
"config",
|
|
1380
|
+
"account",
|
|
1381
|
+
"receipt",
|
|
1382
|
+
"propbookRegistry",
|
|
1383
|
+
"pyth",
|
|
1384
|
+
"bsValues",
|
|
1385
|
+
"bsSvi",
|
|
1386
|
+
"closeQuantity",
|
|
1387
|
+
"minProbability",
|
|
1388
|
+
"minProceeds",
|
|
1389
|
+
"orderFee",
|
|
1390
|
+
"sviMaxAgeMs",
|
|
1391
|
+
"channel",
|
|
1392
|
+
"tauMs",
|
|
1393
|
+
"deadlineMs"
|
|
1394
|
+
];
|
|
1395
|
+
return (tx) => tx.moveCall({
|
|
1396
|
+
package: packageAddress,
|
|
1397
|
+
module: "expiry_market",
|
|
1398
|
+
function: "admit_sell",
|
|
1399
|
+
arguments: normalizeMoveArguments({
|
|
1400
|
+
...options.arguments,
|
|
1401
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
1402
|
+
propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry
|
|
1403
|
+
}, argumentsTypes, parameterNames),
|
|
1404
|
+
typeArguments: options.typeArguments
|
|
1405
|
+
});
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* Commit the Pyth price an admitted order fills at: a `LazerPrice`, which only the
|
|
1409
|
+
* `deepbook_predict_math` library builds, from a Pyth-verified Lazer update.
|
|
1410
|
+
* Stores the spot, the envelope time (the tick the fill prices at), and the feed's
|
|
1411
|
+
* generation time. For a mint it also reserves the fee subsidy,
|
|
1412
|
+
* `min(subsidy_bound * fee_incentive_subsidy_rate, incentives left)`, records the
|
|
1413
|
+
* rate and amount, and returns the reservation for the companion to escrow with
|
|
1414
|
+
* the order. A sell returns a zero balance.
|
|
1415
|
+
*
|
|
1416
|
+
* The price must be the receipt's: its Pyth feed and channel, an envelope at
|
|
1417
|
+
* exactly τ or one tick of that channel later (the backup tick), a generation time
|
|
1418
|
+
* between τ and the envelope, an envelope at or before now, and a pricing-safe
|
|
1419
|
+
* spot (`EWrongPrice`). Aborts unless `W` is allowlisted, the version gate passes,
|
|
1420
|
+
* the receipt is this market's (`EWrongMarket`), admitted with no price yet
|
|
1421
|
+
* (`EWrongStage`), and before its deadline (`EInvalidOrderTiming`).
|
|
1422
|
+
*/
|
|
1423
|
+
function commit(options) {
|
|
1424
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
1425
|
+
const argumentsTypes = [
|
|
1426
|
+
`${options.typeArguments[0]}`,
|
|
1427
|
+
null,
|
|
1428
|
+
null,
|
|
1429
|
+
null,
|
|
1430
|
+
null,
|
|
1431
|
+
"0x2::clock::Clock"
|
|
1432
|
+
];
|
|
1433
|
+
const parameterNames = [
|
|
1434
|
+
"W",
|
|
1435
|
+
"market",
|
|
1436
|
+
"config",
|
|
1437
|
+
"receipt",
|
|
1438
|
+
"price"
|
|
1439
|
+
];
|
|
1440
|
+
return (tx) => tx.moveCall({
|
|
1441
|
+
package: packageAddress,
|
|
1442
|
+
module: "expiry_market",
|
|
1443
|
+
function: "commit",
|
|
1444
|
+
arguments: normalizeMoveArguments({
|
|
1445
|
+
...options.arguments,
|
|
1446
|
+
config: options.arguments?.config ?? options.config?.protocolConfig
|
|
1447
|
+
}, argumentsTypes, parameterNames),
|
|
1448
|
+
typeArguments: options.typeArguments
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
/**
|
|
1452
|
+
* Fill or refund one committed order at its committed price and consume or return
|
|
1453
|
+
* its receipt. `escrow` is the order's escrowed budget, order fee, and reserved
|
|
1454
|
+
* subsidy. Returns
|
|
1455
|
+
* `(reason, receipt to keep, escrow left over, quantity, amount, trading_fee, builder_fee, referral_fee, subsidy_used, inventory_impact)`.
|
|
1456
|
+
* The amounts are zero on a refund. For a mint `amount` is the all-in cost and
|
|
1457
|
+
* `inventory_impact` the charge; for a sell `amount` is the proceeds and
|
|
1458
|
+
* `inventory_impact` the rebate.
|
|
1459
|
+
*
|
|
1460
|
+
* Aborts only on a companion bookkeeping error: `W` not allowlisted, the version,
|
|
1461
|
+
* freeze, or snapshot-stage gate, another market's receipt (`EWrongMarket`), a
|
|
1462
|
+
* receipt not admitted or without a price (`EWrongStage`), or `escrow` below
|
|
1463
|
+
* `budget + order_fee + subsidy_reserved` (`EEscrowMismatch`). Every market
|
|
1464
|
+
* condition returns a refund reason instead, `0` for a fill: 5 at or past the
|
|
1465
|
+
* deadline, which also covers expiry and settlement; 9 when USDC sent to the
|
|
1466
|
+
* receipt's receive address would abort the transaction (`denied`: the address is
|
|
1467
|
+
* on USDC's deny list for the current epoch, or USDC is globally paused), so
|
|
1468
|
+
* nothing is sent there; 2 when no `Pricer` exists at the tick; then the fill's
|
|
1469
|
+
* own 1 (the order's limits), 2 (admission), 4 (a pinned node is missing, a
|
|
1470
|
+
* backstop), and 8 (the market's cash after the fill would not cover its required
|
|
1471
|
+
* cash).
|
|
1472
|
+
*
|
|
1473
|
+
* A mint fill pays the premium, the trading fee net of the referral share, the
|
|
1474
|
+
* used subsidy, the order fee, and the inventory-impact charge into market cash,
|
|
1475
|
+
* sends the builder and referral fees, returns unused subsidy to the incentive
|
|
1476
|
+
* balance, emits `OrderMinted` with no congestion penalty, and returns the receipt
|
|
1477
|
+
* open. A sell fill pays the proceeds (redeem value plus inventory-impact rebate,
|
|
1478
|
+
* less the trading and builder fees) to the receipt's receive address, keeps the
|
|
1479
|
+
* trading and order fees in market cash, emits `LiveOrderRedeemed`, and returns
|
|
1480
|
+
* the receipt open with the replacement position of a partial close, or consumes
|
|
1481
|
+
* it on a full close. A builder or referral fee whose recipient is denied stays in
|
|
1482
|
+
* market cash instead, and the events still report it as charged. A refund keeps
|
|
1483
|
+
* the order fee in market cash for reasons 1 and 2, returns the reserved subsidy
|
|
1484
|
+
* to the incentive balance, prunes a mint's emptied unpinned nodes, returns the
|
|
1485
|
+
* rest of the escrow, and returns a sell's receipt open or consumes a mint's.
|
|
1486
|
+
* Every outcome takes the order out of the ledger.
|
|
1487
|
+
*/
|
|
1488
|
+
function tryFill(options) {
|
|
1489
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
1490
|
+
const argumentsTypes = [
|
|
1491
|
+
`${options.typeArguments[0]}`,
|
|
1492
|
+
null,
|
|
1493
|
+
null,
|
|
1494
|
+
null,
|
|
1495
|
+
null,
|
|
1496
|
+
"0x2::deny_list::DenyList",
|
|
1497
|
+
"0x2::clock::Clock"
|
|
1498
|
+
];
|
|
1499
|
+
const parameterNames = [
|
|
1500
|
+
"W",
|
|
1501
|
+
"market",
|
|
1502
|
+
"config",
|
|
1503
|
+
"receipt",
|
|
1504
|
+
"escrow"
|
|
1505
|
+
];
|
|
1506
|
+
return (tx) => tx.moveCall({
|
|
1507
|
+
package: packageAddress,
|
|
1508
|
+
module: "expiry_market",
|
|
1509
|
+
function: "try_fill",
|
|
1510
|
+
arguments: normalizeMoveArguments({
|
|
1511
|
+
...options.arguments,
|
|
1512
|
+
config: options.arguments?.config ?? options.config?.protocolConfig
|
|
1513
|
+
}, argumentsTypes, parameterNames),
|
|
1514
|
+
typeArguments: options.typeArguments
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
/**
|
|
1518
|
+
* Take an admitted order out without filling it: the companion's deadline, admin,
|
|
1519
|
+
* and settlement-drain refunds release their receipt here. `escrow` is the order's
|
|
1520
|
+
* escrowed budget, order fee, and reserved subsidy, and `reason` the refund's
|
|
1521
|
+
* `constants::fill_reason_*` code. The order fee follows `try_fill`'s refund rule:
|
|
1522
|
+
* reasons 1 and 2 keep it in market cash, and every other reason leaves it in the
|
|
1523
|
+
* escrow returned. Returns the reservation to the incentive balance, subtracts the
|
|
1524
|
+
* exact cash need from the ledger, and unpins a mint's boundary ticks, pruning
|
|
1525
|
+
* emptied, unpinned, unretained nodes only when `prune` and the market is
|
|
1526
|
+
* unsettled. Returns a sell's receipt open, still holding its position, or `none`
|
|
1527
|
+
* for a mint's, which it consumes, and the rest of the escrow.
|
|
1528
|
+
*
|
|
1529
|
+
* Needs no allowlisting and checks only the version floor, so the drain works
|
|
1530
|
+
* while the protocol is frozen and after the witness is removed. Keeping an order
|
|
1531
|
+
* fee moves market cash, so like a fill it aborts inside the keeper's snapshot
|
|
1532
|
+
* stage (`ESnapshotInProgress`). Aborts on another market's receipt
|
|
1533
|
+
* (`EWrongMarket`), a receipt not admitted (`EWrongStage`), or `escrow` below
|
|
1534
|
+
* `budget + order_fee + subsidy_reserved` (`EEscrowMismatch`).
|
|
1535
|
+
*/
|
|
1536
|
+
function release(options) {
|
|
1537
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
1538
|
+
const argumentsTypes = [
|
|
1539
|
+
null,
|
|
1540
|
+
null,
|
|
1541
|
+
null,
|
|
1542
|
+
null,
|
|
1543
|
+
"u8",
|
|
1544
|
+
"bool"
|
|
1545
|
+
];
|
|
1546
|
+
const parameterNames = [
|
|
1547
|
+
"market",
|
|
1548
|
+
"config",
|
|
1549
|
+
"receipt",
|
|
1550
|
+
"escrow",
|
|
1551
|
+
"reason",
|
|
1552
|
+
"prune"
|
|
1553
|
+
];
|
|
1554
|
+
return (tx) => tx.moveCall({
|
|
1555
|
+
package: packageAddress,
|
|
1556
|
+
module: "expiry_market",
|
|
1557
|
+
function: "release",
|
|
1558
|
+
arguments: normalizeMoveArguments({
|
|
1559
|
+
...options.arguments,
|
|
1560
|
+
config: options.arguments?.config ?? options.config?.protocolConfig
|
|
1561
|
+
}, argumentsTypes, parameterNames)
|
|
1562
|
+
});
|
|
1563
|
+
}
|
|
1564
|
+
/**
|
|
1565
|
+
* Pay an open receipt's settled payout, zero for a loser, to its receive address
|
|
1566
|
+
* and consume the receipt. Returns the payout and `none`. When the payout is above
|
|
1567
|
+
* market cash or above the settled liability left, or a nonzero payout's receive
|
|
1568
|
+
* address is denied (`try_fill`'s reason 9: on USDC's deny list for the current
|
|
1569
|
+
* epoch, or USDC globally paused), changes nothing and returns that payout with
|
|
1570
|
+
* the receipt, so the companion's payout walk moves on and a later call pays it
|
|
1571
|
+
* once the cause clears. Needs no allowlisting and checks only the version floor.
|
|
1572
|
+
* Aborts on another market's receipt (`EWrongMarket`), a receipt that is not open
|
|
1573
|
+
* (`EWrongStage`), or an unsettled market (`EMarketNotSettled`).
|
|
1574
|
+
*/
|
|
1575
|
+
function tryPaySettled(options) {
|
|
1576
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
1577
|
+
const argumentsTypes = [
|
|
1578
|
+
null,
|
|
1579
|
+
null,
|
|
1580
|
+
null,
|
|
1581
|
+
"0x2::deny_list::DenyList"
|
|
1582
|
+
];
|
|
1583
|
+
const parameterNames = [
|
|
1584
|
+
"market",
|
|
1585
|
+
"config",
|
|
1586
|
+
"receipt"
|
|
1587
|
+
];
|
|
1588
|
+
return (tx) => tx.moveCall({
|
|
1589
|
+
package: packageAddress,
|
|
1590
|
+
module: "expiry_market",
|
|
1591
|
+
function: "try_pay_settled",
|
|
1592
|
+
arguments: normalizeMoveArguments({
|
|
1593
|
+
...options.arguments,
|
|
1594
|
+
config: options.arguments?.config ?? options.config?.protocolConfig
|
|
1595
|
+
}, argumentsTypes, parameterNames)
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1132
1598
|
|
|
1133
1599
|
//#endregion
|
|
1134
|
-
export { admissionTickSize, currentNav, expiry,
|
|
1600
|
+
export { ExpiryMarket, MintQuote, OrderFlowLedger, OrderFlowLedgerKey, OrderParties, OrderReceipt, RedeemQuote, ValuationStamp, admissionTickSize, admitMint, admitSell, allInCost, backingBufferLambda, builderFee, cashBalance, commit, currentNav, entryProbability, expiry, expiryFeeMaxMultiplier, expiryFeeWindowMs, feeIncentiveBalance, feeIncentiveSubsidy, id, inventoryImpactCharge, inventoryImpactMaxRate, inventoryImpactReserve, inventoryImpactScale, isPendingValuation, isSettled, liveOrderValue, loadLivePricer, mintExactAmount, mintExactCost, mintExactQuantity, mintPaused, orderFlowState, payoutLiability, penaltyFee, premium, propbookUnderlyingId, quantity, quoteClose, quoteMint, quoteMintExactCostForAccount, quoteMintForAccount, receiptInfo, redeemBuilderFee, redeemCloseQuantity, redeemInventoryImpactRebate, redeemLive, redeemProbability, redeemProceeds, redeemSettled, redeemSettledPermissionless, redeemTradingFee, referenceTick, referenceTickSourceTimestampMs, release, requiredCash, setMintPaused, setReferenceTick, settledOrderPayout, settlementPrice, tickSize, tradingFee, tryFill, tryPaySettled, trySettle, trySettlementPrice };
|
|
1135
1601
|
//# sourceMappingURL=expiry_market.mjs.map
|