@mysten/deepbook-v3 2.1.3 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/PREDICT.md +17 -5
- package/dist/account.d.mts.map +1 -1
- package/dist/account.mjs +3 -1
- package/dist/account.mjs.map +1 -1
- package/dist/contracts/account/account.d.mts +23 -23
- package/dist/contracts/account/account.d.mts.map +1 -1
- package/dist/contracts/account/account_events.d.mts +20 -20
- package/dist/contracts/account/account_registry.d.mts +19 -19
- package/dist/contracts/account/account_registry.d.mts.map +1 -1
- package/dist/contracts/deepbook/account.d.mts +18 -18
- package/dist/contracts/deepbook/balances.d.mts +4 -4
- package/dist/contracts/deepbook/deep_price.d.mts +3 -3
- package/dist/contracts/deepbook/order.d.mts +12 -12
- package/dist/contracts/deepbook_predict/deps/sui/vec_map.mjs +37 -0
- package/dist/contracts/deepbook_predict/deps/sui/vec_map.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/expiry_cash.mjs +1 -1
- package/dist/contracts/deepbook_predict/expiry_cash.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/expiry_market.mjs +15 -6
- package/dist/contracts/deepbook_predict/expiry_market.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/market_manager.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/order_events.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/plp.mjs +53 -31
- package/dist/contracts/deepbook_predict/plp.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pool_accounting.mjs +7 -7
- package/dist/contracts/deepbook_predict/pool_accounting.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/predict_account.mjs +1 -1
- package/dist/contracts/deepbook_predict/predict_account.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pricing.mjs +13 -1
- package/dist/contracts/deepbook_predict/pricing.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/registry.mjs +2 -1
- package/dist/contracts/deepbook_predict/registry.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/strike_exposure.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/strike_payout_tree.mjs +13 -1
- package/dist/contracts/deepbook_predict/strike_payout_tree.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/vault_events.mjs +19 -7
- package/dist/contracts/deepbook_predict/vault_events.mjs.map +1 -1
- package/dist/contracts/deepbook_sessions/session_config.d.mts +8 -8
- package/dist/contracts/deepbook_sessions/session_config.d.mts.map +1 -1
- package/dist/contracts/deepbook_sessions/sessions.d.mts +22 -22
- package/dist/contracts/deepbook_sessions/sessions.d.mts.map +1 -1
- package/dist/deployments/index.d.mts +3 -2
- package/dist/deployments/index.d.mts.map +1 -1
- package/dist/deployments/index.mjs +4 -1
- package/dist/deployments/index.mjs.map +1 -1
- package/dist/deployments/mainnet.d.mts +14 -0
- package/dist/deployments/mainnet.d.mts.map +1 -0
- package/dist/deployments/mainnet.mjs +73 -0
- package/dist/deployments/mainnet.mjs.map +1 -0
- package/dist/deployments/testnet.mjs +23 -23
- package/dist/deployments/testnet.mjs.map +1 -1
- package/dist/deployments/types.d.mts +1 -1
- package/dist/predict/client.d.mts +25 -4
- package/dist/predict/client.d.mts.map +1 -1
- package/dist/predict/client.mjs +4 -4
- package/dist/predict/client.mjs.map +1 -1
- package/dist/predict/config/index.d.mts +2 -0
- package/dist/predict/config/index.d.mts.map +1 -1
- package/dist/predict/config/index.mjs +4 -1
- package/dist/predict/config/index.mjs.map +1 -1
- package/dist/predict/config/mainnet.d.mts +17 -0
- package/dist/predict/config/mainnet.d.mts.map +1 -0
- package/dist/predict/config/mainnet.mjs +26 -0
- package/dist/predict/config/mainnet.mjs.map +1 -0
- package/dist/predict/config/types.d.mts +6 -0
- package/dist/predict/config/types.d.mts.map +1 -1
- package/dist/predict/index.d.mts +4 -2
- package/dist/predict/index.mjs +3 -1
- package/dist/predict/pricing.d.mts +6 -6
- package/dist/predict/pricing.d.mts.map +1 -1
- package/dist/predict/pricing.mjs +6 -6
- package/dist/predict/pricing.mjs.map +1 -1
- package/dist/predict/reads/balances.mjs.map +1 -1
- package/dist/predict/reads/markets.mjs +1 -1
- package/dist/predict/reads/markets.mjs.map +1 -1
- package/dist/predict/reads/pricing.d.mts +2 -1
- package/dist/predict/reads/pricing.d.mts.map +1 -1
- package/dist/predict/reads/pricing.mjs.map +1 -1
- package/dist/sessions.d.mts.map +1 -1
- package/dist/sessions.mjs +3 -1
- package/dist/sessions.mjs.map +1 -1
- package/dist/transactions/balanceManager.d.mts +12 -12
- package/dist/transactions/balanceManager.d.mts.map +1 -1
- package/dist/transactions/deepbook.d.mts +20 -20
- package/dist/transactions/deepbookAdmin.d.mts +4 -4
- package/dist/transactions/marginAdmin.d.mts +7 -7
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginManager.d.mts +32 -32
- package/dist/transactions/marginPool.d.mts +18 -18
- package/dist/transactions/marginPool.d.mts.map +1 -1
- package/dist/transactions/marginTPSL.d.mts +10 -10
- package/dist/transactions/marginTPSL.d.mts.map +1 -1
- package/dist/transactions/poolProxy.d.mts +8 -8
- package/dist/transactions/poolProxy.d.mts.map +1 -1
- package/package.json +3 -3
- package/src/account.ts +3 -1
- package/src/contracts/deepbook_predict/builder_code.ts +3 -3
- package/src/contracts/deepbook_predict/config_events.ts +9 -2
- package/src/contracts/deepbook_predict/deps/sui/vec_map.ts +33 -0
- package/src/contracts/deepbook_predict/expiry_cash.ts +1 -1
- package/src/contracts/deepbook_predict/expiry_market.ts +70 -11
- package/src/contracts/deepbook_predict/market_lifecycle_cap.ts +3 -10
- package/src/contracts/deepbook_predict/market_manager.ts +2 -2
- package/src/contracts/deepbook_predict/order_events.ts +6 -6
- package/src/contracts/deepbook_predict/plp.ts +263 -81
- package/src/contracts/deepbook_predict/pool_accounting.ts +14 -14
- package/src/contracts/deepbook_predict/pool_valuation_cap.ts +69 -0
- package/src/contracts/deepbook_predict/predict_account.ts +1 -1
- package/src/contracts/deepbook_predict/pricing.ts +16 -4
- package/src/contracts/deepbook_predict/protocol_config.ts +202 -7
- package/src/contracts/deepbook_predict/registry.ts +91 -17
- package/src/contracts/deepbook_predict/strike_exposure.ts +1 -1
- package/src/contracts/deepbook_predict/strike_payout_tree.ts +27 -0
- package/src/contracts/deepbook_predict/vault_events.ts +45 -14
- package/src/contracts/propbook/block_scholes_store.ts +8 -42
- package/src/deployments/index.ts +13 -3
- package/src/deployments/mainnet.ts +107 -0
- package/src/deployments/testnet.ts +25 -25
- package/src/deployments/types.ts +1 -1
- package/src/predict/client.ts +45 -15
- package/src/predict/config/index.ts +7 -2
- package/src/predict/config/mainnet.ts +27 -0
- package/src/predict/config/types.ts +7 -1
- package/src/predict/index.ts +5 -0
- package/src/predict/pricing.ts +11 -9
- package/src/predict/reads/balances.ts +1 -1
- package/src/predict/reads/markets.ts +1 -1
- package/src/predict/reads/pricing.ts +2 -1
- package/src/sessions.ts +4 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@mysten/deepbook-v3",
|
|
3
3
|
"author": "Mysten Labs <build@mystenlabs.com>",
|
|
4
4
|
"description": "Sui Deepbook SDK",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.3.0",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"sideEffects": false,
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"ts-retry-promise": "^0.8.1",
|
|
62
62
|
"typescript": "^7.0.2",
|
|
63
63
|
"vite": "^8.2.1",
|
|
64
|
-
"vitest": "^4.1.
|
|
64
|
+
"vitest": "^4.1.11",
|
|
65
65
|
"wait-on": "^9.1.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@mysten/sui": "^2.
|
|
68
|
+
"@mysten/sui": "^2.30.0"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"clean": "rm -rf tsconfig.tsbuildinfo ./dist",
|
package/src/account.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { deriveObjectID } from '@mysten/sui/utils';
|
|
|
11
11
|
import * as account from './contracts/account/account.js';
|
|
12
12
|
import * as accountRegistry from './contracts/account/account_registry.js';
|
|
13
13
|
import type { AccountConfig as GeneratedAccountConfig } from './contracts/account/config-arguments.js';
|
|
14
|
+
import { MAINNET_ACCOUNT } from './deployments/mainnet.js';
|
|
14
15
|
import { TESTNET_ACCOUNT } from './deployments/testnet.js';
|
|
15
16
|
import type { NetworkArg } from './deployments/index.js';
|
|
16
17
|
|
|
@@ -53,9 +54,10 @@ export interface AccountConfig extends GeneratedAccountConfig {
|
|
|
53
54
|
*/
|
|
54
55
|
export function getAccountConfig(network: NetworkArg): AccountConfig {
|
|
55
56
|
if (network === 'testnet') return TESTNET_ACCOUNT;
|
|
57
|
+
if (network === 'mainnet') return MAINNET_ACCOUNT;
|
|
56
58
|
throw new Error(
|
|
57
59
|
`@mysten/deepbook-v3/account: no account deployment recorded for network '${network}'. ` +
|
|
58
|
-
'The account primitive is testnet
|
|
60
|
+
'The account primitive is recorded for testnet and mainnet; for your own deployment pass ' +
|
|
59
61
|
'`{ accountPackageId, accountRegistry }` to AccountContract directly.',
|
|
60
62
|
);
|
|
61
63
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**************************************************************/
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Owns deterministic builder referral codes and the
|
|
6
|
+
* Owns deterministic builder referral codes and the USDC fees delivered to their
|
|
7
7
|
* object addresses through the funds accumulator. Codes are derived per owner and
|
|
8
8
|
* index, and only the immutable owner may withdraw accumulated fees.
|
|
9
9
|
*/
|
|
@@ -112,7 +112,7 @@ export interface ClaimableBuilderFeesOptions {
|
|
|
112
112
|
predictPackageId?: string;
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
-
/** Return visible
|
|
115
|
+
/** Return visible USDC builder fees for SDK and devInspect reads. */
|
|
116
116
|
export function claimableBuilderFees(options: ClaimableBuilderFeesOptions) {
|
|
117
117
|
const packageAddress =
|
|
118
118
|
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
@@ -137,7 +137,7 @@ export interface ClaimAllBuilderFeesOptions {
|
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
|
-
* Claims all settled
|
|
140
|
+
* Claims all settled USDC builder fees for the immutable owner; an empty
|
|
141
141
|
* accumulator returns a zero coin.
|
|
142
142
|
*/
|
|
143
143
|
export function claimAllBuilderFees(options: ClaimAllBuilderFeesOptions) {
|
|
@@ -50,6 +50,13 @@ export const PlpFeeRatesUpdated = new MoveStruct({
|
|
|
50
50
|
onchain_timestamp_ms: U64,
|
|
51
51
|
},
|
|
52
52
|
});
|
|
53
|
+
export const NoTradeWindowUpdated = new MoveStruct({
|
|
54
|
+
name: `${$moduleName}::NoTradeWindowUpdated`,
|
|
55
|
+
fields: {
|
|
56
|
+
no_trade_window_ms: U64,
|
|
57
|
+
onchain_timestamp_ms: U64,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
53
60
|
export const TradingPausedUpdated = new MoveStruct({
|
|
54
61
|
name: `${$moduleName}::TradingPausedUpdated`,
|
|
55
62
|
fields: {
|
|
@@ -79,9 +86,9 @@ export const MarketCreated = new MoveStruct({
|
|
|
79
86
|
tick_size: U64,
|
|
80
87
|
/** Coarser raw-price step that new finite mint boundaries must align to. */
|
|
81
88
|
admission_tick_size: U64,
|
|
82
|
-
/**
|
|
89
|
+
/** USDC pool allocation cap snapshotted for this expiry. */
|
|
83
90
|
max_expiry_allocation: U64,
|
|
84
|
-
/** Minimum
|
|
91
|
+
/** Minimum USDC cash target snapshotted for this expiry. */
|
|
85
92
|
initial_expiry_cash: U64,
|
|
86
93
|
backing_buffer_lambda: U64,
|
|
87
94
|
base_fee: U64,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { type BcsType, bcs } from '@mysten/sui/bcs';
|
|
5
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
6
|
+
const $moduleName = '0x2::vec_map';
|
|
7
|
+
/** An entry in the map */
|
|
8
|
+
export function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]) {
|
|
9
|
+
return new MoveStruct({
|
|
10
|
+
name: `${$moduleName}::Entry<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`,
|
|
11
|
+
fields: {
|
|
12
|
+
key: typeParameters[0],
|
|
13
|
+
value: typeParameters[1],
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A map data structure backed by a vector. The map is guaranteed not to contain
|
|
19
|
+
* duplicate keys, but entries are _not_ sorted by key--entries are included in
|
|
20
|
+
* insertion order. All operations are O(N) in the size of the map--the intention
|
|
21
|
+
* of this data structure is only to provide the convenience of programming against
|
|
22
|
+
* a map API. Large maps should use handwritten parent/child relationships instead.
|
|
23
|
+
* Maps that need sorted iteration rather than insertion order iteration should
|
|
24
|
+
* also be handwritten.
|
|
25
|
+
*/
|
|
26
|
+
export function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]) {
|
|
27
|
+
return new MoveStruct({
|
|
28
|
+
name: `${$moduleName}::VecMap<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`,
|
|
29
|
+
fields: {
|
|
30
|
+
contents: bcs.vector(Entry(typeParameters[0], typeParameters[1])),
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**************************************************************/
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Expiry-local
|
|
6
|
+
* Expiry-local USDC custody and isolated reserve accounting.
|
|
7
7
|
*
|
|
8
8
|
* This leaf owns cash balance arithmetic and the inventory-impact escrow used only
|
|
9
9
|
* for live-close rebates. It does not decide payment eligibility, pool allocation,
|
|
@@ -19,14 +19,24 @@ import {
|
|
|
19
19
|
type RawTransactionArgument,
|
|
20
20
|
type ConfigValue,
|
|
21
21
|
} from '../utils/index.js';
|
|
22
|
-
import { bcs } from '@mysten/sui/bcs';
|
|
23
22
|
import { U64 } from '../../bcs/integers.js';
|
|
23
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
24
24
|
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
25
25
|
import * as expiry_cash from './expiry_cash.js';
|
|
26
26
|
import * as balance from './deps/sui/balance.js';
|
|
27
27
|
import * as strike_exposure from './strike_exposure.js';
|
|
28
28
|
import * as ewma from './ewma.js';
|
|
29
29
|
const $moduleName = '@local-pkg/deepbook_predict::expiry_market';
|
|
30
|
+
export const ValuationStamp = new MoveStruct({
|
|
31
|
+
name: `${$moduleName}::ValuationStamp`,
|
|
32
|
+
fields: {
|
|
33
|
+
flush_seq: U64,
|
|
34
|
+
/** `cash.balance()` at the snapshot instant. */
|
|
35
|
+
snapshot_cash: U64,
|
|
36
|
+
/** `cash.inventory_impact_reserve()` at the snapshot instant. */
|
|
37
|
+
snapshot_impact_reserve: U64,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
30
40
|
export const ExpiryMarket = new MoveStruct({
|
|
31
41
|
name: `${$moduleName}::ExpiryMarket`,
|
|
32
42
|
fields: {
|
|
@@ -34,9 +44,9 @@ export const ExpiryMarket = new MoveStruct({
|
|
|
34
44
|
/** Propbook underlying this market was created for. */
|
|
35
45
|
propbook_underlying_id: bcs.u32(),
|
|
36
46
|
expiry: U64,
|
|
37
|
-
/**
|
|
47
|
+
/** USDC custody and payout backing. */
|
|
38
48
|
cash: expiry_cash.ExpiryCash,
|
|
39
|
-
/** Sponsor-funded
|
|
49
|
+
/** Sponsor-funded USDC available to subsidize this market's taker fees. */
|
|
40
50
|
fee_incentive_balance: balance.Balance,
|
|
41
51
|
/** Exposure lifecycle state for this expiry's strike ticks. */
|
|
42
52
|
strike_exposure: strike_exposure.StrikeExposure,
|
|
@@ -48,6 +58,14 @@ export const ExpiryMarket = new MoveStruct({
|
|
|
48
58
|
* through the registry (ungated kill switch).
|
|
49
59
|
*/
|
|
50
60
|
mint_paused: bcs.bool(),
|
|
61
|
+
/**
|
|
62
|
+
* `Some` from the flush's snapshot stage until this market's `value_expiry` (or
|
|
63
|
+
* lazily discarded once the stamp goes stale — see `ValuationStamp`). Trading is
|
|
64
|
+
* never gated on it and never touches it: the cash rows are captured eagerly here
|
|
65
|
+
* at the snapshot instant, and the payout tree captures its own boundary shadows
|
|
66
|
+
* as trades first touch each node.
|
|
67
|
+
*/
|
|
68
|
+
valuation_stamp: bcs.option(ValuationStamp),
|
|
51
69
|
},
|
|
52
70
|
});
|
|
53
71
|
export const MintQuote = new MoveStruct({
|
|
@@ -224,7 +242,7 @@ export interface CashBalanceOptions {
|
|
|
224
242
|
predictPackageId?: string;
|
|
225
243
|
};
|
|
226
244
|
}
|
|
227
|
-
/** Return expiry
|
|
245
|
+
/** Return expiry USDC custody for SDK and devInspect state reads. */
|
|
228
246
|
export function cashBalance(options: CashBalanceOptions) {
|
|
229
247
|
const packageAddress =
|
|
230
248
|
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
@@ -396,7 +414,7 @@ export interface InventoryImpactScaleOptions {
|
|
|
396
414
|
};
|
|
397
415
|
}
|
|
398
416
|
/**
|
|
399
|
-
* Return the immutable
|
|
417
|
+
* Return the immutable USDC scale of this market's inventory-impact curve for SDK
|
|
400
418
|
* and devInspect state reads.
|
|
401
419
|
*/
|
|
402
420
|
export function inventoryImpactScale(options: InventoryImpactScaleOptions) {
|
|
@@ -614,6 +632,45 @@ export function loadLivePricer(options: LoadLivePricerOptions) {
|
|
|
614
632
|
),
|
|
615
633
|
});
|
|
616
634
|
}
|
|
635
|
+
export interface IsPendingValuationArguments {
|
|
636
|
+
market: RawTransactionArgument<string>;
|
|
637
|
+
config?: RawTransactionArgument<string>;
|
|
638
|
+
}
|
|
639
|
+
export interface IsPendingValuationOptions {
|
|
640
|
+
package?: string;
|
|
641
|
+
arguments: IsPendingValuationArguments;
|
|
642
|
+
config?: {
|
|
643
|
+
protocolConfig: ConfigValue;
|
|
644
|
+
predictPackageId?: string;
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Return whether this market is snapshotted into the in-flight flush and still
|
|
649
|
+
* awaiting its `value_expiry`. For SDK, keeper, and devInspect reads. It gates
|
|
650
|
+
* nothing: settlement and trading both run regardless — the frozen mark is
|
|
651
|
+
* settlement-invariant, so a stamped market settles the instant it expires. Do not
|
|
652
|
+
* defer a settlement attempt on this read.
|
|
653
|
+
*/
|
|
654
|
+
export function isPendingValuation(options: IsPendingValuationOptions) {
|
|
655
|
+
const packageAddress =
|
|
656
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
657
|
+
const argumentsTypes = [null, null] satisfies (string | null)[];
|
|
658
|
+
const parameterNames = ['market', 'config'];
|
|
659
|
+
return (tx: Transaction) =>
|
|
660
|
+
tx.moveCall({
|
|
661
|
+
package: packageAddress,
|
|
662
|
+
module: 'expiry_market',
|
|
663
|
+
function: 'is_pending_valuation',
|
|
664
|
+
arguments: normalizeMoveArguments(
|
|
665
|
+
{
|
|
666
|
+
...options.arguments,
|
|
667
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
668
|
+
},
|
|
669
|
+
argumentsTypes,
|
|
670
|
+
parameterNames,
|
|
671
|
+
),
|
|
672
|
+
});
|
|
673
|
+
}
|
|
617
674
|
export interface CurrentNavArguments {
|
|
618
675
|
market: RawTransactionArgument<string>;
|
|
619
676
|
pricer: TransactionArgument;
|
|
@@ -1118,7 +1175,7 @@ export interface MintExactQuantityOptions {
|
|
|
1118
1175
|
* withdraw through the loaded account. The position's strike range is the tick
|
|
1119
1176
|
* pair `(lower_tick, higher_tick]` (`lower_tick = 0` is `-inf`,
|
|
1120
1177
|
* `higher_tick = pos_inf_tick` is `+inf`); the SDK converts raw strikes to ticks.
|
|
1121
|
-
* `max_cost` caps the all-in
|
|
1178
|
+
* `max_cost` caps the all-in USDC withdrawal, while `max_probability` caps the
|
|
1122
1179
|
* quoted per-contract probability before fees. Callers can pass
|
|
1123
1180
|
* `std::u64::max_value!()` for either uncapped guard. Returns the minted order ID
|
|
1124
1181
|
* for future order-scoped flows.
|
|
@@ -1193,12 +1250,12 @@ export interface MintExactAmountOptions {
|
|
|
1193
1250
|
* must meet `min_quantity`.
|
|
1194
1251
|
*
|
|
1195
1252
|
* Fees, builder fees, and EWMA congestion penalties are charged on top of
|
|
1196
|
-
* `max_premium`, so `max_cost` — not `max_premium` — bounds the all-in
|
|
1253
|
+
* `max_premium`, so `max_cost` — not `max_premium` — bounds the all-in USDC
|
|
1197
1254
|
* withdrawal (`premium + trader-paid fee + builder_fee + EWMA penalty`).
|
|
1198
1255
|
* `max_cost` is required: unlike `mint_exact_quantity`'s guards there is no value
|
|
1199
1256
|
* that disables it, because the budget shape exists to bound spend. The sizing
|
|
1200
|
-
* budget is first capped to the account's available
|
|
1201
|
-
* still require additional available
|
|
1257
|
+
* budget is first capped to the account's available USDC after settlement; fees
|
|
1258
|
+
* still require additional available USDC at payment time. Any unspent premium
|
|
1202
1259
|
* dust remains in the account because order quantity must be an integer number of
|
|
1203
1260
|
* `position_lot_size` lots.
|
|
1204
1261
|
*/
|
|
@@ -1275,7 +1332,7 @@ export interface RedeemLiveOptions {
|
|
|
1275
1332
|
* Two close-side slippage floors, the mirror of mint's `max_probability` /
|
|
1276
1333
|
* `max_cost` pair; pass `0` to disable either. `min_probability` floors the quoted
|
|
1277
1334
|
* per-contract range probability (same units as mint's `max_probability`).
|
|
1278
|
-
* `min_proceeds` floors the all-in net
|
|
1335
|
+
* `min_proceeds` floors the all-in net USDC credited to the account
|
|
1279
1336
|
* (`redeem_amount` minus trading fee, builder fee, and EWMA penalty), the mirror
|
|
1280
1337
|
* of mint's all-in `max_cost`.
|
|
1281
1338
|
*/
|
|
@@ -1440,7 +1497,9 @@ export interface SetReferenceTickOptions {
|
|
|
1440
1497
|
* Set this expiry's reference fine-grid tick from the exact previous-window
|
|
1441
1498
|
* Propbook Pyth observation. The source observation must be inserted into the feed
|
|
1442
1499
|
* at `reference_tick_source_timestamp_ms` before this call, and the normalized
|
|
1443
|
-
* spot is floored to the market's `tick_size`.
|
|
1500
|
+
* spot is floored to the market's `tick_size`. Not gated on the valuation lock:
|
|
1501
|
+
* the reference tick shapes mint admission only, and a mint it admits mid-flush is
|
|
1502
|
+
* invisible to the captured snapshot like any other.
|
|
1444
1503
|
*/
|
|
1445
1504
|
export function setReferenceTick(options: SetReferenceTickOptions) {
|
|
1446
1505
|
const packageAddress =
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
**************************************************************/
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Defines revocable authority for market creation
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* cross-module lifecycle flows.
|
|
6
|
+
* Defines revocable authority for market creation without granting pool-valuation,
|
|
7
|
+
* oracle-write, or root-admin power. `Registry` owns the allowlist and the
|
|
8
|
+
* creation entrypoint this capability gates.
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
11
|
import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
@@ -19,12 +18,6 @@ export const MarketLifecycleCap = new MoveStruct({
|
|
|
19
18
|
id: bcs.Address,
|
|
20
19
|
},
|
|
21
20
|
});
|
|
22
|
-
export const MarketLifecycleProof = new MoveStruct({
|
|
23
|
-
name: `${$moduleName}::MarketLifecycleProof`,
|
|
24
|
-
fields: {
|
|
25
|
-
dummy_field: bcs.bool(),
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
21
|
export interface IdArguments {
|
|
29
22
|
cap: RawTransactionArgument<string>;
|
|
30
23
|
}
|
|
@@ -40,12 +40,12 @@ export const CadenceConfig = new MoveStruct({
|
|
|
40
40
|
/** Coarser raw-price step that new finite mint boundaries must align to. */
|
|
41
41
|
admission_tick_size: U64,
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* USDC pool allocation cap snapshotted into pool accounting for each created
|
|
44
44
|
* expiry.
|
|
45
45
|
*/
|
|
46
46
|
max_expiry_allocation: U64,
|
|
47
47
|
/**
|
|
48
|
-
* Minimum
|
|
48
|
+
* Minimum USDC cash target snapshotted into pool accounting for each created
|
|
49
49
|
* expiry.
|
|
50
50
|
*/
|
|
51
51
|
initial_expiry_cash: U64,
|
|
@@ -36,14 +36,14 @@ export const OrderMinted = new MoveStruct({
|
|
|
36
36
|
/** 1e9-scaled range probability quoted at entry. */
|
|
37
37
|
entry_probability: U64,
|
|
38
38
|
quantity: U64,
|
|
39
|
-
/** Premium the user paid into LP backing, in
|
|
39
|
+
/** Premium the user paid into LP backing, in USDC base units. */
|
|
40
40
|
premium: U64,
|
|
41
41
|
/** Full trading fee assessed for the mint, including any sponsor-paid subsidy. */
|
|
42
42
|
trading_fee: U64,
|
|
43
43
|
/** Portion of `trading_fee` paid from expiry-local fee incentives. */
|
|
44
44
|
fee_incentive_subsidy: U64,
|
|
45
45
|
builder_fee: U64,
|
|
46
|
-
/** EWMA gas-price congestion surcharge assessed for the mint, in
|
|
46
|
+
/** EWMA gas-price congestion surcharge assessed for the mint, in USDC base units. */
|
|
47
47
|
penalty_fee: U64,
|
|
48
48
|
/**
|
|
49
49
|
* Portion of the trader-paid trading fee and congestion surcharge delivered to the
|
|
@@ -62,8 +62,8 @@ export const OrderMinted = new MoveStruct({
|
|
|
62
62
|
onchain_timestamp_ms: U64,
|
|
63
63
|
/**
|
|
64
64
|
* Oracle source timestamps present when this mint was priced: Pyth's canonical
|
|
65
|
-
* source time and the Block Scholes
|
|
66
|
-
* SVI one is also the roll-down anchor. Pyth is `0` only when unusable.
|
|
65
|
+
* source time and the Block Scholes per-update source times used for freshness.
|
|
66
|
+
* The SVI one is also the roll-down anchor. Pyth is `0` only when unusable.
|
|
67
67
|
*/
|
|
68
68
|
pyth_spot_source_timestamp_ms: U64,
|
|
69
69
|
block_scholes_spot_source_timestamp_ms: U64,
|
|
@@ -92,7 +92,7 @@ export const LiveOrderRedeemed = new MoveStruct({
|
|
|
92
92
|
redeem_amount: U64,
|
|
93
93
|
trading_fee: U64,
|
|
94
94
|
builder_fee: U64,
|
|
95
|
-
/** EWMA gas-price congestion surcharge retained by the pool, in
|
|
95
|
+
/** EWMA gas-price congestion surcharge retained by the pool, in USDC base units. */
|
|
96
96
|
penalty_fee: U64,
|
|
97
97
|
/** Separate inventory-impact rebate paid from its isolated escrow. */
|
|
98
98
|
inventory_impact_rebate: U64,
|
|
@@ -104,7 +104,7 @@ export const LiveOrderRedeemed = new MoveStruct({
|
|
|
104
104
|
onchain_timestamp_ms: U64,
|
|
105
105
|
/**
|
|
106
106
|
* Oracle source timestamps present when this redemption was priced: Pyth's
|
|
107
|
-
* canonical source time and the Block Scholes
|
|
107
|
+
* canonical source time and the Block Scholes per-update source times used for
|
|
108
108
|
* freshness. The SVI one is also the roll-down anchor. Pyth is `0` only when
|
|
109
109
|
* unusable.
|
|
110
110
|
*/
|