@mysten/deepbook-v3 2.1.3 → 2.3.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 +45 -0
- package/PREDICT.md +17 -5
- package/dist/account.d.mts.map +1 -1
- package/dist/account.mjs +3 -1
- package/dist/account.mjs.map +1 -1
- package/dist/contracts/account/account.d.mts +23 -23
- package/dist/contracts/account/account.d.mts.map +1 -1
- package/dist/contracts/account/account_events.d.mts +20 -20
- package/dist/contracts/account/account_registry.d.mts +19 -19
- package/dist/contracts/account/account_registry.d.mts.map +1 -1
- 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/deps/sui/vec_map.mjs +37 -0
- package/dist/contracts/deepbook_predict/deps/sui/vec_map.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/expiry_cash.mjs +1 -1
- package/dist/contracts/deepbook_predict/expiry_cash.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/expiry_market.mjs +15 -6
- package/dist/contracts/deepbook_predict/expiry_market.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/market_manager.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/order_events.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/plp.mjs +53 -31
- package/dist/contracts/deepbook_predict/plp.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pool_accounting.mjs +7 -7
- package/dist/contracts/deepbook_predict/pool_accounting.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/predict_account.mjs +1 -1
- package/dist/contracts/deepbook_predict/predict_account.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pricing.mjs +13 -1
- package/dist/contracts/deepbook_predict/pricing.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/registry.mjs +2 -1
- package/dist/contracts/deepbook_predict/registry.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/strike_exposure.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/strike_payout_tree.mjs +13 -1
- package/dist/contracts/deepbook_predict/strike_payout_tree.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/vault_events.mjs +19 -7
- package/dist/contracts/deepbook_predict/vault_events.mjs.map +1 -1
- package/dist/contracts/deepbook_sessions/session_config.d.mts +8 -8
- package/dist/contracts/deepbook_sessions/session_config.d.mts.map +1 -1
- package/dist/contracts/deepbook_sessions/sessions.d.mts +22 -22
- package/dist/contracts/deepbook_sessions/sessions.d.mts.map +1 -1
- package/dist/deployments/index.d.mts +3 -2
- package/dist/deployments/index.d.mts.map +1 -1
- package/dist/deployments/index.mjs +4 -1
- package/dist/deployments/index.mjs.map +1 -1
- package/dist/deployments/mainnet.d.mts +14 -0
- package/dist/deployments/mainnet.d.mts.map +1 -0
- package/dist/deployments/mainnet.mjs +73 -0
- package/dist/deployments/mainnet.mjs.map +1 -0
- package/dist/deployments/testnet.mjs +23 -23
- package/dist/deployments/testnet.mjs.map +1 -1
- package/dist/deployments/types.d.mts +1 -1
- package/dist/predict/client.d.mts +25 -4
- package/dist/predict/client.d.mts.map +1 -1
- package/dist/predict/client.mjs +4 -4
- package/dist/predict/client.mjs.map +1 -1
- package/dist/predict/config/index.d.mts +2 -0
- package/dist/predict/config/index.d.mts.map +1 -1
- package/dist/predict/config/index.mjs +4 -1
- package/dist/predict/config/index.mjs.map +1 -1
- package/dist/predict/config/mainnet.d.mts +17 -0
- package/dist/predict/config/mainnet.d.mts.map +1 -0
- package/dist/predict/config/mainnet.mjs +26 -0
- package/dist/predict/config/mainnet.mjs.map +1 -0
- package/dist/predict/config/types.d.mts +6 -0
- package/dist/predict/config/types.d.mts.map +1 -1
- package/dist/predict/index.d.mts +4 -2
- package/dist/predict/index.mjs +3 -1
- package/dist/predict/pricing.d.mts +6 -6
- package/dist/predict/pricing.d.mts.map +1 -1
- package/dist/predict/pricing.mjs +6 -6
- package/dist/predict/pricing.mjs.map +1 -1
- package/dist/predict/reads/balances.mjs.map +1 -1
- package/dist/predict/reads/markets.mjs +1 -1
- package/dist/predict/reads/markets.mjs.map +1 -1
- package/dist/predict/reads/pricing.d.mts +2 -1
- package/dist/predict/reads/pricing.d.mts.map +1 -1
- package/dist/predict/reads/pricing.mjs.map +1 -1
- package/dist/sessions.d.mts.map +1 -1
- package/dist/sessions.mjs +3 -1
- package/dist/sessions.mjs.map +1 -1
- package/dist/transactions/balanceManager.d.mts +12 -12
- package/dist/transactions/balanceManager.d.mts.map +1 -1
- package/dist/transactions/deepbook.d.mts +20 -20
- package/dist/transactions/deepbookAdmin.d.mts +4 -4
- package/dist/transactions/marginAdmin.d.mts +7 -7
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginManager.d.mts +32 -32
- package/dist/transactions/marginPool.d.mts +18 -18
- package/dist/transactions/marginPool.d.mts.map +1 -1
- package/dist/transactions/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 +3 -3
- package/src/account.ts +3 -1
- package/src/contracts/deepbook_predict/builder_code.ts +3 -3
- package/src/contracts/deepbook_predict/config_events.ts +9 -2
- package/src/contracts/deepbook_predict/deps/sui/vec_map.ts +33 -0
- package/src/contracts/deepbook_predict/expiry_cash.ts +1 -1
- package/src/contracts/deepbook_predict/expiry_market.ts +70 -11
- package/src/contracts/deepbook_predict/market_lifecycle_cap.ts +3 -10
- package/src/contracts/deepbook_predict/market_manager.ts +2 -2
- package/src/contracts/deepbook_predict/order_events.ts +6 -6
- package/src/contracts/deepbook_predict/plp.ts +263 -81
- package/src/contracts/deepbook_predict/pool_accounting.ts +14 -14
- package/src/contracts/deepbook_predict/pool_valuation_cap.ts +69 -0
- package/src/contracts/deepbook_predict/predict_account.ts +1 -1
- package/src/contracts/deepbook_predict/pricing.ts +16 -4
- package/src/contracts/deepbook_predict/protocol_config.ts +202 -7
- package/src/contracts/deepbook_predict/registry.ts +91 -17
- package/src/contracts/deepbook_predict/strike_exposure.ts +1 -1
- package/src/contracts/deepbook_predict/strike_payout_tree.ts +27 -0
- package/src/contracts/deepbook_predict/vault_events.ts +45 -14
- package/src/contracts/propbook/block_scholes_store.ts +8 -42
- package/src/deployments/index.ts +13 -3
- package/src/deployments/mainnet.ts +107 -0
- package/src/deployments/testnet.ts +25 -25
- package/src/deployments/types.ts +1 -1
- package/src/predict/client.ts +45 -15
- package/src/predict/config/index.ts +7 -2
- package/src/predict/config/mainnet.ts +27 -0
- package/src/predict/config/types.ts +7 -1
- package/src/predict/index.ts +5 -0
- package/src/predict/pricing.ts +11 -9
- package/src/predict/reads/balances.ts +1 -1
- package/src/predict/reads/markets.ts +1 -1
- package/src/predict/reads/pricing.ts +2 -1
- package/src/sessions.ts +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"market_manager.mjs","names":["table.Table"],"sources":["../../../src/contracts/deepbook_predict/market_manager.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Market identity and deployment cadence manager for Predict.\n *\n * `Registry` owns this state and delegates market admission to it. Fixed cadence\n * IDs, periods, and rank order are upgrade-required. Underlying rows, cadence\n * deployment terms, and per-underlying watermarks are stored here.\n */\n\nimport { MoveStruct, normalizeMoveArguments } 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 table from './deps/sui/table.js';\nconst $moduleName = '@local-pkg/deepbook_predict::market_manager';\nexport const MarketKey = new MoveStruct({\n\tname: `${$moduleName}::MarketKey`,\n\tfields: {\n\t\tpropbook_underlying_id: bcs.u32(),\n\t\texpiry: U64,\n\t},\n});\nexport const MarketManager = new MoveStruct({\n\tname: `${$moduleName}::MarketManager`,\n\tfields: {\n\t\t/** Propbook underlying ID -> deployment watermarks. */\n\t\tunderlying_configs: table.Table,\n\t\t/** Created markets keyed by `(propbook_underlying_id, expiry)`. */\n\t\tmarket_ids: table.Table,\n\t},\n});\nexport const CadenceConfig = new MoveStruct({\n\tname: `${$moduleName}::CadenceConfig`,\n\tfields: {\n\t\t/** Raw-price-per-tick factor snapshotted into each created market. */\n\t\ttick_size: U64,\n\t\t/** Coarser raw-price step that new finite mint boundaries must align to. */\n\t\tadmission_tick_size: U64,\n\t\t/**\n\t\t *
|
|
1
|
+
{"version":3,"file":"market_manager.mjs","names":["table.Table"],"sources":["../../../src/contracts/deepbook_predict/market_manager.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Market identity and deployment cadence manager for Predict.\n *\n * `Registry` owns this state and delegates market admission to it. Fixed cadence\n * IDs, periods, and rank order are upgrade-required. Underlying rows, cadence\n * deployment terms, and per-underlying watermarks are stored here.\n */\n\nimport { MoveStruct, normalizeMoveArguments } 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 table from './deps/sui/table.js';\nconst $moduleName = '@local-pkg/deepbook_predict::market_manager';\nexport const MarketKey = new MoveStruct({\n\tname: `${$moduleName}::MarketKey`,\n\tfields: {\n\t\tpropbook_underlying_id: bcs.u32(),\n\t\texpiry: U64,\n\t},\n});\nexport const MarketManager = new MoveStruct({\n\tname: `${$moduleName}::MarketManager`,\n\tfields: {\n\t\t/** Propbook underlying ID -> deployment watermarks. */\n\t\tunderlying_configs: table.Table,\n\t\t/** Created markets keyed by `(propbook_underlying_id, expiry)`. */\n\t\tmarket_ids: table.Table,\n\t},\n});\nexport const CadenceConfig = new MoveStruct({\n\tname: `${$moduleName}::CadenceConfig`,\n\tfields: {\n\t\t/** Raw-price-per-tick factor snapshotted into each created market. */\n\t\ttick_size: U64,\n\t\t/** Coarser raw-price step that new finite mint boundaries must align to. */\n\t\tadmission_tick_size: U64,\n\t\t/**\n\t\t * USDC pool allocation cap snapshotted into pool accounting for each created\n\t\t * expiry.\n\t\t */\n\t\tmax_expiry_allocation: U64,\n\t\t/**\n\t\t * Minimum USDC cash target snapshotted into pool accounting for each created\n\t\t * expiry.\n\t\t */\n\t\tinitial_expiry_cash: U64,\n\t\t/**\n\t\t * Number of cadence periods in the rolling future deployment horizon. Zero\n\t\t * disables this cadence.\n\t\t */\n\t\twindow_size: U64,\n\t},\n});\nexport const DeployableMarket = new MoveStruct({\n\tname: `${$moduleName}::DeployableMarket`,\n\tfields: {\n\t\texpiry: U64,\n\t\tcadence: CadenceConfig,\n\t},\n});\nexport const UnderlyingMarketConfig = new MoveStruct({\n\tname: `${$moduleName}::UnderlyingMarketConfig`,\n\tfields: {\n\t\t/** Deployment config indexed by cadence ID. */\n\t\tcadences: bcs.vector(CadenceConfig),\n\t\t/** Highest deployed expiry timestamp indexed by cadence ID. */\n\t\tlast_deployed_expiries: bcs.vector(U64),\n\t},\n});\nexport interface CadenceTickSizeArguments {\n\tconfig: TransactionArgument;\n}\nexport interface CadenceTickSizeOptions {\n\tpackage?: string;\n\targuments: CadenceTickSizeArguments | [config: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return the raw-price-per-tick factor for SDK and devInspect cadence reads. */\nexport function cadenceTickSize(options: CadenceTickSizeOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['config'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'market_manager',\n\t\t\tfunction: 'cadence_tick_size',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface CadenceAdmissionTickSizeArguments {\n\tconfig: TransactionArgument;\n}\nexport interface CadenceAdmissionTickSizeOptions {\n\tpackage?: string;\n\targuments: CadenceAdmissionTickSizeArguments | [config: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return the admission-grid step for SDK and devInspect cadence reads. */\nexport function cadenceAdmissionTickSize(options: CadenceAdmissionTickSizeOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['config'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'market_manager',\n\t\t\tfunction: 'cadence_admission_tick_size',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface CadenceMaxExpiryAllocationArguments {\n\tconfig: TransactionArgument;\n}\nexport interface CadenceMaxExpiryAllocationOptions {\n\tpackage?: string;\n\targuments: CadenceMaxExpiryAllocationArguments | [config: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return the expiry allocation cap for SDK and devInspect cadence reads. */\nexport function cadenceMaxExpiryAllocation(options: CadenceMaxExpiryAllocationOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['config'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'market_manager',\n\t\t\tfunction: 'cadence_max_expiry_allocation',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface CadenceInitialExpiryCashArguments {\n\tconfig: TransactionArgument;\n}\nexport interface CadenceInitialExpiryCashOptions {\n\tpackage?: string;\n\targuments: CadenceInitialExpiryCashArguments | [config: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return the initial expiry cash target for SDK and devInspect cadence reads. */\nexport function cadenceInitialExpiryCash(options: CadenceInitialExpiryCashOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['config'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'market_manager',\n\t\t\tfunction: 'cadence_initial_expiry_cash',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface CadenceWindowSizeArguments {\n\tconfig: TransactionArgument;\n}\nexport interface CadenceWindowSizeOptions {\n\tpackage?: string;\n\targuments: CadenceWindowSizeArguments | [config: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return the rolling deployment horizon for SDK and devInspect cadence reads. */\nexport function cadenceWindowSize(options: CadenceWindowSizeOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['config'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'market_manager',\n\t\t\tfunction: 'cadence_window_size',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface CadenceEnabledArguments {\n\tconfig: TransactionArgument;\n}\nexport interface CadenceEnabledOptions {\n\tpackage?: string;\n\targuments: CadenceEnabledArguments | [config: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return whether this cadence is enabled for SDK and devInspect discovery. */\nexport function cadenceEnabled(options: CadenceEnabledOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['config'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'market_manager',\n\t\t\tfunction: 'cadence_enabled',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAM,cAAc;AACpB,MAAa,YAAY,IAAI,WAAW;CACvC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,wBAAwB,IAAI,KAAK;EACjC,QAAQ;EACR;CACD,CAAC;AACF,MAAa,gBAAgB,IAAI,WAAW;CAC3C,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,oBAAoBA;EAEpB,YAAYA;EACZ;CACD,CAAC;AACF,MAAa,gBAAgB,IAAI,WAAW;CAC3C,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,WAAW;EAEX,qBAAqB;EAKrB,uBAAuB;EAKvB,qBAAqB;EAKrB,aAAa;EACb;CACD,CAAC;AACF,MAAa,mBAAmB,IAAI,WAAW;CAC9C,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,QAAQ;EACR,SAAS;EACT;CACD,CAAC;AACF,MAAa,yBAAyB,IAAI,WAAW;CACpD,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,UAAU,IAAI,OAAO,cAAc;EAEnC,wBAAwB,IAAI,OAAO,IAAI;EACvC;CACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order_events.mjs","names":[],"sources":["../../../src/contracts/deepbook_predict/order_events.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Order-lifecycle events for Predict.\n *\n * Events carry transition identities and deltas rather than account or market\n * balances. Partial closes link an old order ID to its replacement; the position\n * root remains constant across that chain.\n */\n\nimport { MoveStruct } from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { U256, U64 } from '../../bcs/integers.js';\nconst $moduleName = '@local-pkg/deepbook_predict::order_events';\nexport const OrderMinted = new MoveStruct({\n\tname: `${$moduleName}::OrderMinted`,\n\tfields: {\n\t\texpiry_market_id: bcs.Address,\n\t\taccount_id: bcs.Address,\n\t\torder_id: U256,\n\t\t/**\n\t\t * Stable economic-position handle: the original mint's `order_id`, carried forward\n\t\t * unchanged across partial-close replacements. Equals `order_id` here.\n\t\t */\n\t\tposition_root_id: U256,\n\t\towner: bcs.Address,\n\t\t/**\n\t\t * Canonical strike range as absolute ticks: `lower_tick` (`0` = `-inf`) and\n\t\t * `higher_tick` (`pos_inf_tick` = `+inf`). Raw strikes are the derived display\n\t\t * form, `tick * tick_size` with the `tick_size` from `MarketCreated`.\n\t\t */\n\t\tlower_tick: U64,\n\t\thigher_tick: U64,\n\t\t/** 1e9-scaled range probability quoted at entry. */\n\t\tentry_probability: U64,\n\t\tquantity: U64,\n\t\t/** Premium the user paid into LP backing, in
|
|
1
|
+
{"version":3,"file":"order_events.mjs","names":[],"sources":["../../../src/contracts/deepbook_predict/order_events.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Order-lifecycle events for Predict.\n *\n * Events carry transition identities and deltas rather than account or market\n * balances. Partial closes link an old order ID to its replacement; the position\n * root remains constant across that chain.\n */\n\nimport { MoveStruct } from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { U256, U64 } from '../../bcs/integers.js';\nconst $moduleName = '@local-pkg/deepbook_predict::order_events';\nexport const OrderMinted = new MoveStruct({\n\tname: `${$moduleName}::OrderMinted`,\n\tfields: {\n\t\texpiry_market_id: bcs.Address,\n\t\taccount_id: bcs.Address,\n\t\torder_id: U256,\n\t\t/**\n\t\t * Stable economic-position handle: the original mint's `order_id`, carried forward\n\t\t * unchanged across partial-close replacements. Equals `order_id` here.\n\t\t */\n\t\tposition_root_id: U256,\n\t\towner: bcs.Address,\n\t\t/**\n\t\t * Canonical strike range as absolute ticks: `lower_tick` (`0` = `-inf`) and\n\t\t * `higher_tick` (`pos_inf_tick` = `+inf`). Raw strikes are the derived display\n\t\t * form, `tick * tick_size` with the `tick_size` from `MarketCreated`.\n\t\t */\n\t\tlower_tick: U64,\n\t\thigher_tick: U64,\n\t\t/** 1e9-scaled range probability quoted at entry. */\n\t\tentry_probability: U64,\n\t\tquantity: U64,\n\t\t/** Premium the user paid into LP backing, in USDC base units. */\n\t\tpremium: U64,\n\t\t/** Full trading fee assessed for the mint, including any sponsor-paid subsidy. */\n\t\ttrading_fee: U64,\n\t\t/** Portion of `trading_fee` paid from expiry-local fee incentives. */\n\t\tfee_incentive_subsidy: U64,\n\t\tbuilder_fee: U64,\n\t\t/** EWMA gas-price congestion surcharge assessed for the mint, in USDC base units. */\n\t\tpenalty_fee: U64,\n\t\t/**\n\t\t * Portion of the trader-paid trading fee and congestion surcharge delivered to the\n\t\t * referrer.\n\t\t */\n\t\treferral_fee: U64,\n\t\t/** Separate inventory-impact charge escrowed for live-close rebates. */\n\t\tinventory_impact_charge: U64,\n\t\t/**\n\t\t * Builder credited for `builder_fee`; `none` when no builder fee was paid\n\t\t * (attribution follows the fee — applied once, in the emit helper).\n\t\t */\n\t\tbuilder_code_id: bcs.option(bcs.Address),\n\t\t/** Referrer recorded on the minting account, independent of the fee paid. */\n\t\treferrer_account_id: bcs.option(bcs.Address),\n\t\tonchain_timestamp_ms: U64,\n\t\t/**\n\t\t * Oracle source timestamps present when this mint was priced: Pyth's canonical\n\t\t * source time and the Block Scholes per-update source times used for freshness.\n\t\t * The SVI one is also the roll-down anchor. Pyth is `0` only when unusable.\n\t\t */\n\t\tpyth_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_forward_source_timestamp_ms: U64,\n\t\tblock_scholes_svi_source_timestamp_ms: U64,\n\t},\n});\nexport const LiveOrderRedeemed = new MoveStruct({\n\tname: `${$moduleName}::LiveOrderRedeemed`,\n\tfields: {\n\t\texpiry_market_id: bcs.Address,\n\t\taccount_id: bcs.Address,\n\t\torder_id: U256,\n\t\t/**\n\t\t * Stable economic-position handle, constant across the replacement chain. On a\n\t\t * partial close the replacement inherits this same root.\n\t\t */\n\t\tposition_root_id: U256,\n\t\towner: bcs.Address,\n\t\tquantity_closed: U64,\n\t\t/** `0` means the position was fully closed. */\n\t\tremaining_quantity: U64,\n\t\t/** New order ID minted to carry the remainder on a partial live close. */\n\t\treplacement_order_id: bcs.option(U256),\n\t\t/** Redeem value before fees. */\n\t\tredeem_amount: U64,\n\t\ttrading_fee: U64,\n\t\tbuilder_fee: U64,\n\t\t/** EWMA gas-price congestion surcharge retained by the pool, in USDC base units. */\n\t\tpenalty_fee: U64,\n\t\t/** Separate inventory-impact rebate paid from its isolated escrow. */\n\t\tinventory_impact_rebate: U64,\n\t\t/**\n\t\t * Builder credited for `builder_fee`; `none` when no builder fee was paid\n\t\t * (attribution follows the fee — applied once, in the emit helper).\n\t\t */\n\t\tbuilder_code_id: bcs.option(bcs.Address),\n\t\tonchain_timestamp_ms: U64,\n\t\t/**\n\t\t * Oracle source timestamps present when this redemption was priced: Pyth's\n\t\t * canonical source time and the Block Scholes per-update source times used for\n\t\t * freshness. The SVI one is also the roll-down anchor. Pyth is `0` only when\n\t\t * unusable.\n\t\t */\n\t\tpyth_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_forward_source_timestamp_ms: U64,\n\t\tblock_scholes_svi_source_timestamp_ms: U64,\n\t},\n});\nexport const SettledOrderRedeemed = new MoveStruct({\n\tname: `${$moduleName}::SettledOrderRedeemed`,\n\tfields: {\n\t\texpiry_market_id: bcs.Address,\n\t\taccount_id: bcs.Address,\n\t\torder_id: U256,\n\t\t/** Stable economic-position handle, constant across the replacement chain. */\n\t\tposition_root_id: U256,\n\t\towner: bcs.Address,\n\t\tpayout_amount: U64,\n\t\tonchain_timestamp_ms: U64,\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,cAAc;AACpB,MAAa,cAAc,IAAI,WAAW;CACzC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,kBAAkB,IAAI;EACtB,YAAY,IAAI;EAChB,UAAU;EAKV,kBAAkB;EAClB,OAAO,IAAI;EAMX,YAAY;EACZ,aAAa;EAEb,mBAAmB;EACnB,UAAU;EAEV,SAAS;EAET,aAAa;EAEb,uBAAuB;EACvB,aAAa;EAEb,aAAa;EAKb,cAAc;EAEd,yBAAyB;EAKzB,iBAAiB,IAAI,OAAO,IAAI,QAAQ;EAExC,qBAAqB,IAAI,OAAO,IAAI,QAAQ;EAC5C,sBAAsB;EAMtB,+BAA+B;EAC/B,wCAAwC;EACxC,2CAA2C;EAC3C,uCAAuC;EACvC;CACD,CAAC;AACF,MAAa,oBAAoB,IAAI,WAAW;CAC/C,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,kBAAkB,IAAI;EACtB,YAAY,IAAI;EAChB,UAAU;EAKV,kBAAkB;EAClB,OAAO,IAAI;EACX,iBAAiB;EAEjB,oBAAoB;EAEpB,sBAAsB,IAAI,OAAO,KAAK;EAEtC,eAAe;EACf,aAAa;EACb,aAAa;EAEb,aAAa;EAEb,yBAAyB;EAKzB,iBAAiB,IAAI,OAAO,IAAI,QAAQ;EACxC,sBAAsB;EAOtB,+BAA+B;EAC/B,wCAAwC;EACxC,2CAA2C;EAC3C,uCAAuC;EACvC;CACD,CAAC;AACF,MAAa,uBAAuB,IAAI,WAAW;CAClD,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,kBAAkB,IAAI;EACtB,YAAY,IAAI;EAChB,UAAU;EAEV,kBAAkB;EAClB,OAAO,IAAI;EACX,eAAe;EACf,sBAAsB;EACtB;CACD,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { MoveStruct, normalizeMoveArguments } from "../utils/index.mjs";
|
|
2
2
|
import { U64 } from "../../bcs/integers.mjs";
|
|
3
3
|
import { Balance } from "./deps/sui/balance.mjs";
|
|
4
|
+
import { VecMap } from "./deps/sui/vec_map.mjs";
|
|
5
|
+
import { FrozenPricer } from "./pricing.mjs";
|
|
4
6
|
import { LpBook } from "./lp_book.mjs";
|
|
5
7
|
import { Ledger } from "./pool_accounting.mjs";
|
|
6
8
|
import { bcs } from "@mysten/sui/bcs";
|
|
@@ -12,21 +14,49 @@ import { bcs } from "@mysten/sui/bcs";
|
|
|
12
14
|
/**
|
|
13
15
|
* PLP token and pool vault.
|
|
14
16
|
*
|
|
15
|
-
* PoolVault owns the PLP treasury cap, idle
|
|
17
|
+
* PoolVault owns the PLP treasury cap, idle USDC, the protocol reserve,
|
|
16
18
|
* sponsor-funded fee incentives, per-expiry cash accounting, and the queued LP
|
|
17
|
-
* supply/withdraw requests. It coordinates the full-pool NAV valuation
|
|
18
|
-
*
|
|
19
|
+
* supply/withdraw requests. It coordinates the full-pool NAV valuation — an atomic
|
|
20
|
+
* oracle snapshot followed by resumable per-market valuation transactions, with
|
|
21
|
+
* trading live throughout (see `PoolValuation`) — and the unified per-market cash
|
|
19
22
|
* flow (initial funding, live rebalance/sweep, and settled-market sweep with
|
|
20
23
|
* terminal profit materialization). LPs queue supply/withdraw requests routed
|
|
21
|
-
* through a loaded Account; each flush (`finish_flush`) drains
|
|
22
|
-
* pool NAV, minting/burning PLP and delivering
|
|
23
|
-
* balance accumulator.
|
|
24
|
+
* through a loaded Account; each flush (`finish_flush`) drains the requests that
|
|
25
|
+
* predate its snapshot at the frozen pool NAV, minting/burning PLP and delivering
|
|
26
|
+
* fills to each account via the balance accumulator.
|
|
24
27
|
*/
|
|
25
28
|
const $moduleName = "@local-pkg/deepbook_predict::plp";
|
|
26
29
|
const PLP = new MoveStruct({
|
|
27
30
|
name: `${$moduleName}::PLP`,
|
|
28
31
|
fields: { dummy_field: bcs.bool() }
|
|
29
32
|
});
|
|
33
|
+
const PoolValuationProof = new MoveStruct({
|
|
34
|
+
name: `${$moduleName}::PoolValuationProof`,
|
|
35
|
+
fields: { dummy_field: bcs.bool() }
|
|
36
|
+
});
|
|
37
|
+
const SnapshotStage = new MoveStruct({
|
|
38
|
+
name: `${$moduleName}::SnapshotStage`,
|
|
39
|
+
fields: { dummy_field: bcs.bool() }
|
|
40
|
+
});
|
|
41
|
+
const PoolValuation = new MoveStruct({
|
|
42
|
+
name: `${$moduleName}::PoolValuation`,
|
|
43
|
+
fields: {
|
|
44
|
+
expected_expiry_markets: bcs.vector(bcs.Address),
|
|
45
|
+
valued_expiry_markets: bcs.vector(bcs.Address),
|
|
46
|
+
total_nav: U64,
|
|
47
|
+
frozen_pricers: VecMap(bcs.Address, bcs.option(FrozenPricer)),
|
|
48
|
+
sealed: bcs.bool(),
|
|
49
|
+
started_at_ms: U64,
|
|
50
|
+
supply_budget: bcs.option(U64),
|
|
51
|
+
withdraw_budget: bcs.option(U64),
|
|
52
|
+
supply_request_cutoff: U64,
|
|
53
|
+
withdraw_request_cutoff: U64,
|
|
54
|
+
frozen_idle_balance: U64,
|
|
55
|
+
frozen_profit_basis_credits: U64,
|
|
56
|
+
frozen_profit_basis_debits: U64,
|
|
57
|
+
frozen_pending_protocol_profit: U64
|
|
58
|
+
}
|
|
59
|
+
});
|
|
30
60
|
const PoolVault = new MoveStruct({
|
|
31
61
|
name: `${$moduleName}::PoolVault`,
|
|
32
62
|
fields: {
|
|
@@ -34,19 +64,11 @@ const PoolVault = new MoveStruct({
|
|
|
34
64
|
protocol_reserve_balance: Balance,
|
|
35
65
|
fee_incentive_reserve: Balance,
|
|
36
66
|
lp: LpBook,
|
|
37
|
-
expiry_accounting: Ledger
|
|
67
|
+
expiry_accounting: Ledger,
|
|
68
|
+
valuation: bcs.option(PoolValuation)
|
|
38
69
|
}
|
|
39
70
|
});
|
|
40
|
-
|
|
41
|
-
name: `${$moduleName}::PoolValuation`,
|
|
42
|
-
fields: {
|
|
43
|
-
pool_vault_id: bcs.Address,
|
|
44
|
-
expected_expiry_markets: bcs.vector(bcs.Address),
|
|
45
|
-
valued_expiry_markets: bcs.vector(bcs.Address),
|
|
46
|
-
total_nav: U64
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
/** Return idle DUSDC for SDK and devInspect state reads. */
|
|
71
|
+
/** Return idle USDC for SDK and devInspect state reads. */
|
|
50
72
|
function idleBalance(options) {
|
|
51
73
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
52
74
|
const argumentsTypes = [null];
|
|
@@ -122,10 +144,10 @@ function activeExpiryMarkets(options) {
|
|
|
122
144
|
});
|
|
123
145
|
}
|
|
124
146
|
/**
|
|
125
|
-
* Queue a supply request: pull `amount`
|
|
147
|
+
* Queue a supply request: pull `amount` USDC from account custody into queue
|
|
126
148
|
* escrow, recording the account's receive address as the fill recipient. The pull
|
|
127
|
-
* auto-settles any flush-delivered
|
|
128
|
-
* supply fee — zero by default — on the
|
|
149
|
+
* auto-settles any flush-delivered USDC first. The flush charges the protocol's
|
|
150
|
+
* supply fee — zero by default — on the USDC it takes in and prices shares on the
|
|
129
151
|
* remainder, so `min_plp_out` is measured after that fee. The account receives
|
|
130
152
|
* minted PLP only at a mark that mints at least `min_plp_out` for the whole
|
|
131
153
|
* `amount` — a **price floor**, not a promise of that many shares: if the pool cap
|
|
@@ -171,15 +193,15 @@ function requestSupply(options) {
|
|
|
171
193
|
* Queue a withdraw request: pull `amount` PLP shares from account custody into
|
|
172
194
|
* queue escrow, recording the account's receive address as the fill recipient. The
|
|
173
195
|
* pull auto-settles any flush-delivered PLP first. The flush withholds the
|
|
174
|
-
* protocol's withdraw fee from the marked payout, so `
|
|
196
|
+
* protocol's withdraw fee from the marked payout, so `min_usdc_out` is measured
|
|
175
197
|
* after the fee. The account is paid only at a mark that quotes at least
|
|
176
|
-
* `
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
198
|
+
* `min_usdc_out` for the whole `amount` — a **price floor**, not a promise of that
|
|
199
|
+
* much USDC: if idle liquidity covers only part of the payout, only the shares
|
|
200
|
+
* idle affords are burned, the fill is proportionally smaller at the same price,
|
|
201
|
+
* and the remainder stays queued with its limit rescaled. At the shipped attempt
|
|
202
|
+
* count of one, a flush whose mark quotes less cancels and refunds the request
|
|
203
|
+
* there and then; a higher configured count lets it rest and retry that many
|
|
204
|
+
* flushes first. Returns the queue index used to cancel before the flush.
|
|
183
205
|
*/
|
|
184
206
|
function requestWithdraw(options) {
|
|
185
207
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -199,7 +221,7 @@ function requestWithdraw(options) {
|
|
|
199
221
|
"auth",
|
|
200
222
|
"config",
|
|
201
223
|
"amount",
|
|
202
|
-
"
|
|
224
|
+
"minUsdcOut"
|
|
203
225
|
];
|
|
204
226
|
return (tx) => tx.moveCall({
|
|
205
227
|
package: packageAddress,
|
|
@@ -213,8 +235,8 @@ function requestWithdraw(options) {
|
|
|
213
235
|
});
|
|
214
236
|
}
|
|
215
237
|
/**
|
|
216
|
-
* Cancel a still-pending supply request, refunding its escrowed
|
|
217
|
-
*
|
|
238
|
+
* Cancel a still-pending supply request, refunding its escrowed USDC straight into
|
|
239
|
+
* the requesting account. `account` must be the request's recorded recipient.
|
|
218
240
|
*/
|
|
219
241
|
function cancelSupplyRequest(options) {
|
|
220
242
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plp.mjs","names":["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 DUSDC, 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 (a\n * hot-potato aggregation over every active market) 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 them at the frozen\n * pool NAV, minting/burning PLP and delivering fills to each account via the\n * 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 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 PoolVault = new MoveStruct({\n\tname: `${$moduleName}::PoolVault`,\n\tfields: {\n\t\tid: bcs.Address,\n\t\t/**\n\t\t * Protocol-owned DUSDC 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 DUSDC 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 DUSDC custody, registered expiries, and per-expiry cash-flow rows. */\n\t\texpiry_accounting: pool_accounting.Ledger,\n\t},\n});\nexport const PoolValuation = new MoveStruct({\n\tname: `${$moduleName}::PoolValuation`,\n\tfields: {\n\t\tpool_vault_id: bcs.Address,\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 flow; folded against `expected` at finish. */\n\t\tvalued_expiry_markets: bcs.vector(bcs.Address),\n\t\t/** Running Σ of each valued market's NAV (settled markets contribute 0). */\n\t\ttotal_nav: U64,\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 DUSDC 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 DUSDC 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\tlifecycleProof: TransactionArgument;\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 lifecycle proof. The proof\n * grants control over when current oracle state is frozen for queued LP fills.\n * Starting engages the transaction-local valuation lock and snapshots every active\n * expiry that must be included before the queues can drain.\n */\nexport function startPoolValuation(options: StartPoolValuationOptions) {\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 = ['config', 'vault', 'lifecycleProof'];\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 ValueExpiryArguments {\n\tvaluation: TransactionArgument;\n\tvault?: RawTransactionArgument<string>;\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 ValueExpiryOptions {\n\tpackage?: string;\n\targuments: ValueExpiryArguments;\n\tconfig?: {\n\t\tpoolVault: ConfigValue;\n\t\tprotocolConfig: ConfigValue;\n\t\toracleRegistry: ConfigValue;\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Run the per-market cash flow for one snapshotted market, then fold its NAV into\n * the running total. The market must be in the snapshot and not already valued. A\n * settled market is swept (deactivated, cash returned, profit materialized) and\n * contributes 0; a live market is rebalanced to target and valued on its current\n * cash.\n *\n * Settlement is a separate PTB step through `expiry_market::try_settle`. An\n * expired unsettled market cannot produce the live pricer required here.\n */\nexport function valueExpiry(options: ValueExpiryOptions) {\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'valuation',\n\t\t'vault',\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: '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\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 FinishFlushArguments {\n\tvaluation: TransactionArgument;\n\tvault?: RawTransactionArgument<string>;\n\tconfig?: RawTransactionArgument<string>;\n\tsupplyBudget: RawTransactionArgument<number | bigint | null>;\n\twithdrawBudget: RawTransactionArgument<number | bigint | null>;\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 DUSDC for withdrawals), release the valuation lock, consume the potato, and\n * return the LP-attributable pool-wide DUSDC NAV (idle + Σ active NAV, net of the\n * pending-protocol-profit exclusion priced from the aggregate profit basis).\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 = [\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] satisfies (string | null)[];\n\tconst parameterNames = ['valuation', 'vault', 'config', 'supplyBudget', 'withdrawBudget'];\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`). Blocked while a full-pool\n * valuation is in progress.\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 DUSDC. Anyone may contribute; the payment\n * joins a pool-level reserve that is excluded from PLP NAV and later allocated to\n * expiry 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` DUSDC 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 DUSDC 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` DUSDC 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 DUSDC first. The flush charges the protocol's\n * supply fee — zero by default — on the DUSDC 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\tminDusdcOut: 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_dusdc_out` is measured\n * after the fee. The account is paid only at a mark that quotes at least\n * `min_dusdc_out` for the whole `amount` — a **price floor**, not a promise of\n * that much DUSDC: if idle liquidity covers only part of the payout, only the\n * shares idle affords are burned, the fill is proportionally smaller at the same\n * price, and the remainder stays queued with its limit rescaled. At the shipped\n * attempt count of one, a flush whose mark quotes less cancels and refunds the\n * request there and then; a higher configured count lets it rest and retry that\n * many 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', 'minDusdcOut'];\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 DUSDC straight\n * into 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":";;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,cAAc;AACpB,MAAa,MAAM,IAAI,WAAW;CACjC,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,aAAa,IAAI,MAAM,EACvB;CACD,CAAC;AACF,MAAa,YAAY,IAAI,WAAW;CACvC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,IAAI,IAAI;EAKR,0BAA0BA;EAE1B,uBAAuBA;EAEvB,IAAIC;EAEJ,mBAAmBC;EACnB;CACD,CAAC;AACF,MAAa,gBAAgB,IAAI,WAAW;CAC3C,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,eAAe,IAAI;EAEnB,yBAAyB,IAAI,OAAO,IAAI,QAAQ;EAEhD,uBAAuB,IAAI,OAAO,IAAI,QAAQ;EAE9C,WAAW;EACX;CACD,CAAC;;AA6CF,SAAgB,YAAY,SAA6B;CACxD,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB,CAAC,KAAK;CAC7B,MAAM,iBAAiB,CAAC,QAAQ;AAChC,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBACV;GACC,GAAG,QAAQ;GACX,OAAO,QAAQ,WAAW,SAAS,QAAQ,QAAQ;GACnD,EACD,gBACA,eACA;EACD,CAAC;;;AA8EJ,SAAgB,eAAe,SAAgC;CAC9D,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB,CAAC,KAAK;CAC7B,MAAM,iBAAiB,CAAC,QAAQ;AAChC,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBACV;GACC,GAAG,QAAQ;GACX,OAAO,QAAQ,WAAW,SAAS,QAAQ,QAAQ;GACnD,EACD,gBACA,eACA;EACD,CAAC;;;AAcJ,SAAgB,sBAAsB,SAAuC;CAC5E,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB,CAAC,KAAK;CAC7B,MAAM,iBAAiB,CAAC,QAAQ;AAChC,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBACV;GACC,GAAG,QAAQ;GACX,OAAO,QAAQ,WAAW,SAAS,QAAQ,QAAQ;GACnD,EACD,gBACA,eACA;EACD,CAAC;;;AAcJ,SAAgB,wBAAwB,SAAyC;CAChF,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB,CAAC,KAAK;CAC7B,MAAM,iBAAiB,CAAC,QAAQ;AAChC,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBACV;GACC,GAAG,QAAQ;GACX,OAAO,QAAQ,WAAW,SAAS,QAAQ,QAAQ;GACnD,EACD,gBACA,eACA;EACD,CAAC;;;AAcJ,SAAgB,oBAAoB,SAAqC;CACxE,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB,CAAC,KAAK;CAC7B,MAAM,iBAAiB,CAAC,QAAQ;AAChC,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBACV;GACC,GAAG,QAAQ;GACX,OAAO,QAAQ,WAAW,SAAS,QAAQ,QAAQ;GACnD,EACD,gBACA,eACA;EACD,CAAC;;;;;;;;;;;;;;;;;AA8dJ,SAAgB,cAAc,SAA+B;CAC5D,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,MAAM,iBAAiB;EAAC;EAAS;EAAW;EAAQ;EAAU;EAAU;EAAY;AACpF,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;;;;;;;;;;;;;;;;AAiCJ,SAAgB,gBAAgB,SAAiC;CAChE,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,MAAM,iBAAiB;EAAC;EAAS;EAAW;EAAQ;EAAU;EAAU;EAAc;AACtF,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,oBAAoB,SAAqC;CACxE,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;;;;;;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. 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":"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"}
|
|
@@ -11,13 +11,13 @@ import { bcs } from "@mysten/sui/bcs";
|
|
|
11
11
|
/**
|
|
12
12
|
* Pool-owned expiry registration and cash-flow accounting.
|
|
13
13
|
*
|
|
14
|
-
* This module owns pool idle
|
|
15
|
-
* to a pool, the active expiry index used for valuation,
|
|
16
|
-
* pool into each expiry,
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
14
|
+
* This module owns pool idle USDC custody, the durable set of expiries registered
|
|
15
|
+
* to a pool, the active expiry index used for valuation, USDC sent from the main
|
|
16
|
+
* pool into each expiry, USDC received back from each expiry, snapshotted lifetime
|
|
17
|
+
* fee-incentive caps and allocations, terminal cash watermarks, and per-expiry cap
|
|
18
|
+
* checks. It does not classify expiry-local liabilities or apply PLP reserve
|
|
19
|
+
* policy; PoolVault uses the aggregate profit basis to price PLP and decide
|
|
20
|
+
* protocol reserve transfers.
|
|
21
21
|
*/
|
|
22
22
|
const $moduleName = "@local-pkg/deepbook_predict::pool_accounting";
|
|
23
23
|
const ActiveExpiry = new MoveStruct({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool_accounting.mjs","names":["balance.Balance","table.Table"],"sources":["../../../src/contracts/deepbook_predict/pool_accounting.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Pool-owned expiry registration and cash-flow accounting.\n *\n * This module owns pool idle
|
|
1
|
+
{"version":3,"file":"pool_accounting.mjs","names":["balance.Balance","table.Table"],"sources":["../../../src/contracts/deepbook_predict/pool_accounting.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Pool-owned expiry registration and cash-flow accounting.\n *\n * This module owns pool idle USDC custody, the durable set of expiries registered\n * to a pool, the active expiry index used for valuation, USDC sent from the main\n * pool into each expiry, USDC received back from each expiry, snapshotted lifetime\n * fee-incentive caps and allocations, terminal cash watermarks, and per-expiry cap\n * checks. It does not classify expiry-local liabilities or apply PLP reserve\n * policy; PoolVault uses the aggregate profit basis to price PLP and decide\n * protocol reserve transfers.\n */\n\nimport { MoveStruct } from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { U64 } from '../../bcs/integers.js';\nimport * as balance from './deps/sui/balance.js';\nimport * as table from './deps/sui/table.js';\nconst $moduleName = '@local-pkg/deepbook_predict::pool_accounting';\nexport const ActiveExpiry = new MoveStruct({\n\tname: `${$moduleName}::ActiveExpiry`,\n\tfields: {\n\t\texpiry_market_id: bcs.Address,\n\t\texpiry_ms: U64,\n\t},\n});\nexport const Ledger = new MoveStruct({\n\tname: `${$moduleName}::Ledger`,\n\tfields: {\n\t\t/** Idle LP-owned USDC available for withdrawals and expiry funding. */\n\t\tidle_balance: balance.Balance,\n\t\t/** Expiry markets that still contribute active pool valuation/risk. */\n\t\tactive_expiry_markets: bcs.vector(ActiveExpiry),\n\t\t/**\n\t\t * Permanent per-expiry accounting rows. Presence means the expiry belongs to this\n\t\t * pool.\n\t\t */\n\t\tregistered_expiries: table.Table,\n\t\t/** Pricing debit basis: USDC sent to expiries plus materialized terminal profit. */\n\t\tprofit_basis_debits: U64,\n\t\t/** Pricing credit basis: all USDC received back from expiries. */\n\t\tprofit_basis_credits: U64,\n\t\t/**\n\t\t * Aggregate terminal losses that later terminal profits must recover first; losses\n\t\t * do not claw back profit that was already materialized.\n\t\t */\n\t\tnet_losses_to_fill: U64,\n\t\t/**\n\t\t * Protocol profit already materialized into the debit basis but not yet physically\n\t\t * moved to the reserve because idle was deployed in other active markets at\n\t\t * materialization. Excluded from LP value until drained.\n\t\t */\n\t\tpending_protocol_profit: U64,\n\t},\n});\nexport const RegisteredExpiry = new MoveStruct({\n\tname: `${$moduleName}::RegisteredExpiry`,\n\tfields: {\n\t\t/** USDC pool allocation cap snapshotted when this expiry was created. */\n\t\tmax_expiry_allocation: U64,\n\t\t/** Minimum USDC cash target snapshotted when this expiry was created. */\n\t\tinitial_expiry_cash: U64,\n\t\t/** USDC sent from the main pool into this expiry. */\n\t\tsent_to_expiry: U64,\n\t\t/** USDC returned from this expiry to the main pool. */\n\t\treceived_from_expiry: U64,\n\t\t/** Absolute lifetime fee-incentive cap snapshotted when this expiry was registered. */\n\t\tfee_incentive_lifetime_cap: U64,\n\t\t/** Lifetime sponsor-funded fee incentives allocated to this expiry. */\n\t\tfee_incentives_allocated: U64,\n\t\t/** True once this expiry has started terminal profit/loss accounting. */\n\t\tterminal_accounting_started: bcs.bool(),\n\t\t/** Received amount already consumed by terminal accounting. */\n\t\tterminal_received_watermark: U64,\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,cAAc;AACpB,MAAa,eAAe,IAAI,WAAW;CAC1C,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,kBAAkB,IAAI;EACtB,WAAW;EACX;CACD,CAAC;AACF,MAAa,SAAS,IAAI,WAAW;CACpC,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,cAAcA;EAEd,uBAAuB,IAAI,OAAO,aAAa;EAK/C,qBAAqBC;EAErB,qBAAqB;EAErB,sBAAsB;EAKtB,oBAAoB;EAMpB,yBAAyB;EACzB;CACD,CAAC;AACF,MAAa,mBAAmB,IAAI,WAAW;CAC9C,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,uBAAuB;EAEvB,qBAAqB;EAErB,gBAAgB;EAEhB,sBAAsB;EAEtB,4BAA4B;EAE5B,0BAA0B;EAE1B,6BAA6B,IAAI,MAAM;EAEvC,6BAA6B;EAC7B;CACD,CAAC"}
|
|
@@ -12,7 +12,7 @@ import { bcs } from "@mysten/sui/bcs";
|
|
|
12
12
|
* (the `account` package).
|
|
13
13
|
*
|
|
14
14
|
* This is Predict's account-local state: open positions and sticky builder-code
|
|
15
|
-
* attribution.
|
|
15
|
+
* attribution. USDC/PLP custody lives in `Account`. The `PredictApp` witness
|
|
16
16
|
* namespaces this slot, so only Predict writes it.
|
|
17
17
|
*
|
|
18
18
|
* Position mutations are package-internal. Builder-code configuration accepts an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predict_account.mjs","names":["table.Table"],"sources":["../../../src/contracts/deepbook_predict/predict_account.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Predict's per-account state, stored as an app-data slot on a shared `Account`\n * (the `account` package).\n *\n * This is Predict's account-local state: open positions and sticky builder-code\n * attribution.
|
|
1
|
+
{"version":3,"file":"predict_account.mjs","names":["table.Table"],"sources":["../../../src/contracts/deepbook_predict/predict_account.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Predict's per-account state, stored as an app-data slot on a shared `Account`\n * (the `account` package).\n *\n * This is Predict's account-local state: open positions and sticky builder-code\n * attribution. USDC/PLP custody lives in `Account`. The `PredictApp` witness\n * namespaces this slot, so only Predict writes it.\n *\n * Position mutations are package-internal. Builder-code configuration accepts an\n * account `Auth`; the account package decides which owner or authorized\n * application may obtain that mutable borrow.\n */\n\nimport {\n\tMoveTuple,\n\tMoveStruct,\n\tnormalizeMoveArguments,\n\ttype RawTransactionArgument,\n} from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { U256, U64 } from '../../bcs/integers.js';\nimport { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';\nimport * as table from './deps/sui/table.js';\nconst $moduleName = '@local-pkg/deepbook_predict::predict_account';\nexport const PredictApp = new MoveTuple({\n\tname: `${$moduleName}::PredictApp`,\n\tfields: [bcs.bool()],\n});\nexport const PositionKey = new MoveStruct({\n\tname: `${$moduleName}::PositionKey`,\n\tfields: {\n\t\texpiry_market_id: bcs.Address,\n\t\torder_id: U256,\n\t},\n});\nexport const Position = new MoveStruct({\n\tname: `${$moduleName}::Position`,\n\tfields: {\n\t\t/** Root order ID, carried forward unchanged across partial-close replacements. */\n\t\troot_id: U256,\n\t\t/**\n\t\t * On-chain time (`clock.timestamp_ms()`) the position was opened, carried forward\n\t\t * unchanged across partial-close replacements. A live redeem in the same timestamp\n\t\t * is rejected, blocking an atomic mint -> oracle-update -> redeem in one\n\t\t * transaction.\n\t\t */\n\t\topened_at_ms: U64,\n\t},\n});\nexport const PredictData = new MoveStruct({\n\tname: `${$moduleName}::PredictData`,\n\tfields: {\n\t\t/** Open positions scoped by expiry market. */\n\t\tpositions: table.Table,\n\t\t/** Sticky builder-code attribution for future trades, if set. */\n\t\tbuilder_code_id: bcs.option(bcs.Address),\n\t},\n});\nexport interface HasPositionArguments {\n\taccount: TransactionArgument;\n\texpiryMarketId: RawTransactionArgument<string>;\n\torderId: RawTransactionArgument<number | bigint>;\n}\nexport interface HasPositionOptions {\n\tpackage?: string;\n\targuments:\n\t\t| HasPositionArguments\n\t\t| [\n\t\t\t\taccount: TransactionArgument,\n\t\t\t\texpiryMarketId: RawTransactionArgument<string>,\n\t\t\t\torderId: RawTransactionArgument<number | bigint>,\n\t\t ];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return whether an account holds a position for SDK and devInspect state reads. */\nexport function hasPosition(options: HasPositionOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, '0x2::object::ID', 'u256'] satisfies (string | null)[];\n\tconst parameterNames = ['account', 'expiryMarketId', 'orderId'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'predict_account',\n\t\t\tfunction: 'has_position',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface BuilderCodeIdArguments {\n\taccount: TransactionArgument;\n}\nexport interface BuilderCodeIdOptions {\n\tpackage?: string;\n\targuments: BuilderCodeIdArguments | [account: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Return the sticky builder-code ID, if set. */\nexport function builderCodeId(options: BuilderCodeIdOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['account'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'predict_account',\n\t\t\tfunction: 'builder_code_id',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface SetBuilderCodeArguments {\n\twrapper: RawTransactionArgument<string>;\n\tauth: TransactionArgument;\n\tcode: RawTransactionArgument<string>;\n}\nexport interface SetBuilderCodeOptions {\n\tpackage?: string;\n\targuments:\n\t\t| SetBuilderCodeArguments\n\t\t| [\n\t\t\t\twrapper: RawTransactionArgument<string>,\n\t\t\t\tauth: TransactionArgument,\n\t\t\t\tcode: RawTransactionArgument<string>,\n\t\t ];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Set sticky builder-code attribution for future trades using valid account auth.\n * Owner auth and authorized-app auth both satisfy the account borrow boundary.\n */\nexport function setBuilderCode(options: SetBuilderCodeOptions) {\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 = ['wrapper', 'auth', 'code'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'predict_account',\n\t\t\tfunction: 'set_builder_code',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface UnsetBuilderCodeArguments {\n\twrapper: RawTransactionArgument<string>;\n\tauth: TransactionArgument;\n}\nexport interface UnsetBuilderCodeOptions {\n\tpackage?: string;\n\targuments:\n\t\t| UnsetBuilderCodeArguments\n\t\t| [wrapper: RawTransactionArgument<string>, auth: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/** Clear sticky builder-code attribution using valid owner or authorized-app auth. */\nexport function unsetBuilderCode(options: UnsetBuilderCodeOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['wrapper', 'auth'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'predict_account',\n\t\t\tfunction: 'unset_builder_code',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,cAAc;AACpB,MAAa,aAAa,IAAI,UAAU;CACvC,MAAM,GAAG,YAAY;CACrB,QAAQ,CAAC,IAAI,MAAM,CAAC;CACpB,CAAC;AACF,MAAa,cAAc,IAAI,WAAW;CACzC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,kBAAkB,IAAI;EACtB,UAAU;EACV;CACD,CAAC;AACF,MAAa,WAAW,IAAI,WAAW;CACtC,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,SAAS;EAOT,cAAc;EACd;CACD,CAAC;AACF,MAAa,cAAc,IAAI,WAAW;CACzC,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,WAAWA;EAEX,iBAAiB,IAAI,OAAO,IAAI,QAAQ;EACxC;CACD,CAAC;;AAoBF,SAAgB,YAAY,SAA6B;CACxD,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB;EAAC;EAAM;EAAmB;EAAO;CACxD,MAAM,iBAAiB;EAAC;EAAW;EAAkB;EAAU;AAC/D,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,CAAC;;;;;;AAgDJ,SAAgB,eAAe,SAAgC;CAC9D,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB;EAAC;EAAM;EAAM;EAAK;CACzC,MAAM,iBAAiB;EAAC;EAAW;EAAQ;EAAO;AAClD,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,CAAC;;;AAgBJ,SAAgB,iBAAiB,SAAkC;CAClE,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB,CAAC,MAAM,KAAK;CACnC,MAAM,iBAAiB,CAAC,WAAW,OAAO;AAC1C,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,CAAC"}
|
|
@@ -29,6 +29,18 @@ const PricingSVI = new MoveStruct({
|
|
|
29
29
|
sigma: U64
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
+
const FrozenPricer = new MoveStruct({
|
|
33
|
+
name: `${$moduleName}::FrozenPricer`,
|
|
34
|
+
fields: {
|
|
35
|
+
expiry_market_id: bcs.Address,
|
|
36
|
+
forward: U64,
|
|
37
|
+
svi: PricingSVI,
|
|
38
|
+
pyth_spot_source_timestamp_ms: U64,
|
|
39
|
+
block_scholes_spot_source_timestamp_ms: U64,
|
|
40
|
+
block_scholes_forward_source_timestamp_ms: U64,
|
|
41
|
+
block_scholes_svi_source_timestamp_ms: U64
|
|
42
|
+
}
|
|
43
|
+
});
|
|
32
44
|
const Pricer = new MoveStruct({
|
|
33
45
|
name: `${$moduleName}::Pricer`,
|
|
34
46
|
fields: {
|
|
@@ -76,5 +88,5 @@ function rangePrice(options) {
|
|
|
76
88
|
}
|
|
77
89
|
|
|
78
90
|
//#endregion
|
|
79
|
-
export { Pricer, rangePrice };
|
|
91
|
+
export { FrozenPricer, Pricer, rangePrice };
|
|
80
92
|
//# sourceMappingURL=pricing.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pricing.mjs","names":["i64.I64"],"sources":["../../../src/contracts/deepbook_predict/pricing.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Pricing for Predict markets.\n *\n * This module reads canonical Propbook Pyth and Block Scholes feeds and computes\n * SVI-adjusted digital probabilities. Live reads require fresh, pricing-safe Block\n * Scholes spot, forward, and SVI observations. The live forward comes from one of\n * two admin-selected sources (`PricingConfig.use_pyth_spot_for_forward`): a fresh\n * positive Pyth spot carrying the Block Scholes basis, or the Block Scholes\n * forward directly. Exact-history reads do not apply live freshness policy.\n */\n\nimport { MoveStruct, normalizeMoveArguments } from '../utils/index.js';\nimport { U128, U64 } from '../../bcs/integers.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';\nimport * as i64 from './deps/fixed_math/i64.js';\nconst $moduleName = '@local-pkg/deepbook_predict::pricing';\nexport const PricingSVI = new MoveStruct({\n\tname: `${$moduleName}::PricingSVI`,\n\tfields: {\n\t\t/** Rolled-down SVI `a`, magnitude at 1e18, sign in `a_is_negative`. */\n\t\ta_magnitude: U128,\n\t\ta_is_negative: bcs.bool(),\n\t\t/** Rolled-down SVI `b`, at 1e18. */\n\t\tb: U128,\n\t\trho: i64.I64,\n\t\tm: i64.I64,\n\t\tsigma: U64,\n\t},\n});\nexport const Pricer = new MoveStruct({\n\tname: `${$moduleName}::Pricer`,\n\tfields: {\n\t\t/** Expiry market this snapshot was loaded for. */\n\t\texpiry_market_id: bcs.Address,\n\t\tforward: U64,\n\t\tsvi: PricingSVI,\n\t\t/**\n\t\t * Timestamps of the oracle observations this snapshot validated, as trade events\n\t\t * report them — each observation's own economic clock. Pyth carries its source\n\t\t * timestamp (`0` only when no usable normalized observation exists);
|
|
1
|
+
{"version":3,"file":"pricing.mjs","names":["i64.I64"],"sources":["../../../src/contracts/deepbook_predict/pricing.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Pricing for Predict markets.\n *\n * This module reads canonical Propbook Pyth and Block Scholes feeds and computes\n * SVI-adjusted digital probabilities. Live reads require fresh, pricing-safe Block\n * Scholes spot, forward, and SVI observations. The live forward comes from one of\n * two admin-selected sources (`PricingConfig.use_pyth_spot_for_forward`): a fresh\n * positive Pyth spot carrying the Block Scholes basis, or the Block Scholes\n * forward directly. Exact-history reads do not apply live freshness policy.\n */\n\nimport { MoveStruct, normalizeMoveArguments } from '../utils/index.js';\nimport { U128, U64 } from '../../bcs/integers.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';\nimport * as i64 from './deps/fixed_math/i64.js';\nconst $moduleName = '@local-pkg/deepbook_predict::pricing';\nexport const PricingSVI = new MoveStruct({\n\tname: `${$moduleName}::PricingSVI`,\n\tfields: {\n\t\t/** Rolled-down SVI `a`, magnitude at 1e18, sign in `a_is_negative`. */\n\t\ta_magnitude: U128,\n\t\ta_is_negative: bcs.bool(),\n\t\t/** Rolled-down SVI `b`, at 1e18. */\n\t\tb: U128,\n\t\trho: i64.I64,\n\t\tm: i64.I64,\n\t\tsigma: U64,\n\t},\n});\nexport const FrozenPricer = new MoveStruct({\n\tname: `${$moduleName}::FrozenPricer`,\n\tfields: {\n\t\texpiry_market_id: bcs.Address,\n\t\tforward: U64,\n\t\tsvi: PricingSVI,\n\t\tpyth_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_forward_source_timestamp_ms: U64,\n\t\tblock_scholes_svi_source_timestamp_ms: U64,\n\t},\n});\nexport const Pricer = new MoveStruct({\n\tname: `${$moduleName}::Pricer`,\n\tfields: {\n\t\t/** Expiry market this snapshot was loaded for. */\n\t\texpiry_market_id: bcs.Address,\n\t\tforward: U64,\n\t\tsvi: PricingSVI,\n\t\t/**\n\t\t * Timestamps of the oracle observations this snapshot validated, as trade events\n\t\t * report them — each observation's own economic clock. Pyth carries its source\n\t\t * timestamp (`0` only when no usable normalized observation exists); Block Scholes\n\t\t * spot and forward carry the provider `value_timestamp`, and SVI carries the\n\t\t * provider `svi_timestamp`. Those timestamps are the clocks freshness gates and\n\t\t * SVI roll-down use.\n\t\t */\n\t\tpyth_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_forward_source_timestamp_ms: U64,\n\t\tblock_scholes_svi_source_timestamp_ms: U64,\n\t},\n});\nexport const RawSVI = new MoveStruct({\n\tname: `${$moduleName}::RawSVI`,\n\tfields: {\n\t\ta: i64.I64,\n\t\tb: U64,\n\t\trho: i64.I64,\n\t\tm: i64.I64,\n\t\tsigma: U64,\n\t},\n});\nexport interface UpPriceArguments {\n\tpricer: TransactionArgument;\n\tstrike: TransactionArgument;\n}\nexport interface UpPriceOptions {\n\tpackage?: string;\n\targuments: UpPriceArguments | [pricer: TransactionArgument, strike: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Return the current UP digital probability for a typed strike. Public PTB and\n * devInspect reads can compose it with a transaction-local `Pricer`.\n */\nexport function upPrice(options: UpPriceOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['pricer', 'strike'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'pricing',\n\t\t\tfunction: 'up_price',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface RangePriceArguments {\n\tpricer: TransactionArgument;\n\tlower: TransactionArgument;\n\thigher: TransactionArgument;\n}\nexport interface RangePriceOptions {\n\tpackage?: string;\n\targuments:\n\t\t| RangePriceArguments\n\t\t| [pricer: TransactionArgument, lower: TransactionArgument, higher: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Return the current probability for `(lower, higher]`, floored at zero if the two\n * approximated boundary probabilities invert.\n */\nexport function rangePrice(options: RangePriceOptions) {\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 = ['pricer', 'lower', 'higher'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'pricing',\n\t\t\tfunction: 'range_price',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,MAAM,cAAc;AACpB,MAAa,aAAa,IAAI,WAAW;CACxC,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,aAAa;EACb,eAAe,IAAI,MAAM;EAEzB,GAAG;EACH,KAAKA;EACL,GAAGA;EACH,OAAO;EACP;CACD,CAAC;AACF,MAAa,eAAe,IAAI,WAAW;CAC1C,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,kBAAkB,IAAI;EACtB,SAAS;EACT,KAAK;EACL,+BAA+B;EAC/B,wCAAwC;EACxC,2CAA2C;EAC3C,uCAAuC;EACvC;CACD,CAAC;AACF,MAAa,SAAS,IAAI,WAAW;CACpC,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,kBAAkB,IAAI;EACtB,SAAS;EACT,KAAK;EASL,+BAA+B;EAC/B,wCAAwC;EACxC,2CAA2C;EAC3C,uCAAuC;EACvC;CACD,CAAC;AACF,MAAa,SAAS,IAAI,WAAW;CACpC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,GAAGA;EACH,GAAG;EACH,KAAKA;EACL,GAAGA;EACH,OAAO;EACP;CACD,CAAC;;;;;AA+CF,SAAgB,WAAW,SAA4B;CACtD,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB;EAAC;EAAM;EAAM;EAAK;CACzC,MAAM,iBAAiB;EAAC;EAAU;EAAS;EAAS;AACpD,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,CAAC"}
|