@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,9 +1,9 @@
|
|
|
1
1
|
import { __exportAll } from "../../_virtual/rolldown_runtime.mjs";
|
|
2
2
|
import { MoveStruct, normalizeMoveArguments } from "../utils/index.mjs";
|
|
3
3
|
import { U64 } from "../../bcs/integers.mjs";
|
|
4
|
-
import { Balance } from "./deps/sui/balance.mjs";
|
|
5
|
-
import { FrozenPricer } from "./pricing.mjs";
|
|
6
4
|
import { VecMap } from "./deps/sui/vec_map.mjs";
|
|
5
|
+
import { FrozenPricer } from "./pricing.mjs";
|
|
6
|
+
import { Balance } from "./deps/sui/balance.mjs";
|
|
7
7
|
import { LpBook } from "./lp_book.mjs";
|
|
8
8
|
import { Ledger } from "./pool_accounting.mjs";
|
|
9
9
|
import { bcs } from "@mysten/sui/bcs";
|
|
@@ -34,6 +34,7 @@ var plp_exports = /* @__PURE__ */ __exportAll({
|
|
|
34
34
|
SnapshotStage: () => SnapshotStage,
|
|
35
35
|
activeExpiryMarkets: () => activeExpiryMarkets,
|
|
36
36
|
activeLiveExpiryCount: () => activeLiveExpiryCount,
|
|
37
|
+
addUsdcToPlp: () => addUsdcToPlp,
|
|
37
38
|
cancelSupplyRequest: () => cancelSupplyRequest,
|
|
38
39
|
cancelWithdrawRequest: () => cancelWithdrawRequest,
|
|
39
40
|
feeIncentiveReserve: () => feeIncentiveReserve,
|
|
@@ -55,6 +56,7 @@ var plp_exports = /* @__PURE__ */ __exportAll({
|
|
|
55
56
|
startPoolValuation: () => startPoolValuation,
|
|
56
57
|
supplyRequestsPending: () => supplyRequestsPending,
|
|
57
58
|
valueExpiry: () => valueExpiry,
|
|
59
|
+
withdrawFeeIncentives: () => withdrawFeeIncentives,
|
|
58
60
|
withdrawRequestsPending: () => withdrawRequestsPending
|
|
59
61
|
});
|
|
60
62
|
const $moduleName = "@local-pkg/deepbook_predict::plp";
|
|
@@ -328,8 +330,8 @@ function startPoolValuation(options) {
|
|
|
328
330
|
* a payout tree — so all markets fit one PTB regardless of book size.
|
|
329
331
|
*
|
|
330
332
|
* The oracle feeding this stage must have been written in an EARLIER transaction:
|
|
331
|
-
* `pricing::
|
|
332
|
-
*
|
|
333
|
+
* `pricing::resolve_live` refuses a read stamped with the current transaction
|
|
334
|
+
* digest (RP-24), so a keeper cannot refresh and snapshot in one PTB.
|
|
333
335
|
*
|
|
334
336
|
* A market already settled at snapshot time is recorded with no pricer, gets no
|
|
335
337
|
* stamp (settled flows never touch live NAV), and contributes 0. An
|
|
@@ -476,6 +478,11 @@ function valueExpiry(options) {
|
|
|
476
478
|
* Because queueing is permissionless and a refunded request returns its escrow in
|
|
477
479
|
* the same transaction, an operator should bound both budgets in production rather
|
|
478
480
|
* than rely on queue length staying small — see RP-12.
|
|
481
|
+
*
|
|
482
|
+
* Only an allowlisted flush operator may call it
|
|
483
|
+
* (`protocol_config::ENotFlushOperator`). Fills move idle cash, so restricting who
|
|
484
|
+
* completes a flush keeps idle predictable for the keeper that funds markets for
|
|
485
|
+
* queued orders.
|
|
479
486
|
*/
|
|
480
487
|
function finishFlush(options) {
|
|
481
488
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -502,7 +509,10 @@ function finishFlush(options) {
|
|
|
502
509
|
* Permissionless and standalone: anyone may call it at any cadence. Handles all
|
|
503
510
|
* three per-market cases — initial funding of a freshly registered (unfunded)
|
|
504
511
|
* market, ongoing live rebalance/surplus-sweep toward target, and the
|
|
505
|
-
* settled-market sweep (deactivate, return all free cash, materialize profit).
|
|
512
|
+
* settled-market sweep (deactivate, return all free cash, materialize profit). The
|
|
513
|
+
* live target covers the market's queued orders' cash need (the waiting cash need
|
|
514
|
+
* in `expiry_market::order_flow_state`), so the keeper calls this after each
|
|
515
|
+
* enqueue to fund those orders' fills, and a sweep never takes that cash back.
|
|
506
516
|
* Call `expiry_market::try_settle` first in the same PTB when settlement may be
|
|
507
517
|
* due. An expired unsettled market is a no-op until that transition succeeds. Mint
|
|
508
518
|
* asserts backing but never pulls pool cash, so this is what makes a market
|
|
@@ -541,7 +551,9 @@ function rebalanceExpiryCash(options) {
|
|
|
541
551
|
/**
|
|
542
552
|
* Sponsor taker fee incentives with USDC. Anyone may contribute; the payment joins
|
|
543
553
|
* a pool-level reserve that is excluded from PLP NAV and later allocated to expiry
|
|
544
|
-
* markets by the normal rebalance flow.
|
|
554
|
+
* markets by the normal rebalance flow. A contribution is not earmarked to its
|
|
555
|
+
* sponsor: admin can withdraw any of the reserve through
|
|
556
|
+
* `withdraw_fee_incentives`.
|
|
545
557
|
*/
|
|
546
558
|
function sponsorFeeIncentives(options) {
|
|
547
559
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -567,6 +579,113 @@ function sponsorFeeIncentives(options) {
|
|
|
567
579
|
});
|
|
568
580
|
}
|
|
569
581
|
/**
|
|
582
|
+
* Withdraw `amount` USDC of sponsor-funded fee incentives from the pool-level
|
|
583
|
+
* reserve, for sponsorship the protocol no longer wants to spend. Admin-only.
|
|
584
|
+
*
|
|
585
|
+
* Reaches the reserve only. Incentives already allocated to a live market stay in
|
|
586
|
+
* that market's `fee_incentive_balance` and return to the reserve when its
|
|
587
|
+
* settled-market sweep runs, after which they can be withdrawn here; setting
|
|
588
|
+
* `protocol_config::set_fee_incentive_subsidy_rate` to zero stops them being spent
|
|
589
|
+
* in the meantime. The per-expiry lifetime allocation counters are not credited
|
|
590
|
+
* back: they bound what a market may ever receive, and a withdrawal does not
|
|
591
|
+
* change what a market already received.
|
|
592
|
+
*
|
|
593
|
+
* Not gated on the valuation flag, in either stage of a flush: the reserve is
|
|
594
|
+
* excluded from PLP NAV and no flush figure, frozen or live, reads it, so a
|
|
595
|
+
* withdrawal cannot reach the mark.
|
|
596
|
+
*/
|
|
597
|
+
function withdrawFeeIncentives(options) {
|
|
598
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
599
|
+
const argumentsTypes = [
|
|
600
|
+
null,
|
|
601
|
+
null,
|
|
602
|
+
null,
|
|
603
|
+
"u64"
|
|
604
|
+
];
|
|
605
|
+
const parameterNames = [
|
|
606
|
+
"vault",
|
|
607
|
+
"AdminCap",
|
|
608
|
+
"config",
|
|
609
|
+
"amount"
|
|
610
|
+
];
|
|
611
|
+
return (tx) => tx.moveCall({
|
|
612
|
+
package: packageAddress,
|
|
613
|
+
module: "plp",
|
|
614
|
+
function: "withdraw_fee_incentives",
|
|
615
|
+
arguments: normalizeMoveArguments({
|
|
616
|
+
...options.arguments,
|
|
617
|
+
vault: options.arguments?.vault ?? options.config?.poolVault,
|
|
618
|
+
config: options.arguments?.config ?? options.config?.protocolConfig
|
|
619
|
+
}, argumentsTypes, parameterNames)
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Add USDC straight to pool idle liquidity without minting any PLP. Anyone may
|
|
624
|
+
* call it; the payment is an outright gift to the existing share base, so the
|
|
625
|
+
* caller receives nothing back and no share of it is recoverable.
|
|
626
|
+
*
|
|
627
|
+
* This is the incentive/top-up path: because no shares are issued, the whole
|
|
628
|
+
* `payment` lands inside the value the next flush's mark divides by an unchanged
|
|
629
|
+
* `total_supply`, which raises NAV per PLP for every current holder. It
|
|
630
|
+
* deliberately does not touch the profit basis — the basis tracks cash sent to and
|
|
631
|
+
* returned from expiries, so an outside contribution is neither a debit nor a
|
|
632
|
+
* credit, and the protocol reserve therefore takes no cut of it (`pool_value`
|
|
633
|
+
* leaves `exclusion` unchanged while `gross_pool_value` grows). Sending the same
|
|
634
|
+
* USDC through `request_supply` instead mints shares against it, so only the
|
|
635
|
+
* supply fee would reach existing holders — zero as shipped.
|
|
636
|
+
*
|
|
637
|
+
* Three gates, each closing a state this entrypoint would otherwise manufacture:
|
|
638
|
+
*
|
|
639
|
+
* - **Bootstrapped pool.** At `total_supply == 0` there is no share base to
|
|
640
|
+
* credit; the USDC would only inflate the genesis lock's non-withdrawable stake.
|
|
641
|
+
* - **Contribution price ceiling.** Pool cash after the contribution — idle plus
|
|
642
|
+
* the net cash deployed into active expiries — may price at most
|
|
643
|
+
* `contribution_price_ceiling_factor` USDC per PLP, a tenth of the band a flush
|
|
644
|
+
* mark needs to be fillable. Above the band every supply and withdraw head is
|
|
645
|
+
* refunded (RP-2) and `total_supply` grows only through a supply fill, so
|
|
646
|
+
* nothing brings the price back down — a terminal state that an unbounded
|
|
647
|
+
* contribution against a small share base would otherwise reach for the price of
|
|
648
|
+
* the contribution. The ceiling sits well inside the band because later fills
|
|
649
|
+
* only push the price up (rounding and retained fees stay in the pool), so a
|
|
650
|
+
* pool left exactly at the band would leave it on the next uneven or fee-charged
|
|
651
|
+
* fill. The test is one-sided because a contribution can only move the price up.
|
|
652
|
+
* It reads pool cash rather than pool NAV — NAV needs a flush — and counts
|
|
653
|
+
* deployed cash because the mark does: `rebalance_expiry_cash` is
|
|
654
|
+
* permissionless, so an idle-only test could be emptied into a market and passed
|
|
655
|
+
* again. Cash is exactly the protocol-controlled share: the guard forbids this
|
|
656
|
+
* entrypoint from _manufacturing_ the degenerate ratio and leaves market-driven
|
|
657
|
+
* NAV moves (trader premiums and P&L) to RP-1/RP-2, which own them.
|
|
658
|
+
* - **No flush in flight.** The seal freezes idle mid-flush, so an ungated
|
|
659
|
+
* contribution would land on one side or the other of that capture depending
|
|
660
|
+
* only on when the contributor's transaction executed — either paying that
|
|
661
|
+
* flush's queued withdrawals or not. `sponsor_fee_incentives` takes the same
|
|
662
|
+
* gate. `rebalance_expiry_cash` may run mid-window because it only moves cash
|
|
663
|
+
* between two figures the seal already froze; new value is different.
|
|
664
|
+
*/
|
|
665
|
+
function addUsdcToPlp(options) {
|
|
666
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
667
|
+
const argumentsTypes = [
|
|
668
|
+
null,
|
|
669
|
+
null,
|
|
670
|
+
null
|
|
671
|
+
];
|
|
672
|
+
const parameterNames = [
|
|
673
|
+
"vault",
|
|
674
|
+
"config",
|
|
675
|
+
"payment"
|
|
676
|
+
];
|
|
677
|
+
return (tx) => tx.moveCall({
|
|
678
|
+
package: packageAddress,
|
|
679
|
+
module: "plp",
|
|
680
|
+
function: "add_usdc_to_plp",
|
|
681
|
+
arguments: normalizeMoveArguments({
|
|
682
|
+
...options.arguments,
|
|
683
|
+
vault: options.arguments?.vault ?? options.config?.poolVault,
|
|
684
|
+
config: options.arguments?.config ?? options.config?.protocolConfig
|
|
685
|
+
}, argumentsTypes, parameterNames)
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
570
689
|
* Bootstrap the pool exactly once: permanently lock `payment` USDC of minimum
|
|
571
690
|
* liquidity. Mints matching PLP (1:1) into the book's locked balance — never
|
|
572
691
|
* withdrawable, so the caller receives no shares — and joins the USDC into idle.
|
|
@@ -759,5 +878,5 @@ function cancelWithdrawRequest(options) {
|
|
|
759
878
|
}
|
|
760
879
|
|
|
761
880
|
//#endregion
|
|
762
|
-
export { activeExpiryMarkets, cancelSupplyRequest, cancelWithdrawRequest, idleBalance, plpTotalSupply, plp_exports, requestSupply, requestWithdraw, supplyRequestsPending, withdrawRequestsPending };
|
|
881
|
+
export { activeExpiryMarkets, cancelSupplyRequest, cancelWithdrawRequest, idleBalance, plpTotalSupply, plp_exports, rebalanceExpiryCash, requestSupply, requestWithdraw, supplyRequestsPending, withdrawRequestsPending };
|
|
763
882
|
//# sourceMappingURL=plp.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plp.mjs","names":["vec_map.VecMap","pricing.FrozenPricer","balance.Balance","lp_book.LpBook","pool_accounting.Ledger"],"sources":["../../../src/contracts/deepbook_predict/plp.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * PLP token and pool vault.\n *\n * PoolVault owns the PLP treasury cap, idle USDC, the protocol reserve,\n * sponsor-funded fee incentives, per-expiry cash accounting, and the queued LP\n * supply/withdraw requests. It coordinates the full-pool NAV valuation — an atomic\n * oracle snapshot followed by resumable per-market valuation transactions, with\n * trading live throughout (see `PoolValuation`) — and the unified per-market cash\n * flow (initial funding, live rebalance/sweep, and settled-market sweep with\n * terminal profit materialization). LPs queue supply/withdraw requests routed\n * through a loaded Account; each flush (`finish_flush`) drains the requests that\n * predate its snapshot at the frozen pool NAV, minting/burning PLP and delivering\n * fills to each account via the balance accumulator.\n */\n\nimport {\n\tMoveStruct,\n\tnormalizeMoveArguments,\n\ttype RawTransactionArgument,\n\ttype ConfigValue,\n} from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { U64 } from '../../bcs/integers.js';\nimport { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';\nimport * as vec_map from './deps/sui/vec_map.js';\nimport * as pricing from './pricing.js';\nimport * as balance from './deps/sui/balance.js';\nimport * as lp_book from './lp_book.js';\nimport * as pool_accounting from './pool_accounting.js';\nconst $moduleName = '@local-pkg/deepbook_predict::plp';\nexport const PLP = new MoveStruct({\n\tname: `${$moduleName}::PLP`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const PoolValuationProof = new MoveStruct({\n\tname: `${$moduleName}::PoolValuationProof`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const SnapshotStage = new MoveStruct({\n\tname: `${$moduleName}::SnapshotStage`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const PoolValuation = new MoveStruct({\n\tname: `${$moduleName}::PoolValuation`,\n\tfields: {\n\t\t/** Active expiry markets snapshotted at start; every one must be valued. */\n\t\texpected_expiry_markets: bcs.vector(bcs.Address),\n\t\t/** Markets valued so far this flush; folded against `expected` at finish. */\n\t\tvalued_expiry_markets: bcs.vector(bcs.Address),\n\t\t/** Running Σ of each valued market's snapshot NAV (settled markets contribute 0). */\n\t\ttotal_nav: U64,\n\t\t/**\n\t\t * Oracle state frozen during the snapshot stage, one entry per expected market.\n\t\t * Keyed by market id so a `Pricer` can never be applied to the wrong market.\n\t\t * `none` marks a market that was already settled at snapshot time and therefore\n\t\t * contributes 0. This map is what makes the valuation stage deterministic: it\n\t\t * decides both the mark AND the sweep-vs-value branch, so no later transaction's\n\t\t * clock or oracle state can change a market's contribution.\n\t\t */\n\t\tfrozen_pricers: vec_map.VecMap(bcs.Address, bcs.option(pricing.FrozenPricer)),\n\t\t/**\n\t\t * Set by `seal_valuation_snapshot`; no market may be valued before it. Nothing may\n\t\t * be snapshotted after it because sealing consumes the `SnapshotStage`.\n\t\t */\n\t\tsealed: bcs.bool(),\n\t\t/** Clock time the flush was started, for the stuck-flush deadline. */\n\t\tstarted_at_ms: U64,\n\t\t/**\n\t\t * Drain budgets committed at start (the cap owner's choice), bounding how many\n\t\t * requests each queue processes at finish. Committing them here — not at finish —\n\t\t * is what lets `finish_flush` run permissionless: a stranger may complete a flush\n\t\t * but only ever drains at these budgets, so completion can help LPs, never starve\n\t\t * them by finishing with a zero budget.\n\t\t */\n\t\tsupply_budget: bcs.option(U64),\n\t\twithdraw_budget: bcs.option(U64),\n\t\t/**\n\t\t * Each LP queue's `next_index` at the snapshot instant: the drain fills only\n\t\t * requests indexed strictly below these, so nobody can watch the frozen mark form\n\t\t * and then submit against a price they already know is stale.\n\t\t */\n\t\tsupply_request_cutoff: U64,\n\t\twithdraw_request_cutoff: U64,\n\t\t/**\n\t\t * Vault-side figures captured by `seal_valuation_snapshot`. With every market's\n\t\t * cash frozen in its stamp and these frozen here, the mark is a pure function of\n\t\t * the snapshot instant: no in-window cash move — maintenance, settled sweep,\n\t\t * market funding, reserve realization — can reach it. Settled members are swept\n\t\t * during the snapshot stage, so their recoverable cash sits inside\n\t\t * `frozen_idle_balance`.\n\t\t */\n\t\tfrozen_idle_balance: U64,\n\t\tfrozen_profit_basis_credits: U64,\n\t\tfrozen_profit_basis_debits: U64,\n\t\tfrozen_pending_protocol_profit: U64,\n\t},\n});\nexport const PoolVault = new MoveStruct({\n\tname: `${$moduleName}::PoolVault`,\n\tfields: {\n\t\tid: bcs.Address,\n\t\t/**\n\t\t * Protocol-owned USDC excluded from PLP redemption. No package entrypoint\n\t\t * withdraws this balance.\n\t\t */\n\t\tprotocol_reserve_balance: balance.Balance,\n\t\t/** Sponsor-funded USDC reserved for taker fee sponsorship, excluded from PLP NAV. */\n\t\tfee_incentive_reserve: balance.Balance,\n\t\t/** PLP share issuance plus queued supply/withdraw escrow. */\n\t\tlp: lp_book.LpBook,\n\t\t/** Idle USDC custody, registered expiries, and per-expiry cash-flow rows. */\n\t\texpiry_accounting: pool_accounting.Ledger,\n\t\t/**\n\t\t * In-flight full-pool valuation, held across transactions. `Some` exactly while\n\t\t * the `ProtocolConfig` valuation flag is engaged.\n\t\t */\n\t\tvaluation: bcs.option(PoolValuation),\n\t},\n});\nexport interface IdArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface IdOptions {\n\tpackage?: string;\n\targuments?: IdArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return the pool vault object ID for external discovery and PTB construction. */\nexport function id(options: IdOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'id',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface IdleBalanceArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface IdleBalanceOptions {\n\tpackage?: string;\n\targuments?: IdleBalanceArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return idle USDC for SDK and devInspect state reads. */\nexport function idleBalance(options: IdleBalanceOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'idle_balance',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface ProtocolReserveBalanceArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface ProtocolReserveBalanceOptions {\n\tpackage?: string;\n\targuments?: ProtocolReserveBalanceArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return protocol-owned USDC for SDK and devInspect state reads. */\nexport function protocolReserveBalance(options: ProtocolReserveBalanceOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'protocol_reserve_balance',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface FeeIncentiveReserveArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface FeeIncentiveReserveOptions {\n\tpackage?: string;\n\targuments?: FeeIncentiveReserveArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return sponsor-funded fee reserves for SDK and devInspect state reads. */\nexport function feeIncentiveReserve(options: FeeIncentiveReserveOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'fee_incentive_reserve',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface PlpTotalSupplyArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface PlpTotalSupplyOptions {\n\tpackage?: string;\n\targuments?: PlpTotalSupplyArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return total PLP supply for SDK and devInspect state reads. */\nexport function plpTotalSupply(options: PlpTotalSupplyOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'plp_total_supply',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface SupplyRequestsPendingArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface SupplyRequestsPendingOptions {\n\tpackage?: string;\n\targuments?: SupplyRequestsPendingArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return pending LP supply count for SDK and devInspect queue reads. */\nexport function supplyRequestsPending(options: SupplyRequestsPendingOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'supply_requests_pending',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface WithdrawRequestsPendingArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface WithdrawRequestsPendingOptions {\n\tpackage?: string;\n\targuments?: WithdrawRequestsPendingArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return pending LP withdrawal count for SDK and devInspect queue reads. */\nexport function withdrawRequestsPending(options: WithdrawRequestsPendingOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'withdraw_requests_pending',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface ActiveExpiryMarketsArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface ActiveExpiryMarketsOptions {\n\tpackage?: string;\n\targuments?: ActiveExpiryMarketsArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return active expiry IDs for external PTB construction and pool inspection. */\nexport function activeExpiryMarkets(options: ActiveExpiryMarketsOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'active_expiry_markets',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface ActiveLiveExpiryCountArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface ActiveLiveExpiryCountOptions {\n\tpackage?: string;\n\targuments?: ActiveLiveExpiryCountArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return the pre-expiry active count for SDK and devInspect capacity reads. */\nexport function activeLiveExpiryCount(options: ActiveLiveExpiryCountOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, '0x2::clock::Clock'] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'active_live_expiry_count',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface ProfitBasisDebitsArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface ProfitBasisDebitsOptions {\n\tpackage?: string;\n\targuments?: ProfitBasisDebitsArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return the profit-basis debits for external accounting observability. */\nexport function profitBasisDebits(options: ProfitBasisDebitsOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'profit_basis_debits',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface ProfitBasisCreditsArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface ProfitBasisCreditsOptions {\n\tpackage?: string;\n\targuments?: ProfitBasisCreditsArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return the profit-basis credits for external accounting observability. */\nexport function profitBasisCredits(options: ProfitBasisCreditsOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'profit_basis_credits',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface PendingProtocolProfitArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface PendingProtocolProfitOptions {\n\tpackage?: string;\n\targuments?: PendingProtocolProfitArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return deferred protocol profit for external accounting observability. */\nexport function pendingProtocolProfit(options: PendingProtocolProfitOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'pending_protocol_profit',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface StartPoolValuationArguments {\n\tconfig?: RawTransactionArgument<string>;\n\tvault?: RawTransactionArgument<string>;\n\tvaluationProof: TransactionArgument;\n\tsupplyBudget: RawTransactionArgument<number | bigint | null>;\n\twithdrawBudget: RawTransactionArgument<number | bigint | null>;\n}\nexport interface StartPoolValuationOptions {\n\tpackage?: string;\n\targuments: StartPoolValuationArguments;\n\tconfig?: {\n\t\tprotocolConfig: ConfigValue;\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Begin a full-pool valuation using a registry-issued pool-valuation proof. The\n * proof grants control over when current oracle state is frozen for queued LP\n * fills. Starting engages the cross-transaction valuation flag, snapshots the\n * active expiry set and each LP queue's eligibility cutoff, and opens the atomic\n * snapshot stage: freeze every active market's pricer under the returned\n * `SnapshotStage`, then seal it in the same transaction.\n */\nexport function startPoolValuation(options: StartPoolValuationOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'0x1::option::Option<u64>',\n\t\t'0x1::option::Option<u64>',\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = ['config', 'vault', 'valuationProof', 'supplyBudget', 'withdrawBudget'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'start_pool_valuation',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface SnapshotExpiryPricerArguments {\n\tvault?: RawTransactionArgument<string>;\n\tStage: TransactionArgument;\n\tmarket: RawTransactionArgument<string>;\n\tconfig?: RawTransactionArgument<string>;\n\tpropbookRegistry?: RawTransactionArgument<string>;\n\tpyth: RawTransactionArgument<string>;\n\tbsValues: RawTransactionArgument<string>;\n\tbsSvi: RawTransactionArgument<string>;\n}\nexport interface SnapshotExpiryPricerOptions {\n\tpackage?: string;\n\targuments: SnapshotExpiryPricerArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\toracleRegistry: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Freeze one snapshotted market's oracle state for this flush and stamp the\n * market, capturing its cash rows and activating its payout-tree snapshot at this\n * instant.\n *\n * Holding `SnapshotStage` is what admits this call, and that potato cannot leave\n * the transaction `start_pool_valuation` minted it in — so every `Pricer` here is\n * loaded at one instant, which is what lets the valuation stage span transactions\n * without mixing marks (audit L10). This stage reads oracles only — it never walks\n * a payout tree — so all markets fit one PTB regardless of book size.\n *\n * The oracle feeding this stage must have been written in an EARLIER transaction:\n * `pricing::resolve_live_pricer` refuses a read stamped with the current\n * transaction digest (RP-24), so a keeper cannot refresh and snapshot in one PTB.\n *\n * A market already settled at snapshot time is recorded with no pricer, gets no\n * stamp (settled flows never touch live NAV), and contributes 0. An\n * expired-but-unsettled market aborts: it has no well-defined mark, and because\n * this stage is atomic the abort reverts the whole snapshot transaction, so the\n * flag is never left engaged. Settle it first, then start the flush; settlement is\n * never blocked by a flush, so that ordering is always available.\n */\nexport function snapshotExpiryPricer(options: SnapshotExpiryPricerOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = [\n\t\t'vault',\n\t\t'Stage',\n\t\t'market',\n\t\t'config',\n\t\t'propbookRegistry',\n\t\t'pyth',\n\t\t'bsValues',\n\t\t'bsSvi',\n\t];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'snapshot_expiry_pricer',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t\tpropbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface SealValuationSnapshotArguments {\n\tvault?: RawTransactionArgument<string>;\n\tstage: TransactionArgument;\n\tconfig?: RawTransactionArgument<string>;\n}\nexport interface SealValuationSnapshotOptions {\n\tpackage?: string;\n\targuments: SealValuationSnapshotArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Close the snapshot stage once every expected market has a frozen pricer, and\n * freeze the vault-side figures — idle, the profit basis, the pending protocol cut\n * — completing the snapshot.\n *\n * Consuming `SnapshotStage` is the simultaneity proof: the potato dies here, so no\n * later transaction can add oracle state to this flush, and every market is marked\n * at the instant the snapshot transaction executed. The vault capture is\n * consistent with the per-market stamps because `rebalance_expiry_cash` refuses to\n * run while the stage is open (`ESnapshotStageOpen`), so no idle↔market move can\n * land between a stamp and this capture. Valuation may then resume across as many\n * transactions as it needs.\n */\nexport function sealValuationSnapshot(options: SealValuationSnapshotOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null, null] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'stage', 'config'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'seal_valuation_snapshot',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface ValueExpiryArguments {\n\tvault?: RawTransactionArgument<string>;\n\tmarket: RawTransactionArgument<string>;\n\tconfig?: RawTransactionArgument<string>;\n}\nexport interface ValueExpiryOptions {\n\tpackage?: string;\n\targuments: ValueExpiryArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Fold one snapshotted market's SNAPSHOT-INSTANT NAV into the running total. A\n * market frozen as settled is swept and contributes 0; one frozen with a pricer is\n * valued via `expiry_market::snapshot_nav` over its captured cash and tree\n * shadows, then has its stamp cleared (releasing the tree snapshot), so later\n * trades and the next flush start clean.\n *\n * The resumable stage: any transaction after the seal, one market per transaction\n * (`constants::max_payout_tree_nodes`), reading no oracle and no clock.\n * MEASUREMENT-ONLY for every member — settled members were swept during the\n * snapshot stage and every frozen figure was captured there, so this call moves no\n * cash and `rebalance_expiry_cash` runs at any time. A market that expired\n * mid-window is valued at its frozen pre-expiry mark; its settlement does not wait\n * for this call, because settlement is never blocked by a flush.\n */\nexport function valueExpiry(options: ValueExpiryOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null, null] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'market', 'config'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'value_expiry',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface FinishFlushArguments {\n\tvault?: RawTransactionArgument<string>;\n\tconfig?: RawTransactionArgument<string>;\n}\nexport interface FinishFlushOptions {\n\tpackage?: string;\n\targuments?: FinishFlushArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Finish a full-pool valuation and run the LP flush: prove every snapshotted\n * market was valued exactly once, price the pool NAV, then drain the\n * supply/withdraw queues at that frozen mark (mint PLP for supplies, burn PLP and\n * pay USDC for withdrawals), release the valuation flag, retire the in-flight\n * valuation, and return the LP-attributable pool-wide USDC NAV (frozen idle + Σ\n * active NAV, net of the pending-protocol-profit exclusion priced from the frozen\n * profit basis — every term as of the snapshot instant). Each drain fills only\n * requests submitted before the flush's snapshot instant (the recorded queue\n * cutoffs); younger requests wait for the next mark.\n *\n * `supply_budget` and `withdraw_budget` bound how many requests each queue may\n * process this flush (`None` = unbounded). Fills — whole or partial — and\n * protocol-refunded heads — non-executable, or quoting below the request's own\n * minimum output — all count as processed. At `ProtocolConfig`'s shipped attempt\n * count of one, a head that misses its limit is refunded by the flush that reaches\n * it; above one it stays queued and stops that queue for the flush. The budgets\n * are independent, so a supply backlog does not consume withdrawal capacity.\n *\n * Capacity bounds each pass on top of the budgets and refunds nothing: supplies\n * fill only up to `ProtocolConfig`'s LP pool-value cap, withdrawals only up to\n * idle. A head larger than the room left fills to the room, spends flush budget,\n * and keeps its remainder queued at a rescaled limit; a head with no usable room\n * carries untouched and spends none. Either way the pass stops, so an unbounded\n * budget does not mean every queued request is processed (RP-23).\n *\n * Because queueing is permissionless and a refunded request returns its escrow in\n * the same transaction, an operator should bound both budgets in production rather\n * than rely on queue length staying small — see RP-12.\n */\nexport function finishFlush(options: FinishFlushOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null, '0x2::clock::Clock'] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'config'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'finish_flush',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface RebalanceExpiryCashArguments {\n\tvault?: RawTransactionArgument<string>;\n\tmarket: RawTransactionArgument<string>;\n\tconfig?: RawTransactionArgument<string>;\n}\nexport interface RebalanceExpiryCashOptions {\n\tpackage?: string;\n\targuments: RebalanceExpiryCashArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Move cash between pool idle liquidity and one expiry market.\n *\n * Permissionless and standalone: anyone may call it at any cadence. Handles all\n * three per-market cases — initial funding of a freshly registered (unfunded)\n * market, ongoing live rebalance/surplus-sweep toward target, and the\n * settled-market sweep (deactivate, return all free cash, materialize profit).\n * Call `expiry_market::try_settle` first in the same PTB when settlement may be\n * due. An expired unsettled market is a no-op until that transition succeeds. Mint\n * asserts backing but never pulls pool cash, so this is what makes a market\n * mintable. The market must already be registered to this vault\n * (`registry::create_and_share_expiry_market`). Runs at any time, including while\n * a flush is in flight — every figure the mark reads was frozen at the snapshot\n * instant, so no move here can reach it. The one refusal is the still-open\n * snapshot stage (start → seal, a single transaction): a cross-move landing\n * between a market's stamp and the seal's vault capture would skew the frozen\n * figures, so it is structurally rejected rather than corrected for.\n */\nexport function rebalanceExpiryCash(options: RebalanceExpiryCashOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null, null, '0x2::clock::Clock'] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'market', 'config'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'rebalance_expiry_cash',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface SponsorFeeIncentivesArguments {\n\tvault?: RawTransactionArgument<string>;\n\tconfig?: RawTransactionArgument<string>;\n\tpayment: RawTransactionArgument<string>;\n}\nexport interface SponsorFeeIncentivesOptions {\n\tpackage?: string;\n\targuments: SponsorFeeIncentivesArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Sponsor taker fee incentives with USDC. Anyone may contribute; the payment joins\n * a pool-level reserve that is excluded from PLP NAV and later allocated to expiry\n * markets by the normal rebalance flow.\n */\nexport function sponsorFeeIncentives(options: SponsorFeeIncentivesOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null, null] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'config', 'payment'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'sponsor_fee_incentives',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface LockCapitalArguments {\n\tvault?: RawTransactionArgument<string>;\n\tconfig?: RawTransactionArgument<string>;\n\tAdminCap: RawTransactionArgument<string>;\n\tpayment: RawTransactionArgument<string>;\n}\nexport interface LockCapitalOptions {\n\tpackage?: string;\n\targuments: LockCapitalArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Bootstrap the pool exactly once: permanently lock `payment` USDC of minimum\n * liquidity. Mints matching PLP (1:1) into the book's locked balance — never\n * withdrawable, so the caller receives no shares — and joins the USDC into idle.\n * This keeps `total_supply > 0` while the vault exists and gives rounding dust a\n * non-withdrawable PLP holder. Requires root authority and zero existing supply.\n * Supply, withdrawal, and flush flows remain disabled until the locked liquidity\n * has been created.\n */\nexport function lockCapital(options: LockCapitalOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null, null, null] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'config', 'AdminCap', 'payment'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'lock_capital',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface RequestSupplyArguments {\n\tvault?: RawTransactionArgument<string>;\n\twrapper: RawTransactionArgument<string>;\n\tauth: TransactionArgument;\n\tconfig?: RawTransactionArgument<string>;\n\tamount: RawTransactionArgument<number | bigint>;\n\tminPlpOut: RawTransactionArgument<number | bigint>;\n}\nexport interface RequestSupplyOptions {\n\tpackage?: string;\n\targuments: RequestSupplyArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Queue a supply request: pull `amount` USDC from account custody into queue\n * escrow, recording the account's receive address as the fill recipient. The pull\n * auto-settles any flush-delivered USDC first. The flush charges the protocol's\n * supply fee — zero by default — on the USDC it takes in and prices shares on the\n * remainder, so `min_plp_out` is measured after that fee. The account receives\n * minted PLP only at a mark that mints at least `min_plp_out` for the whole\n * `amount` — a **price floor**, not a promise of that many shares: if the pool cap\n * leaves room for only part of the deposit, the fill is proportionally smaller at\n * the same price and the remainder stays queued with its limit rescaled. At the\n * shipped attempt count of one, a flush whose mark quotes less cancels and refunds\n * the request there and then; a higher configured count lets it rest and retry\n * that many flushes first. Returns the queue index, the handle used to cancel\n * before the flush.\n */\nexport function requestSupply(options: RequestSupplyOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'u64',\n\t\t'u64',\n\t\t'0x2::accumulator::AccumulatorRoot',\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'wrapper', 'auth', 'config', 'amount', 'minPlpOut'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'request_supply',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface RequestWithdrawArguments {\n\tvault?: RawTransactionArgument<string>;\n\twrapper: RawTransactionArgument<string>;\n\tauth: TransactionArgument;\n\tconfig?: RawTransactionArgument<string>;\n\tamount: RawTransactionArgument<number | bigint>;\n\tminUsdcOut: RawTransactionArgument<number | bigint>;\n}\nexport interface RequestWithdrawOptions {\n\tpackage?: string;\n\targuments: RequestWithdrawArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Queue a withdraw request: pull `amount` PLP shares from account custody into\n * queue escrow, recording the account's receive address as the fill recipient. The\n * pull auto-settles any flush-delivered PLP first. The flush withholds the\n * protocol's withdraw fee from the marked payout, so `min_usdc_out` is measured\n * after the fee. The account is paid only at a mark that quotes at least\n * `min_usdc_out` for the whole `amount` — a **price floor**, not a promise of that\n * much USDC: if idle liquidity covers only part of the payout, only the shares\n * idle affords are burned, the fill is proportionally smaller at the same price,\n * and the remainder stays queued with its limit rescaled. At the shipped attempt\n * count of one, a flush whose mark quotes less cancels and refunds the request\n * there and then; a higher configured count lets it rest and retry that many\n * flushes first. Returns the queue index used to cancel before the flush.\n */\nexport function requestWithdraw(options: RequestWithdrawOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'u64',\n\t\t'u64',\n\t\t'0x2::accumulator::AccumulatorRoot',\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'wrapper', 'auth', 'config', 'amount', 'minUsdcOut'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'request_withdraw',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface CancelSupplyRequestArguments {\n\tvault?: RawTransactionArgument<string>;\n\twrapper: RawTransactionArgument<string>;\n\tauth: TransactionArgument;\n\tconfig?: RawTransactionArgument<string>;\n\tindex: RawTransactionArgument<number | bigint>;\n}\nexport interface CancelSupplyRequestOptions {\n\tpackage?: string;\n\targuments: CancelSupplyRequestArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Cancel a still-pending supply request, refunding its escrowed USDC straight into\n * the requesting account. `account` must be the request's recorded recipient.\n */\nexport function cancelSupplyRequest(options: CancelSupplyRequestOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'u64',\n\t\t'0x2::accumulator::AccumulatorRoot',\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'wrapper', 'auth', 'config', 'index'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'cancel_supply_request',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface CancelWithdrawRequestArguments {\n\tvault?: RawTransactionArgument<string>;\n\twrapper: RawTransactionArgument<string>;\n\tauth: TransactionArgument;\n\tconfig?: RawTransactionArgument<string>;\n\tindex: RawTransactionArgument<number | bigint>;\n}\nexport interface CancelWithdrawRequestOptions {\n\tpackage?: string;\n\targuments: CancelWithdrawRequestArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Cancel a still-pending withdraw request, refunding its escrowed PLP straight\n * into the requesting account. `account` must be the request's recorded recipient.\n */\nexport function cancelWithdrawRequest(options: CancelWithdrawRequestOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'u64',\n\t\t'0x2::accumulator::AccumulatorRoot',\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'wrapper', 'auth', 'config', 'index'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'cancel_withdraw_request',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,cAAc;AACpB,MAAa,MAAM,IAAI,WAAW;CACjC,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,aAAa,IAAI,MAAM,EACvB;CACD,CAAC;AACF,MAAa,qBAAqB,IAAI,WAAW;CAChD,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,aAAa,IAAI,MAAM,EACvB;CACD,CAAC;AACF,MAAa,gBAAgB,IAAI,WAAW;CAC3C,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,aAAa,IAAI,MAAM,EACvB;CACD,CAAC;AACF,MAAa,gBAAgB,IAAI,WAAW;CAC3C,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,yBAAyB,IAAI,OAAO,IAAI,QAAQ;EAEhD,uBAAuB,IAAI,OAAO,IAAI,QAAQ;EAE9C,WAAW;EASX,gBAAgBA,OAAe,IAAI,SAAS,IAAI,OAAOC,aAAqB,CAAC;EAK7E,QAAQ,IAAI,MAAM;EAElB,eAAe;EAQf,eAAe,IAAI,OAAO,IAAI;EAC9B,iBAAiB,IAAI,OAAO,IAAI;EAMhC,uBAAuB;EACvB,yBAAyB;EASzB,qBAAqB;EACrB,6BAA6B;EAC7B,4BAA4B;EAC5B,gCAAgC;EAChC;CACD,CAAC;AACF,MAAa,YAAY,IAAI,WAAW;CACvC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,IAAI,IAAI;EAKR,0BAA0BC;EAE1B,uBAAuBA;EAEvB,IAAIC;EAEJ,mBAAmBC;EAKnB,WAAW,IAAI,OAAO,cAAc;EACpC;CACD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BACV;GACC,GAAG,QAAQ;GACX,OAAO,QAAQ,WAAW,SAAS,QAAQ,QAAQ;GACnD,QAAQ,QAAQ,WAAW,UAAU,QAAQ,QAAQ;GACrD,EACD,gBACA,eACA;EACD,CAAC;;;;;;AAsBJ,SAAgB,sBAAsB,SAAuC;CAC5E,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,MAAM,iBAAiB;EAAC;EAAS;EAAW;EAAQ;EAAU;EAAQ;AACtE,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBACV;GACC,GAAG,QAAQ;GACX,OAAO,QAAQ,WAAW,SAAS,QAAQ,QAAQ;GACnD,QAAQ,QAAQ,WAAW,UAAU,QAAQ,QAAQ;GACrD,EACD,gBACA,eACA;EACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"plp.mjs","names":["vec_map.VecMap","pricing.FrozenPricer","balance.Balance","lp_book.LpBook","pool_accounting.Ledger"],"sources":["../../../src/contracts/deepbook_predict/plp.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * PLP token and pool vault.\n *\n * PoolVault owns the PLP treasury cap, idle USDC, the protocol reserve,\n * sponsor-funded fee incentives, per-expiry cash accounting, and the queued LP\n * supply/withdraw requests. It coordinates the full-pool NAV valuation — an atomic\n * oracle snapshot followed by resumable per-market valuation transactions, with\n * trading live throughout (see `PoolValuation`) — and the unified per-market cash\n * flow (initial funding, live rebalance/sweep, and settled-market sweep with\n * terminal profit materialization). LPs queue supply/withdraw requests routed\n * through a loaded Account; each flush (`finish_flush`) drains the requests that\n * predate its snapshot at the frozen pool NAV, minting/burning PLP and delivering\n * fills to each account via the balance accumulator.\n */\n\nimport {\n\tMoveStruct,\n\tnormalizeMoveArguments,\n\ttype RawTransactionArgument,\n\ttype ConfigValue,\n} from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { U64 } from '../../bcs/integers.js';\nimport { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';\nimport * as vec_map from './deps/sui/vec_map.js';\nimport * as pricing from './pricing.js';\nimport * as balance from './deps/sui/balance.js';\nimport * as lp_book from './lp_book.js';\nimport * as pool_accounting from './pool_accounting.js';\nconst $moduleName = '@local-pkg/deepbook_predict::plp';\nexport const PLP = new MoveStruct({\n\tname: `${$moduleName}::PLP`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const PoolValuationProof = new MoveStruct({\n\tname: `${$moduleName}::PoolValuationProof`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const SnapshotStage = new MoveStruct({\n\tname: `${$moduleName}::SnapshotStage`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const PoolValuation = new MoveStruct({\n\tname: `${$moduleName}::PoolValuation`,\n\tfields: {\n\t\t/** Active expiry markets snapshotted at start; every one must be valued. */\n\t\texpected_expiry_markets: bcs.vector(bcs.Address),\n\t\t/** Markets valued so far this flush; folded against `expected` at finish. */\n\t\tvalued_expiry_markets: bcs.vector(bcs.Address),\n\t\t/** Running Σ of each valued market's snapshot NAV (settled markets contribute 0). */\n\t\ttotal_nav: U64,\n\t\t/**\n\t\t * Oracle state frozen during the snapshot stage, one entry per expected market.\n\t\t * Keyed by market id so a `Pricer` can never be applied to the wrong market.\n\t\t * `none` marks a market that was already settled at snapshot time and therefore\n\t\t * contributes 0. This map is what makes the valuation stage deterministic: it\n\t\t * decides both the mark AND the sweep-vs-value branch, so no later transaction's\n\t\t * clock or oracle state can change a market's contribution.\n\t\t */\n\t\tfrozen_pricers: vec_map.VecMap(bcs.Address, bcs.option(pricing.FrozenPricer)),\n\t\t/**\n\t\t * Set by `seal_valuation_snapshot`; no market may be valued before it. Nothing may\n\t\t * be snapshotted after it because sealing consumes the `SnapshotStage`.\n\t\t */\n\t\tsealed: bcs.bool(),\n\t\t/** Clock time the flush was started, for the stuck-flush deadline. */\n\t\tstarted_at_ms: U64,\n\t\t/**\n\t\t * Drain budgets committed at start (the cap owner's choice), bounding how many\n\t\t * requests each queue processes at finish. `finish_flush` takes no budget, so the\n\t\t * flush operator who completes it drains at exactly these.\n\t\t */\n\t\tsupply_budget: bcs.option(U64),\n\t\twithdraw_budget: bcs.option(U64),\n\t\t/**\n\t\t * Each LP queue's `next_index` at the snapshot instant: the drain fills only\n\t\t * requests indexed strictly below these, so nobody can watch the frozen mark form\n\t\t * and then submit against a price they already know is stale.\n\t\t */\n\t\tsupply_request_cutoff: U64,\n\t\twithdraw_request_cutoff: U64,\n\t\t/**\n\t\t * Vault-side figures captured by `seal_valuation_snapshot`. With every market's\n\t\t * cash frozen in its stamp and these frozen here, the mark is a pure function of\n\t\t * the snapshot instant: no in-window cash move — maintenance, settled sweep,\n\t\t * market funding, reserve realization — can reach it. Settled members are swept\n\t\t * during the snapshot stage, so their recoverable cash sits inside\n\t\t * `frozen_idle_balance`.\n\t\t */\n\t\tfrozen_idle_balance: U64,\n\t\tfrozen_profit_basis_credits: U64,\n\t\tfrozen_profit_basis_debits: U64,\n\t\tfrozen_pending_protocol_profit: U64,\n\t},\n});\nexport const PoolVault = new MoveStruct({\n\tname: `${$moduleName}::PoolVault`,\n\tfields: {\n\t\tid: bcs.Address,\n\t\t/**\n\t\t * Protocol-owned USDC excluded from PLP redemption. No package entrypoint\n\t\t * withdraws this balance.\n\t\t */\n\t\tprotocol_reserve_balance: balance.Balance,\n\t\t/**\n\t\t * Sponsor-funded USDC reserved for taker fee sponsorship, excluded from PLP NAV.\n\t\t * Admin may reclaim it through `withdraw_fee_incentives`.\n\t\t */\n\t\tfee_incentive_reserve: balance.Balance,\n\t\t/** PLP share issuance plus queued supply/withdraw escrow. */\n\t\tlp: lp_book.LpBook,\n\t\t/** Idle USDC custody, registered expiries, and per-expiry cash-flow rows. */\n\t\texpiry_accounting: pool_accounting.Ledger,\n\t\t/**\n\t\t * In-flight full-pool valuation, held across transactions. `Some` exactly while\n\t\t * the `ProtocolConfig` valuation flag is engaged.\n\t\t */\n\t\tvaluation: bcs.option(PoolValuation),\n\t},\n});\nexport interface IdArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface IdOptions {\n\tpackage?: string;\n\targuments?: IdArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return the pool vault object ID for external discovery and PTB construction. */\nexport function id(options: IdOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'id',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface IdleBalanceArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface IdleBalanceOptions {\n\tpackage?: string;\n\targuments?: IdleBalanceArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return idle USDC for SDK and devInspect state reads. */\nexport function idleBalance(options: IdleBalanceOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'idle_balance',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface ProtocolReserveBalanceArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface ProtocolReserveBalanceOptions {\n\tpackage?: string;\n\targuments?: ProtocolReserveBalanceArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return protocol-owned USDC for SDK and devInspect state reads. */\nexport function protocolReserveBalance(options: ProtocolReserveBalanceOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'protocol_reserve_balance',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface FeeIncentiveReserveArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface FeeIncentiveReserveOptions {\n\tpackage?: string;\n\targuments?: FeeIncentiveReserveArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return sponsor-funded fee reserves for SDK and devInspect state reads. */\nexport function feeIncentiveReserve(options: FeeIncentiveReserveOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'fee_incentive_reserve',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface PlpTotalSupplyArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface PlpTotalSupplyOptions {\n\tpackage?: string;\n\targuments?: PlpTotalSupplyArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return total PLP supply for SDK and devInspect state reads. */\nexport function plpTotalSupply(options: PlpTotalSupplyOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'plp_total_supply',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface SupplyRequestsPendingArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface SupplyRequestsPendingOptions {\n\tpackage?: string;\n\targuments?: SupplyRequestsPendingArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return pending LP supply count for SDK and devInspect queue reads. */\nexport function supplyRequestsPending(options: SupplyRequestsPendingOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'supply_requests_pending',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface WithdrawRequestsPendingArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface WithdrawRequestsPendingOptions {\n\tpackage?: string;\n\targuments?: WithdrawRequestsPendingArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return pending LP withdrawal count for SDK and devInspect queue reads. */\nexport function withdrawRequestsPending(options: WithdrawRequestsPendingOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'withdraw_requests_pending',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface ActiveExpiryMarketsArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface ActiveExpiryMarketsOptions {\n\tpackage?: string;\n\targuments?: ActiveExpiryMarketsArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return active expiry IDs for external PTB construction and pool inspection. */\nexport function activeExpiryMarkets(options: ActiveExpiryMarketsOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'active_expiry_markets',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface ActiveLiveExpiryCountArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface ActiveLiveExpiryCountOptions {\n\tpackage?: string;\n\targuments?: ActiveLiveExpiryCountArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return the pre-expiry active count for SDK and devInspect capacity reads. */\nexport function activeLiveExpiryCount(options: ActiveLiveExpiryCountOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, '0x2::clock::Clock'] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'active_live_expiry_count',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface ProfitBasisDebitsArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface ProfitBasisDebitsOptions {\n\tpackage?: string;\n\targuments?: ProfitBasisDebitsArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return the profit-basis debits for external accounting observability. */\nexport function profitBasisDebits(options: ProfitBasisDebitsOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'profit_basis_debits',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface ProfitBasisCreditsArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface ProfitBasisCreditsOptions {\n\tpackage?: string;\n\targuments?: ProfitBasisCreditsArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return the profit-basis credits for external accounting observability. */\nexport function profitBasisCredits(options: ProfitBasisCreditsOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'profit_basis_credits',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface PendingProtocolProfitArguments {\n\tvault?: RawTransactionArgument<string>;\n}\nexport interface PendingProtocolProfitOptions {\n\tpackage?: string;\n\targuments?: PendingProtocolProfitArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return deferred protocol profit for external accounting observability. */\nexport function pendingProtocolProfit(options: PendingProtocolProfitOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['vault'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'pending_protocol_profit',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface StartPoolValuationArguments {\n\tconfig?: RawTransactionArgument<string>;\n\tvault?: RawTransactionArgument<string>;\n\tvaluationProof: TransactionArgument;\n\tsupplyBudget: RawTransactionArgument<number | bigint | null>;\n\twithdrawBudget: RawTransactionArgument<number | bigint | null>;\n}\nexport interface StartPoolValuationOptions {\n\tpackage?: string;\n\targuments: StartPoolValuationArguments;\n\tconfig?: {\n\t\tprotocolConfig: ConfigValue;\n\t\tpoolVault: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Begin a full-pool valuation using a registry-issued pool-valuation proof. The\n * proof grants control over when current oracle state is frozen for queued LP\n * fills. Starting engages the cross-transaction valuation flag, snapshots the\n * active expiry set and each LP queue's eligibility cutoff, and opens the atomic\n * snapshot stage: freeze every active market's pricer under the returned\n * `SnapshotStage`, then seal it in the same transaction.\n */\nexport function startPoolValuation(options: StartPoolValuationOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'0x1::option::Option<u64>',\n\t\t'0x1::option::Option<u64>',\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = ['config', 'vault', 'valuationProof', 'supplyBudget', 'withdrawBudget'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'start_pool_valuation',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface SnapshotExpiryPricerArguments {\n\tvault?: RawTransactionArgument<string>;\n\tStage: TransactionArgument;\n\tmarket: RawTransactionArgument<string>;\n\tconfig?: RawTransactionArgument<string>;\n\tpropbookRegistry?: RawTransactionArgument<string>;\n\tpyth: RawTransactionArgument<string>;\n\tbsValues: RawTransactionArgument<string>;\n\tbsSvi: RawTransactionArgument<string>;\n}\nexport interface SnapshotExpiryPricerOptions {\n\tpackage?: string;\n\targuments: SnapshotExpiryPricerArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\toracleRegistry: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Freeze one snapshotted market's oracle state for this flush and stamp the\n * market, capturing its cash rows and activating its payout-tree snapshot at this\n * instant.\n *\n * Holding `SnapshotStage` is what admits this call, and that potato cannot leave\n * the transaction `start_pool_valuation` minted it in — so every `Pricer` here is\n * loaded at one instant, which is what lets the valuation stage span transactions\n * without mixing marks (audit L10). This stage reads oracles only — it never walks\n * a payout tree — so all markets fit one PTB regardless of book size.\n *\n * The oracle feeding this stage must have been written in an EARLIER transaction:\n * `pricing::resolve_live` refuses a read stamped with the current transaction\n * digest (RP-24), so a keeper cannot refresh and snapshot in one PTB.\n *\n * A market already settled at snapshot time is recorded with no pricer, gets no\n * stamp (settled flows never touch live NAV), and contributes 0. An\n * expired-but-unsettled market aborts: it has no well-defined mark, and because\n * this stage is atomic the abort reverts the whole snapshot transaction, so the\n * flag is never left engaged. Settle it first, then start the flush; settlement is\n * never blocked by a flush, so that ordering is always available.\n */\nexport function snapshotExpiryPricer(options: SnapshotExpiryPricerOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = [\n\t\t'vault',\n\t\t'Stage',\n\t\t'market',\n\t\t'config',\n\t\t'propbookRegistry',\n\t\t'pyth',\n\t\t'bsValues',\n\t\t'bsSvi',\n\t];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'snapshot_expiry_pricer',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t\tpropbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface SealValuationSnapshotArguments {\n\tvault?: RawTransactionArgument<string>;\n\tstage: TransactionArgument;\n\tconfig?: RawTransactionArgument<string>;\n}\nexport interface SealValuationSnapshotOptions {\n\tpackage?: string;\n\targuments: SealValuationSnapshotArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Close the snapshot stage once every expected market has a frozen pricer, and\n * freeze the vault-side figures — idle, the profit basis, the pending protocol cut\n * — completing the snapshot.\n *\n * Consuming `SnapshotStage` is the simultaneity proof: the potato dies here, so no\n * later transaction can add oracle state to this flush, and every market is marked\n * at the instant the snapshot transaction executed. The vault capture is\n * consistent with the per-market stamps because `rebalance_expiry_cash` refuses to\n * run while the stage is open (`ESnapshotStageOpen`), so no idle↔market move can\n * land between a stamp and this capture. Valuation may then resume across as many\n * transactions as it needs.\n */\nexport function sealValuationSnapshot(options: SealValuationSnapshotOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null, null] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'stage', 'config'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'seal_valuation_snapshot',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface ValueExpiryArguments {\n\tvault?: RawTransactionArgument<string>;\n\tmarket: RawTransactionArgument<string>;\n\tconfig?: RawTransactionArgument<string>;\n}\nexport interface ValueExpiryOptions {\n\tpackage?: string;\n\targuments: ValueExpiryArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Fold one snapshotted market's SNAPSHOT-INSTANT NAV into the running total. A\n * market frozen as settled is swept and contributes 0; one frozen with a pricer is\n * valued via `expiry_market::snapshot_nav` over its captured cash and tree\n * shadows, then has its stamp cleared (releasing the tree snapshot), so later\n * trades and the next flush start clean.\n *\n * The resumable stage: any transaction after the seal, one market per transaction\n * (`constants::max_payout_tree_nodes`), reading no oracle and no clock.\n * MEASUREMENT-ONLY for every member — settled members were swept during the\n * snapshot stage and every frozen figure was captured there, so this call moves no\n * cash and `rebalance_expiry_cash` runs at any time. A market that expired\n * mid-window is valued at its frozen pre-expiry mark; its settlement does not wait\n * for this call, because settlement is never blocked by a flush.\n */\nexport function valueExpiry(options: ValueExpiryOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null, null] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'market', 'config'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'value_expiry',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface FinishFlushArguments {\n\tvault?: RawTransactionArgument<string>;\n\tconfig?: RawTransactionArgument<string>;\n}\nexport interface FinishFlushOptions {\n\tpackage?: string;\n\targuments?: FinishFlushArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Finish a full-pool valuation and run the LP flush: prove every snapshotted\n * market was valued exactly once, price the pool NAV, then drain the\n * supply/withdraw queues at that frozen mark (mint PLP for supplies, burn PLP and\n * pay USDC for withdrawals), release the valuation flag, retire the in-flight\n * valuation, and return the LP-attributable pool-wide USDC NAV (frozen idle + Σ\n * active NAV, net of the pending-protocol-profit exclusion priced from the frozen\n * profit basis — every term as of the snapshot instant). Each drain fills only\n * requests submitted before the flush's snapshot instant (the recorded queue\n * cutoffs); younger requests wait for the next mark.\n *\n * `supply_budget` and `withdraw_budget` bound how many requests each queue may\n * process this flush (`None` = unbounded). Fills — whole or partial — and\n * protocol-refunded heads — non-executable, or quoting below the request's own\n * minimum output — all count as processed. At `ProtocolConfig`'s shipped attempt\n * count of one, a head that misses its limit is refunded by the flush that reaches\n * it; above one it stays queued and stops that queue for the flush. The budgets\n * are independent, so a supply backlog does not consume withdrawal capacity.\n *\n * Capacity bounds each pass on top of the budgets and refunds nothing: supplies\n * fill only up to `ProtocolConfig`'s LP pool-value cap, withdrawals only up to\n * idle. A head larger than the room left fills to the room, spends flush budget,\n * and keeps its remainder queued at a rescaled limit; a head with no usable room\n * carries untouched and spends none. Either way the pass stops, so an unbounded\n * budget does not mean every queued request is processed (RP-23).\n *\n * Because queueing is permissionless and a refunded request returns its escrow in\n * the same transaction, an operator should bound both budgets in production rather\n * than rely on queue length staying small — see RP-12.\n *\n * Only an allowlisted flush operator may call it\n * (`protocol_config::ENotFlushOperator`). Fills move idle cash, so restricting who\n * completes a flush keeps idle predictable for the keeper that funds markets for\n * queued orders.\n */\nexport function finishFlush(options: FinishFlushOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null, '0x2::clock::Clock'] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'config'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'finish_flush',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface RebalanceExpiryCashArguments {\n\tvault?: RawTransactionArgument<string>;\n\tmarket: RawTransactionArgument<string>;\n\tconfig?: RawTransactionArgument<string>;\n}\nexport interface RebalanceExpiryCashOptions {\n\tpackage?: string;\n\targuments: RebalanceExpiryCashArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Move cash between pool idle liquidity and one expiry market.\n *\n * Permissionless and standalone: anyone may call it at any cadence. Handles all\n * three per-market cases — initial funding of a freshly registered (unfunded)\n * market, ongoing live rebalance/surplus-sweep toward target, and the\n * settled-market sweep (deactivate, return all free cash, materialize profit). The\n * live target covers the market's queued orders' cash need (the waiting cash need\n * in `expiry_market::order_flow_state`), so the keeper calls this after each\n * enqueue to fund those orders' fills, and a sweep never takes that cash back.\n * Call `expiry_market::try_settle` first in the same PTB when settlement may be\n * due. An expired unsettled market is a no-op until that transition succeeds. Mint\n * asserts backing but never pulls pool cash, so this is what makes a market\n * mintable. The market must already be registered to this vault\n * (`registry::create_and_share_expiry_market`). Runs at any time, including while\n * a flush is in flight — every figure the mark reads was frozen at the snapshot\n * instant, so no move here can reach it. The one refusal is the still-open\n * snapshot stage (start → seal, a single transaction): a cross-move landing\n * between a market's stamp and the seal's vault capture would skew the frozen\n * figures, so it is structurally rejected rather than corrected for.\n */\nexport function rebalanceExpiryCash(options: RebalanceExpiryCashOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null, null, '0x2::clock::Clock'] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'market', 'config'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'rebalance_expiry_cash',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface SponsorFeeIncentivesArguments {\n\tvault?: RawTransactionArgument<string>;\n\tconfig?: RawTransactionArgument<string>;\n\tpayment: RawTransactionArgument<string>;\n}\nexport interface SponsorFeeIncentivesOptions {\n\tpackage?: string;\n\targuments: SponsorFeeIncentivesArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Sponsor taker fee incentives with USDC. Anyone may contribute; the payment joins\n * a pool-level reserve that is excluded from PLP NAV and later allocated to expiry\n * markets by the normal rebalance flow. A contribution is not earmarked to its\n * sponsor: admin can withdraw any of the reserve through\n * `withdraw_fee_incentives`.\n */\nexport function sponsorFeeIncentives(options: SponsorFeeIncentivesOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null, null] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'config', 'payment'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'sponsor_fee_incentives',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface WithdrawFeeIncentivesArguments {\n\tvault?: RawTransactionArgument<string>;\n\tAdminCap: RawTransactionArgument<string>;\n\tconfig?: RawTransactionArgument<string>;\n\tamount: RawTransactionArgument<number | bigint>;\n}\nexport interface WithdrawFeeIncentivesOptions {\n\tpackage?: string;\n\targuments: WithdrawFeeIncentivesArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Withdraw `amount` USDC of sponsor-funded fee incentives from the pool-level\n * reserve, for sponsorship the protocol no longer wants to spend. Admin-only.\n *\n * Reaches the reserve only. Incentives already allocated to a live market stay in\n * that market's `fee_incentive_balance` and return to the reserve when its\n * settled-market sweep runs, after which they can be withdrawn here; setting\n * `protocol_config::set_fee_incentive_subsidy_rate` to zero stops them being spent\n * in the meantime. The per-expiry lifetime allocation counters are not credited\n * back: they bound what a market may ever receive, and a withdrawal does not\n * change what a market already received.\n *\n * Not gated on the valuation flag, in either stage of a flush: the reserve is\n * excluded from PLP NAV and no flush figure, frozen or live, reads it, so a\n * withdrawal cannot reach the mark.\n */\nexport function withdrawFeeIncentives(options: WithdrawFeeIncentivesOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null, null, 'u64'] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'AdminCap', 'config', 'amount'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'withdraw_fee_incentives',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface AddUsdcToPlpArguments {\n\tvault?: RawTransactionArgument<string>;\n\tconfig?: RawTransactionArgument<string>;\n\tpayment: RawTransactionArgument<string>;\n}\nexport interface AddUsdcToPlpOptions {\n\tpackage?: string;\n\targuments: AddUsdcToPlpArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Add USDC straight to pool idle liquidity without minting any PLP. Anyone may\n * call it; the payment is an outright gift to the existing share base, so the\n * caller receives nothing back and no share of it is recoverable.\n *\n * This is the incentive/top-up path: because no shares are issued, the whole\n * `payment` lands inside the value the next flush's mark divides by an unchanged\n * `total_supply`, which raises NAV per PLP for every current holder. It\n * deliberately does not touch the profit basis — the basis tracks cash sent to and\n * returned from expiries, so an outside contribution is neither a debit nor a\n * credit, and the protocol reserve therefore takes no cut of it (`pool_value`\n * leaves `exclusion` unchanged while `gross_pool_value` grows). Sending the same\n * USDC through `request_supply` instead mints shares against it, so only the\n * supply fee would reach existing holders — zero as shipped.\n *\n * Three gates, each closing a state this entrypoint would otherwise manufacture:\n *\n * - **Bootstrapped pool.** At `total_supply == 0` there is no share base to\n * credit; the USDC would only inflate the genesis lock's non-withdrawable stake.\n * - **Contribution price ceiling.** Pool cash after the contribution — idle plus\n * the net cash deployed into active expiries — may price at most\n * `contribution_price_ceiling_factor` USDC per PLP, a tenth of the band a flush\n * mark needs to be fillable. Above the band every supply and withdraw head is\n * refunded (RP-2) and `total_supply` grows only through a supply fill, so\n * nothing brings the price back down — a terminal state that an unbounded\n * contribution against a small share base would otherwise reach for the price of\n * the contribution. The ceiling sits well inside the band because later fills\n * only push the price up (rounding and retained fees stay in the pool), so a\n * pool left exactly at the band would leave it on the next uneven or fee-charged\n * fill. The test is one-sided because a contribution can only move the price up.\n * It reads pool cash rather than pool NAV — NAV needs a flush — and counts\n * deployed cash because the mark does: `rebalance_expiry_cash` is\n * permissionless, so an idle-only test could be emptied into a market and passed\n * again. Cash is exactly the protocol-controlled share: the guard forbids this\n * entrypoint from _manufacturing_ the degenerate ratio and leaves market-driven\n * NAV moves (trader premiums and P&L) to RP-1/RP-2, which own them.\n * - **No flush in flight.** The seal freezes idle mid-flush, so an ungated\n * contribution would land on one side or the other of that capture depending\n * only on when the contributor's transaction executed — either paying that\n * flush's queued withdrawals or not. `sponsor_fee_incentives` takes the same\n * gate. `rebalance_expiry_cash` may run mid-window because it only moves cash\n * between two figures the seal already froze; new value is different.\n */\nexport function addUsdcToPlp(options: AddUsdcToPlpOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null, null] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'config', 'payment'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'add_usdc_to_plp',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface LockCapitalArguments {\n\tvault?: RawTransactionArgument<string>;\n\tconfig?: RawTransactionArgument<string>;\n\tAdminCap: RawTransactionArgument<string>;\n\tpayment: RawTransactionArgument<string>;\n}\nexport interface LockCapitalOptions {\n\tpackage?: string;\n\targuments: LockCapitalArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Bootstrap the pool exactly once: permanently lock `payment` USDC of minimum\n * liquidity. Mints matching PLP (1:1) into the book's locked balance — never\n * withdrawable, so the caller receives no shares — and joins the USDC into idle.\n * This keeps `total_supply > 0` while the vault exists and gives rounding dust a\n * non-withdrawable PLP holder. Requires root authority and zero existing supply.\n * Supply, withdrawal, and flush flows remain disabled until the locked liquidity\n * has been created.\n */\nexport function lockCapital(options: LockCapitalOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null, null, null] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'config', 'AdminCap', 'payment'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'lock_capital',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface RequestSupplyArguments {\n\tvault?: RawTransactionArgument<string>;\n\twrapper: RawTransactionArgument<string>;\n\tauth: TransactionArgument;\n\tconfig?: RawTransactionArgument<string>;\n\tamount: RawTransactionArgument<number | bigint>;\n\tminPlpOut: RawTransactionArgument<number | bigint>;\n}\nexport interface RequestSupplyOptions {\n\tpackage?: string;\n\targuments: RequestSupplyArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Queue a supply request: pull `amount` USDC from account custody into queue\n * escrow, recording the account's receive address as the fill recipient. The pull\n * auto-settles any flush-delivered USDC first. The flush charges the protocol's\n * supply fee — zero by default — on the USDC it takes in and prices shares on the\n * remainder, so `min_plp_out` is measured after that fee. The account receives\n * minted PLP only at a mark that mints at least `min_plp_out` for the whole\n * `amount` — a **price floor**, not a promise of that many shares: if the pool cap\n * leaves room for only part of the deposit, the fill is proportionally smaller at\n * the same price and the remainder stays queued with its limit rescaled. At the\n * shipped attempt count of one, a flush whose mark quotes less cancels and refunds\n * the request there and then; a higher configured count lets it rest and retry\n * that many flushes first. Returns the queue index, the handle used to cancel\n * before the flush.\n */\nexport function requestSupply(options: RequestSupplyOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'u64',\n\t\t'u64',\n\t\t'0x2::accumulator::AccumulatorRoot',\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'wrapper', 'auth', 'config', 'amount', 'minPlpOut'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'request_supply',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface RequestWithdrawArguments {\n\tvault?: RawTransactionArgument<string>;\n\twrapper: RawTransactionArgument<string>;\n\tauth: TransactionArgument;\n\tconfig?: RawTransactionArgument<string>;\n\tamount: RawTransactionArgument<number | bigint>;\n\tminUsdcOut: RawTransactionArgument<number | bigint>;\n}\nexport interface RequestWithdrawOptions {\n\tpackage?: string;\n\targuments: RequestWithdrawArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Queue a withdraw request: pull `amount` PLP shares from account custody into\n * queue escrow, recording the account's receive address as the fill recipient. The\n * pull auto-settles any flush-delivered PLP first. The flush withholds the\n * protocol's withdraw fee from the marked payout, so `min_usdc_out` is measured\n * after the fee. The account is paid only at a mark that quotes at least\n * `min_usdc_out` for the whole `amount` — a **price floor**, not a promise of that\n * much USDC: if idle liquidity covers only part of the payout, only the shares\n * idle affords are burned, the fill is proportionally smaller at the same price,\n * and the remainder stays queued with its limit rescaled. At the shipped attempt\n * count of one, a flush whose mark quotes less cancels and refunds the request\n * there and then; a higher configured count lets it rest and retry that many\n * flushes first. Returns the queue index used to cancel before the flush.\n */\nexport function requestWithdraw(options: RequestWithdrawOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'u64',\n\t\t'u64',\n\t\t'0x2::accumulator::AccumulatorRoot',\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'wrapper', 'auth', 'config', 'amount', 'minUsdcOut'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'request_withdraw',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface CancelSupplyRequestArguments {\n\tvault?: RawTransactionArgument<string>;\n\twrapper: RawTransactionArgument<string>;\n\tauth: TransactionArgument;\n\tconfig?: RawTransactionArgument<string>;\n\tindex: RawTransactionArgument<number | bigint>;\n}\nexport interface CancelSupplyRequestOptions {\n\tpackage?: string;\n\targuments: CancelSupplyRequestArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Cancel a still-pending supply request, refunding its escrowed USDC straight into\n * the requesting account. `account` must be the request's recorded recipient.\n */\nexport function cancelSupplyRequest(options: CancelSupplyRequestOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'u64',\n\t\t'0x2::accumulator::AccumulatorRoot',\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'wrapper', 'auth', 'config', 'index'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'cancel_supply_request',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\nexport interface CancelWithdrawRequestArguments {\n\tvault?: RawTransactionArgument<string>;\n\twrapper: RawTransactionArgument<string>;\n\tauth: TransactionArgument;\n\tconfig?: RawTransactionArgument<string>;\n\tindex: RawTransactionArgument<number | bigint>;\n}\nexport interface CancelWithdrawRequestOptions {\n\tpackage?: string;\n\targuments: CancelWithdrawRequestArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Cancel a still-pending withdraw request, refunding its escrowed PLP straight\n * into the requesting account. `account` must be the request's recorded recipient.\n */\nexport function cancelWithdrawRequest(options: CancelWithdrawRequestOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'u64',\n\t\t'0x2::accumulator::AccumulatorRoot',\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = ['vault', 'wrapper', 'auth', 'config', 'index'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'plp',\n\t\t\tfunction: 'cancel_withdraw_request',\n\t\t\targuments: normalizeMoveArguments(\n\t\t\t\t{\n\t\t\t\t\t...options.arguments,\n\t\t\t\t\tvault: options.arguments?.vault ?? options.config?.poolVault,\n\t\t\t\t\tconfig: options.arguments?.config ?? options.config?.protocolConfig,\n\t\t\t\t},\n\t\t\t\targumentsTypes,\n\t\t\t\tparameterNames,\n\t\t\t),\n\t\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,cAAc;AACpB,MAAa,MAAM,IAAI,WAAW;CACjC,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,aAAa,IAAI,MAAM,EACvB;CACD,CAAC;AACF,MAAa,qBAAqB,IAAI,WAAW;CAChD,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,aAAa,IAAI,MAAM,EACvB;CACD,CAAC;AACF,MAAa,gBAAgB,IAAI,WAAW;CAC3C,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,aAAa,IAAI,MAAM,EACvB;CACD,CAAC;AACF,MAAa,gBAAgB,IAAI,WAAW;CAC3C,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,yBAAyB,IAAI,OAAO,IAAI,QAAQ;EAEhD,uBAAuB,IAAI,OAAO,IAAI,QAAQ;E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AAM,iBAAiB;EAAC;EAAS;EAAW;EAAQ;EAAU;EAAQ;AACtE,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBACV;GACC,GAAG,QAAQ;GACX,OAAO,QAAQ,WAAW,SAAS,QAAQ,QAAQ;GACnD,QAAQ,QAAQ,WAAW,UAAU,QAAQ,QAAQ;GACrD,EACD,gBACA,eACA;EACD,CAAC;;;;;;AAsBJ,SAAgB,sBAAsB,SAAuC;CAC5E,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,MAAM,iBAAiB;EAAC;EAAS;EAAW;EAAQ;EAAU;EAAQ;AACtE,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBACV;GACC,GAAG,QAAQ;GACX,OAAO,QAAQ,WAAW,SAAS,QAAQ,QAAQ;GACnD,QAAQ,QAAQ,WAAW,UAAU,QAAQ,QAAQ;GACrD,EACD,gBACA,eACA;EACD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MoveStruct } from "../utils/index.mjs";
|
|
2
2
|
import { U64 } from "../../bcs/integers.mjs";
|
|
3
|
-
import { Table } from "./deps/sui/table.mjs";
|
|
4
3
|
import { Balance } from "./deps/sui/balance.mjs";
|
|
4
|
+
import { Table } from "./deps/sui/table.mjs";
|
|
5
5
|
import { bcs } from "@mysten/sui/bcs";
|
|
6
6
|
|
|
7
7
|
//#region src/contracts/deepbook_predict/pool_accounting.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MoveStruct, RawTransactionArgument } from "../utils/index.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _mysten_sui_bcs117 from "@mysten/sui/bcs";
|
|
3
|
+
import * as _mysten_sui_transactions175 from "@mysten/sui/transactions";
|
|
4
4
|
import { Transaction } from "@mysten/sui/transactions";
|
|
5
5
|
|
|
6
6
|
//#region src/contracts/deepbook_predict/pool_valuation_cap.d.ts
|
|
@@ -8,7 +8,7 @@ declare namespace pool_valuation_cap_d_exports {
|
|
|
8
8
|
export { DestroyArguments, DestroyOptions, IdArguments, IdOptions, PoolValuationCap, destroy, id };
|
|
9
9
|
}
|
|
10
10
|
declare const PoolValuationCap: MoveStruct<{
|
|
11
|
-
id:
|
|
11
|
+
id: _mysten_sui_bcs117.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
12
12
|
}, "@local-pkg/deepbook_predict::pool_valuation_cap::PoolValuationCap">;
|
|
13
13
|
interface IdArguments {
|
|
14
14
|
cap: RawTransactionArgument<string>;
|
|
@@ -21,7 +21,7 @@ interface IdOptions {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
/** Returns the capability identity used by the registry allowlist. */
|
|
24
|
-
declare function id(options: IdOptions): (tx: Transaction) =>
|
|
24
|
+
declare function id(options: IdOptions): (tx: Transaction) => _mysten_sui_transactions175.TransactionResult;
|
|
25
25
|
interface DestroyArguments {
|
|
26
26
|
cap: RawTransactionArgument<string>;
|
|
27
27
|
}
|
|
@@ -33,7 +33,7 @@ interface DestroyOptions {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
/** Destroy a `PoolValuationCap` the holder no longer needs. */
|
|
36
|
-
declare function destroy(options: DestroyOptions): (tx: Transaction) =>
|
|
36
|
+
declare function destroy(options: DestroyOptions): (tx: Transaction) => _mysten_sui_transactions175.TransactionResult;
|
|
37
37
|
//#endregion
|
|
38
38
|
export { pool_valuation_cap_d_exports };
|
|
39
39
|
//# sourceMappingURL=pool_valuation_cap.d.mts.map
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { MoveStruct, MoveTuple, RawTransactionArgument } from "../utils/index.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _mysten_sui_bcs49 from "@mysten/sui/bcs";
|
|
3
|
+
import * as _mysten_sui_transactions166 from "@mysten/sui/transactions";
|
|
4
4
|
import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
|
|
5
5
|
|
|
6
6
|
//#region src/contracts/deepbook_predict/predict_account.d.ts
|
|
7
7
|
declare namespace predict_account_d_exports {
|
|
8
8
|
export { BuilderCodeIdArguments, BuilderCodeIdOptions, HasPositionArguments, HasPositionOptions, Position, PositionKey, PredictApp, PredictData, SetBuilderCodeArguments, SetBuilderCodeOptions, UnsetBuilderCodeArguments, UnsetBuilderCodeOptions, builderCodeId, hasPosition, setBuilderCode, unsetBuilderCode };
|
|
9
9
|
}
|
|
10
|
-
declare const PredictApp: MoveTuple<readonly [
|
|
10
|
+
declare const PredictApp: MoveTuple<readonly [_mysten_sui_bcs49.BcsType<boolean, boolean, "bool">], "@local-pkg/deepbook_predict::predict_account::PredictApp">;
|
|
11
11
|
declare const PositionKey: MoveStruct<{
|
|
12
|
-
expiry_market_id:
|
|
13
|
-
order_id:
|
|
12
|
+
expiry_market_id: _mysten_sui_bcs49.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
13
|
+
order_id: _mysten_sui_bcs49.BcsType<bigint, string | number | bigint, "u256">;
|
|
14
14
|
}, "@local-pkg/deepbook_predict::predict_account::PositionKey">;
|
|
15
15
|
declare const Position: MoveStruct<{
|
|
16
|
-
/** Root order ID, carried forward unchanged across partial-close replacements. */root_id:
|
|
16
|
+
/** Root order ID, carried forward unchanged across partial-close replacements. */root_id: _mysten_sui_bcs49.BcsType<bigint, string | number | bigint, "u256">;
|
|
17
17
|
/**
|
|
18
18
|
* On-chain time (`clock.timestamp_ms()`) the position was opened, carried forward
|
|
19
19
|
* unchanged across partial-close replacements. A live redeem in the same timestamp
|
|
20
20
|
* is rejected, blocking an atomic mint -> oracle-update -> redeem in one
|
|
21
21
|
* transaction.
|
|
22
22
|
*/
|
|
23
|
-
opened_at_ms:
|
|
23
|
+
opened_at_ms: _mysten_sui_bcs49.BcsType<bigint, string | number | bigint, "u64">;
|
|
24
24
|
}, "@local-pkg/deepbook_predict::predict_account::Position">;
|
|
25
25
|
declare const PredictData: MoveStruct<{
|
|
26
26
|
/** Open positions scoped by expiry market. */positions: MoveStruct<{
|
|
27
|
-
id:
|
|
28
|
-
size:
|
|
27
|
+
id: _mysten_sui_bcs49.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
28
|
+
size: _mysten_sui_bcs49.BcsType<bigint, string | number | bigint, "u64">;
|
|
29
29
|
}, "0x2::table::Table<phantom K, phantom V>">; /** Sticky builder-code attribution for future trades, if set. */
|
|
30
|
-
builder_code_id:
|
|
30
|
+
builder_code_id: _mysten_sui_bcs49.BcsType<string | null, string | Uint8Array<ArrayBufferLike> | null | undefined, "Option<bytes[32]>">;
|
|
31
31
|
}, "@local-pkg/deepbook_predict::predict_account::PredictData">;
|
|
32
32
|
interface HasPositionArguments {
|
|
33
33
|
account: TransactionArgument;
|
|
@@ -42,7 +42,7 @@ interface HasPositionOptions {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
/** Return whether an account holds a position for SDK and devInspect state reads. */
|
|
45
|
-
declare function hasPosition(options: HasPositionOptions): (tx: Transaction) =>
|
|
45
|
+
declare function hasPosition(options: HasPositionOptions): (tx: Transaction) => _mysten_sui_transactions166.TransactionResult;
|
|
46
46
|
interface BuilderCodeIdArguments {
|
|
47
47
|
account: TransactionArgument;
|
|
48
48
|
}
|
|
@@ -54,7 +54,7 @@ interface BuilderCodeIdOptions {
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
/** Return the sticky builder-code ID, if set. */
|
|
57
|
-
declare function builderCodeId(options: BuilderCodeIdOptions): (tx: Transaction) =>
|
|
57
|
+
declare function builderCodeId(options: BuilderCodeIdOptions): (tx: Transaction) => _mysten_sui_transactions166.TransactionResult;
|
|
58
58
|
interface SetBuilderCodeArguments {
|
|
59
59
|
wrapper: RawTransactionArgument<string>;
|
|
60
60
|
auth: TransactionArgument;
|
|
@@ -71,7 +71,7 @@ interface SetBuilderCodeOptions {
|
|
|
71
71
|
* Set sticky builder-code attribution for future trades using valid account auth.
|
|
72
72
|
* Owner auth and authorized-app auth both satisfy the account borrow boundary.
|
|
73
73
|
*/
|
|
74
|
-
declare function setBuilderCode(options: SetBuilderCodeOptions): (tx: Transaction) =>
|
|
74
|
+
declare function setBuilderCode(options: SetBuilderCodeOptions): (tx: Transaction) => _mysten_sui_transactions166.TransactionResult;
|
|
75
75
|
interface UnsetBuilderCodeArguments {
|
|
76
76
|
wrapper: RawTransactionArgument<string>;
|
|
77
77
|
auth: TransactionArgument;
|
|
@@ -84,7 +84,7 @@ interface UnsetBuilderCodeOptions {
|
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
/** Clear sticky builder-code attribution using valid owner or authorized-app auth. */
|
|
87
|
-
declare function unsetBuilderCode(options: UnsetBuilderCodeOptions): (tx: Transaction) =>
|
|
87
|
+
declare function unsetBuilderCode(options: UnsetBuilderCodeOptions): (tx: Transaction) => _mysten_sui_transactions166.TransactionResult;
|
|
88
88
|
//#endregion
|
|
89
89
|
export { predict_account_d_exports };
|
|
90
90
|
//# sourceMappingURL=predict_account.d.mts.map
|