import type { Address } from "viem"; import type { LucidlyClient } from "./client.js"; /** Point-in-time, read-only view of a vault's health. Works without a signer (dashboards/alerts). */ export interface VaultSnapshot { timestamp: number; vault: Address; name: string; symbol: string; decimals: number; /** NAV: base-asset units per 1.0 share (Accountant exchange rate). */ rate: bigint; totalSupply: bigint; /** AUM in base-asset units = totalSupply * rate / 10**decimals. */ aum: bigint; accountant: { address: Address; isPaused: boolean; exchangeRate: bigint; highwaterMark: bigint; feesOwedInBase: bigint; lastUpdateTimestamp: number; minimumUpdateDelaySec: number; upperBoundBps: number; lowerBoundBps: number; platformFeeBps: number; performanceFeeBps: number; }; teller: { address: Address; isPaused: boolean; shareLockPeriodSec: number; }; queue?: { address: Address; isPaused: boolean; }; } /** Aggregated deposit/withdraw/queue flows over a block window. */ export interface FlowWindow { fromBlock: bigint; toBlock: bigint; deposits: { count: number; assets: bigint; shares: bigint; }; withdrawals: { count: number; shares: bigint; }; queue: { requested: number; fulfilled: number; offerSharesFulfilled: bigint; wantPaid: bigint; pending: number; }; /** shares minted minus shares burned/redeemed across the window. */ netShareFlow: bigint; } export interface Alert { level: "info" | "warn" | "critical"; code: string; message: string; } export interface AlertThresholds { /** Flag if |rate change| vs the previous snapshot exceeds this (bps of the prior rate). */ maxRateMoveBps?: number; /** Flag if AUM dropped vs the previous snapshot by more than this (bps). */ maxAumDropBps?: number; /** Flag if the rate hasn't updated within this many seconds. */ maxRateStalenessSec?: number; /** Flag if accrued fees owed (base units) exceed this. */ maxFeesOwedBase?: bigint; } /** * Read-only monitoring for a deployed vault: point-in-time snapshots (NAV/AUM/supply, pause and fee * state), event-derived flows (deposits, withdrawals, queue requests/fills), and threshold alerts. * Designed to feed a dashboard or a scheduled health check — no signer required. */ export declare class MonitorModule { private readonly c; constructor(c: LucidlyClient); /** Capture a full point-in-time snapshot of the active (or supplied) vault. */ snapshot(opts?: { vault?: Address; accountant?: Address; teller?: Address; queue?: Address; }): Promise; /** Aggregate deposit/withdraw/queue flows over [fromBlock, toBlock] (toBlock defaults to latest). */ flows(opts?: { fromBlock: bigint; toBlock?: bigint; vault?: Address; teller?: Address; queue?: Address; }): Promise; /** * Evaluate alerts on a snapshot. Pass the previous snapshot to enable delta checks (rate move, * AUM drop). Pause states and a stale rate are flagged from the single snapshot alone. */ checkAlerts(snap: VaultSnapshot, prev?: VaultSnapshot, thresholds?: AlertThresholds): Alert[]; }