@mysten/deepbook-v3 2.6.4 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/CHANGELOG.md +153 -0
  2. package/PREDICT.md +389 -61
  3. package/dist/contracts/account/account.d.mts +23 -23
  4. package/dist/contracts/account/account.d.mts.map +1 -1
  5. package/dist/contracts/account/account_registry.d.mts +13 -13
  6. package/dist/contracts/deepbook/account.d.mts +18 -18
  7. package/dist/contracts/deepbook/balances.d.mts +4 -4
  8. package/dist/contracts/deepbook/deep_price.d.mts +3 -3
  9. package/dist/contracts/deepbook/order.d.mts +12 -12
  10. package/dist/contracts/deepbook_predict/admin.d.mts +4 -4
  11. package/dist/contracts/deepbook_predict/builder_code.d.mts +11 -11
  12. package/dist/contracts/deepbook_predict/builder_code_events.d.mts +10 -10
  13. package/dist/contracts/deepbook_predict/config_events.d.mts +93 -68
  14. package/dist/contracts/deepbook_predict/config_events.d.mts.map +1 -1
  15. package/dist/contracts/deepbook_predict/config_events.mjs +45 -1
  16. package/dist/contracts/deepbook_predict/config_events.mjs.map +1 -1
  17. package/dist/contracts/deepbook_predict/deps/std/type_name.mjs +17 -0
  18. package/dist/contracts/deepbook_predict/deps/std/type_name.mjs.map +1 -0
  19. package/dist/contracts/deepbook_predict/expiry_market.d.mts +652 -235
  20. package/dist/contracts/deepbook_predict/expiry_market.d.mts.map +1 -1
  21. package/dist/contracts/deepbook_predict/expiry_market.mjs +652 -186
  22. package/dist/contracts/deepbook_predict/expiry_market.mjs.map +1 -1
  23. package/dist/contracts/deepbook_predict/lp_book.mjs +1 -1
  24. package/dist/contracts/deepbook_predict/market_lifecycle_cap.d.mts +5 -5
  25. package/dist/contracts/deepbook_predict/market_manager.d.mts +27 -27
  26. package/dist/contracts/deepbook_predict/order_events.d.mts +50 -50
  27. package/dist/contracts/deepbook_predict/order_events.d.mts.map +1 -1
  28. package/dist/contracts/deepbook_predict/order_events.mjs +3 -1
  29. package/dist/contracts/deepbook_predict/order_events.mjs.map +1 -1
  30. package/dist/contracts/deepbook_predict/pause_cap.d.mts +5 -5
  31. package/dist/contracts/deepbook_predict/plp.d.mts +184 -82
  32. package/dist/contracts/deepbook_predict/plp.d.mts.map +1 -1
  33. package/dist/contracts/deepbook_predict/plp.mjs +126 -7
  34. package/dist/contracts/deepbook_predict/plp.mjs.map +1 -1
  35. package/dist/contracts/deepbook_predict/pool_accounting.mjs +1 -1
  36. package/dist/contracts/deepbook_predict/pool_valuation_cap.d.mts +5 -5
  37. package/dist/contracts/deepbook_predict/predict_account.d.mts +14 -14
  38. package/dist/contracts/deepbook_predict/pricing.d.mts +91 -58
  39. package/dist/contracts/deepbook_predict/pricing.d.mts.map +1 -1
  40. package/dist/contracts/deepbook_predict/pricing.mjs +30 -3
  41. package/dist/contracts/deepbook_predict/pricing.mjs.map +1 -1
  42. package/dist/contracts/deepbook_predict/pricing_config.mjs.map +1 -1
  43. package/dist/contracts/deepbook_predict/protocol_config.d.mts +400 -92
  44. package/dist/contracts/deepbook_predict/protocol_config.d.mts.map +1 -1
  45. package/dist/contracts/deepbook_predict/protocol_config.mjs +451 -61
  46. package/dist/contracts/deepbook_predict/protocol_config.mjs.map +1 -1
  47. package/dist/contracts/deepbook_predict/range_codec.d.mts +2 -2
  48. package/dist/contracts/deepbook_predict/registry.d.mts +28 -28
  49. package/dist/contracts/deepbook_predict/strike_exposure.mjs +1 -1
  50. package/dist/contracts/deepbook_predict/strike_payout_tree.mjs +17 -12
  51. package/dist/contracts/deepbook_predict/strike_payout_tree.mjs.map +1 -1
  52. package/dist/contracts/deepbook_predict/vault_events.d.mts +154 -106
  53. package/dist/contracts/deepbook_predict/vault_events.d.mts.map +1 -1
  54. package/dist/contracts/deepbook_predict/vault_events.mjs +57 -1
  55. package/dist/contracts/deepbook_predict/vault_events.mjs.map +1 -1
  56. package/dist/contracts/deepbook_predict_math/config-arguments.d.mts +10 -0
  57. package/dist/contracts/deepbook_predict_math/config-arguments.d.mts.map +1 -0
  58. package/dist/contracts/deepbook_predict_math/lazer_price.d.mts +106 -0
  59. package/dist/contracts/deepbook_predict_math/lazer_price.d.mts.map +1 -0
  60. package/dist/contracts/deepbook_predict_math/lazer_price.mjs +125 -0
  61. package/dist/contracts/deepbook_predict_math/lazer_price.mjs.map +1 -0
  62. package/dist/contracts/deepbook_predict_math/math.d.mts +284 -0
  63. package/dist/contracts/deepbook_predict_math/math.d.mts.map +1 -0
  64. package/dist/contracts/deepbook_predict_math/math.mjs +364 -0
  65. package/dist/contracts/deepbook_predict_math/math.mjs.map +1 -0
  66. package/dist/contracts/deepbook_predict_orders/config-arguments.d.mts +13 -0
  67. package/dist/contracts/deepbook_predict_orders/config-arguments.d.mts.map +1 -0
  68. package/dist/contracts/deepbook_predict_orders/delayed_execution_config.d.mts +215 -0
  69. package/dist/contracts/deepbook_predict_orders/delayed_execution_config.d.mts.map +1 -0
  70. package/dist/contracts/deepbook_predict_orders/delayed_execution_config.mjs +215 -0
  71. package/dist/contracts/deepbook_predict_orders/delayed_execution_config.mjs.map +1 -0
  72. package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.mjs +87 -0
  73. package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.mjs.map +1 -0
  74. package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/pricing.mjs +52 -0
  75. package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/pricing.mjs.map +1 -0
  76. package/dist/contracts/deepbook_predict_orders/deps/fixed_math/i64.mjs +25 -0
  77. package/dist/contracts/deepbook_predict_orders/deps/fixed_math/i64.mjs.map +1 -0
  78. package/dist/contracts/deepbook_predict_orders/deps/sui/balance.mjs +21 -0
  79. package/dist/contracts/deepbook_predict_orders/deps/sui/balance.mjs.map +1 -0
  80. package/dist/contracts/deepbook_predict_orders/deps/sui/table.mjs +39 -0
  81. package/dist/contracts/deepbook_predict_orders/deps/sui/table.mjs.map +1 -0
  82. package/dist/contracts/deepbook_predict_orders/desk.d.mts +187 -0
  83. package/dist/contracts/deepbook_predict_orders/desk.d.mts.map +1 -0
  84. package/dist/contracts/deepbook_predict_orders/desk.mjs +261 -0
  85. package/dist/contracts/deepbook_predict_orders/desk.mjs.map +1 -0
  86. package/dist/contracts/deepbook_predict_orders/order_queue.d.mts +1042 -0
  87. package/dist/contracts/deepbook_predict_orders/order_queue.d.mts.map +1 -0
  88. package/dist/contracts/deepbook_predict_orders/order_queue.mjs +849 -0
  89. package/dist/contracts/deepbook_predict_orders/order_queue.mjs.map +1 -0
  90. package/dist/contracts/deepbook_predict_orders/queue.d.mts +683 -0
  91. package/dist/contracts/deepbook_predict_orders/queue.d.mts.map +1 -0
  92. package/dist/contracts/deepbook_predict_orders/queue.mjs +912 -0
  93. package/dist/contracts/deepbook_predict_orders/queue.mjs.map +1 -0
  94. package/dist/contracts/deepbook_predict_orders/queue_events.d.mts +195 -0
  95. package/dist/contracts/deepbook_predict_orders/queue_events.d.mts.map +1 -0
  96. package/dist/contracts/deepbook_predict_orders/queue_events.mjs +187 -0
  97. package/dist/contracts/deepbook_predict_orders/queue_events.mjs.map +1 -0
  98. package/dist/contracts/deepbook_sessions/session_config.d.mts +8 -8
  99. package/dist/contracts/deepbook_sessions/sessions.d.mts +163 -28
  100. package/dist/contracts/deepbook_sessions/sessions.d.mts.map +1 -1
  101. package/dist/contracts/deepbook_sessions/sessions.mjs +234 -5
  102. package/dist/contracts/deepbook_sessions/sessions.mjs.map +1 -1
  103. package/dist/deployments/mainnet.mjs +7 -4
  104. package/dist/deployments/mainnet.mjs.map +1 -1
  105. package/dist/deployments/testnet.mjs +7 -4
  106. package/dist/deployments/testnet.mjs.map +1 -1
  107. package/dist/predict/bindings/expiry-market.d.mts +77 -0
  108. package/dist/predict/bindings/expiry-market.d.mts.map +1 -0
  109. package/dist/predict/bindings/expiry-market.mjs +139 -0
  110. package/dist/predict/bindings/expiry-market.mjs.map +1 -0
  111. package/dist/predict/bindings/protocol-config.d.mts +39 -0
  112. package/dist/predict/bindings/protocol-config.d.mts.map +1 -0
  113. package/dist/predict/bindings/protocol-config.mjs +90 -0
  114. package/dist/predict/bindings/protocol-config.mjs.map +1 -0
  115. package/dist/predict/bindings/rename.mjs +9 -0
  116. package/dist/predict/bindings/rename.mjs.map +1 -0
  117. package/dist/predict/client.d.mts +595 -16
  118. package/dist/predict/client.d.mts.map +1 -1
  119. package/dist/predict/client.mjs +986 -10
  120. package/dist/predict/client.mjs.map +1 -1
  121. package/dist/predict/config/generated.d.mts +22 -1
  122. package/dist/predict/config/generated.d.mts.map +1 -1
  123. package/dist/predict/config/generated.mjs +30 -1
  124. package/dist/predict/config/generated.mjs.map +1 -1
  125. package/dist/predict/config/mainnet.mjs +11 -3
  126. package/dist/predict/config/mainnet.mjs.map +1 -1
  127. package/dist/predict/config/testnet.mjs +11 -3
  128. package/dist/predict/config/testnet.mjs.map +1 -1
  129. package/dist/predict/config/types.d.mts +50 -1
  130. package/dist/predict/config/types.d.mts.map +1 -1
  131. package/dist/predict/cost.d.mts +38 -11
  132. package/dist/predict/cost.d.mts.map +1 -1
  133. package/dist/predict/cost.mjs +37 -11
  134. package/dist/predict/cost.mjs.map +1 -1
  135. package/dist/predict/decode.d.mts +251 -1
  136. package/dist/predict/decode.d.mts.map +1 -1
  137. package/dist/predict/decode.mjs +342 -4
  138. package/dist/predict/decode.mjs.map +1 -1
  139. package/dist/predict/errors.d.mts +69 -6
  140. package/dist/predict/errors.d.mts.map +1 -1
  141. package/dist/predict/errors.mjs +277 -4
  142. package/dist/predict/errors.mjs.map +1 -1
  143. package/dist/predict/index.d.mts +21 -10
  144. package/dist/predict/index.mjs +24 -12
  145. package/dist/predict/queue-id.d.mts +13 -0
  146. package/dist/predict/queue-id.d.mts.map +1 -0
  147. package/dist/predict/queue-id.mjs +19 -0
  148. package/dist/predict/queue-id.mjs.map +1 -0
  149. package/dist/predict/queue.d.mts +505 -0
  150. package/dist/predict/queue.d.mts.map +1 -0
  151. package/dist/predict/queue.mjs +774 -0
  152. package/dist/predict/queue.mjs.map +1 -0
  153. package/dist/predict/reads/balances.mjs +1 -1
  154. package/dist/predict/reads/markets.mjs +46 -5
  155. package/dist/predict/reads/markets.mjs.map +1 -1
  156. package/dist/predict/reads/pool.mjs +1 -1
  157. package/dist/predict/reads/pricing.d.mts +1 -1
  158. package/dist/predict/reads/queue.d.mts +105 -0
  159. package/dist/predict/reads/queue.d.mts.map +1 -0
  160. package/dist/predict/reads/queue.mjs +445 -0
  161. package/dist/predict/reads/queue.mjs.map +1 -0
  162. package/dist/predict/ticks.d.mts +9 -1
  163. package/dist/predict/ticks.d.mts.map +1 -1
  164. package/dist/predict/ticks.mjs +18 -1
  165. package/dist/predict/ticks.mjs.map +1 -1
  166. package/dist/predict/tx/authed.mjs +1 -1
  167. package/dist/predict/tx/common.d.mts.map +1 -1
  168. package/dist/predict/tx/common.mjs +12 -1
  169. package/dist/predict/tx/common.mjs.map +1 -1
  170. package/dist/predict/tx/queue.d.mts +220 -0
  171. package/dist/predict/tx/queue.d.mts.map +1 -0
  172. package/dist/predict/tx/queue.mjs +399 -0
  173. package/dist/predict/tx/queue.mjs.map +1 -0
  174. package/dist/predict/tx/trade.d.mts.map +1 -1
  175. package/dist/predict/tx/trade.mjs +61 -43
  176. package/dist/predict/tx/trade.mjs.map +1 -1
  177. package/dist/sessions.d.mts +90 -2
  178. package/dist/sessions.d.mts.map +1 -1
  179. package/dist/sessions.mjs +107 -2
  180. package/dist/sessions.mjs.map +1 -1
  181. package/dist/transactions/balanceManager.d.mts +12 -12
  182. package/dist/transactions/balanceManager.d.mts.map +1 -1
  183. package/dist/transactions/deepbook.d.mts +20 -20
  184. package/dist/transactions/deepbook.d.mts.map +1 -1
  185. package/dist/transactions/deepbookAdmin.d.mts +4 -4
  186. package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
  187. package/dist/transactions/marginAdmin.d.mts +7 -7
  188. package/dist/transactions/marginAdmin.d.mts.map +1 -1
  189. package/dist/transactions/marginLiquidations.d.mts +3 -3
  190. package/dist/transactions/marginMaintainer.d.mts +5 -5
  191. package/dist/transactions/marginMaintainer.d.mts.map +1 -1
  192. package/dist/transactions/marginManager.d.mts +32 -32
  193. package/dist/transactions/marginManager.d.mts.map +1 -1
  194. package/dist/transactions/marginPool.d.mts +18 -18
  195. package/dist/transactions/marginRegistry.d.mts +16 -16
  196. package/dist/transactions/marginTPSL.d.mts +10 -10
  197. package/dist/transactions/marginTPSL.d.mts.map +1 -1
  198. package/dist/transactions/poolProxy.d.mts +8 -8
  199. package/dist/transactions/poolProxy.d.mts.map +1 -1
  200. package/package.json +4 -4
  201. package/src/contracts/deepbook_predict/config_events.ts +39 -0
  202. package/src/contracts/deepbook_predict/deps/std/type_name.ts +24 -0
  203. package/src/contracts/deepbook_predict/expiry_market.ts +960 -169
  204. package/src/contracts/deepbook_predict/order_events.ts +3 -1
  205. package/src/contracts/deepbook_predict/plp.ts +150 -9
  206. package/src/contracts/deepbook_predict/pricing.ts +46 -7
  207. package/src/contracts/deepbook_predict/pricing_config.ts +3 -1
  208. package/src/contracts/deepbook_predict/protocol_config.ts +648 -33
  209. package/src/contracts/deepbook_predict/strike_payout_tree.ts +25 -21
  210. package/src/contracts/deepbook_predict/vault_events.ts +65 -0
  211. package/src/contracts/deepbook_predict_math/config-arguments.ts +6 -0
  212. package/src/contracts/deepbook_predict_math/lazer_price.ts +196 -0
  213. package/src/contracts/deepbook_predict_math/math.ts +553 -0
  214. package/src/contracts/deepbook_predict_orders/config-arguments.ts +11 -0
  215. package/src/contracts/deepbook_predict_orders/delayed_execution_config.ts +430 -0
  216. package/src/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.ts +108 -0
  217. package/src/contracts/deepbook_predict_orders/deps/deepbook_predict/pricing.ts +58 -0
  218. package/src/contracts/deepbook_predict_orders/deps/fixed_math/i64.ts +21 -0
  219. package/src/contracts/deepbook_predict_orders/deps/sui/balance.ts +19 -0
  220. package/src/contracts/deepbook_predict_orders/deps/sui/table.ts +37 -0
  221. package/src/contracts/deepbook_predict_orders/desk.ts +419 -0
  222. package/src/contracts/deepbook_predict_orders/order_flow.ts +19 -0
  223. package/src/contracts/deepbook_predict_orders/order_queue.ts +1670 -0
  224. package/src/contracts/deepbook_predict_orders/queue.ts +1394 -0
  225. package/src/contracts/deepbook_predict_orders/queue_events.ts +189 -0
  226. package/src/contracts/deepbook_sessions/sessions.ts +355 -4
  227. package/src/deployments/mainnet.ts +7 -2
  228. package/src/deployments/testnet.ts +7 -2
  229. package/src/deployments/types.ts +14 -1
  230. package/src/predict/bindings/expiry-market.ts +127 -0
  231. package/src/predict/bindings/protocol-config.ts +59 -0
  232. package/src/predict/bindings/rename.ts +14 -0
  233. package/src/predict/client.ts +2076 -13
  234. package/src/predict/config/generated.ts +50 -0
  235. package/src/predict/config/mainnet.ts +16 -2
  236. package/src/predict/config/testnet.ts +16 -2
  237. package/src/predict/config/types.ts +51 -1
  238. package/src/predict/cost.ts +62 -14
  239. package/src/predict/decode.ts +691 -2
  240. package/src/predict/errors.ts +391 -14
  241. package/src/predict/index.ts +87 -6
  242. package/src/predict/queue-id.ts +22 -0
  243. package/src/predict/queue.ts +1231 -0
  244. package/src/predict/reads/markets.ts +30 -0
  245. package/src/predict/reads/queue.ts +606 -0
  246. package/src/predict/ticks.ts +35 -0
  247. package/src/predict/tx/common.ts +25 -1
  248. package/src/predict/tx/queue.ts +525 -0
  249. package/src/predict/tx/trade.ts +80 -49
  250. package/src/sessions.ts +206 -1
