@mysten/deepbook-v3 2.1.4 → 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 +43 -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/client.d.mts +2 -2
- package/dist/contracts/account/account_events.d.mts +20 -20
- package/dist/contracts/deepbook/account.d.mts +18 -18
- package/dist/contracts/deepbook/balances.d.mts +4 -4
- 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/deepbook.d.mts.map +1 -1
- package/dist/transactions/deepbookAdmin.d.mts +4 -4
- package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
- package/dist/transactions/marginAdmin.d.mts +7 -7
- package/dist/transactions/marginLiquidations.d.mts +3 -3
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginManager.d.mts +32 -32
- package/dist/transactions/marginPool.d.mts +18 -18
- package/dist/transactions/marginPool.d.mts.map +1 -1
- package/dist/transactions/marginRegistry.d.mts +16 -16
- package/dist/transactions/marginTPSL.d.mts +10 -10
- package/dist/transactions/poolProxy.d.mts +8 -8
- package/package.json +3 -3
- package/src/account.ts +3 -1
- package/src/contracts/deepbook_predict/builder_code.ts +3 -3
- package/src/contracts/deepbook_predict/config_events.ts +9 -2
- package/src/contracts/deepbook_predict/deps/sui/vec_map.ts +33 -0
- package/src/contracts/deepbook_predict/expiry_cash.ts +1 -1
- package/src/contracts/deepbook_predict/expiry_market.ts +70 -11
- package/src/contracts/deepbook_predict/market_lifecycle_cap.ts +3 -10
- package/src/contracts/deepbook_predict/market_manager.ts +2 -2
- package/src/contracts/deepbook_predict/order_events.ts +6 -6
- package/src/contracts/deepbook_predict/plp.ts +263 -81
- package/src/contracts/deepbook_predict/pool_accounting.ts +14 -14
- package/src/contracts/deepbook_predict/pool_valuation_cap.ts +69 -0
- package/src/contracts/deepbook_predict/predict_account.ts +1 -1
- package/src/contracts/deepbook_predict/pricing.ts +16 -4
- package/src/contracts/deepbook_predict/protocol_config.ts +202 -7
- package/src/contracts/deepbook_predict/registry.ts +91 -17
- package/src/contracts/deepbook_predict/strike_exposure.ts +1 -1
- package/src/contracts/deepbook_predict/strike_payout_tree.ts +27 -0
- package/src/contracts/deepbook_predict/vault_events.ts +45 -14
- package/src/contracts/propbook/block_scholes_store.ts +8 -42
- package/src/deployments/index.ts +13 -3
- package/src/deployments/mainnet.ts +107 -0
- package/src/deployments/testnet.ts +25 -25
- package/src/deployments/types.ts +1 -1
- package/src/predict/client.ts +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
|
@@ -5,15 +5,16 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* PLP token and pool vault.
|
|
7
7
|
*
|
|
8
|
-
* PoolVault owns the PLP treasury cap, idle
|
|
8
|
+
* PoolVault owns the PLP treasury cap, idle USDC, the protocol reserve,
|
|
9
9
|
* sponsor-funded fee incentives, per-expiry cash accounting, and the queued LP
|
|
10
|
-
* supply/withdraw requests. It coordinates the full-pool NAV valuation
|
|
11
|
-
*
|
|
10
|
+
* supply/withdraw requests. It coordinates the full-pool NAV valuation — an atomic
|
|
11
|
+
* oracle snapshot followed by resumable per-market valuation transactions, with
|
|
12
|
+
* trading live throughout (see `PoolValuation`) — and the unified per-market cash
|
|
12
13
|
* flow (initial funding, live rebalance/sweep, and settled-market sweep with
|
|
13
14
|
* terminal profit materialization). LPs queue supply/withdraw requests routed
|
|
14
|
-
* through a loaded Account; each flush (`finish_flush`) drains
|
|
15
|
-
* pool NAV, minting/burning PLP and delivering
|
|
16
|
-
* balance accumulator.
|
|
15
|
+
* through a loaded Account; each flush (`finish_flush`) drains the requests that
|
|
16
|
+
* predate its snapshot at the frozen pool NAV, minting/burning PLP and delivering
|
|
17
|
+
* fills to each account via the balance accumulator.
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
20
|
import {
|
|
@@ -25,6 +26,8 @@ import {
|
|
|
25
26
|
import { bcs } from '@mysten/sui/bcs';
|
|
26
27
|
import { U64 } from '../../bcs/integers.js';
|
|
27
28
|
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
29
|
+
import * as vec_map from './deps/sui/vec_map.js';
|
|
30
|
+
import * as pricing from './pricing.js';
|
|
28
31
|
import * as balance from './deps/sui/balance.js';
|
|
29
32
|
import * as lp_book from './lp_book.js';
|
|
30
33
|
import * as pool_accounting from './pool_accounting.js';
|
|
@@ -35,33 +38,93 @@ export const PLP = new MoveStruct({
|
|
|
35
38
|
dummy_field: bcs.bool(),
|
|
36
39
|
},
|
|
37
40
|
});
|
|
41
|
+
export const PoolValuationProof = new MoveStruct({
|
|
42
|
+
name: `${$moduleName}::PoolValuationProof`,
|
|
43
|
+
fields: {
|
|
44
|
+
dummy_field: bcs.bool(),
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
export const SnapshotStage = new MoveStruct({
|
|
48
|
+
name: `${$moduleName}::SnapshotStage`,
|
|
49
|
+
fields: {
|
|
50
|
+
dummy_field: bcs.bool(),
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
export const PoolValuation = new MoveStruct({
|
|
54
|
+
name: `${$moduleName}::PoolValuation`,
|
|
55
|
+
fields: {
|
|
56
|
+
/** Active expiry markets snapshotted at start; every one must be valued. */
|
|
57
|
+
expected_expiry_markets: bcs.vector(bcs.Address),
|
|
58
|
+
/** Markets valued so far this flush; folded against `expected` at finish. */
|
|
59
|
+
valued_expiry_markets: bcs.vector(bcs.Address),
|
|
60
|
+
/** Running Σ of each valued market's snapshot NAV (settled markets contribute 0). */
|
|
61
|
+
total_nav: U64,
|
|
62
|
+
/**
|
|
63
|
+
* Oracle state frozen during the snapshot stage, one entry per expected market.
|
|
64
|
+
* Keyed by market id so a `Pricer` can never be applied to the wrong market.
|
|
65
|
+
* `none` marks a market that was already settled at snapshot time and therefore
|
|
66
|
+
* contributes 0. This map is what makes the valuation stage deterministic: it
|
|
67
|
+
* decides both the mark AND the sweep-vs-value branch, so no later transaction's
|
|
68
|
+
* clock or oracle state can change a market's contribution.
|
|
69
|
+
*/
|
|
70
|
+
frozen_pricers: vec_map.VecMap(bcs.Address, bcs.option(pricing.FrozenPricer)),
|
|
71
|
+
/**
|
|
72
|
+
* Set by `seal_valuation_snapshot`; no market may be valued before it. Nothing may
|
|
73
|
+
* be snapshotted after it because sealing consumes the `SnapshotStage`.
|
|
74
|
+
*/
|
|
75
|
+
sealed: bcs.bool(),
|
|
76
|
+
/** Clock time the flush was started, for the stuck-flush deadline. */
|
|
77
|
+
started_at_ms: U64,
|
|
78
|
+
/**
|
|
79
|
+
* Drain budgets committed at start (the cap owner's choice), bounding how many
|
|
80
|
+
* requests each queue processes at finish. Committing them here — not at finish —
|
|
81
|
+
* is what lets `finish_flush` run permissionless: a stranger may complete a flush
|
|
82
|
+
* but only ever drains at these budgets, so completion can help LPs, never starve
|
|
83
|
+
* them by finishing with a zero budget.
|
|
84
|
+
*/
|
|
85
|
+
supply_budget: bcs.option(U64),
|
|
86
|
+
withdraw_budget: bcs.option(U64),
|
|
87
|
+
/**
|
|
88
|
+
* Each LP queue's `next_index` at the snapshot instant: the drain fills only
|
|
89
|
+
* requests indexed strictly below these, so nobody can watch the frozen mark form
|
|
90
|
+
* and then submit against a price they already know is stale.
|
|
91
|
+
*/
|
|
92
|
+
supply_request_cutoff: U64,
|
|
93
|
+
withdraw_request_cutoff: U64,
|
|
94
|
+
/**
|
|
95
|
+
* Vault-side figures captured by `seal_valuation_snapshot`. With every market's
|
|
96
|
+
* cash frozen in its stamp and these frozen here, the mark is a pure function of
|
|
97
|
+
* the snapshot instant: no in-window cash move — maintenance, settled sweep,
|
|
98
|
+
* market funding, reserve realization — can reach it. Settled members are swept
|
|
99
|
+
* during the snapshot stage, so their recoverable cash sits inside
|
|
100
|
+
* `frozen_idle_balance`.
|
|
101
|
+
*/
|
|
102
|
+
frozen_idle_balance: U64,
|
|
103
|
+
frozen_profit_basis_credits: U64,
|
|
104
|
+
frozen_profit_basis_debits: U64,
|
|
105
|
+
frozen_pending_protocol_profit: U64,
|
|
106
|
+
},
|
|
107
|
+
});
|
|
38
108
|
export const PoolVault = new MoveStruct({
|
|
39
109
|
name: `${$moduleName}::PoolVault`,
|
|
40
110
|
fields: {
|
|
41
111
|
id: bcs.Address,
|
|
42
112
|
/**
|
|
43
|
-
* Protocol-owned
|
|
113
|
+
* Protocol-owned USDC excluded from PLP redemption. No package entrypoint
|
|
44
114
|
* withdraws this balance.
|
|
45
115
|
*/
|
|
46
116
|
protocol_reserve_balance: balance.Balance,
|
|
47
|
-
/** Sponsor-funded
|
|
117
|
+
/** Sponsor-funded USDC reserved for taker fee sponsorship, excluded from PLP NAV. */
|
|
48
118
|
fee_incentive_reserve: balance.Balance,
|
|
49
119
|
/** PLP share issuance plus queued supply/withdraw escrow. */
|
|
50
120
|
lp: lp_book.LpBook,
|
|
51
|
-
/** Idle
|
|
121
|
+
/** Idle USDC custody, registered expiries, and per-expiry cash-flow rows. */
|
|
52
122
|
expiry_accounting: pool_accounting.Ledger,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
pool_vault_id: bcs.Address,
|
|
59
|
-
/** Active expiry markets snapshotted at start; every one must be valued. */
|
|
60
|
-
expected_expiry_markets: bcs.vector(bcs.Address),
|
|
61
|
-
/** Markets valued so far this flow; folded against `expected` at finish. */
|
|
62
|
-
valued_expiry_markets: bcs.vector(bcs.Address),
|
|
63
|
-
/** Running Σ of each valued market's NAV (settled markets contribute 0). */
|
|
64
|
-
total_nav: U64,
|
|
123
|
+
/**
|
|
124
|
+
* In-flight full-pool valuation, held across transactions. `Some` exactly while
|
|
125
|
+
* the `ProtocolConfig` valuation flag is engaged.
|
|
126
|
+
*/
|
|
127
|
+
valuation: bcs.option(PoolValuation),
|
|
65
128
|
},
|
|
66
129
|
});
|
|
67
130
|
export interface IdArguments {
|
|
@@ -107,7 +170,7 @@ export interface IdleBalanceOptions {
|
|
|
107
170
|
predictPackageId?: string;
|
|
108
171
|
};
|
|
109
172
|
}
|
|
110
|
-
/** Return idle
|
|
173
|
+
/** Return idle USDC for SDK and devInspect state reads. */
|
|
111
174
|
export function idleBalance(options: IdleBalanceOptions) {
|
|
112
175
|
const packageAddress =
|
|
113
176
|
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
@@ -139,7 +202,7 @@ export interface ProtocolReserveBalanceOptions {
|
|
|
139
202
|
predictPackageId?: string;
|
|
140
203
|
};
|
|
141
204
|
}
|
|
142
|
-
/** Return protocol-owned
|
|
205
|
+
/** Return protocol-owned USDC for SDK and devInspect state reads. */
|
|
143
206
|
export function protocolReserveBalance(options: ProtocolReserveBalanceOptions) {
|
|
144
207
|
const packageAddress =
|
|
145
208
|
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
@@ -451,7 +514,9 @@ export function pendingProtocolProfit(options: PendingProtocolProfitOptions) {
|
|
|
451
514
|
export interface StartPoolValuationArguments {
|
|
452
515
|
config?: RawTransactionArgument<string>;
|
|
453
516
|
vault?: RawTransactionArgument<string>;
|
|
454
|
-
|
|
517
|
+
valuationProof: TransactionArgument;
|
|
518
|
+
supplyBudget: RawTransactionArgument<number | bigint | null>;
|
|
519
|
+
withdrawBudget: RawTransactionArgument<number | bigint | null>;
|
|
455
520
|
}
|
|
456
521
|
export interface StartPoolValuationOptions {
|
|
457
522
|
package?: string;
|
|
@@ -463,16 +528,25 @@ export interface StartPoolValuationOptions {
|
|
|
463
528
|
};
|
|
464
529
|
}
|
|
465
530
|
/**
|
|
466
|
-
* Begin a full-pool valuation using a registry-issued
|
|
467
|
-
* grants control over when current oracle state is frozen for queued LP
|
|
468
|
-
* Starting engages the transaction
|
|
469
|
-
* expiry
|
|
531
|
+
* Begin a full-pool valuation using a registry-issued pool-valuation proof. The
|
|
532
|
+
* proof grants control over when current oracle state is frozen for queued LP
|
|
533
|
+
* fills. Starting engages the cross-transaction valuation flag, snapshots the
|
|
534
|
+
* active expiry set and each LP queue's eligibility cutoff, and opens the atomic
|
|
535
|
+
* snapshot stage: freeze every active market's pricer under the returned
|
|
536
|
+
* `SnapshotStage`, then seal it in the same transaction.
|
|
470
537
|
*/
|
|
471
538
|
export function startPoolValuation(options: StartPoolValuationOptions) {
|
|
472
539
|
const packageAddress =
|
|
473
540
|
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
474
|
-
const argumentsTypes = [
|
|
475
|
-
|
|
541
|
+
const argumentsTypes = [
|
|
542
|
+
null,
|
|
543
|
+
null,
|
|
544
|
+
null,
|
|
545
|
+
'0x1::option::Option<u64>',
|
|
546
|
+
'0x1::option::Option<u64>',
|
|
547
|
+
'0x2::clock::Clock',
|
|
548
|
+
] satisfies (string | null)[];
|
|
549
|
+
const parameterNames = ['config', 'vault', 'valuationProof', 'supplyBudget', 'withdrawBudget'];
|
|
476
550
|
return (tx: Transaction) =>
|
|
477
551
|
tx.moveCall({
|
|
478
552
|
package: packageAddress,
|
|
@@ -489,9 +563,9 @@ export function startPoolValuation(options: StartPoolValuationOptions) {
|
|
|
489
563
|
),
|
|
490
564
|
});
|
|
491
565
|
}
|
|
492
|
-
export interface
|
|
493
|
-
valuation: TransactionArgument;
|
|
566
|
+
export interface SnapshotExpiryPricerArguments {
|
|
494
567
|
vault?: RawTransactionArgument<string>;
|
|
568
|
+
Stage: TransactionArgument;
|
|
495
569
|
market: RawTransactionArgument<string>;
|
|
496
570
|
config?: RawTransactionArgument<string>;
|
|
497
571
|
propbookRegistry?: RawTransactionArgument<string>;
|
|
@@ -499,9 +573,9 @@ export interface ValueExpiryArguments {
|
|
|
499
573
|
bsValues: RawTransactionArgument<string>;
|
|
500
574
|
bsSvi: RawTransactionArgument<string>;
|
|
501
575
|
}
|
|
502
|
-
export interface
|
|
576
|
+
export interface SnapshotExpiryPricerOptions {
|
|
503
577
|
package?: string;
|
|
504
|
-
arguments:
|
|
578
|
+
arguments: SnapshotExpiryPricerArguments;
|
|
505
579
|
config?: {
|
|
506
580
|
poolVault: ConfigValue;
|
|
507
581
|
protocolConfig: ConfigValue;
|
|
@@ -510,16 +584,28 @@ export interface ValueExpiryOptions {
|
|
|
510
584
|
};
|
|
511
585
|
}
|
|
512
586
|
/**
|
|
513
|
-
*
|
|
514
|
-
*
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
*
|
|
587
|
+
* Freeze one snapshotted market's oracle state for this flush and stamp the
|
|
588
|
+
* market, capturing its cash rows and activating its payout-tree snapshot at this
|
|
589
|
+
* instant.
|
|
590
|
+
*
|
|
591
|
+
* Holding `SnapshotStage` is what admits this call, and that potato cannot leave
|
|
592
|
+
* the transaction `start_pool_valuation` minted it in — so every `Pricer` here is
|
|
593
|
+
* loaded at one instant, which is what lets the valuation stage span transactions
|
|
594
|
+
* without mixing marks (audit L10). This stage reads oracles only — it never walks
|
|
595
|
+
* a payout tree — so all markets fit one PTB regardless of book size.
|
|
596
|
+
*
|
|
597
|
+
* The oracle feeding this stage must have been written in an EARLIER transaction:
|
|
598
|
+
* `pricing::resolve_live_pricer` refuses a read stamped with the current
|
|
599
|
+
* transaction digest (RP-24), so a keeper cannot refresh and snapshot in one PTB.
|
|
518
600
|
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
601
|
+
* A market already settled at snapshot time is recorded with no pricer, gets no
|
|
602
|
+
* stamp (settled flows never touch live NAV), and contributes 0. An
|
|
603
|
+
* expired-but-unsettled market aborts: it has no well-defined mark, and because
|
|
604
|
+
* this stage is atomic the abort reverts the whole snapshot transaction, so the
|
|
605
|
+
* flag is never left engaged. Settle it first, then start the flush; settlement is
|
|
606
|
+
* never blocked by a flush, so that ordering is always available.
|
|
521
607
|
*/
|
|
522
|
-
export function
|
|
608
|
+
export function snapshotExpiryPricer(options: SnapshotExpiryPricerOptions) {
|
|
523
609
|
const packageAddress =
|
|
524
610
|
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
525
611
|
const argumentsTypes = [
|
|
@@ -534,8 +620,8 @@ export function valueExpiry(options: ValueExpiryOptions) {
|
|
|
534
620
|
'0x2::clock::Clock',
|
|
535
621
|
] satisfies (string | null)[];
|
|
536
622
|
const parameterNames = [
|
|
537
|
-
'valuation',
|
|
538
623
|
'vault',
|
|
624
|
+
'Stage',
|
|
539
625
|
'market',
|
|
540
626
|
'config',
|
|
541
627
|
'propbookRegistry',
|
|
@@ -547,7 +633,7 @@ export function valueExpiry(options: ValueExpiryOptions) {
|
|
|
547
633
|
tx.moveCall({
|
|
548
634
|
package: packageAddress,
|
|
549
635
|
module: 'plp',
|
|
550
|
-
function: '
|
|
636
|
+
function: 'snapshot_expiry_pricer',
|
|
551
637
|
arguments: normalizeMoveArguments(
|
|
552
638
|
{
|
|
553
639
|
...options.arguments,
|
|
@@ -560,16 +646,111 @@ export function valueExpiry(options: ValueExpiryOptions) {
|
|
|
560
646
|
),
|
|
561
647
|
});
|
|
562
648
|
}
|
|
649
|
+
export interface SealValuationSnapshotArguments {
|
|
650
|
+
vault?: RawTransactionArgument<string>;
|
|
651
|
+
stage: TransactionArgument;
|
|
652
|
+
config?: RawTransactionArgument<string>;
|
|
653
|
+
}
|
|
654
|
+
export interface SealValuationSnapshotOptions {
|
|
655
|
+
package?: string;
|
|
656
|
+
arguments: SealValuationSnapshotArguments;
|
|
657
|
+
config?: {
|
|
658
|
+
poolVault: ConfigValue;
|
|
659
|
+
protocolConfig: ConfigValue;
|
|
660
|
+
predictPackageId?: string;
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Close the snapshot stage once every expected market has a frozen pricer, and
|
|
665
|
+
* freeze the vault-side figures — idle, the profit basis, the pending protocol cut
|
|
666
|
+
* — completing the snapshot.
|
|
667
|
+
*
|
|
668
|
+
* Consuming `SnapshotStage` is the simultaneity proof: the potato dies here, so no
|
|
669
|
+
* later transaction can add oracle state to this flush, and every market is marked
|
|
670
|
+
* at the instant the snapshot transaction executed. The vault capture is
|
|
671
|
+
* consistent with the per-market stamps because `rebalance_expiry_cash` refuses to
|
|
672
|
+
* run while the stage is open (`ESnapshotStageOpen`), so no idle↔market move can
|
|
673
|
+
* land between a stamp and this capture. Valuation may then resume across as many
|
|
674
|
+
* transactions as it needs.
|
|
675
|
+
*/
|
|
676
|
+
export function sealValuationSnapshot(options: SealValuationSnapshotOptions) {
|
|
677
|
+
const packageAddress =
|
|
678
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
679
|
+
const argumentsTypes = [null, null, null] satisfies (string | null)[];
|
|
680
|
+
const parameterNames = ['vault', 'stage', 'config'];
|
|
681
|
+
return (tx: Transaction) =>
|
|
682
|
+
tx.moveCall({
|
|
683
|
+
package: packageAddress,
|
|
684
|
+
module: 'plp',
|
|
685
|
+
function: 'seal_valuation_snapshot',
|
|
686
|
+
arguments: normalizeMoveArguments(
|
|
687
|
+
{
|
|
688
|
+
...options.arguments,
|
|
689
|
+
vault: options.arguments?.vault ?? options.config?.poolVault,
|
|
690
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
691
|
+
},
|
|
692
|
+
argumentsTypes,
|
|
693
|
+
parameterNames,
|
|
694
|
+
),
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
export interface ValueExpiryArguments {
|
|
698
|
+
vault?: RawTransactionArgument<string>;
|
|
699
|
+
market: RawTransactionArgument<string>;
|
|
700
|
+
config?: RawTransactionArgument<string>;
|
|
701
|
+
}
|
|
702
|
+
export interface ValueExpiryOptions {
|
|
703
|
+
package?: string;
|
|
704
|
+
arguments: ValueExpiryArguments;
|
|
705
|
+
config?: {
|
|
706
|
+
poolVault: ConfigValue;
|
|
707
|
+
protocolConfig: ConfigValue;
|
|
708
|
+
predictPackageId?: string;
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Fold one snapshotted market's SNAPSHOT-INSTANT NAV into the running total. A
|
|
713
|
+
* market frozen as settled is swept and contributes 0; one frozen with a pricer is
|
|
714
|
+
* valued via `expiry_market::snapshot_nav` over its captured cash and tree
|
|
715
|
+
* shadows, then has its stamp cleared (releasing the tree snapshot), so later
|
|
716
|
+
* trades and the next flush start clean.
|
|
717
|
+
*
|
|
718
|
+
* The resumable stage: any transaction after the seal, one market per transaction
|
|
719
|
+
* (`constants::max_payout_tree_nodes`), reading no oracle and no clock.
|
|
720
|
+
* MEASUREMENT-ONLY for every member — settled members were swept during the
|
|
721
|
+
* snapshot stage and every frozen figure was captured there, so this call moves no
|
|
722
|
+
* cash and `rebalance_expiry_cash` runs at any time. A market that expired
|
|
723
|
+
* mid-window is valued at its frozen pre-expiry mark; its settlement does not wait
|
|
724
|
+
* for this call, because settlement is never blocked by a flush.
|
|
725
|
+
*/
|
|
726
|
+
export function valueExpiry(options: ValueExpiryOptions) {
|
|
727
|
+
const packageAddress =
|
|
728
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
729
|
+
const argumentsTypes = [null, null, null] satisfies (string | null)[];
|
|
730
|
+
const parameterNames = ['vault', 'market', 'config'];
|
|
731
|
+
return (tx: Transaction) =>
|
|
732
|
+
tx.moveCall({
|
|
733
|
+
package: packageAddress,
|
|
734
|
+
module: 'plp',
|
|
735
|
+
function: 'value_expiry',
|
|
736
|
+
arguments: normalizeMoveArguments(
|
|
737
|
+
{
|
|
738
|
+
...options.arguments,
|
|
739
|
+
vault: options.arguments?.vault ?? options.config?.poolVault,
|
|
740
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
741
|
+
},
|
|
742
|
+
argumentsTypes,
|
|
743
|
+
parameterNames,
|
|
744
|
+
),
|
|
745
|
+
});
|
|
746
|
+
}
|
|
563
747
|
export interface FinishFlushArguments {
|
|
564
|
-
valuation: TransactionArgument;
|
|
565
748
|
vault?: RawTransactionArgument<string>;
|
|
566
749
|
config?: RawTransactionArgument<string>;
|
|
567
|
-
supplyBudget: RawTransactionArgument<number | bigint | null>;
|
|
568
|
-
withdrawBudget: RawTransactionArgument<number | bigint | null>;
|
|
569
750
|
}
|
|
570
751
|
export interface FinishFlushOptions {
|
|
571
752
|
package?: string;
|
|
572
|
-
arguments
|
|
753
|
+
arguments?: FinishFlushArguments;
|
|
573
754
|
config?: {
|
|
574
755
|
poolVault: ConfigValue;
|
|
575
756
|
protocolConfig: ConfigValue;
|
|
@@ -580,9 +761,12 @@ export interface FinishFlushOptions {
|
|
|
580
761
|
* Finish a full-pool valuation and run the LP flush: prove every snapshotted
|
|
581
762
|
* market was valued exactly once, price the pool NAV, then drain the
|
|
582
763
|
* supply/withdraw queues at that frozen mark (mint PLP for supplies, burn PLP and
|
|
583
|
-
* pay
|
|
584
|
-
* return the LP-attributable pool-wide
|
|
585
|
-
* pending-protocol-profit exclusion priced from the
|
|
764
|
+
* pay USDC for withdrawals), release the valuation flag, retire the in-flight
|
|
765
|
+
* valuation, and return the LP-attributable pool-wide USDC NAV (frozen idle + Σ
|
|
766
|
+
* active NAV, net of the pending-protocol-profit exclusion priced from the frozen
|
|
767
|
+
* profit basis — every term as of the snapshot instant). Each drain fills only
|
|
768
|
+
* requests submitted before the flush's snapshot instant (the recorded queue
|
|
769
|
+
* cutoffs); younger requests wait for the next mark.
|
|
586
770
|
*
|
|
587
771
|
* `supply_budget` and `withdraw_budget` bound how many requests each queue may
|
|
588
772
|
* process this flush (`None` = unbounded). Fills — whole or partial — and
|
|
@@ -606,14 +790,8 @@ export interface FinishFlushOptions {
|
|
|
606
790
|
export function finishFlush(options: FinishFlushOptions) {
|
|
607
791
|
const packageAddress =
|
|
608
792
|
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
609
|
-
const argumentsTypes = [
|
|
610
|
-
|
|
611
|
-
null,
|
|
612
|
-
null,
|
|
613
|
-
'0x1::option::Option<u64>',
|
|
614
|
-
'0x1::option::Option<u64>',
|
|
615
|
-
] satisfies (string | null)[];
|
|
616
|
-
const parameterNames = ['valuation', 'vault', 'config', 'supplyBudget', 'withdrawBudget'];
|
|
793
|
+
const argumentsTypes = [null, null, '0x2::clock::Clock'] satisfies (string | null)[];
|
|
794
|
+
const parameterNames = ['vault', 'config'];
|
|
617
795
|
return (tx: Transaction) =>
|
|
618
796
|
tx.moveCall({
|
|
619
797
|
package: packageAddress,
|
|
@@ -655,8 +833,12 @@ export interface RebalanceExpiryCashOptions {
|
|
|
655
833
|
* due. An expired unsettled market is a no-op until that transition succeeds. Mint
|
|
656
834
|
* asserts backing but never pulls pool cash, so this is what makes a market
|
|
657
835
|
* mintable. The market must already be registered to this vault
|
|
658
|
-
* (`registry::create_and_share_expiry_market`).
|
|
659
|
-
*
|
|
836
|
+
* (`registry::create_and_share_expiry_market`). Runs at any time, including while
|
|
837
|
+
* a flush is in flight — every figure the mark reads was frozen at the snapshot
|
|
838
|
+
* instant, so no move here can reach it. The one refusal is the still-open
|
|
839
|
+
* snapshot stage (start → seal, a single transaction): a cross-move landing
|
|
840
|
+
* between a market's stamp and the seal's vault capture would skew the frozen
|
|
841
|
+
* figures, so it is structurally rejected rather than corrected for.
|
|
660
842
|
*/
|
|
661
843
|
export function rebalanceExpiryCash(options: RebalanceExpiryCashOptions) {
|
|
662
844
|
const packageAddress =
|
|
@@ -694,9 +876,9 @@ export interface SponsorFeeIncentivesOptions {
|
|
|
694
876
|
};
|
|
695
877
|
}
|
|
696
878
|
/**
|
|
697
|
-
* Sponsor taker fee incentives with
|
|
698
|
-
*
|
|
699
|
-
*
|
|
879
|
+
* Sponsor taker fee incentives with USDC. Anyone may contribute; the payment joins
|
|
880
|
+
* a pool-level reserve that is excluded from PLP NAV and later allocated to expiry
|
|
881
|
+
* markets by the normal rebalance flow.
|
|
700
882
|
*/
|
|
701
883
|
export function sponsorFeeIncentives(options: SponsorFeeIncentivesOptions) {
|
|
702
884
|
const packageAddress =
|
|
@@ -735,9 +917,9 @@ export interface LockCapitalOptions {
|
|
|
735
917
|
};
|
|
736
918
|
}
|
|
737
919
|
/**
|
|
738
|
-
* Bootstrap the pool exactly once: permanently lock `payment`
|
|
920
|
+
* Bootstrap the pool exactly once: permanently lock `payment` USDC of minimum
|
|
739
921
|
* liquidity. Mints matching PLP (1:1) into the book's locked balance — never
|
|
740
|
-
* withdrawable, so the caller receives no shares — and joins the
|
|
922
|
+
* withdrawable, so the caller receives no shares — and joins the USDC into idle.
|
|
741
923
|
* This keeps `total_supply > 0` while the vault exists and gives rounding dust a
|
|
742
924
|
* non-withdrawable PLP holder. Requires root authority and zero existing supply.
|
|
743
925
|
* Supply, withdrawal, and flush flows remain disabled until the locked liquidity
|
|
@@ -782,10 +964,10 @@ export interface RequestSupplyOptions {
|
|
|
782
964
|
};
|
|
783
965
|
}
|
|
784
966
|
/**
|
|
785
|
-
* Queue a supply request: pull `amount`
|
|
967
|
+
* Queue a supply request: pull `amount` USDC from account custody into queue
|
|
786
968
|
* escrow, recording the account's receive address as the fill recipient. The pull
|
|
787
|
-
* auto-settles any flush-delivered
|
|
788
|
-
* supply fee — zero by default — on the
|
|
969
|
+
* auto-settles any flush-delivered USDC first. The flush charges the protocol's
|
|
970
|
+
* supply fee — zero by default — on the USDC it takes in and prices shares on the
|
|
789
971
|
* remainder, so `min_plp_out` is measured after that fee. The account receives
|
|
790
972
|
* minted PLP only at a mark that mints at least `min_plp_out` for the whole
|
|
791
973
|
* `amount` — a **price floor**, not a promise of that many shares: if the pool cap
|
|
@@ -832,7 +1014,7 @@ export interface RequestWithdrawArguments {
|
|
|
832
1014
|
auth: TransactionArgument;
|
|
833
1015
|
config?: RawTransactionArgument<string>;
|
|
834
1016
|
amount: RawTransactionArgument<number | bigint>;
|
|
835
|
-
|
|
1017
|
+
minUsdcOut: RawTransactionArgument<number | bigint>;
|
|
836
1018
|
}
|
|
837
1019
|
export interface RequestWithdrawOptions {
|
|
838
1020
|
package?: string;
|
|
@@ -847,15 +1029,15 @@ export interface RequestWithdrawOptions {
|
|
|
847
1029
|
* Queue a withdraw request: pull `amount` PLP shares from account custody into
|
|
848
1030
|
* queue escrow, recording the account's receive address as the fill recipient. The
|
|
849
1031
|
* pull auto-settles any flush-delivered PLP first. The flush withholds the
|
|
850
|
-
* protocol's withdraw fee from the marked payout, so `
|
|
1032
|
+
* protocol's withdraw fee from the marked payout, so `min_usdc_out` is measured
|
|
851
1033
|
* after the fee. The account is paid only at a mark that quotes at least
|
|
852
|
-
* `
|
|
853
|
-
*
|
|
854
|
-
*
|
|
855
|
-
*
|
|
856
|
-
*
|
|
857
|
-
*
|
|
858
|
-
*
|
|
1034
|
+
* `min_usdc_out` for the whole `amount` — a **price floor**, not a promise of that
|
|
1035
|
+
* much USDC: if idle liquidity covers only part of the payout, only the shares
|
|
1036
|
+
* idle affords are burned, the fill is proportionally smaller at the same price,
|
|
1037
|
+
* and the remainder stays queued with its limit rescaled. At the shipped attempt
|
|
1038
|
+
* count of one, a flush whose mark quotes less cancels and refunds the request
|
|
1039
|
+
* there and then; a higher configured count lets it rest and retry that many
|
|
1040
|
+
* flushes first. Returns the queue index used to cancel before the flush.
|
|
859
1041
|
*/
|
|
860
1042
|
export function requestWithdraw(options: RequestWithdrawOptions) {
|
|
861
1043
|
const packageAddress =
|
|
@@ -870,7 +1052,7 @@ export function requestWithdraw(options: RequestWithdrawOptions) {
|
|
|
870
1052
|
'0x2::accumulator::AccumulatorRoot',
|
|
871
1053
|
'0x2::clock::Clock',
|
|
872
1054
|
] satisfies (string | null)[];
|
|
873
|
-
const parameterNames = ['vault', 'wrapper', 'auth', 'config', 'amount', '
|
|
1055
|
+
const parameterNames = ['vault', 'wrapper', 'auth', 'config', 'amount', 'minUsdcOut'];
|
|
874
1056
|
return (tx: Transaction) =>
|
|
875
1057
|
tx.moveCall({
|
|
876
1058
|
package: packageAddress,
|
|
@@ -904,8 +1086,8 @@ export interface CancelSupplyRequestOptions {
|
|
|
904
1086
|
};
|
|
905
1087
|
}
|
|
906
1088
|
/**
|
|
907
|
-
* Cancel a still-pending supply request, refunding its escrowed
|
|
908
|
-
*
|
|
1089
|
+
* Cancel a still-pending supply request, refunding its escrowed USDC straight into
|
|
1090
|
+
* the requesting account. `account` must be the request's recorded recipient.
|
|
909
1091
|
*/
|
|
910
1092
|
export function cancelSupplyRequest(options: CancelSupplyRequestOptions) {
|
|
911
1093
|
const packageAddress =
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* Pool-owned expiry registration and cash-flow accounting.
|
|
7
7
|
*
|
|
8
|
-
* This module owns pool idle
|
|
9
|
-
* to a pool, the active expiry index used for valuation,
|
|
10
|
-
* pool into each expiry,
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
8
|
+
* This module owns pool idle USDC custody, the durable set of expiries registered
|
|
9
|
+
* to a pool, the active expiry index used for valuation, USDC sent from the main
|
|
10
|
+
* pool into each expiry, USDC received back from each expiry, snapshotted lifetime
|
|
11
|
+
* fee-incentive caps and allocations, terminal cash watermarks, and per-expiry cap
|
|
12
|
+
* checks. It does not classify expiry-local liabilities or apply PLP reserve
|
|
13
|
+
* policy; PoolVault uses the aggregate profit basis to price PLP and decide
|
|
14
|
+
* protocol reserve transfers.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { MoveStruct } from '../utils/index.js';
|
|
@@ -30,7 +30,7 @@ export const ActiveExpiry = new MoveStruct({
|
|
|
30
30
|
export const Ledger = new MoveStruct({
|
|
31
31
|
name: `${$moduleName}::Ledger`,
|
|
32
32
|
fields: {
|
|
33
|
-
/** Idle LP-owned
|
|
33
|
+
/** Idle LP-owned USDC available for withdrawals and expiry funding. */
|
|
34
34
|
idle_balance: balance.Balance,
|
|
35
35
|
/** Expiry markets that still contribute active pool valuation/risk. */
|
|
36
36
|
active_expiry_markets: bcs.vector(ActiveExpiry),
|
|
@@ -39,9 +39,9 @@ export const Ledger = new MoveStruct({
|
|
|
39
39
|
* pool.
|
|
40
40
|
*/
|
|
41
41
|
registered_expiries: table.Table,
|
|
42
|
-
/** Pricing debit basis:
|
|
42
|
+
/** Pricing debit basis: USDC sent to expiries plus materialized terminal profit. */
|
|
43
43
|
profit_basis_debits: U64,
|
|
44
|
-
/** Pricing credit basis: all
|
|
44
|
+
/** Pricing credit basis: all USDC received back from expiries. */
|
|
45
45
|
profit_basis_credits: U64,
|
|
46
46
|
/**
|
|
47
47
|
* Aggregate terminal losses that later terminal profits must recover first; losses
|
|
@@ -59,13 +59,13 @@ export const Ledger = new MoveStruct({
|
|
|
59
59
|
export const RegisteredExpiry = new MoveStruct({
|
|
60
60
|
name: `${$moduleName}::RegisteredExpiry`,
|
|
61
61
|
fields: {
|
|
62
|
-
/**
|
|
62
|
+
/** USDC pool allocation cap snapshotted when this expiry was created. */
|
|
63
63
|
max_expiry_allocation: U64,
|
|
64
|
-
/** Minimum
|
|
64
|
+
/** Minimum USDC cash target snapshotted when this expiry was created. */
|
|
65
65
|
initial_expiry_cash: U64,
|
|
66
|
-
/**
|
|
66
|
+
/** USDC sent from the main pool into this expiry. */
|
|
67
67
|
sent_to_expiry: U64,
|
|
68
|
-
/**
|
|
68
|
+
/** USDC returned from this expiry to the main pool. */
|
|
69
69
|
received_from_expiry: U64,
|
|
70
70
|
/** Absolute lifetime fee-incentive cap snapshotted when this expiry was registered. */
|
|
71
71
|
fee_incentive_lifetime_cap: U64,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Defines revocable authority to start the full-pool valuation (the flush) without
|
|
7
|
+
* granting market-creation, oracle-write, or root-admin power. `Registry` owns the
|
|
8
|
+
* allowlist and issues the transaction-local proof `plp::start_pool_valuation`
|
|
9
|
+
* consumes.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
13
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
14
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
15
|
+
const $moduleName = '@local-pkg/deepbook_predict::pool_valuation_cap';
|
|
16
|
+
export const PoolValuationCap = new MoveStruct({
|
|
17
|
+
name: `${$moduleName}::PoolValuationCap`,
|
|
18
|
+
fields: {
|
|
19
|
+
id: bcs.Address,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
export interface IdArguments {
|
|
23
|
+
cap: RawTransactionArgument<string>;
|
|
24
|
+
}
|
|
25
|
+
export interface IdOptions {
|
|
26
|
+
package?: string;
|
|
27
|
+
arguments: IdArguments | [cap: RawTransactionArgument<string>];
|
|
28
|
+
config?: {
|
|
29
|
+
predictPackageId?: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** Returns the capability identity used by the registry allowlist. */
|
|
33
|
+
export function id(options: IdOptions) {
|
|
34
|
+
const packageAddress =
|
|
35
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
36
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
37
|
+
const parameterNames = ['cap'];
|
|
38
|
+
return (tx: Transaction) =>
|
|
39
|
+
tx.moveCall({
|
|
40
|
+
package: packageAddress,
|
|
41
|
+
module: 'pool_valuation_cap',
|
|
42
|
+
function: 'id',
|
|
43
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export interface DestroyArguments {
|
|
47
|
+
cap: RawTransactionArgument<string>;
|
|
48
|
+
}
|
|
49
|
+
export interface DestroyOptions {
|
|
50
|
+
package?: string;
|
|
51
|
+
arguments: DestroyArguments | [cap: RawTransactionArgument<string>];
|
|
52
|
+
config?: {
|
|
53
|
+
predictPackageId?: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** Destroy a `PoolValuationCap` the holder no longer needs. */
|
|
57
|
+
export function destroy(options: DestroyOptions) {
|
|
58
|
+
const packageAddress =
|
|
59
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
60
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
61
|
+
const parameterNames = ['cap'];
|
|
62
|
+
return (tx: Transaction) =>
|
|
63
|
+
tx.moveCall({
|
|
64
|
+
package: packageAddress,
|
|
65
|
+
module: 'pool_valuation_cap',
|
|
66
|
+
function: 'destroy',
|
|
67
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* (the `account` package).
|
|
8
8
|
*
|
|
9
9
|
* This is Predict's account-local state: open positions and sticky builder-code
|
|
10
|
-
* attribution.
|
|
10
|
+
* attribution. USDC/PLP custody lives in `Account`. The `PredictApp` witness
|
|
11
11
|
* namespaces this slot, so only Predict writes it.
|
|
12
12
|
*
|
|
13
13
|
* Position mutations are package-internal. Builder-code configuration accepts an
|