import { RawTransactionArgument } from "../utils/index.mjs"; import * as _mysten_sui_transactions420 from "@mysten/sui/transactions"; import { Transaction, TransactionArgument } from "@mysten/sui/transactions"; //#region src/contracts/deepbook_predict_math/math.d.ts declare namespace math_d_exports { export { BuilderFeeArguments, BuilderFeeOptions, DigitalArguments, DigitalOptions, InputsOkArguments, InputsOkOptions, LegFeeArguments, LegFeeOptions, MaxQtyArguments, MaxQtyOptions, NeedBudgetArguments, NeedBudgetOptions, NeedQtyArguments, NeedQtyOptions, NeedSellArguments, NeedSellOptions, OrderTermsArguments, OrderTermsOptions, PotentialArguments, PotentialOptions, RawVarOkArguments, RawVarOkOptions, RollDownArguments, RollDownOptions, VarPositiveArguments, VarPositiveOptions, builderFee, digital, inputsOk, legFee, maxQty, needBudget, needQty, needSell, orderTerms, potential, rawVarOk, rollDown, varPositive }; } interface RollDownArguments { value: RawTransactionArgument; remainingMs: RawTransactionArgument; anchorTteMs: RawTransactionArgument; } interface RollDownOptions { package?: string; arguments: RollDownArguments | [value: RawTransactionArgument, remainingMs: RawTransactionArgument, anchorTteMs: RawTransactionArgument]; config?: { predictMathPackageId?: string; }; } /** * Scale one 1e9-scaled SVI magnitude down by the fraction of anchored time * remaining, returning it at 1e18. * * The roll-down result is kept at 1e18 because the fraction is applied to values * that are themselves tiny on short-dated surfaces: a 1e9 floor here costs up to a * whole raw unit of `a`, and a short-dated `a` is only about ten raw units, so the * truncation alone moves the digital by percent-scale amounts. At 1e18 the same * floor is a billionth of that. * * The `u256` intermediate keeps the product exact for any `expiry_ms` rather than * relying on a bound on the anchored horizon. The result is at most * `value * 1e9 < 2^64 * 1e9`, so narrowing to `u128` never truncates. */ declare function rollDown(options: RollDownOptions): (tx: Transaction) => _mysten_sui_transactions420.TransactionResult; interface DigitalArguments { aMagnitude: RawTransactionArgument; aIsNegative: RawTransactionArgument; b: RawTransactionArgument; rho: TransactionArgument; m: TransactionArgument; sigma: RawTransactionArgument; forward: RawTransactionArgument; strike: RawTransactionArgument; } interface DigitalOptions { package?: string; arguments: DigitalArguments | [aMagnitude: RawTransactionArgument, aIsNegative: RawTransactionArgument, b: RawTransactionArgument, rho: TransactionArgument, m: TransactionArgument, sigma: RawTransactionArgument, forward: RawTransactionArgument, strike: RawTransactionArgument]; config?: { predictMathPackageId?: string; }; } /** * The adjusted UP digital for `strike` on a rolled SVI surface (`a` and `b` at * 1e18, `rho`, `m`, and `sigma` at 1e9) and `forward`: * * - k = ln(strike / forward) * - w(k) = a + b * (rho * (k - m) + sqrt((k - m)^2 + sigma^2)) * - d2 = -((k + w(k) / 2) / sqrt(w(k))) * - price = N(d2) - phi(d2) * w'(k) / (2 * sqrt(w(k))) * * Returns the price and `0`, or `none` and the code Predict aborts with where the * formula is undefined: a zero forward, a negative inner term, or a non-positive * variance. */ declare function digital(options: DigitalOptions): (tx: Transaction) => _mysten_sui_transactions420.TransactionResult; interface VarPositiveArguments { aMagnitude: RawTransactionArgument; aIsNegative: RawTransactionArgument; b: RawTransactionArgument; rho: TransactionArgument; sigma: RawTransactionArgument; } interface VarPositiveOptions { package?: string; arguments: VarPositiveArguments | [aMagnitude: RawTransactionArgument, aIsNegative: RawTransactionArgument, b: RawTransactionArgument, rho: TransactionArgument, sigma: RawTransactionArgument]; config?: { predictMathPackageId?: string; }; } /** * Whether a rolled surface's minimum total variance over all strikes is positive, * at the 1e18 the rolled `a` and `b` are carried in. */ declare function varPositive(options: VarPositiveOptions): (tx: Transaction) => _mysten_sui_transactions420.TransactionResult; interface InputsOkArguments { spot: RawTransactionArgument; forward: RawTransactionArgument; b: RawTransactionArgument; rho: TransactionArgument; m: TransactionArgument; sigma: RawTransactionArgument; } interface InputsOkOptions { package?: string; arguments: InputsOkArguments | [spot: RawTransactionArgument, forward: RawTransactionArgument, b: RawTransactionArgument, rho: TransactionArgument, m: TransactionArgument, sigma: RawTransactionArgument]; config?: { predictMathPackageId?: string; }; } /** * Whether raw Block Scholes inputs fit Predict's pricing-safe envelope: a positive * spot and forward, `forward <= max_spot` and `forward <= 100 * spot`, and SVI * `b`, `|rho|`, `|m|`, and `sigma` within their bounds. `a` carries no bound of * its own: only total variance has to be positive (`raw_var_ok`), and every * downstream use of `a` fits its provider width. */ declare function inputsOk(options: InputsOkOptions): (tx: Transaction) => _mysten_sui_transactions420.TransactionResult; interface RawVarOkArguments { a: TransactionArgument; b: RawTransactionArgument; rho: TransactionArgument; sigma: RawTransactionArgument; } interface RawVarOkOptions { package?: string; arguments: RawVarOkArguments | [a: TransactionArgument, b: RawTransactionArgument, rho: TransactionArgument, sigma: RawTransactionArgument]; config?: { predictMathPackageId?: string; }; } /** * Whether a raw SVI tuple's minimum total variance * `a + b * sigma * sqrt(1 - rho^2)` is positive, compared rather than summed: `a` * reaches `u64::MAX`, where the sum would leave `u64`. */ declare function rawVarOk(options: RawVarOkOptions): (tx: Transaction) => _mysten_sui_transactions420.TransactionResult; interface LegFeeArguments { baseFee: RawTransactionArgument; minFee: RawTransactionArgument; windowMs: RawTransactionArgument; maxMultiplier: RawTransactionArgument; probability: RawTransactionArgument; quantity: RawTransactionArgument; timeToExpiryMs: RawTransactionArgument; } interface LegFeeOptions { package?: string; arguments: LegFeeArguments | [baseFee: RawTransactionArgument, minFee: RawTransactionArgument, windowMs: RawTransactionArgument, maxMultiplier: RawTransactionArgument, probability: RawTransactionArgument, quantity: RawTransactionArgument, timeToExpiryMs: RawTransactionArgument]; config?: { predictMathPackageId?: string; }; } /** * One finite leg's trading fee: `max(bernoulli(p), min_fee) * ramp * quantity`, * each product rounded down. `bernoulli(p) = base_fee * sqrt(p * (1 - p))`, zero * at `p = 0` or `1`; the caller checks `p <= 1`. The ramp is 1 at or beyond * `window_ms` to expiry and rises linearly to `max_multiplier` at expiry, rounded * down so the trader keeps the ramp dust. */ declare function legFee(options: LegFeeOptions): (tx: Transaction) => _mysten_sui_transactions420.TransactionResult; interface PotentialArguments { maxRate: RawTransactionArgument; scale: RawTransactionArgument; liability: RawTransactionArgument; } interface PotentialOptions { package?: string; arguments: PotentialArguments | [maxRate: RawTransactionArgument, scale: RawTransactionArgument, liability: RawTransactionArgument]; config?: { predictMathPackageId?: string; }; } /** * The inventory-impact potential of `liability`: the marginal rate rises linearly * from zero to `max_rate` over `scale`, then stays capped: * * `phi(L) = r_max * L^2 / (2B)` for `L <= B` `phi(L) = phi(B) + r_max * (L - B)` * for `L > B`. * * Defined by this exact sequence of rounded integer operations, so charges and * rebates, which always subtract two evaluations, telescope exactly. */ declare function potential(options: PotentialOptions): (tx: Transaction) => _mysten_sui_transactions420.TransactionResult; interface MaxQtyArguments { probability: RawTransactionArgument; maxPremium: RawTransactionArgument; lot: RawTransactionArgument; maxLots: RawTransactionArgument; } interface MaxQtyOptions { package?: string; arguments: MaxQtyArguments | [probability: RawTransactionArgument, maxPremium: RawTransactionArgument, lot: RawTransactionArgument, maxLots: RawTransactionArgument]; config?: { predictMathPackageId?: string; }; } /** * The largest whole number of `lot`s, at most `max_lots`, whose premium * `mul_down(probability, quantity)` fits `max_premium`, as a quantity. The probe * is the premium mint admission charges, so the result is exact, and an oversized * budget saturates at `max_lots` instead of aborting. */ declare function maxQty(options: MaxQtyOptions): (tx: Transaction) => _mysten_sui_transactions420.TransactionResult; interface BuilderFeeArguments { feeAmount: RawTransactionArgument; quantity: RawTransactionArgument; multiplier: RawTransactionArgument; maxRate: RawTransactionArgument; } interface BuilderFeeOptions { package?: string; arguments: BuilderFeeArguments | [feeAmount: RawTransactionArgument, quantity: RawTransactionArgument, multiplier: RawTransactionArgument, maxRate: RawTransactionArgument]; config?: { predictMathPackageId?: string; }; } /** * The builder fee on a trade with a builder code: `fee_amount * multiplier`, * capped at `quantity * max_rate`, each rounded down. */ declare function builderFee(options: BuilderFeeOptions): (tx: Transaction) => _mysten_sui_transactions420.TransactionResult; interface NeedQtyArguments { quantity: RawTransactionArgument; p: RawTransactionArgument; } interface NeedQtyOptions { package?: string; arguments: NeedQtyArguments | [quantity: RawTransactionArgument, p: RawTransactionArgument]; config?: { predictMathPackageId?: string; }; } /** * Exact-quantity mint cash need: `ceil(quantity * (1 - p)) + 1`, where `p` is the * market's minimum entry probability: a fill pays at least `p` per contract into * market cash. */ declare function needQty(options: NeedQtyOptions): (tx: Transaction) => _mysten_sui_transactions420.TransactionResult; interface NeedBudgetArguments { budget: RawTransactionArgument; p: RawTransactionArgument; } interface NeedBudgetOptions { package?: string; arguments: NeedBudgetArguments | [budget: RawTransactionArgument, p: RawTransactionArgument]; config?: { predictMathPackageId?: string; }; } /** * Budget mint cash need: `ceil((budget + 1) * (1 / p - 1)) + 1`. The `budget + 1` * covers premiums rounding down, which lets a fill buy up to `1 / p` raw units * more than `budget / p`. */ declare function needBudget(options: NeedBudgetOptions): (tx: Transaction) => _mysten_sui_transactions420.TransactionResult; interface NeedSellArguments { closeQuantity: RawTransactionArgument; lambda: RawTransactionArgument; } interface NeedSellOptions { package?: string; arguments: NeedSellArguments | [closeQuantity: RawTransactionArgument, lambda: RawTransactionArgument]; config?: { predictMathPackageId?: string; }; } /** * Sell cash need: `ceil(close_quantity * (1 - lambda)) + 1`. A close lowers payout * liability by at least `lambda * close_quantity` and pays at most * `close_quantity`. */ declare function needSell(options: NeedSellOptions): (tx: Transaction) => _mysten_sui_transactions420.TransactionResult; interface OrderTermsArguments { orderId: RawTransactionArgument; } interface OrderTermsOptions { package?: string; arguments: OrderTermsArguments | [orderId: RawTransactionArgument]; config?: { predictMathPackageId?: string; }; } /** * Decode a packed Predict order ID into `(lower_tick, higher_tick, quantity)`, * with the quantity in USDC base units. For the order-flow companion's sell sizing * and remainder checks over order IDs Predict issued: it validates nothing. The * layout is Predict's frozen order-ID encoding: 30-bit ticks at bits 70 and 40, * and a 32-bit count of 10_000-unit lots at bit 100. */ declare function orderTerms(options: OrderTermsOptions): (tx: Transaction) => _mysten_sui_transactions420.TransactionResult; //#endregion export { math_d_exports }; //# sourceMappingURL=math.d.mts.map