@mysten/deepbook-v3 2.3.0 → 2.4.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 +27 -0
- package/PREDICT.md +149 -55
- package/README.md +18 -13
- 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/deepbook/account.d.mts +18 -18
- package/dist/contracts/deepbook/account.d.mts.map +1 -1
- package/dist/contracts/deepbook/balances.d.mts +4 -4
- package/dist/contracts/deepbook/balances.d.mts.map +1 -1
- package/dist/contracts/deepbook/deep_price.d.mts +3 -3
- package/dist/contracts/deepbook/deep_price.d.mts.map +1 -1
- package/dist/contracts/deepbook/order.d.mts +12 -12
- package/dist/contracts/deepbook_predict/admin.d.mts +27 -0
- package/dist/contracts/deepbook_predict/admin.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/admin.mjs +38 -0
- package/dist/contracts/deepbook_predict/admin.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/builder_code.d.mts +81 -0
- package/dist/contracts/deepbook_predict/builder_code.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/builder_code.mjs +103 -0
- package/dist/contracts/deepbook_predict/builder_code.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/builder_code_events.d.mts +25 -0
- package/dist/contracts/deepbook_predict/builder_code_events.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/builder_code_events.mjs +7 -1
- package/dist/contracts/deepbook_predict/builder_code_events.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/config_events.d.mts +104 -0
- package/dist/contracts/deepbook_predict/config_events.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/config_events.mjs +155 -0
- package/dist/contracts/deepbook_predict/config_events.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/ewma_config.mjs +28 -0
- package/dist/contracts/deepbook_predict/ewma_config.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/expiry_market.d.mts +859 -0
- package/dist/contracts/deepbook_predict/expiry_market.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/expiry_market.mjs +647 -1
- package/dist/contracts/deepbook_predict/expiry_market.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/market_lifecycle_cap.d.mts +39 -0
- package/dist/contracts/deepbook_predict/market_lifecycle_cap.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/market_lifecycle_cap.mjs +51 -0
- package/dist/contracts/deepbook_predict/market_lifecycle_cap.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/market_manager.d.mts +159 -0
- package/dist/contracts/deepbook_predict/market_manager.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/market_manager.mjs +88 -2
- package/dist/contracts/deepbook_predict/market_manager.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/order_events.d.mts +101 -0
- package/dist/contracts/deepbook_predict/order_events.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/order_events.mjs +7 -1
- package/dist/contracts/deepbook_predict/order_events.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pause_cap.d.mts +39 -0
- package/dist/contracts/deepbook_predict/pause_cap.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/pause_cap.mjs +51 -0
- package/dist/contracts/deepbook_predict/pause_cap.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/plp.d.mts +801 -0
- package/dist/contracts/deepbook_predict/plp.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/plp.mjs +458 -1
- package/dist/contracts/deepbook_predict/plp.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pool_valuation_cap.d.mts +39 -0
- package/dist/contracts/deepbook_predict/pool_valuation_cap.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/pool_valuation_cap.mjs +52 -0
- package/dist/contracts/deepbook_predict/pool_valuation_cap.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/predict_account.d.mts +90 -0
- package/dist/contracts/deepbook_predict/predict_account.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/predict_account.mjs +24 -1
- package/dist/contracts/deepbook_predict/predict_account.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pricing.d.mts +127 -0
- package/dist/contracts/deepbook_predict/pricing.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/pricing.mjs +25 -1
- package/dist/contracts/deepbook_predict/pricing.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pricing_config.mjs +28 -0
- package/dist/contracts/deepbook_predict/pricing_config.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/protocol_config.d.mts +665 -0
- package/dist/contracts/deepbook_predict/protocol_config.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/protocol_config.mjs +841 -0
- package/dist/contracts/deepbook_predict/protocol_config.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/range_codec.d.mts +30 -0
- package/dist/contracts/deepbook_predict/range_codec.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/range_codec.mjs +6 -1
- package/dist/contracts/deepbook_predict/range_codec.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/registry.d.mts +382 -0
- package/dist/contracts/deepbook_predict/registry.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/registry.mjs +456 -1
- package/dist/contracts/deepbook_predict/registry.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/vault_events.d.mts +199 -0
- package/dist/contracts/deepbook_predict/vault_events.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/vault_events.mjs +19 -1
- 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/sessions.d.mts +22 -22
- package/dist/contracts/deepbook_sessions/sessions.d.mts.map +1 -1
- package/dist/predict/client.d.mts +3 -2
- package/dist/predict/client.d.mts.map +1 -1
- package/dist/predict/client.mjs +3 -2
- package/dist/predict/client.mjs.map +1 -1
- package/dist/predict/index.d.mts +18 -1
- package/dist/predict/index.mjs +18 -1
- package/dist/transactions/balanceManager.d.mts +12 -12
- 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/marginRegistry.d.mts +16 -16
- package/dist/transactions/marginTPSL.d.mts +10 -10
- package/dist/transactions/poolProxy.d.mts +8 -8
- package/package.json +1 -1
- package/src/predict/client.ts +3 -2
- package/src/predict/index.ts +26 -2
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { MoveStruct } from "../utils/index.mjs";
|
|
2
|
+
import * as _mysten_sui_bcs164 from "@mysten/sui/bcs";
|
|
3
|
+
import * as _mysten_sui_transactions246 from "@mysten/sui/transactions";
|
|
4
|
+
import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
|
|
5
|
+
|
|
6
|
+
//#region src/contracts/deepbook_predict/pricing.d.ts
|
|
7
|
+
declare namespace pricing_d_exports {
|
|
8
|
+
export { FrozenPricer, Pricer, PricingSVI, RangePriceArguments, RangePriceOptions, RawSVI, UpPriceArguments, UpPriceOptions, rangePrice, upPrice };
|
|
9
|
+
}
|
|
10
|
+
declare const PricingSVI: MoveStruct<{
|
|
11
|
+
/** Rolled-down SVI `a`, magnitude at 1e18, sign in `a_is_negative`. */a_magnitude: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u128">;
|
|
12
|
+
a_is_negative: _mysten_sui_bcs164.BcsType<boolean, boolean, "bool">; /** Rolled-down SVI `b`, at 1e18. */
|
|
13
|
+
b: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u128">;
|
|
14
|
+
rho: MoveStruct<{
|
|
15
|
+
magnitude: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
16
|
+
is_negative: _mysten_sui_bcs164.BcsType<boolean, boolean, "bool">;
|
|
17
|
+
}, "fixed_math::i64::I64">;
|
|
18
|
+
m: MoveStruct<{
|
|
19
|
+
magnitude: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
20
|
+
is_negative: _mysten_sui_bcs164.BcsType<boolean, boolean, "bool">;
|
|
21
|
+
}, "fixed_math::i64::I64">;
|
|
22
|
+
sigma: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
23
|
+
}, "@local-pkg/deepbook_predict::pricing::PricingSVI">;
|
|
24
|
+
declare const FrozenPricer: MoveStruct<{
|
|
25
|
+
expiry_market_id: _mysten_sui_bcs164.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
26
|
+
forward: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
27
|
+
svi: MoveStruct<{
|
|
28
|
+
/** Rolled-down SVI `a`, magnitude at 1e18, sign in `a_is_negative`. */a_magnitude: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u128">;
|
|
29
|
+
a_is_negative: _mysten_sui_bcs164.BcsType<boolean, boolean, "bool">; /** Rolled-down SVI `b`, at 1e18. */
|
|
30
|
+
b: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u128">;
|
|
31
|
+
rho: MoveStruct<{
|
|
32
|
+
magnitude: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
33
|
+
is_negative: _mysten_sui_bcs164.BcsType<boolean, boolean, "bool">;
|
|
34
|
+
}, "fixed_math::i64::I64">;
|
|
35
|
+
m: MoveStruct<{
|
|
36
|
+
magnitude: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
37
|
+
is_negative: _mysten_sui_bcs164.BcsType<boolean, boolean, "bool">;
|
|
38
|
+
}, "fixed_math::i64::I64">;
|
|
39
|
+
sigma: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
40
|
+
}, "@local-pkg/deepbook_predict::pricing::PricingSVI">;
|
|
41
|
+
pyth_spot_source_timestamp_ms: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
42
|
+
block_scholes_spot_source_timestamp_ms: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
43
|
+
block_scholes_forward_source_timestamp_ms: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
44
|
+
block_scholes_svi_source_timestamp_ms: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
45
|
+
}, "@local-pkg/deepbook_predict::pricing::FrozenPricer">;
|
|
46
|
+
declare const Pricer: MoveStruct<{
|
|
47
|
+
/** Expiry market this snapshot was loaded for. */expiry_market_id: _mysten_sui_bcs164.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
48
|
+
forward: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
49
|
+
svi: MoveStruct<{
|
|
50
|
+
/** Rolled-down SVI `a`, magnitude at 1e18, sign in `a_is_negative`. */a_magnitude: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u128">;
|
|
51
|
+
a_is_negative: _mysten_sui_bcs164.BcsType<boolean, boolean, "bool">; /** Rolled-down SVI `b`, at 1e18. */
|
|
52
|
+
b: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u128">;
|
|
53
|
+
rho: MoveStruct<{
|
|
54
|
+
magnitude: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
55
|
+
is_negative: _mysten_sui_bcs164.BcsType<boolean, boolean, "bool">;
|
|
56
|
+
}, "fixed_math::i64::I64">;
|
|
57
|
+
m: MoveStruct<{
|
|
58
|
+
magnitude: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
59
|
+
is_negative: _mysten_sui_bcs164.BcsType<boolean, boolean, "bool">;
|
|
60
|
+
}, "fixed_math::i64::I64">;
|
|
61
|
+
sigma: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
62
|
+
}, "@local-pkg/deepbook_predict::pricing::PricingSVI">;
|
|
63
|
+
/**
|
|
64
|
+
* Timestamps of the oracle observations this snapshot validated, as trade events
|
|
65
|
+
* report them — each observation's own economic clock. Pyth carries its source
|
|
66
|
+
* timestamp (`0` only when no usable normalized observation exists); Block Scholes
|
|
67
|
+
* spot and forward carry the provider `value_timestamp`, and SVI carries the
|
|
68
|
+
* provider `svi_timestamp`. Those timestamps are the clocks freshness gates and
|
|
69
|
+
* SVI roll-down use.
|
|
70
|
+
*/
|
|
71
|
+
pyth_spot_source_timestamp_ms: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
72
|
+
block_scholes_spot_source_timestamp_ms: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
73
|
+
block_scholes_forward_source_timestamp_ms: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
74
|
+
block_scholes_svi_source_timestamp_ms: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
75
|
+
}, "@local-pkg/deepbook_predict::pricing::Pricer">;
|
|
76
|
+
declare const RawSVI: MoveStruct<{
|
|
77
|
+
a: MoveStruct<{
|
|
78
|
+
magnitude: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
79
|
+
is_negative: _mysten_sui_bcs164.BcsType<boolean, boolean, "bool">;
|
|
80
|
+
}, "fixed_math::i64::I64">;
|
|
81
|
+
b: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
82
|
+
rho: MoveStruct<{
|
|
83
|
+
magnitude: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
84
|
+
is_negative: _mysten_sui_bcs164.BcsType<boolean, boolean, "bool">;
|
|
85
|
+
}, "fixed_math::i64::I64">;
|
|
86
|
+
m: MoveStruct<{
|
|
87
|
+
magnitude: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
88
|
+
is_negative: _mysten_sui_bcs164.BcsType<boolean, boolean, "bool">;
|
|
89
|
+
}, "fixed_math::i64::I64">;
|
|
90
|
+
sigma: _mysten_sui_bcs164.BcsType<bigint, string | number | bigint, "u64">;
|
|
91
|
+
}, "@local-pkg/deepbook_predict::pricing::RawSVI">;
|
|
92
|
+
interface UpPriceArguments {
|
|
93
|
+
pricer: TransactionArgument;
|
|
94
|
+
strike: TransactionArgument;
|
|
95
|
+
}
|
|
96
|
+
interface UpPriceOptions {
|
|
97
|
+
package?: string;
|
|
98
|
+
arguments: UpPriceArguments | [pricer: TransactionArgument, strike: TransactionArgument];
|
|
99
|
+
config?: {
|
|
100
|
+
predictPackageId?: string;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Return the current UP digital probability for a typed strike. Public PTB and
|
|
105
|
+
* devInspect reads can compose it with a transaction-local `Pricer`.
|
|
106
|
+
*/
|
|
107
|
+
declare function upPrice(options: UpPriceOptions): (tx: Transaction) => _mysten_sui_transactions246.TransactionResult;
|
|
108
|
+
interface RangePriceArguments {
|
|
109
|
+
pricer: TransactionArgument;
|
|
110
|
+
lower: TransactionArgument;
|
|
111
|
+
higher: TransactionArgument;
|
|
112
|
+
}
|
|
113
|
+
interface RangePriceOptions {
|
|
114
|
+
package?: string;
|
|
115
|
+
arguments: RangePriceArguments | [pricer: TransactionArgument, lower: TransactionArgument, higher: TransactionArgument];
|
|
116
|
+
config?: {
|
|
117
|
+
predictPackageId?: string;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Return the current probability for `(lower, higher]`, floored at zero if the two
|
|
122
|
+
* approximated boundary probabilities invert.
|
|
123
|
+
*/
|
|
124
|
+
declare function rangePrice(options: RangePriceOptions): (tx: Transaction) => _mysten_sui_transactions246.TransactionResult;
|
|
125
|
+
//#endregion
|
|
126
|
+
export { pricing_d_exports };
|
|
127
|
+
//# sourceMappingURL=pricing.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricing.d.mts","names":[],"sources":["../../../src/contracts/deepbook_predict/pricing.ts"],"mappings":";;;;;;;;;cAqBa,UAAA,EAAU,UAAA;sFAYrB,kBAAA,CAAA,OAAA;uEAZW;;;;;;;;;;;;cAaA,YAAA,EAAY,UAAA;;;;IAbF;;;;;;;;;;;;;;;;;;cAyBV,MAAA,EAAM,UAAA;;;;IADjB;;;;;;;;;;;;;;;;;;;;;;;;;;cAsBW,MAAA,EAAM,UAAA;;eASjB,kBAAA,CAAA,OAAA;;;;;;;;;;;;;;UACe,gBAAA;EAChB,MAAA,EAAQ,mBAAA;EACR,MAAA,EAAQ,mBAAA;AAAA;AAAA,UAEQ,cAAA;EAChB,OAAA;EACA,SAAA,EAAW,gBAAA,IAAoB,MAAA,EAAQ,mBAAA,EAAqB,MAAA,EAAQ,mBAAA;EACpE,MAAA;IACC,gBAAA;EAAA;AAAA;;;;;iBAOc,OAAA,CAAQ,OAAA,EAAS,cAAA,IAKxB,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;AAAA,UAQP,mBAAA;EAChB,MAAA,EAAQ,mBAAA;EACR,KAAA,EAAO,mBAAA;EACP,MAAA,EAAQ,mBAAA;AAAA;AAAA,UAEQ,iBAAA;EAChB,OAAA;EACA,SAAA,EACG,mBAAA,IACC,MAAA,EAAQ,mBAAA,EAAqB,KAAA,EAAO,mBAAA,EAAqB,MAAA,EAAQ,mBAAA;EACrE,MAAA;IACC,gBAAA;EAAA;AAAA;;;;;iBAOc,UAAA,CAAW,OAAA,EAAS,iBAAA,IAK3B,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/rolldown_runtime.mjs";
|
|
1
2
|
import { MoveStruct, normalizeMoveArguments } from "../utils/index.mjs";
|
|
2
3
|
import { U128, U64 } from "../../bcs/integers.mjs";
|
|
3
4
|
import { I64 } from "./deps/fixed_math/i64.mjs";
|
|
@@ -17,6 +18,14 @@ import { bcs } from "@mysten/sui/bcs";
|
|
|
17
18
|
* positive Pyth spot carrying the Block Scholes basis, or the Block Scholes
|
|
18
19
|
* forward directly. Exact-history reads do not apply live freshness policy.
|
|
19
20
|
*/
|
|
21
|
+
var pricing_exports = /* @__PURE__ */ __exportAll({
|
|
22
|
+
FrozenPricer: () => FrozenPricer,
|
|
23
|
+
Pricer: () => Pricer,
|
|
24
|
+
PricingSVI: () => PricingSVI,
|
|
25
|
+
RawSVI: () => RawSVI,
|
|
26
|
+
rangePrice: () => rangePrice,
|
|
27
|
+
upPrice: () => upPrice
|
|
28
|
+
});
|
|
20
29
|
const $moduleName = "@local-pkg/deepbook_predict::pricing";
|
|
21
30
|
const PricingSVI = new MoveStruct({
|
|
22
31
|
name: `${$moduleName}::PricingSVI`,
|
|
@@ -64,6 +73,21 @@ const RawSVI = new MoveStruct({
|
|
|
64
73
|
}
|
|
65
74
|
});
|
|
66
75
|
/**
|
|
76
|
+
* Return the current UP digital probability for a typed strike. Public PTB and
|
|
77
|
+
* devInspect reads can compose it with a transaction-local `Pricer`.
|
|
78
|
+
*/
|
|
79
|
+
function upPrice(options) {
|
|
80
|
+
const packageAddress = options.package ?? options.config?.predictPackageId ?? "@local-pkg/deepbook_predict";
|
|
81
|
+
const argumentsTypes = [null, null];
|
|
82
|
+
const parameterNames = ["pricer", "strike"];
|
|
83
|
+
return (tx) => tx.moveCall({
|
|
84
|
+
package: packageAddress,
|
|
85
|
+
module: "pricing",
|
|
86
|
+
function: "up_price",
|
|
87
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
67
91
|
* Return the current probability for `(lower, higher]`, floored at zero if the two
|
|
68
92
|
* approximated boundary probabilities invert.
|
|
69
93
|
*/
|
|
@@ -88,5 +112,5 @@ function rangePrice(options) {
|
|
|
88
112
|
}
|
|
89
113
|
|
|
90
114
|
//#endregion
|
|
91
|
-
export { FrozenPricer, Pricer, rangePrice };
|
|
115
|
+
export { FrozenPricer, Pricer, pricing_exports, rangePrice };
|
|
92
116
|
//# sourceMappingURL=pricing.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pricing.mjs","names":["i64.I64"],"sources":["../../../src/contracts/deepbook_predict/pricing.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Pricing for Predict markets.\n *\n * This module reads canonical Propbook Pyth and Block Scholes feeds and computes\n * SVI-adjusted digital probabilities. Live reads require fresh, pricing-safe Block\n * Scholes spot, forward, and SVI observations. The live forward comes from one of\n * two admin-selected sources (`PricingConfig.use_pyth_spot_for_forward`): a fresh\n * positive Pyth spot carrying the Block Scholes basis, or the Block Scholes\n * forward directly. Exact-history reads do not apply live freshness policy.\n */\n\nimport { MoveStruct, normalizeMoveArguments } from '../utils/index.js';\nimport { U128, U64 } from '../../bcs/integers.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';\nimport * as i64 from './deps/fixed_math/i64.js';\nconst $moduleName = '@local-pkg/deepbook_predict::pricing';\nexport const PricingSVI = new MoveStruct({\n\tname: `${$moduleName}::PricingSVI`,\n\tfields: {\n\t\t/** Rolled-down SVI `a`, magnitude at 1e18, sign in `a_is_negative`. */\n\t\ta_magnitude: U128,\n\t\ta_is_negative: bcs.bool(),\n\t\t/** Rolled-down SVI `b`, at 1e18. */\n\t\tb: U128,\n\t\trho: i64.I64,\n\t\tm: i64.I64,\n\t\tsigma: U64,\n\t},\n});\nexport const FrozenPricer = new MoveStruct({\n\tname: `${$moduleName}::FrozenPricer`,\n\tfields: {\n\t\texpiry_market_id: bcs.Address,\n\t\tforward: U64,\n\t\tsvi: PricingSVI,\n\t\tpyth_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_forward_source_timestamp_ms: U64,\n\t\tblock_scholes_svi_source_timestamp_ms: U64,\n\t},\n});\nexport const Pricer = new MoveStruct({\n\tname: `${$moduleName}::Pricer`,\n\tfields: {\n\t\t/** Expiry market this snapshot was loaded for. */\n\t\texpiry_market_id: bcs.Address,\n\t\tforward: U64,\n\t\tsvi: PricingSVI,\n\t\t/**\n\t\t * Timestamps of the oracle observations this snapshot validated, as trade events\n\t\t * report them — each observation's own economic clock. Pyth carries its source\n\t\t * timestamp (`0` only when no usable normalized observation exists); Block Scholes\n\t\t * spot and forward carry the provider `value_timestamp`, and SVI carries the\n\t\t * provider `svi_timestamp`. Those timestamps are the clocks freshness gates and\n\t\t * SVI roll-down use.\n\t\t */\n\t\tpyth_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_forward_source_timestamp_ms: U64,\n\t\tblock_scholes_svi_source_timestamp_ms: U64,\n\t},\n});\nexport const RawSVI = new MoveStruct({\n\tname: `${$moduleName}::RawSVI`,\n\tfields: {\n\t\ta: i64.I64,\n\t\tb: U64,\n\t\trho: i64.I64,\n\t\tm: i64.I64,\n\t\tsigma: U64,\n\t},\n});\nexport interface UpPriceArguments {\n\tpricer: TransactionArgument;\n\tstrike: TransactionArgument;\n}\nexport interface UpPriceOptions {\n\tpackage?: string;\n\targuments: UpPriceArguments | [pricer: TransactionArgument, strike: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Return the current UP digital probability for a typed strike. Public PTB and\n * devInspect reads can compose it with a transaction-local `Pricer`.\n */\nexport function upPrice(options: UpPriceOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['pricer', 'strike'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'pricing',\n\t\t\tfunction: 'up_price',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface RangePriceArguments {\n\tpricer: TransactionArgument;\n\tlower: TransactionArgument;\n\thigher: TransactionArgument;\n}\nexport interface RangePriceOptions {\n\tpackage?: string;\n\targuments:\n\t\t| RangePriceArguments\n\t\t| [pricer: TransactionArgument, lower: TransactionArgument, higher: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Return the current probability for `(lower, higher]`, floored at zero if the two\n * approximated boundary probabilities invert.\n */\nexport function rangePrice(options: RangePriceOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null, null] satisfies (string | null)[];\n\tconst parameterNames = ['pricer', 'lower', 'higher'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'pricing',\n\t\t\tfunction: 'range_price',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pricing.mjs","names":["i64.I64"],"sources":["../../../src/contracts/deepbook_predict/pricing.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Pricing for Predict markets.\n *\n * This module reads canonical Propbook Pyth and Block Scholes feeds and computes\n * SVI-adjusted digital probabilities. Live reads require fresh, pricing-safe Block\n * Scholes spot, forward, and SVI observations. The live forward comes from one of\n * two admin-selected sources (`PricingConfig.use_pyth_spot_for_forward`): a fresh\n * positive Pyth spot carrying the Block Scholes basis, or the Block Scholes\n * forward directly. Exact-history reads do not apply live freshness policy.\n */\n\nimport { MoveStruct, normalizeMoveArguments } from '../utils/index.js';\nimport { U128, U64 } from '../../bcs/integers.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';\nimport * as i64 from './deps/fixed_math/i64.js';\nconst $moduleName = '@local-pkg/deepbook_predict::pricing';\nexport const PricingSVI = new MoveStruct({\n\tname: `${$moduleName}::PricingSVI`,\n\tfields: {\n\t\t/** Rolled-down SVI `a`, magnitude at 1e18, sign in `a_is_negative`. */\n\t\ta_magnitude: U128,\n\t\ta_is_negative: bcs.bool(),\n\t\t/** Rolled-down SVI `b`, at 1e18. */\n\t\tb: U128,\n\t\trho: i64.I64,\n\t\tm: i64.I64,\n\t\tsigma: U64,\n\t},\n});\nexport const FrozenPricer = new MoveStruct({\n\tname: `${$moduleName}::FrozenPricer`,\n\tfields: {\n\t\texpiry_market_id: bcs.Address,\n\t\tforward: U64,\n\t\tsvi: PricingSVI,\n\t\tpyth_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_forward_source_timestamp_ms: U64,\n\t\tblock_scholes_svi_source_timestamp_ms: U64,\n\t},\n});\nexport const Pricer = new MoveStruct({\n\tname: `${$moduleName}::Pricer`,\n\tfields: {\n\t\t/** Expiry market this snapshot was loaded for. */\n\t\texpiry_market_id: bcs.Address,\n\t\tforward: U64,\n\t\tsvi: PricingSVI,\n\t\t/**\n\t\t * Timestamps of the oracle observations this snapshot validated, as trade events\n\t\t * report them — each observation's own economic clock. Pyth carries its source\n\t\t * timestamp (`0` only when no usable normalized observation exists); Block Scholes\n\t\t * spot and forward carry the provider `value_timestamp`, and SVI carries the\n\t\t * provider `svi_timestamp`. Those timestamps are the clocks freshness gates and\n\t\t * SVI roll-down use.\n\t\t */\n\t\tpyth_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_spot_source_timestamp_ms: U64,\n\t\tblock_scholes_forward_source_timestamp_ms: U64,\n\t\tblock_scholes_svi_source_timestamp_ms: U64,\n\t},\n});\nexport const RawSVI = new MoveStruct({\n\tname: `${$moduleName}::RawSVI`,\n\tfields: {\n\t\ta: i64.I64,\n\t\tb: U64,\n\t\trho: i64.I64,\n\t\tm: i64.I64,\n\t\tsigma: U64,\n\t},\n});\nexport interface UpPriceArguments {\n\tpricer: TransactionArgument;\n\tstrike: TransactionArgument;\n}\nexport interface UpPriceOptions {\n\tpackage?: string;\n\targuments: UpPriceArguments | [pricer: TransactionArgument, strike: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Return the current UP digital probability for a typed strike. Public PTB and\n * devInspect reads can compose it with a transaction-local `Pricer`.\n */\nexport function upPrice(options: UpPriceOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['pricer', 'strike'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'pricing',\n\t\t\tfunction: 'up_price',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface RangePriceArguments {\n\tpricer: TransactionArgument;\n\tlower: TransactionArgument;\n\thigher: TransactionArgument;\n}\nexport interface RangePriceOptions {\n\tpackage?: string;\n\targuments:\n\t\t| RangePriceArguments\n\t\t| [pricer: TransactionArgument, lower: TransactionArgument, higher: TransactionArgument];\n\tconfig?: {\n\t\tpredictPackageId?: string;\n\t};\n}\n/**\n * Return the current probability for `(lower, higher]`, floored at zero if the two\n * approximated boundary probabilities invert.\n */\nexport function rangePrice(options: RangePriceOptions) {\n\tconst packageAddress =\n\t\toptions.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';\n\tconst argumentsTypes = [null, null, null] satisfies (string | null)[];\n\tconst parameterNames = ['pricer', 'lower', 'higher'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'pricing',\n\t\t\tfunction: 'range_price',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,cAAc;AACpB,MAAa,aAAa,IAAI,WAAW;CACxC,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,aAAa;EACb,eAAe,IAAI,MAAM;EAEzB,GAAG;EACH,KAAKA;EACL,GAAGA;EACH,OAAO;EACP;CACD,CAAC;AACF,MAAa,eAAe,IAAI,WAAW;CAC1C,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,kBAAkB,IAAI;EACtB,SAAS;EACT,KAAK;EACL,+BAA+B;EAC/B,wCAAwC;EACxC,2CAA2C;EAC3C,uCAAuC;EACvC;CACD,CAAC;AACF,MAAa,SAAS,IAAI,WAAW;CACpC,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,kBAAkB,IAAI;EACtB,SAAS;EACT,KAAK;EASL,+BAA+B;EAC/B,wCAAwC;EACxC,2CAA2C;EAC3C,uCAAuC;EACvC;CACD,CAAC;AACF,MAAa,SAAS,IAAI,WAAW;CACpC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,GAAGA;EACH,GAAG;EACH,KAAKA;EACL,GAAGA;EACH,OAAO;EACP;CACD,CAAC;;;;;AAgBF,SAAgB,QAAQ,SAAyB;CAChD,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB,CAAC,MAAM,KAAK;CACnC,MAAM,iBAAiB,CAAC,UAAU,SAAS;AAC3C,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,CAAC;;;;;;AAoBJ,SAAgB,WAAW,SAA4B;CACtD,MAAM,iBACL,QAAQ,WAAW,QAAQ,QAAQ,oBAAoB;CACxD,MAAM,iBAAiB;EAAC;EAAM;EAAM;EAAK;CACzC,MAAM,iBAAiB;EAAC;EAAU;EAAS;EAAS;AACpD,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { MoveStruct } from "../utils/index.mjs";
|
|
2
|
+
import { U64 } from "../../bcs/integers.mjs";
|
|
3
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
4
|
+
|
|
5
|
+
//#region src/contracts/deepbook_predict/pricing_config.ts
|
|
6
|
+
/**************************************************************
|
|
7
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
8
|
+
**************************************************************/
|
|
9
|
+
/**
|
|
10
|
+
* Stored oracle source-selection and freshness config for Predict quotes.
|
|
11
|
+
*
|
|
12
|
+
* ProtocolConfig owns this mutable policy. Pricing reads it when resolving live
|
|
13
|
+
* probabilities for mint and redeem flows.
|
|
14
|
+
*/
|
|
15
|
+
const $moduleName = "@local-pkg/deepbook_predict::pricing_config";
|
|
16
|
+
const PricingConfig = new MoveStruct({
|
|
17
|
+
name: `${$moduleName}::PricingConfig`,
|
|
18
|
+
fields: {
|
|
19
|
+
use_pyth_spot_for_forward: bcs.bool(),
|
|
20
|
+
pyth_spot_freshness_ms: U64,
|
|
21
|
+
block_scholes_price_freshness_ms: U64,
|
|
22
|
+
block_scholes_svi_freshness_ms: U64
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { PricingConfig };
|
|
28
|
+
//# sourceMappingURL=pricing_config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricing_config.mjs","names":[],"sources":["../../../src/contracts/deepbook_predict/pricing_config.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Stored oracle source-selection and freshness config for Predict quotes.\n *\n * ProtocolConfig owns this mutable policy. Pricing reads it when resolving live\n * probabilities for mint and redeem flows.\n */\n\nimport { MoveStruct } from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { U64 } from '../../bcs/integers.js';\nconst $moduleName = '@local-pkg/deepbook_predict::pricing_config';\nexport const PricingConfig = new MoveStruct({\n\tname: `${$moduleName}::PricingConfig`,\n\tfields: {\n\t\t/**\n\t\t * Selects which live-forward formula pricing uses. True carries the Block Scholes\n\t\t * basis on a fresh Pyth spot (`pyth_spot * bs_forward / bs_spot`); false uses the\n\t\t * Block Scholes forward directly and no Pyth spot, fresh or not, moves a quote.\n\t\t */\n\t\tuse_pyth_spot_for_forward: bcs.bool(),\n\t\t/**\n\t\t * Fixed wall-clock maximum age for Pyth spot; it does not vary with time to\n\t\t * expiry.\n\t\t */\n\t\tpyth_spot_freshness_ms: U64,\n\t\t/**\n\t\t * Fixed wall-clock maximum age for Block Scholes spot and forward; it does not\n\t\t * vary with time to expiry.\n\t\t */\n\t\tblock_scholes_price_freshness_ms: U64,\n\t\t/**\n\t\t * Fixed wall-clock maximum age for Block Scholes SVI parameters; it does not vary\n\t\t * with time to expiry.\n\t\t */\n\t\tblock_scholes_svi_freshness_ms: U64,\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,cAAc;AACpB,MAAa,gBAAgB,IAAI,WAAW;CAC3C,MAAM,GAAG,YAAY;CACrB,QAAQ;EAMP,2BAA2B,IAAI,MAAM;EAKrC,wBAAwB;EAKxB,kCAAkC;EAKlC,gCAAgC;EAChC;CACD,CAAC"}
|