@mysten/deepbook-v3 2.4.1 → 2.5.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 +23 -0
- 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_events.d.mts.map +1 -1
- 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/admin.d.mts +4 -4
- package/dist/contracts/deepbook_predict/builder_code.d.mts +11 -11
- package/dist/contracts/deepbook_predict/builder_code_events.d.mts +10 -10
- package/dist/contracts/deepbook_predict/config_events.d.mts +67 -67
- package/dist/contracts/deepbook_predict/expiry_market.d.mts +95 -95
- package/dist/contracts/deepbook_predict/market_lifecycle_cap.d.mts +5 -5
- package/dist/contracts/deepbook_predict/market_manager.d.mts +27 -27
- package/dist/contracts/deepbook_predict/market_manager.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/order_events.d.mts +50 -50
- package/dist/contracts/deepbook_predict/pause_cap.d.mts +5 -5
- package/dist/contracts/deepbook_predict/plp.d.mts +72 -72
- package/dist/contracts/deepbook_predict/plp.mjs +1 -1
- package/dist/contracts/deepbook_predict/pool_valuation_cap.d.mts +5 -5
- package/dist/contracts/deepbook_predict/predict_account.d.mts +14 -14
- package/dist/contracts/deepbook_predict/pricing.d.mts +92 -51
- package/dist/contracts/deepbook_predict/pricing.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/pricing.mjs +57 -7
- package/dist/contracts/deepbook_predict/pricing.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/protocol_config.d.mts +64 -64
- package/dist/contracts/deepbook_predict/range_codec.d.mts +2 -2
- package/dist/contracts/deepbook_predict/registry.d.mts +28 -28
- package/dist/contracts/deepbook_predict/strike_exposure.mjs +3 -2
- package/dist/contracts/deepbook_predict/strike_exposure.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/vault_events.d.mts +105 -105
- 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/mainnet.mjs +21 -21
- package/dist/deployments/mainnet.mjs.map +1 -1
- package/dist/deployments/testnet.mjs +21 -21
- package/dist/deployments/testnet.mjs.map +1 -1
- package/dist/predict/index.mjs +1 -1
- package/dist/predict/reads/markets.mjs +11 -3
- package/dist/predict/reads/markets.mjs.map +1 -1
- package/dist/predict/reads/pricing.mjs +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/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/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 +2 -2
- package/src/contracts/deepbook_predict/pricing.ts +88 -6
- package/src/contracts/deepbook_predict/strike_exposure.ts +3 -2
- package/src/contracts/propbook/block_scholes_store.ts +34 -0
- package/src/contracts/propbook/pyth_feed.ts +3 -1
- package/src/deployments/mainnet.ts +22 -22
- package/src/deployments/testnet.ts +22 -22
- package/src/predict/reads/markets.ts +16 -3
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
import { MoveStruct } from "../utils/index.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _mysten_sui_bcs148 from "@mysten/sui/bcs";
|
|
3
|
+
import * as _mysten_sui_transactions197 from "@mysten/sui/transactions";
|
|
4
4
|
import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
|
|
5
5
|
|
|
6
6
|
//#region src/contracts/deepbook_predict/pricing.d.ts
|
|
7
7
|
declare namespace pricing_d_exports {
|
|
8
|
-
export { FrozenPricer, Pricer, PricingSVI, RangePriceArguments, RangePriceOptions, RawSVI, UpPriceArguments, UpPriceOptions, rangePrice, upPrice };
|
|
8
|
+
export { FrozenPricer, HigherUpArguments, HigherUpOptions, LowerUpArguments, LowerUpOptions, Pricer, PricingSVI, ProbabilityArguments, ProbabilityOptions, RangePrice, RangePriceArguments, RangePriceOptions, RawSVI, UpPriceArguments, UpPriceOptions, higherUp, lowerUp, probability, rangePrice, upPrice };
|
|
9
9
|
}
|
|
10
10
|
declare const PricingSVI: MoveStruct<{
|
|
11
|
-
/** Rolled-down SVI `a`, magnitude at 1e18, sign in `a_is_negative`. */a_magnitude:
|
|
12
|
-
a_is_negative:
|
|
13
|
-
b:
|
|
11
|
+
/** Rolled-down SVI `a`, magnitude at 1e18, sign in `a_is_negative`. */a_magnitude: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u128">;
|
|
12
|
+
a_is_negative: _mysten_sui_bcs148.BcsType<boolean, boolean, "bool">; /** Rolled-down SVI `b`, at 1e18. */
|
|
13
|
+
b: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u128">;
|
|
14
14
|
rho: MoveStruct<{
|
|
15
|
-
magnitude:
|
|
16
|
-
is_negative:
|
|
15
|
+
magnitude: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
16
|
+
is_negative: _mysten_sui_bcs148.BcsType<boolean, boolean, "bool">;
|
|
17
17
|
}, "fixed_math::i64::I64">;
|
|
18
18
|
m: MoveStruct<{
|
|
19
|
-
magnitude:
|
|
20
|
-
is_negative:
|
|
19
|
+
magnitude: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
20
|
+
is_negative: _mysten_sui_bcs148.BcsType<boolean, boolean, "bool">;
|
|
21
21
|
}, "fixed_math::i64::I64">;
|
|
22
|
-
sigma:
|
|
22
|
+
sigma: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
23
23
|
}, "@local-pkg/deepbook_predict::pricing::PricingSVI">;
|
|
24
24
|
declare const FrozenPricer: MoveStruct<{
|
|
25
|
-
expiry_market_id:
|
|
26
|
-
forward:
|
|
25
|
+
expiry_market_id: _mysten_sui_bcs148.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
26
|
+
forward: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
27
27
|
svi: MoveStruct<{
|
|
28
|
-
/** Rolled-down SVI `a`, magnitude at 1e18, sign in `a_is_negative`. */a_magnitude:
|
|
29
|
-
a_is_negative:
|
|
30
|
-
b:
|
|
28
|
+
/** Rolled-down SVI `a`, magnitude at 1e18, sign in `a_is_negative`. */a_magnitude: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u128">;
|
|
29
|
+
a_is_negative: _mysten_sui_bcs148.BcsType<boolean, boolean, "bool">; /** Rolled-down SVI `b`, at 1e18. */
|
|
30
|
+
b: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u128">;
|
|
31
31
|
rho: MoveStruct<{
|
|
32
|
-
magnitude:
|
|
33
|
-
is_negative:
|
|
32
|
+
magnitude: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
33
|
+
is_negative: _mysten_sui_bcs148.BcsType<boolean, boolean, "bool">;
|
|
34
34
|
}, "fixed_math::i64::I64">;
|
|
35
35
|
m: MoveStruct<{
|
|
36
|
-
magnitude:
|
|
37
|
-
is_negative:
|
|
36
|
+
magnitude: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
37
|
+
is_negative: _mysten_sui_bcs148.BcsType<boolean, boolean, "bool">;
|
|
38
38
|
}, "fixed_math::i64::I64">;
|
|
39
|
-
sigma:
|
|
39
|
+
sigma: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
40
40
|
}, "@local-pkg/deepbook_predict::pricing::PricingSVI">;
|
|
41
|
-
pyth_spot_source_timestamp_ms:
|
|
42
|
-
block_scholes_spot_source_timestamp_ms:
|
|
43
|
-
block_scholes_forward_source_timestamp_ms:
|
|
44
|
-
block_scholes_svi_source_timestamp_ms:
|
|
41
|
+
pyth_spot_source_timestamp_ms: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
42
|
+
block_scholes_spot_source_timestamp_ms: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
43
|
+
block_scholes_forward_source_timestamp_ms: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
44
|
+
block_scholes_svi_source_timestamp_ms: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
45
45
|
}, "@local-pkg/deepbook_predict::pricing::FrozenPricer">;
|
|
46
46
|
declare const Pricer: MoveStruct<{
|
|
47
|
-
/** Expiry market this snapshot was loaded for. */expiry_market_id:
|
|
48
|
-
forward:
|
|
47
|
+
/** Expiry market this snapshot was loaded for. */expiry_market_id: _mysten_sui_bcs148.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
48
|
+
forward: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
49
49
|
svi: MoveStruct<{
|
|
50
|
-
/** Rolled-down SVI `a`, magnitude at 1e18, sign in `a_is_negative`. */a_magnitude:
|
|
51
|
-
a_is_negative:
|
|
52
|
-
b:
|
|
50
|
+
/** Rolled-down SVI `a`, magnitude at 1e18, sign in `a_is_negative`. */a_magnitude: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u128">;
|
|
51
|
+
a_is_negative: _mysten_sui_bcs148.BcsType<boolean, boolean, "bool">; /** Rolled-down SVI `b`, at 1e18. */
|
|
52
|
+
b: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u128">;
|
|
53
53
|
rho: MoveStruct<{
|
|
54
|
-
magnitude:
|
|
55
|
-
is_negative:
|
|
54
|
+
magnitude: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
55
|
+
is_negative: _mysten_sui_bcs148.BcsType<boolean, boolean, "bool">;
|
|
56
56
|
}, "fixed_math::i64::I64">;
|
|
57
57
|
m: MoveStruct<{
|
|
58
|
-
magnitude:
|
|
59
|
-
is_negative:
|
|
58
|
+
magnitude: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
59
|
+
is_negative: _mysten_sui_bcs148.BcsType<boolean, boolean, "bool">;
|
|
60
60
|
}, "fixed_math::i64::I64">;
|
|
61
|
-
sigma:
|
|
61
|
+
sigma: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
62
62
|
}, "@local-pkg/deepbook_predict::pricing::PricingSVI">;
|
|
63
63
|
/**
|
|
64
64
|
* Timestamps of the oracle observations this snapshot validated, as trade events
|
|
@@ -68,26 +68,30 @@ declare const Pricer: MoveStruct<{
|
|
|
68
68
|
* provider `svi_timestamp`. Those timestamps are the clocks freshness gates and
|
|
69
69
|
* SVI roll-down use.
|
|
70
70
|
*/
|
|
71
|
-
pyth_spot_source_timestamp_ms:
|
|
72
|
-
block_scholes_spot_source_timestamp_ms:
|
|
73
|
-
block_scholes_forward_source_timestamp_ms:
|
|
74
|
-
block_scholes_svi_source_timestamp_ms:
|
|
71
|
+
pyth_spot_source_timestamp_ms: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
72
|
+
block_scholes_spot_source_timestamp_ms: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
73
|
+
block_scholes_forward_source_timestamp_ms: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
74
|
+
block_scholes_svi_source_timestamp_ms: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
75
75
|
}, "@local-pkg/deepbook_predict::pricing::Pricer">;
|
|
76
|
+
declare const RangePrice: MoveStruct<{
|
|
77
|
+
lower_up: _mysten_sui_bcs148.BcsType<bigint | null, string | number | bigint | null | undefined, "Option<u64>">;
|
|
78
|
+
higher_up: _mysten_sui_bcs148.BcsType<bigint | null, string | number | bigint | null | undefined, "Option<u64>">;
|
|
79
|
+
}, "@local-pkg/deepbook_predict::pricing::RangePrice">;
|
|
76
80
|
declare const RawSVI: MoveStruct<{
|
|
77
81
|
a: MoveStruct<{
|
|
78
|
-
magnitude:
|
|
79
|
-
is_negative:
|
|
82
|
+
magnitude: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
83
|
+
is_negative: _mysten_sui_bcs148.BcsType<boolean, boolean, "bool">;
|
|
80
84
|
}, "fixed_math::i64::I64">;
|
|
81
|
-
b:
|
|
85
|
+
b: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
82
86
|
rho: MoveStruct<{
|
|
83
|
-
magnitude:
|
|
84
|
-
is_negative:
|
|
87
|
+
magnitude: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
88
|
+
is_negative: _mysten_sui_bcs148.BcsType<boolean, boolean, "bool">;
|
|
85
89
|
}, "fixed_math::i64::I64">;
|
|
86
90
|
m: MoveStruct<{
|
|
87
|
-
magnitude:
|
|
88
|
-
is_negative:
|
|
91
|
+
magnitude: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
92
|
+
is_negative: _mysten_sui_bcs148.BcsType<boolean, boolean, "bool">;
|
|
89
93
|
}, "fixed_math::i64::I64">;
|
|
90
|
-
sigma:
|
|
94
|
+
sigma: _mysten_sui_bcs148.BcsType<bigint, string | number | bigint, "u64">;
|
|
91
95
|
}, "@local-pkg/deepbook_predict::pricing::RawSVI">;
|
|
92
96
|
interface UpPriceArguments {
|
|
93
97
|
pricer: TransactionArgument;
|
|
@@ -104,7 +108,7 @@ interface UpPriceOptions {
|
|
|
104
108
|
* Return the current UP digital probability for a typed strike. Public PTB and
|
|
105
109
|
* devInspect reads can compose it with a transaction-local `Pricer`.
|
|
106
110
|
*/
|
|
107
|
-
declare function upPrice(options: UpPriceOptions): (tx: Transaction) =>
|
|
111
|
+
declare function upPrice(options: UpPriceOptions): (tx: Transaction) => _mysten_sui_transactions197.TransactionResult;
|
|
108
112
|
interface RangePriceArguments {
|
|
109
113
|
pricer: TransactionArgument;
|
|
110
114
|
lower: TransactionArgument;
|
|
@@ -118,10 +122,47 @@ interface RangePriceOptions {
|
|
|
118
122
|
};
|
|
119
123
|
}
|
|
120
124
|
/**
|
|
121
|
-
* Return
|
|
122
|
-
*
|
|
125
|
+
* Return both boundary probabilities for `(lower, higher]`. Use `probability()`
|
|
126
|
+
* for the combined range probability; absent boundaries are infinite sentinels.
|
|
123
127
|
*/
|
|
124
|
-
declare function rangePrice(options: RangePriceOptions): (tx: Transaction) =>
|
|
128
|
+
declare function rangePrice(options: RangePriceOptions): (tx: Transaction) => _mysten_sui_transactions197.TransactionResult;
|
|
129
|
+
interface LowerUpArguments {
|
|
130
|
+
price: TransactionArgument;
|
|
131
|
+
}
|
|
132
|
+
interface LowerUpOptions {
|
|
133
|
+
package?: string;
|
|
134
|
+
arguments: LowerUpArguments | [price: TransactionArgument];
|
|
135
|
+
config?: {
|
|
136
|
+
predictPackageId?: string;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
declare function lowerUp(options: LowerUpOptions): (tx: Transaction) => _mysten_sui_transactions197.TransactionResult;
|
|
140
|
+
interface HigherUpArguments {
|
|
141
|
+
price: TransactionArgument;
|
|
142
|
+
}
|
|
143
|
+
interface HigherUpOptions {
|
|
144
|
+
package?: string;
|
|
145
|
+
arguments: HigherUpArguments | [price: TransactionArgument];
|
|
146
|
+
config?: {
|
|
147
|
+
predictPackageId?: string;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
declare function higherUp(options: HigherUpOptions): (tx: Transaction) => _mysten_sui_transactions197.TransactionResult;
|
|
151
|
+
interface ProbabilityArguments {
|
|
152
|
+
price: TransactionArgument;
|
|
153
|
+
}
|
|
154
|
+
interface ProbabilityOptions {
|
|
155
|
+
package?: string;
|
|
156
|
+
arguments: ProbabilityArguments | [price: TransactionArgument];
|
|
157
|
+
config?: {
|
|
158
|
+
predictPackageId?: string;
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Return the combined probability, floored at zero if approximated boundary prices
|
|
163
|
+
* invert.
|
|
164
|
+
*/
|
|
165
|
+
declare function probability(options: ProbabilityOptions): (tx: Transaction) => _mysten_sui_transactions197.TransactionResult;
|
|
125
166
|
//#endregion
|
|
126
167
|
export { pricing_d_exports };
|
|
127
168
|
//# sourceMappingURL=pricing.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pricing.d.mts","names":[],"sources":["../../../src/contracts/deepbook_predict/pricing.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"pricing.d.mts","names":[],"sources":["../../../src/contracts/deepbook_predict/pricing.ts"],"mappings":";;;;;;;;;cAuBa,UAAA,EAAU,UAAA;sFAYrB,kBAAA,CAAA,OAAA;;;;;;;;;;;;;cACW,YAAA,EAAY,UAAA;;;;;;;;;;;;;;;;;;;;;;cAYZ,MAAA,EAAM,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqBN,UAAA,EAAU,UAAA;YAMrB,kBAAA,CAAA,OAAA;;;cACW,MAAA,EAAM,UAAA;;eASjB,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AAA;AAAA,UAQP,oBAAA;EAChB,KAAA,EAAO,mBAAA;AAAA;AAAA,UAES,kBAAA;EAChB,OAAA;EACA,SAAA,EAAW,oBAAA,IAAwB,KAAA,EAAO,mBAAA;EAC1C,MAAA;IACC,gBAAA;EAAA;AAAA;;;;;iBAOc,WAAA,CAAY,OAAA,EAAS,kBAAA,IAK5B,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA"}
|
|
@@ -13,16 +13,22 @@ import { bcs } from "@mysten/sui/bcs";
|
|
|
13
13
|
*
|
|
14
14
|
* This module reads canonical Propbook Pyth and Block Scholes feeds and computes
|
|
15
15
|
* SVI-adjusted digital probabilities. Live reads require fresh, pricing-safe Block
|
|
16
|
-
* Scholes spot, forward, and SVI observations. The
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* Scholes spot, forward, and SVI observations. The latest forward is paired with
|
|
17
|
+
* an exact source-timestamp spot from Propbook's bounded recent history. The live
|
|
18
|
+
* forward comes from one of two admin-selected sources
|
|
19
|
+
* (`PricingConfig.use_pyth_spot_for_forward`): a fresh positive Pyth spot carrying
|
|
20
|
+
* the Block Scholes basis, or the Block Scholes forward directly. Exact-history
|
|
21
|
+
* reads do not apply live freshness policy.
|
|
20
22
|
*/
|
|
21
23
|
var pricing_exports = /* @__PURE__ */ __exportAll({
|
|
22
24
|
FrozenPricer: () => FrozenPricer,
|
|
23
25
|
Pricer: () => Pricer,
|
|
24
26
|
PricingSVI: () => PricingSVI,
|
|
27
|
+
RangePrice: () => RangePrice,
|
|
25
28
|
RawSVI: () => RawSVI,
|
|
29
|
+
higherUp: () => higherUp,
|
|
30
|
+
lowerUp: () => lowerUp,
|
|
31
|
+
probability: () => probability,
|
|
26
32
|
rangePrice: () => rangePrice,
|
|
27
33
|
upPrice: () => upPrice
|
|
28
34
|
});
|
|
@@ -62,6 +68,13 @@ const Pricer = new MoveStruct({
|
|
|
62
68
|
block_scholes_svi_source_timestamp_ms: U64
|
|
63
69
|
}
|
|
64
70
|
});
|
|
71
|
+
const RangePrice = new MoveStruct({
|
|
72
|
+
name: `${$moduleName}::RangePrice`,
|
|
73
|
+
fields: {
|
|
74
|
+
lower_up: bcs.option(U64),
|
|
75
|
+
higher_up: bcs.option(U64)
|
|
76
|
+
}
|
|
77
|
+
});
|
|
65
78
|
const RawSVI = new MoveStruct({
|
|
66
79
|
name: `${$moduleName}::RawSVI`,
|
|
67
80
|
fields: {
|
|
@@ -88,8 +101,8 @@ function upPrice(options) {
|
|
|
88
101
|
});
|
|
89
102
|
}
|
|
90
103
|
/**
|
|
91
|
-
* Return
|
|
92
|
-
*
|
|
104
|
+
* Return both boundary probabilities for `(lower, higher]`. Use `probability()`
|
|
105
|
+
* for the combined range probability; absent boundaries are infinite sentinels.
|
|
93
106
|
*/
|
|
94
107
|
function rangePrice(options) {
|
|
95
108
|
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
@@ -110,7 +123,44 @@ function rangePrice(options) {
|
|
|
110
123
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
111
124
|
});
|
|
112
125
|
}
|
|
126
|
+
function lowerUp(options) {
|
|
127
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
128
|
+
const argumentsTypes = [null];
|
|
129
|
+
const parameterNames = ["price"];
|
|
130
|
+
return (tx) => tx.moveCall({
|
|
131
|
+
package: packageAddress,
|
|
132
|
+
module: "pricing",
|
|
133
|
+
function: "lower_up",
|
|
134
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function higherUp(options) {
|
|
138
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
139
|
+
const argumentsTypes = [null];
|
|
140
|
+
const parameterNames = ["price"];
|
|
141
|
+
return (tx) => tx.moveCall({
|
|
142
|
+
package: packageAddress,
|
|
143
|
+
module: "pricing",
|
|
144
|
+
function: "higher_up",
|
|
145
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Return the combined probability, floored at zero if approximated boundary prices
|
|
150
|
+
* invert.
|
|
151
|
+
*/
|
|
152
|
+
function probability(options) {
|
|
153
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
154
|
+
const argumentsTypes = [null];
|
|
155
|
+
const parameterNames = ["price"];
|
|
156
|
+
return (tx) => tx.moveCall({
|
|
157
|
+
package: packageAddress,
|
|
158
|
+
module: "pricing",
|
|
159
|
+
function: "probability",
|
|
160
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
161
|
+
});
|
|
162
|
+
}
|
|
113
163
|
|
|
114
164
|
//#endregion
|
|
115
|
-
export { FrozenPricer, Pricer, pricing_exports, rangePrice };
|
|
165
|
+
export { FrozenPricer, Pricer, RangePrice, pricing_exports, probability, rangePrice };
|
|
116
166
|
//# sourceMappingURL=pricing.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pricing.mjs","names":["i64.I64"],"sources":["../../../src/contracts/deepbook_predict/pricing.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Pricing for Predict markets.\n *\n * This module reads canonical Propbook Pyth and Block Scholes feeds and computes\n * SVI-adjusted digital probabilities. Live reads require fresh, pricing-safe Block\n * Scholes spot, forward, and SVI observations. The live forward comes from one of
|
|
1
|
+
{"version":3,"file":"pricing.mjs","names":["i64.I64"],"sources":["../../../src/contracts/deepbook_predict/pricing.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Pricing for Predict markets.\n *\n * This module reads canonical Propbook Pyth and Block Scholes feeds and computes\n * SVI-adjusted digital probabilities. Live reads require fresh, pricing-safe Block\n * Scholes spot, forward, and SVI observations. The latest forward is paired with\n * an exact source-timestamp spot from Propbook's bounded recent history. The live\n * forward comes from one of two admin-selected sources\n * (`PricingConfig.use_pyth_spot_for_forward`): a fresh positive Pyth spot carrying\n * the Block Scholes basis, or the Block Scholes forward directly. Exact-history\n * reads do not apply live freshness policy.\n */\n\nimport { MoveStruct, normalizeMoveArguments } from '../utils/index.js';\nimport { U128, U64 } from '../../bcs/integers.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';\nimport * as i64 from './deps/fixed_math/i64.js';\nconst $moduleName = '@local-pkg/deepbook_predict::pricing';\nexport const PricingSVI = new MoveStruct({\n\tname: `${$moduleName}::PricingSVI`,\n\tfields: {\n\t\t/** Rolled-down SVI `a`, magnitude at 1e18, sign in `a_is_negative`. */\n\t\ta_magnitude: U128,\n\t\ta_is_negative: bcs.bool(),\n\t\t/** Rolled-down SVI `b`, at 1e18. */\n\t\tb: U128,\n\t\trho: i64.I64,\n\t\tm: i64.I64,\n\t\tsigma: U64,\n\t},\n});\nexport const FrozenPricer = new MoveStruct({\n\tname: `${$moduleName}::FrozenPricer`,\n\tfields: {\n\t\texpiry_market_id: bcs.Address,\n\t\tforward: U64,\n\t\tsvi: PricingSVI,\n\t\tpyth_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_forward_source_timestamp_ms: U64,\n\t\tblock_scholes_svi_source_timestamp_ms: U64,\n\t},\n});\nexport const Pricer = new MoveStruct({\n\tname: `${$moduleName}::Pricer`,\n\tfields: {\n\t\t/** Expiry market this snapshot was loaded for. */\n\t\texpiry_market_id: bcs.Address,\n\t\tforward: U64,\n\t\tsvi: PricingSVI,\n\t\t/**\n\t\t * Timestamps of the oracle observations this snapshot validated, as trade events\n\t\t * report them — each observation's own economic clock. Pyth carries its source\n\t\t * timestamp (`0` only when no usable normalized observation exists); Block Scholes\n\t\t * spot and forward carry the provider `value_timestamp`, and SVI carries the\n\t\t * provider `svi_timestamp`. Those timestamps are the clocks freshness gates and\n\t\t * SVI roll-down use.\n\t\t */\n\t\tpyth_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_forward_source_timestamp_ms: U64,\n\t\tblock_scholes_svi_source_timestamp_ms: U64,\n\t},\n});\nexport const RangePrice = new MoveStruct({\n\tname: `${$moduleName}::RangePrice`,\n\tfields: {\n\t\tlower_up: bcs.option(U64),\n\t\thigher_up: bcs.option(U64),\n\t},\n});\nexport const RawSVI = new MoveStruct({\n\tname: `${$moduleName}::RawSVI`,\n\tfields: {\n\t\ta: i64.I64,\n\t\tb: U64,\n\t\trho: i64.I64,\n\t\tm: i64.I64,\n\t\tsigma: U64,\n\t},\n});\nexport interface UpPriceArguments {\n\tpricer: TransactionArgument;\n\tstrike: TransactionArgument;\n}\nexport interface UpPriceOptions {\n\tpackage?: string;\n\targuments: UpPriceArguments | [pricer: TransactionArgument, strike: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Return the current UP digital probability for a typed strike. Public PTB and\n * devInspect reads can compose it with a transaction-local `Pricer`.\n */\nexport function upPrice(options: UpPriceOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['pricer', 'strike'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'pricing',\n\t\t\tfunction: 'up_price',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface RangePriceArguments {\n\tpricer: TransactionArgument;\n\tlower: TransactionArgument;\n\thigher: TransactionArgument;\n}\nexport interface RangePriceOptions {\n\tpackage?: string;\n\targuments:\n\t\t| RangePriceArguments\n\t\t| [pricer: TransactionArgument, lower: TransactionArgument, higher: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Return both boundary probabilities for `(lower, higher]`. Use `probability()`\n * for the combined range probability; absent boundaries are infinite sentinels.\n */\nexport function rangePrice(options: RangePriceOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null, null] satisfies (string | null)[];\n\tconst parameterNames = ['pricer', 'lower', 'higher'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'pricing',\n\t\t\tfunction: 'range_price',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface LowerUpArguments {\n\tprice: TransactionArgument;\n}\nexport interface LowerUpOptions {\n\tpackage?: string;\n\targuments: LowerUpArguments | [price: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\nexport function lowerUp(options: LowerUpOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['price'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'pricing',\n\t\t\tfunction: 'lower_up',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface HigherUpArguments {\n\tprice: TransactionArgument;\n}\nexport interface HigherUpOptions {\n\tpackage?: string;\n\targuments: HigherUpArguments | [price: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\nexport function higherUp(options: HigherUpOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['price'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'pricing',\n\t\t\tfunction: 'higher_up',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface ProbabilityArguments {\n\tprice: TransactionArgument;\n}\nexport interface ProbabilityOptions {\n\tpackage?: string;\n\targuments: ProbabilityArguments | [price: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Return the combined probability, floored at zero if approximated boundary prices\n * invert.\n */\nexport function probability(options: ProbabilityOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['price'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'pricing',\n\t\t\tfunction: 'probability',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,cAAc;AACpB,MAAa,aAAa,IAAI,WAAW;CACxC,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,aAAa;EACb,eAAe,IAAI,MAAM;EAEzB,GAAG;EACH,KAAKA;EACL,GAAGA;EACH,OAAO;EACP;CACD,CAAC;AACF,MAAa,eAAe,IAAI,WAAW;CAC1C,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,kBAAkB,IAAI;EACtB,SAAS;EACT,KAAK;EACL,+BAA+B;EAC/B,wCAAwC;EACxC,2CAA2C;EAC3C,uCAAuC;EACvC;CACD,CAAC;AACF,MAAa,SAAS,IAAI,WAAW;CACpC,MAAM,GAAG,YAAY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