/** * Fixed-point math utilities for the DBC bonding curve. * All sqrt_price values are Q64.64 fixed-point (128-bit). * Liquidity and amounts use u64/u128 with explicit scaling. */ import BN from "bn.js"; /** Convert a floating-point price to Q64.64 sqrt_price */ export declare function priceToSqrtPrice(price: number): bigint; /** Convert a Q64.64 sqrt_price back to a floating-point price */ export declare function sqrtPriceToPrice(sqrtPrice: bigint): number; /** Multiply two Q64.64 values (returns Q64.64) */ export declare function mulQ64(a: bigint, b: bigint): bigint; /** Divide two Q64.64 values (a/b, returns Q64.64) */ export declare function divQ64(a: bigint, b: bigint): bigint; /** * Compute base token delta for a given sqrt_price range and liquidity. * Δbase = L * (√P_upper - √P_lower) / (√P_upper * √P_lower) */ export declare function getBaseDelta(sqrtPriceLower: bigint, sqrtPriceUpper: bigint, liquidity: bigint): bigint; /** * Compute quote token delta for a given sqrt_price range and liquidity. * Δquote = L * (√P_upper - √P_lower) */ export declare function getQuoteDelta(sqrtPriceLower: bigint, sqrtPriceUpper: bigint, liquidity: bigint): bigint; /** * Given an exact-in quote amount, compute the next sqrt_price. * Used when buying (quote → base). * √P_new = √P + amount / L */ export declare function getNextSqrtPriceFromQuoteIn(sqrtPrice: bigint, liquidity: bigint, amountIn: bigint): bigint; /** * Given an exact-in base amount, compute the next sqrt_price. * Used when selling (base → quote). * √P_new = (L * √P) / (L + amount * √P) */ export declare function getNextSqrtPriceFromBaseIn(sqrtPrice: bigint, liquidity: bigint, amountIn: bigint): bigint; /** Apply a fee in basis points, returns { netAmount, fee } */ export declare function applyFeeBps(amount: bigint, feeBps: number): { netAmount: bigint; fee: bigint; }; /** Apply a fee using FEE_DENOMINATOR (1e9) as used by DBC */ export declare function applyFeeNumerator(amount: bigint, feeNumerator: bigint): { netAmount: bigint; fee: bigint; }; /** * Compute the entropy burn amount. * burn = reserve * max(0, accumulator - threshold) * sensitivity / 1e9 */ export declare function computeEntropyBurn(inflationReserve: bigint, volatilityAccumulator: number, entropyThreshold: number, sensitivityBps: number): bigint; /** * Compute the anti-gravity buy amount. * strength = (floor - current) / floor (capped at max_strength) * buy_amount = fee_reserve * strength */ export declare function computeAntiGravityBuy(currentSqrtPrice: bigint, athSqrtPrice: bigint, floorBps: number, maxStrengthBps: number, feeReserve: bigint): bigint; /** * Compute conviction score for a lock position. * score = amount * duration_days * consistency_multiplier * multiplier = 1.0 + min(consecutive_epochs * 0.1, MAX_MULTIPLIER) */ export declare function computeConvictionScore(amount: bigint, durationSlots: bigint, consecutiveEpochs: number, epochDurationSlots: bigint): bigint; /** * Compute conviction reward share for a single staker. * share = (staker_score / total_score) * epoch_revenue */ export declare function computeConvictionReward(stakerScore: bigint, totalScore: bigint, epochRevenue: bigint): bigint; /** * Compute a wallet's behavioral bot score [0, 10000]. * Higher = more bot-like. * * Factors: * - trade_frequency: trades in 60 slots (>10 = suspicious, >30 = bot) * - hold_duration: avg hold in slots (<10 = flipper, <3 = bot) * - position_size: % of supply (>1000 bps = whale) */ export declare function computeBehaviorScore(tradeCountLast60Slots: number, avgHoldSlots: bigint, normalizedPositionBps: number): number; /** * Update exponential moving average. * ema_new = alpha * value + (1 - alpha) * ema_old * alpha = (10000 - ema_decay_bps) / 10000 */ export declare function updateEma(current: bigint, newValue: bigint, emaDacayBps: number): bigint; /** * Compute signed sentiment score from buy/sell EMA volumes. * score = (buy_ema - sell_ema) / (buy_ema + sell_ema) * SENTIMENT_SCALE */ export declare function computeSentimentScore(emaBuyVolume: bigint, emaSellVolume: bigint, sentimentScale: bigint): bigint; /** * Compute agent activity score [0, MAX_ACTIVITY_SCORE]. * Weighted: tasks 40%, revenue 40%, uptime 20% */ export declare function computeAgentActivityScore(tasksCompleted: number, maxExpectedTasks: number, revenueGeneratedLamports: bigint, maxExpectedRevenueLamports: bigint, uptimeBps: number): number; export declare function bnToBigInt(bn: BN): bigint; export declare function bigIntToBN(n: bigint): BN; //# sourceMappingURL=math.d.ts.map