@@ -5,16 +5,22 @@
5
5
  /**
6
6
  * Protocol-wide configuration and flow gates for Predict.
7
7
  *
8
- * This shared object owns the admin-tunable config structs, the trading pause
9
- * gate, the protocol-wide emergency freeze, and the full-pool valuation in-flight
10
- * state (flag + flush ordinal, held across the transactions a flush spans;
11
- * keeper/config flows gate on it, trading flows read it only to discard stale
12
- * stamps lazily). Flow modules decide which gates apply before they mutate expiry,
13
- * oracle, pool, or account state.
8
+ * This shared object owns the admin-tunable config structs, the fee-incentive
9
+ * subsidy, live-target, and lifetime-cap rates, the trading pause gate, the
10
+ * protocol-wide emergency freeze, the version watermark (reaching
11
+ * `constants::cutover_version!()` is also the delayed-execution cutover), the
12
+ * allowlists of keepers that may redeem settled orders without owner auth, of
13
+ * operators that may finish an LP flush, and of the order-flow companion witness
14
+ * types that may drive the order-flow primitives, and the full-pool valuation
15
+ * in-flight state (flag + flush ordinal, held across the transactions a flush
16
+ * spans; keeper/config flows gate on it, trading flows read it only to discard
17
+ * stale stamps lazily). Flow modules decide which gates apply before they mutate
18
+ * expiry, oracle, pool, or account state.
14
19
  */
