import { type Address } from 'viem'; import type * as Db from '../../db/Db.js'; import * as RewardAccounts from '../../db/tables/rewardAccounts.js'; import type * as Tidx from '../Tidx.js'; import type * as Campaigns from './Campaigns.js'; /** Stored and replayed values of one projected balance. */ export type Comparison = { /** Value a fresh historical replay produces. */ expected: string; /** Value currently persisted in `reward_accounts`. */ stored: string; }; /** One registered recipient whose stored projection differs from its replay. */ export type Discrepancy = { /** Principal permanently allocated against campaign caps. */ allocatedPrincipalAssets: Comparison; /** Attributable public EarnShare balance. */ publicEarnShares: Comparison; /** Qualified EarnShare balance. */ qualifiedEarnShares: Comparison; /** Registered recipient. */ recipient: Address; }; /** Result of comparing one campaign's stored projections against replayed history. */ export type Report = { /** Total principal allocated across every stored and every replayed account. */ allocatedPrincipalAssets: Comparison; /** Campaign identity and the cursor the replay was bounded to. */ campaign: { /** Chain containing the vault. */ chainId: number; /** Last event applied by the delivered projection. */ eventCursor: Campaigns.EventCursor; /** Whether the campaign is paused. */ paused: boolean; /** Per-user principal cap in base-asset units. */ perUserPrincipalCapAssets: string; /** Campaign-wide principal cap in base-asset units. */ totalPrincipalCapAssets: string; /** EarnVault address. */ vaultAddress: Address; }; /** Accounts whose stored balances differ from replay without an allocation shortfall. */ drift: readonly Discrepancy[]; /** Accounts whose replay allocates more principal than is stored: deposits the projection never applied. */ missingDeposits: readonly Discrepancy[]; /** Stored account count. */ storedAccounts: number; /** Eligible registrations for the campaign. */ registrations: number; /** Registered recipients without a stored account; the next run replays them. */ unprojected: readonly Address[]; }; /** * Replays every eligible registration's deposit and EarnShare history through * the campaign's committed cursor and compares it with the stored projections. */ export declare function audit(options: audit.Options): Promise; export declare namespace audit { /** Campaign selector and data sources. */ type Options = { /** Chain containing the vault. */ chainId: number; /** Authoritative Postgres connection. */ db: Db.Db; /** TIDX client for the campaign chain. */ tidx: Tidx.Client; /** EarnVault address. */ vaultAddress: string; }; } /** * Clears deposit-derived state for the given recipients so the next reward run * replays their history through the registration reconciliation path. */ export declare function reset(options: reset.Options): Promise; export declare namespace reset { /** Recipients to rebuild on the next run. */ type Options = RewardAccounts.resetPrincipal.Options & { /** Authoritative Postgres connection. */ db: Db.Db; }; } /** The campaign cannot be audited in its current state. */ export declare class AuditError extends Error { name: string; } //# sourceMappingURL=Audit.d.ts.map