15
20
 
16
21
  import {
17
22
  MoveStruct,
23
+ MoveTuple,
18
24
  normalizeMoveArguments,
19
25
  type RawTransactionArgument,
20
26
  type ConfigValue,
@@ -89,14 +95,14 @@ export const ProtocolConfig = new MoveStruct({
89
95
  * Minimum package version permitted to run version-gated flows. Monotonic;
90
96
  * `bump_version_watermark` advances it to the running `current_version!()`,
91
97
  * retiring older versions. A running version below this floor is dead
92
- * (`assert_version`). `current_version!()` stays the upgrade-required code
93
- * constant; this is the runtime floor.
98
+ * (`chk_version`). `current_version!()` stays the upgrade-required code constant;
99
+ * this is the runtime floor.
94
100
  */
95
101
  version_watermark: U64,
96
102
  /** Blocks new risk creation while true. */
97
103
  trading_paused: bcs.bool(),
98
104
  /**
99
- * Emergency hard stop. While true, `assert_version` aborts, halting every
105
+ * Emergency hard stop. While true, `chk_version` aborts, halting every
100
106
  * version-gated flow (mint, redeem, settlement, valuation, LP supply/withdraw,
101
107
  * admin config) — the same blast radius as a version-disable, but reversible
102
108
  * without a package upgrade. Force-on via `PauseCap`; cleared by `AdminCap`.
@@ -113,7 +119,7 @@ export const ProtocolConfig = new MoveStruct({
113
119
  */
114
120
  valuation_in_progress: bcs.bool(),
115
121
  /**
116
- * True ONLY while the atomic snapshot stage is open — set by `begin_snapshot` at
122
+ * True ONLY while the atomic snapshot stage is open — set by `open_snap` at
117
123
  * `start_pool_valuation` and cleared by `end_snapshot` at
118
124
  * `seal_valuation_snapshot`. Both live in one PTB (the `SnapshotStage` hot potato
119
125
  * forces it), so this can never be observed across transactions: it blocks only a
@@ -123,14 +129,38 @@ export const ProtocolConfig = new MoveStruct({
123
129
  */
124
130
  snapshot_in_progress: bcs.bool(),
125
131
  /**
126
- * Monotonic flush ordinal, bumped by `begin_valuation`. A market's valuation stamp
127
- * names the flush that made it; a stamp whose ordinal is not the current one — or
128
- * held while no valuation is in flight — is stale and is lazily discarded by the
129
- * next trade, so aborting a flush never has to visit its stamped markets.
132
+ * Monotonic flush ordinal, bumped by `begin_val`. A market's valuation stamp names
133
+ * the flush that made it; a stamp whose ordinal is not the current one — or held
134
+ * while no valuation is in flight — is stale and is lazily discarded by the next
135
+ * trade, so aborting a flush never has to visit its stamped markets.
130
136
  */
131
137
  flush_seq: U64,
132
138
  },
133
139
  });
140
+ export const SettledRedeemKeepersKey = new MoveTuple({
141
+ name: `${$moduleName}::SettledRedeemKeepersKey`,
142
+ fields: [bcs.bool()],
143
+ });
144
+ export const FeeIncentiveSubsidyRateKey = new MoveTuple({
145
+ name: `${$moduleName}::FeeIncentiveSubsidyRateKey`,
146
+ fields: [bcs.bool()],
147
+ });
148
+ export const FeeIncentiveLiveTargetRateKey = new MoveTuple({
149
+ name: `${$moduleName}::FeeIncentiveLiveTargetRateKey`,
150
+ fields: [bcs.bool()],
151
+ });
152
+ export const FeeIncentiveLifetimeCapRateKey = new MoveTuple({
153
+ name: `${$moduleName}::FeeIncentiveLifetimeCapRateKey`,
154
+ fields: [bcs.bool()],
155
+ });
156
+ export const FlushOperatorsKey = new MoveTuple({
157
+ name: `${$moduleName}::FlushOperatorsKey`,
158
+ fields: [bcs.bool()],
159
+ });
160
+ export const OrderFlowKey = new MoveTuple({
161
+ name: `${$moduleName}::OrderFlowKey<phantom W>`,
162
+ fields: [bcs.bool()],
163
+ });
134
164
  export interface IdArguments {
135
165
  config?: RawTransactionArgument<string>;
136
166
  }
@@ -299,6 +329,117 @@ export function referralFeeRate(options: ReferralFeeRateOptions) {
299
329
  ),
300
330
  });
301
331
  }
332
+ export interface FeeIncentiveSubsidyRateArguments {
333
+ config?: RawTransactionArgument<string>;
334
+ }
335
+ export interface FeeIncentiveSubsidyRateOptions {
336
+ package?: string;
337
+ arguments?: FeeIncentiveSubsidyRateArguments;
338
+ config?: {
339
+ protocolConfig: ConfigValue;
340
+ predictPackageId?: string;
341
+ };
342
+ }
343
+ /**
344
+ * Return the live fee-incentive subsidy rate: the fraction of each mint's trading
345
+ * fee paid from the market's sponsor-funded fee-incentive balance, in
346
+ * FLOAT_SCALING. `public` for SDK and devInspect reads: the quote already reports
347
+ * the subsidy it applied, but a client needs the rate to explain it.
348
+ */
349
+ export function feeIncentiveSubsidyRate(options: FeeIncentiveSubsidyRateOptions) {
350
+ const packageAddress =
351
+ options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
352
+ const argumentsTypes = [null] satisfies (string | null)[];
353
+ const parameterNames = ['config'];
354
+ return (tx: Transaction) =>
355
+ tx.moveCall({
356
+ package: packageAddress,
357
+ module: 'protocol_config',
358
+ function: 'fee_incentive_subsidy_rate',
359
+ arguments: normalizeMoveArguments(
360
+ {
361
+ ...options.arguments,
362
+ config: options.arguments?.config ?? options.config?.protocolConfig,
363
+ },
364
+ argumentsTypes,
365
+ parameterNames,
366
+ ),
367
+ });
368
+ }
369
+ export interface FeeIncentiveLiveTargetRateArguments {
370
+ config?: RawTransactionArgument<string>;
371
+ }
372
+ export interface FeeIncentiveLiveTargetRateOptions {
373
+ package?: string;
374
+ arguments?: FeeIncentiveLiveTargetRateArguments;
375
+ config?: {
376
+ protocolConfig: ConfigValue;
377
+ predictPackageId?: string;
378
+ };
379
+ }
380
+ /**
381
+ * Return the live fee-incentive target rate: the share of an expiry's allocation
382
+ * cap each live rebalance tops its sponsor-funded balance up to, in FLOAT_SCALING.
383
+ * `public` for SDK and devInspect reads, so a client can tell how much a market
384
+ * can hold before reading its balance.
385
+ */
386
+ export function feeIncentiveLiveTargetRate(options: FeeIncentiveLiveTargetRateOptions) {
387
+ const packageAddress =
388
+ options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
389
+ const argumentsTypes = [null] satisfies (string | null)[];
390
+ const parameterNames = ['config'];
391
+ return (tx: Transaction) =>
392
+ tx.moveCall({
393
+ package: packageAddress,
394
+ module: 'protocol_config',
395
+ function: 'fee_incentive_live_target_rate',
396
+ arguments: normalizeMoveArguments(
397
+ {
398
+ ...options.arguments,
399
+ config: options.arguments?.config ?? options.config?.protocolConfig,
400
+ },
401
+ argumentsTypes,
402
+ parameterNames,
403
+ ),
404
+ });
405
+ }
406
+ export interface FeeIncentiveLifetimeCapRateArguments {
407
+ config?: RawTransactionArgument<string>;
408
+ }
409
+ export interface FeeIncentiveLifetimeCapRateOptions {
410
+ package?: string;
411
+ arguments?: FeeIncentiveLifetimeCapRateArguments;
412
+ config?: {
413
+ protocolConfig: ConfigValue;
414
+ predictPackageId?: string;
415
+ };
416
+ }
417
+ /**
418
+ * Return the fee-incentive lifetime cap rate that newly created expiry markets
419
+ * snapshot: the share of an expiry's allocation cap it may receive in
420
+ * sponsor-funded incentives over its life, in FLOAT_SCALING. `public` for SDK and
421
+ * devInspect reads.
422
+ */
423
+ export function feeIncentiveLifetimeCapRate(options: FeeIncentiveLifetimeCapRateOptions) {
424
+ const packageAddress =
425
+ options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
426
+ const argumentsTypes = [null] satisfies (string | null)[];
427
+ const parameterNames = ['config'];
428
+ return (tx: Transaction) =>
429
+ tx.moveCall({
430
+ package: packageAddress,
431
+ module: 'protocol_config',
432
+ function: 'fee_incentive_lifetime_cap_rate',
433
+ arguments: normalizeMoveArguments(
434
+ {
435
+ ...options.arguments,
436
+ config: options.arguments?.config ?? options.config?.protocolConfig,
437
+ },
438
+ argumentsTypes,
439
+ parameterNames,
440
+ ),
441
+ });
442
+ }
302
443
  export interface NoTradeWindowMsArguments {
303
444
  config?: RawTransactionArgument<string>;
304
445
  }
@@ -336,6 +477,116 @@ export function noTradeWindowMs(options: NoTradeWindowMsOptions) {
336
477
  ),
337
478
  });
338
479
  }
480
+ export interface IsFlushOperatorArguments {
481
+ config?: RawTransactionArgument<string>;
482
+ operator: RawTransactionArgument<string>;
483
+ }
484
+ export interface IsFlushOperatorOptions {
485
+ package?: string;
486
+ arguments: IsFlushOperatorArguments;
487
+ config?: {
488
+ protocolConfig: ConfigValue;
489
+ predictPackageId?: string;
490
+ };
491
+ }
492
+ /**
493
+ * Whether `operator` may call `plp::finish_flush`. For SDK, keeper, and devInspect
494
+ * reads; `finish_flush` gates through `chk_operator`.
495
+ */
496
+ export function isFlushOperator(options: IsFlushOperatorOptions) {
497
+ const packageAddress =
498
+ options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
499
+ const argumentsTypes = [null, 'address'] satisfies (string | null)[];
500
+ const parameterNames = ['config', 'operator'];
501
+ return (tx: Transaction) =>
502
+ tx.moveCall({
503
+ package: packageAddress,
504
+ module: 'protocol_config',
505
+ function: 'is_flush_operator',
506
+ arguments: normalizeMoveArguments(
507
+ {
508
+ ...options.arguments,
509
+ config: options.arguments?.config ?? options.config?.protocolConfig,
510
+ },
511
+ argumentsTypes,
512
+ parameterNames,
513
+ ),
514
+ });
515
+ }
516
+ export interface IsOrderFlowArguments {
517
+ config?: RawTransactionArgument<string>;
518
+ }
519
+ export interface IsOrderFlowOptions {
520
+ package?: string;
521
+ arguments?: IsOrderFlowArguments;
522
+ config?: {
523
+ protocolConfig: ConfigValue;
524
+ predictPackageId?: string;
525
+ };
526
+ typeArguments: [string];
527
+ }
528
+ /**
529
+ * Whether the witness type `W` may drive Predict's order-flow primitives
530
+ * (admission, commit, and fill). For SDK, keeper, and devInspect reads and the
531
+ * companion's setup checks; the primitives gate through `chk_flow`.
532
+ */
533
+ export function isOrderFlow(options: IsOrderFlowOptions) {
534
+ const packageAddress =
535
+ options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
536
+ const argumentsTypes = [null] satisfies (string | null)[];
537
+ const parameterNames = ['config'];
538
+ return (tx: Transaction) =>
539
+ tx.moveCall({
540
+ package: packageAddress,
541
+ module: 'protocol_config',
542
+ function: 'is_order_flow',
543
+ arguments: normalizeMoveArguments(
544
+ {
545
+ ...options.arguments,
546
+ config: options.arguments?.config ?? options.config?.protocolConfig,
547
+ },
548
+ argumentsTypes,
549
+ parameterNames,
550
+ ),
551
+ typeArguments: options.typeArguments,
552
+ });
553
+ }
554
+ export interface VersionWatermarkArguments {
555
+ config?: RawTransactionArgument<string>;
556
+ }
557
+ export interface VersionWatermarkOptions {
558
+ package?: string;
559
+ arguments?: VersionWatermarkArguments;
560
+ config?: {
561
+ protocolConfig: ConfigValue;
562
+ predictPackageId?: string;
563
+ };
564
+ }
565
+ /**
566
+ * Return the runtime version floor. For SDK, keeper, and devInspect reads: the
567
+ * delayed-execution cutover is reached once it is at least 4
568
+ * (`constants::cutover_version!()`).
569
+ */
570
+ export function versionWatermark(options: VersionWatermarkOptions) {
571
+ const packageAddress =
572
+ options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
573
+ const argumentsTypes = [null] satisfies (string | null)[];
574
+ const parameterNames = ['config'];
575
+ return (tx: Transaction) =>
576
+ tx.moveCall({
577
+ package: packageAddress,
578
+ module: 'protocol_config',
579
+ function: 'version_watermark',
580
+ arguments: normalizeMoveArguments(
581
+ {
582
+ ...options.arguments,
583
+ config: options.arguments?.config ?? options.config?.protocolConfig,
584
+ },
585
+ argumentsTypes,
586
+ parameterNames,
587
+ ),
588
+ });
589
+ }
339
590
  export interface SetTemplateBaseFeeArguments {
340
591
  config?: RawTransactionArgument<string>;
341
592
  AdminCap: RawTransactionArgument<string>;
@@ -638,7 +889,9 @@ export interface SetUsePythSpotForForwardOptions {
638
889
  * Select which source the live forward is built from: `true` carries the Block
639
890
  * Scholes basis on a fresh Pyth spot, `false` uses the Block Scholes forward
640
891
  * directly. Locked during valuation so one flush marks every market on one
641
- * formula.
892
+ * formula. Clearing it also lifts the live-trade Pyth freshness requirement
893
+ * (`pricing::assert_pyth_spot_fresh`), which is the way to keep mints and live
894
+ * redeems open through a Pyth outage once no valuation is in flight.
642
895
  */
643
896
  export function setUsePythSpotForForward(options: SetUsePythSpotForForwardOptions) {
644
897
  const packageAddress =
@@ -673,7 +926,15 @@ export interface SetPythSpotFreshnessMsOptions {
673
926
  predictPackageId?: string;
674
927
  };
675
928
  }
676
- /** Set the live Pyth spot freshness threshold. */
929
+ /**
930
+ * Set the live Pyth spot freshness threshold. While `use_pyth_spot_for_forward` is
931
+ * set, a Pyth spot older than this makes valuation price off the Block Scholes
932
+ * forward and makes every mint, mint quote, and live redeem abort
933
+ * `pricing::EPythSpotStale`, so tightening it rejects more live trades and
934
+ * widening it admits older Pyth spots. A window shorter than the time a Pyth
935
+ * update takes to land halts live trading. Locked during valuation, like the
936
+ * source selector.
937
+ */
677
938
  export function setPythSpotFreshnessMs(options: SetPythSpotFreshnessMsOptions) {
678
939
  const packageAddress =
679
940
  options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
@@ -883,11 +1144,11 @@ export function setMaxLpPoolValue(options: SetMaxLpPoolValueOptions) {
883
1144
  });
884
1145
  }
885
1146
  export interface SetEwmaParamsArguments {
886
- config?: RawTransactionArgument<string>;
1147
+ Config?: RawTransactionArgument<string>;
887
1148
  AdminCap: RawTransactionArgument<string>;
888
- alpha: RawTransactionArgument<number | bigint>;
889
- zScoreThreshold: RawTransactionArgument<number | bigint>;
890
- penaltyRate: RawTransactionArgument<number | bigint>;
1149
+ Alpha: RawTransactionArgument<number | bigint>;
1150
+ ZScoreThreshold: RawTransactionArgument<number | bigint>;
1151
+ PenaltyRate: RawTransactionArgument<number | bigint>;
891
1152
  }
892
1153
  export interface SetEwmaParamsOptions {
893
1154
  package?: string;
@@ -897,14 +1158,17 @@ export interface SetEwmaParamsOptions {
897
1158
  predictPackageId?: string;
898
1159
  };
899
1160
  }
900
- /** Set the EWMA gas-price penalty parameters. */
1161
+ /**
1162
+ * Retired with instant trading: the congestion penalty only priced instant trades,
1163
+ * and queued fills charge none. Always aborts `EEwmaRetired`.
1164
+ */
901
1165
  export function setEwmaParams(options: SetEwmaParamsOptions) {
902
1166
  const packageAddress =
903
1167
  options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
904
1168
  const argumentsTypes = [null, null, 'u64', 'u64', 'u64', '0x2::clock::Clock'] satisfies (
905
1169
  string | null
906
1170
  )[];
907
- const parameterNames = ['config', 'AdminCap', 'alpha', 'zScoreThreshold', 'penaltyRate'];
1171
+ const parameterNames = ['Config', 'AdminCap', 'Alpha', 'ZScoreThreshold', 'PenaltyRate'];
908
1172
  return (tx: Transaction) =>
909
1173
  tx.moveCall({
910
1174
  package: packageAddress,
@@ -913,7 +1177,7 @@ export function setEwmaParams(options: SetEwmaParamsOptions) {
913
1177
  arguments: normalizeMoveArguments(
914
1178
  {
915
1179
  ...options.arguments,
916
- config: options.arguments?.config ?? options.config?.protocolConfig,
1180
+ Config: options.arguments?.Config ?? options.config?.protocolConfig,
917
1181
  },
918
1182
  argumentsTypes,
919
1183
  parameterNames,
@@ -921,9 +1185,9 @@ export function setEwmaParams(options: SetEwmaParamsOptions) {
921
1185
  });
922
1186
  }
923
1187
  export interface SetEwmaEnabledArguments {
924
- config?: RawTransactionArgument<string>;
1188
+ Config?: RawTransactionArgument<string>;
925
1189
  AdminCap: RawTransactionArgument<string>;
926
- enabled: RawTransactionArgument<boolean>;
1190
+ Enabled: RawTransactionArgument<boolean>;
927
1191
  }
928
1192
  export interface SetEwmaEnabledOptions {
929
1193
  package?: string;
@@ -933,12 +1197,15 @@ export interface SetEwmaEnabledOptions {
933
1197
  predictPackageId?: string;
934
1198
  };
935
1199
  }
936
- /** Enable or disable the EWMA gas-price penalty. */
1200
+ /**
1201
+ * Retired with instant trading: the congestion penalty only priced instant trades,
1202
+ * and queued fills charge none. Always aborts `EEwmaRetired`.
1203
+ */
937
1204
  export function setEwmaEnabled(options: SetEwmaEnabledOptions) {
938
1205
  const packageAddress =
939
1206
  options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
940
1207
  const argumentsTypes = [null, null, 'bool', '0x2::clock::Clock'] satisfies (string | null)[];
941
- const parameterNames = ['config', 'AdminCap', 'enabled'];
1208
+ const parameterNames = ['Config', 'AdminCap', 'Enabled'];
942
1209
  return (tx: Transaction) =>
943
1210
  tx.moveCall({
944
1211
  package: packageAddress,
@@ -947,7 +1214,7 @@ export function setEwmaEnabled(options: SetEwmaEnabledOptions) {
947
1214
  arguments: normalizeMoveArguments(
948
1215
  {
949
1216
  ...options.arguments,
950
- config: options.arguments?.config ?? options.config?.protocolConfig,
1217
+ Config: options.arguments?.Config ?? options.config?.protocolConfig,
951
1218
  },
952
1219
  argumentsTypes,
953
1220
  parameterNames,
@@ -972,10 +1239,9 @@ export interface SetNoTradeWindowMsOptions {
972
1239
  * abort. `0` disables the block. Read live at trade time, so a change applies to
973
1240
  * markets already trading and stays available as an incident control.
974
1241
  *
975
- * Deliberately not gated on `assert_not_valuation_in_progress`, matching
976
- * `set_trading_paused`: a stalled flush must not be able to trap a safety control.
977
- * Nothing in the flush reads this value, so a mid-valuation change cannot skew a
978
- * frozen mark.
1242
+ * Deliberately not gated on `chk_no_val`, matching `set_trading_paused`: a stalled
1243
+ * flush must not be able to trap a safety control. Nothing in the flush reads this
1244
+ * value, so a mid-valuation change cannot skew a frozen mark.
979
1245
  */
980
1246
  export function setNoTradeWindowMs(options: SetNoTradeWindowMsOptions) {
981
1247
  const packageAddress =
@@ -1048,7 +1314,7 @@ export interface SetFrozenOptions {
1048
1314
  * Set the protocol-wide emergency freeze.
1049
1315
  *
1050
1316
  * Intentionally NOT version-gated, unlike every other admin setter: the freeze
1051
- * gate lives inside `assert_version`, so routing this through it would make an
1317
+ * gate lives inside `chk_version`, so routing this through it would make an
1052
1318
  * engaged freeze unclearable without a package upgrade — defeating the point.
1053
1319
  */
1054
1320
  export function setFrozen(options: SetFrozenOptions) {
@@ -1071,6 +1337,204 @@ export function setFrozen(options: SetFrozenOptions) {
1071
1337
  ),
1072
1338
  });
1073
1339
  }
1340
+ export interface AddSettledRedeemKeeperArguments {
1341
+ config?: RawTransactionArgument<string>;
1342
+ AdminCap: RawTransactionArgument<string>;
1343
+ keeper: RawTransactionArgument<string>;
1344
+ }
1345
+ export interface AddSettledRedeemKeeperOptions {
1346
+ package?: string;
1347
+ arguments: AddSettledRedeemKeeperArguments;
1348
+ config?: {
1349
+ protocolConfig: ConfigValue;
1350
+ predictPackageId?: string;
1351
+ };
1352
+ }
1353
+ /**
1354
+ * Allow `keeper` to call `expiry_market::redeem_settled_permissionless`.
1355
+ * Admin-only and version-gated. Aborts if `keeper` is already allowed.
1356
+ */
1357
+ export function addSettledRedeemKeeper(options: AddSettledRedeemKeeperOptions) {
1358
+ const packageAddress =
1359
+ options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
1360
+ const argumentsTypes = [null, null, 'address'] satisfies (string | null)[];
1361
+ const parameterNames = ['config', 'AdminCap', 'keeper'];
1362
+ return (tx: Transaction) =>
1363
+ tx.moveCall({
1364
+ package: packageAddress,
1365
+ module: 'protocol_config',
1366
+ function: 'add_settled_redeem_keeper',
1367
+ arguments: normalizeMoveArguments(
1368
+ {
1369
+ ...options.arguments,
1370
+ config: options.arguments?.config ?? options.config?.protocolConfig,
1371
+ },
1372
+ argumentsTypes,
1373
+ parameterNames,
1374
+ ),
1375
+ });
1376
+ }
1377
+ export interface RemoveSettledRedeemKeeperArguments {
1378
+ config?: RawTransactionArgument<string>;
1379
+ AdminCap: RawTransactionArgument<string>;
1380
+ keeper: RawTransactionArgument<string>;
1381
+ }
1382
+ export interface RemoveSettledRedeemKeeperOptions {
1383
+ package?: string;
1384
+ arguments: RemoveSettledRedeemKeeperArguments;
1385
+ config?: {
1386
+ protocolConfig: ConfigValue;
1387
+ predictPackageId?: string;
1388
+ };
1389
+ }
1390
+ /**
1391
+ * Revoke `keeper`'s access to `expiry_market::redeem_settled_permissionless`.
1392
+ * Admin-only. Bypasses the version gate, like the registry's cap revocations, so
1393
+ * revocation stays available under the emergency freeze and from a package version
1394
+ * below the runtime floor. Aborts if `keeper` is not allowed.
1395
+ */
1396
+ export function removeSettledRedeemKeeper(options: RemoveSettledRedeemKeeperOptions) {
1397
+ const packageAddress =
1398
+ options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
1399
+ const argumentsTypes = [null, null, 'address'] satisfies (string | null)[];
1400
+ const parameterNames = ['config', 'AdminCap', 'keeper'];
1401
+ return (tx: Transaction) =>
1402
+ tx.moveCall({
1403
+ package: packageAddress,
1404
+ module: 'protocol_config',
1405
+ function: 'remove_settled_redeem_keeper',
1406
+ arguments: normalizeMoveArguments(
1407
+ {
1408
+ ...options.arguments,
1409
+ config: options.arguments?.config ?? options.config?.protocolConfig,
1410
+ },
1411
+ argumentsTypes,
1412
+ parameterNames,
1413
+ ),
1414
+ });
1415
+ }
1416
+ export interface AddFlushOperatorArguments {
1417
+ config?: RawTransactionArgument<string>;
1418
+ AdminCap: RawTransactionArgument<string>;
1419
+ operator: RawTransactionArgument<string>;
1420
+ }
1421
+ export interface AddFlushOperatorOptions {
1422
+ package?: string;
1423
+ arguments: AddFlushOperatorArguments;
1424
+ config?: {
1425
+ protocolConfig: ConfigValue;
1426
+ predictPackageId?: string;
1427
+ };
1428
+ }
1429
+ /**
1430
+ * Allow `operator` to call `plp::finish_flush`. Admin-only and version-gated;
1431
+ * aborts if `operator` is already allowed. Not gated on an open LP valuation, so
1432
+ * an admin can always add an operator to finish a stuck flush.
1433
+ */
1434
+ export function addFlushOperator(options: AddFlushOperatorOptions) {
1435
+ const packageAddress =
1436
+ options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
1437
+ const argumentsTypes = [null, null, 'address', '0x2::clock::Clock'] satisfies (string | null)[];
1438
+ const parameterNames = ['config', 'AdminCap', 'operator'];
1439
+ return (tx: Transaction) =>
1440
+ tx.moveCall({
1441
+ package: packageAddress,
1442
+ module: 'protocol_config',
1443
+ function: 'add_flush_operator',
1444
+ arguments: normalizeMoveArguments(
1445
+ {
1446
+ ...options.arguments,
1447
+ config: options.arguments?.config ?? options.config?.protocolConfig,
1448
+ },
1449
+ argumentsTypes,
1450
+ parameterNames,
1451
+ ),
1452
+ });
1453
+ }
1454
+ export interface RemoveFlushOperatorArguments {
1455
+ config?: RawTransactionArgument<string>;
1456
+ AdminCap: RawTransactionArgument<string>;
1457
+ operator: RawTransactionArgument<string>;
1458
+ }
1459
+ export interface RemoveFlushOperatorOptions {
1460
+ package?: string;
1461
+ arguments: RemoveFlushOperatorArguments;
1462
+ config?: {
1463
+ protocolConfig: ConfigValue;
1464
+ predictPackageId?: string;
1465
+ };
1466
+ }
1467
+ /**
1468
+ * Revoke `operator`'s access to `plp::finish_flush`. Admin-only. Bypasses the
1469
+ * version gate, like `remove_settled_redeem_keeper`, so revocation stays available
1470
+ * under the emergency freeze and from a package version below the runtime floor.
1471
+ * Aborts if `operator` is not allowed.
1472
+ */
1473
+ export function removeFlushOperator(options: RemoveFlushOperatorOptions) {
1474
+ const packageAddress =
1475
+ options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
1476
+ const argumentsTypes = [null, null, 'address', '0x2::clock::Clock'] satisfies (string | null)[];
1477
+ const parameterNames = ['config', 'AdminCap', 'operator'];
1478
+ return (tx: Transaction) =>
1479
+ tx.moveCall({
1480
+ package: packageAddress,
1481
+ module: 'protocol_config',
1482
+ function: 'remove_flush_operator',
1483
+ arguments: normalizeMoveArguments(
1484
+ {
1485
+ ...options.arguments,
1486
+ config: options.arguments?.config ?? options.config?.protocolConfig,
1487
+ },
1488
+ argumentsTypes,
1489
+ parameterNames,
1490
+ ),
1491
+ });
1492
+ }
1493
+ export interface SetOrderFlowArguments {
1494
+ config?: RawTransactionArgument<string>;
1495
+ AdminCap: RawTransactionArgument<string>;
1496
+ enabled: RawTransactionArgument<boolean>;
1497
+ }
1498
+ export interface SetOrderFlowOptions {
1499
+ package?: string;
1500
+ arguments: SetOrderFlowArguments;
1501
+ config?: {
1502
+ protocolConfig: ConfigValue;
1503
+ predictPackageId?: string;
1504
+ };
1505
+ typeArguments: [string];
1506
+ }
1507
+ /**
1508
+ * Allowlist (`enabled = true`) or remove the witness type `W` of an order-flow
1509
+ * companion for Predict's order-flow primitives. Removing it stops admissions,
1510
+ * commits, and fills only: `release` and `try_pay_settled` need a receipt, not the
1511
+ * allowlist, so waiting orders still drain and queue-held positions are still
1512
+ * paid. Admin-only. Enabling is version-gated, since it grants authority; removing
1513
+ * is ungated, like `remove_flush_operator`, so it works under the emergency freeze
1514
+ * and from a package version below the runtime floor. Setting the state `W`
1515
+ * already has changes nothing but still emits `OrderFlowUpdated`.
1516
+ */
1517
+ export function setOrderFlow(options: SetOrderFlowOptions) {
1518
+ const packageAddress =
1519
+ options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
1520
+ const argumentsTypes = [null, null, 'bool', '0x2::clock::Clock'] satisfies (string | null)[];
1521
+ const parameterNames = ['config', 'AdminCap', 'enabled'];
1522
+ return (tx: Transaction) =>
1523
+ tx.moveCall({
1524
+ package: packageAddress,
1525
+ module: 'protocol_config',
1526
+ function: 'set_order_flow',
1527
+ arguments: normalizeMoveArguments(
1528
+ {
1529
+ ...options.arguments,
1530
+ config: options.arguments?.config ?? options.config?.protocolConfig,
1531
+ },
1532
+ argumentsTypes,
1533
+ parameterNames,
1534
+ ),
1535
+ typeArguments: options.typeArguments,
1536
+ });
1537
+ }
1074
1538
  export interface BumpVersionWatermarkArguments {
1075
1539
  config?: RawTransactionArgument<string>;
1076
1540
  AdminCap: RawTransactionArgument<string>;
@@ -1184,6 +1648,157 @@ export function setReferralFeeRate(options: SetReferralFeeRateOptions) {
1184
1648
  ),
1185
1649
  });
1186
1650
  }
1651
+ export interface SetFeeIncentiveSubsidyRateArguments {
1652
+ config?: RawTransactionArgument<string>;
1653
+ AdminCap: RawTransactionArgument<string>;
1654
+ rate: RawTransactionArgument<number | bigint>;
1655
+ }
1656
+ export interface SetFeeIncentiveSubsidyRateOptions {
1657
+ package?: string;
1658
+ arguments: SetFeeIncentiveSubsidyRateArguments;
1659
+ config?: {
1660
+ protocolConfig: ConfigValue;
1661
+ predictPackageId?: string;
1662
+ };
1663
+ }
1664
+ /**
1665
+ * Set the fraction of each mint's trading fee paid from the market's
1666
+ * sponsor-funded fee-incentive balance. Read live at mint time, so the new rate
1667
+ * applies to the next mint on every market, including markets already trading; `0`
1668
+ * stops incentives from being spent without moving them. The subsidy never changes
1669
+ * the trading fee charged, only how much of it the trader pays; on a referred mint
1670
+ * the referral is computed on the trader-paid part, so a higher rate also shrinks
1671
+ * the referral.
1672
+ *
1673
+ * Binds every mint only once the version watermark has retired package versions
1674
+ * older than 4: those compiled in a fixed 20% and never read this rate, so until
1675
+ * then a mint routed through one still draws 20% from the market's balance. A zero
1676
+ * rate does not stop `rebalance_expiry_cash` allocating the pool reserve into
1677
+ * markets; to wind incentives down, also withdraw the reserve
1678
+ * (`plp::withdraw_fee_incentives`), or, once the watermark has retired versions
1679
+ * older than 4, set the live target rate to zero, which keeps the reserve in the
1680
+ * pool.
1681
+ *
1682
+ * Not gated on the valuation flag, matching `set_referral_fee_rate`: nothing in
1683
+ * the flush reads this rate, and a mint that consumes a subsidy mid-flush lands
1684
+ * after the snapshot captured that market's cash, so it cannot reach the frozen
1685
+ * mark.
1686
+ */
1687
+ export function setFeeIncentiveSubsidyRate(options: SetFeeIncentiveSubsidyRateOptions) {
1688
+ const packageAddress =
1689
+ options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
1690
+ const argumentsTypes = [null, null, 'u64', '0x2::clock::Clock'] satisfies (string | null)[];
1691
+ const parameterNames = ['config', 'AdminCap', 'rate'];
1692
+ return (tx: Transaction) =>
1693
+ tx.moveCall({
1694
+ package: packageAddress,
1695
+ module: 'protocol_config',
1696
+ function: 'set_fee_incentive_subsidy_rate',
1697
+ arguments: normalizeMoveArguments(
1698
+ {
1699
+ ...options.arguments,
1700
+ config: options.arguments?.config ?? options.config?.protocolConfig,
1701
+ },
1702
+ argumentsTypes,
1703
+ parameterNames,
1704
+ ),
1705
+ });
1706
+ }
1707
+ export interface SetFeeIncentiveLiveTargetRateArguments {
1708
+ config?: RawTransactionArgument<string>;
1709
+ AdminCap: RawTransactionArgument<string>;
1710
+ rate: RawTransactionArgument<number | bigint>;
1711
+ }
1712
+ export interface SetFeeIncentiveLiveTargetRateOptions {
1713
+ package?: string;
1714
+ arguments: SetFeeIncentiveLiveTargetRateArguments;
1715
+ config?: {
1716
+ protocolConfig: ConfigValue;
1717
+ predictPackageId?: string;
1718
+ };
1719
+ }
1720
+ /**
1721
+ * Set the share of an expiry's allocation cap each live rebalance tops its
1722
+ * sponsor-funded fee-incentive balance up to. Read at every rebalance, so it
1723
+ * applies to markets already trading. Lowering it never claws back a balance
1724
+ * already allocated: a market above the new target receives nothing more until it
1725
+ * spends below it. `0` stops the pool reserve being allocated to markets, so it
1726
+ * stays in the pool and withdrawable. It may exceed a market's lifetime cap: the
1727
+ * cap still bounds what the market receives, so the target is not checked against
1728
+ * the lifetime cap rate.
1729
+ *
1730
+ * Binds every rebalance only once the version watermark has retired package
1731
+ * versions older than 4: `rebalance_expiry_cash` is permissionless, and those
1732
+ * versions top a market up to a fixed 2% whatever this is set to. Not gated on the
1733
+ * valuation flag: the flush never reads it, and the reserve and market incentive
1734
+ * balances it moves between are outside PLP NAV.
1735
+ */
1736
+ export function setFeeIncentiveLiveTargetRate(options: SetFeeIncentiveLiveTargetRateOptions) {
1737
+ const packageAddress =
1738
+ options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
1739
+ const argumentsTypes = [null, null, 'u64', '0x2::clock::Clock'] satisfies (string | null)[];
1740
+ const parameterNames = ['config', 'AdminCap', 'rate'];
1741
+ return (tx: Transaction) =>
1742
+ tx.moveCall({
1743
+ package: packageAddress,
1744
+ module: 'protocol_config',
1745
+ function: 'set_fee_incentive_live_target_rate',
1746
+ arguments: normalizeMoveArguments(
1747
+ {
1748
+ ...options.arguments,
1749
+ config: options.arguments?.config ?? options.config?.protocolConfig,
1750
+ },
1751
+ argumentsTypes,
1752
+ parameterNames,
1753
+ ),
1754
+ });
1755
+ }
1756
+ export interface SetTemplateFeeIncentiveLifetimeCapRateArguments {
1757
+ config?: RawTransactionArgument<string>;
1758
+ AdminCap: RawTransactionArgument<string>;
1759
+ rate: RawTransactionArgument<number | bigint>;
1760
+ }
1761
+ export interface SetTemplateFeeIncentiveLifetimeCapRateOptions {
1762
+ package?: string;
1763
+ arguments: SetTemplateFeeIncentiveLifetimeCapRateArguments;
1764
+ config?: {
1765
+ protocolConfig: ConfigValue;
1766
+ predictPackageId?: string;
1767
+ };
1768
+ }
1769
+ /**
1770
+ * Set the share of an expiry's allocation cap it may receive in sponsor-funded fee
1771
+ * incentives over its life. Snapshotted into each expiry's pool accounting row
1772
+ * when the market is created, so markets already created keep the cap they were
1773
+ * created with, and `vault_events::FeeIncentiveLifetimeCapSnapshotted` reports
1774
+ * each market's cap.
1775
+ *
1776
+ * Binds market creation only once the version watermark has retired package
1777
+ * versions older than 4, which snapshot a fixed 10% whatever this is set to. Not
1778
+ * gated on the valuation flag, for the same reason as the live target rate.
1779
+ */
1780
+ export function setTemplateFeeIncentiveLifetimeCapRate(
1781
+ options: SetTemplateFeeIncentiveLifetimeCapRateOptions,
1782
+ ) {
1783
+ const packageAddress =
1784
+ options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
1785
+ const argumentsTypes = [null, null, 'u64', '0x2::clock::Clock'] satisfies (string | null)[];
1786
+ const parameterNames = ['config', 'AdminCap', 'rate'];
1787
+ return (tx: Transaction) =>
1788
+ tx.moveCall({
1789
+ package: packageAddress,
1790
+ module: 'protocol_config',
1791
+ function: 'set_template_fee_incentive_lifetime_cap_rate',
1792
+ arguments: normalizeMoveArguments(
1793
+ {
1794
+ ...options.arguments,
1795
+ config: options.arguments?.config ?? options.config?.protocolConfig,
1796
+ },
1797
+ argumentsTypes,
1798
+ parameterNames,
1799
+ ),
1800
+ });
1801
+ }
1187
1802
  export interface SetPlpSupplyFeeRateArguments {
1188
1803
  config?: RawTransactionArgument<string>;
1189
1804
  AdminCap: RawTransactionArgument<string>;