Overview
This map links each major Pharos data domain from upstream source to frontend consumption:
external source -> worker cron / sync -> D1 table or cache key -> API endpoint -> frontend hook -> page(s)
Core Flows
| Domain | External Sources | Worker Ingest / Compute | Storage Layer | API Surface | Frontend Hook(s) | Primary UI |
|---|---|---|---|---|---|---|
| Stablecoin core list + prices | DefiLlama, CoinGecko, CMC, DexScreener, DexPaprika, CoinGecko Onchain, Alchemy Prices, Moralis token prices, Birdeye token prices, Pyth Network, Binance, Kraken, Bitstamp, Coinbase, RedStone, GeckoTerminal pool probes, Curve on-chain, protocol redemption quotes, Chainlink FX/commodity overlays, FX sources (Frankfurter, Open Exchange Rates, fawazahmed0/currency-api, ExchangeRate-API), and gold-api.com commodity references | worker/src/cron/sync-fx-rates.ts, worker/src/cron/sync-stablecoins.ts, stage modules under worker/src/cron/sync-stablecoins/, worker/src/lib/address-price-providers/index.ts, worker/src/lib/authoritative-price-sources/, worker/src/lib/price-consensus.ts, worker/src/lib/price-validation.ts | cache keys: fx-rates, stablecoins; surface_publication_generations after migration for generic publication status | GET /api/stablecoins, GET /api/status (publicationHealth.surfaces["stablecoins"]) | useStablecoins | Homepage, Compare, Dependency Map, many cards, /status publication health |
| Aggregate stablecoin charts | DefiLlama aggregate chart history, D1 supply_history overlays for structural supplemental tracked assets, live stablecoins cache for the trailing point | worker/src/cron/sync-stablecoin-charts.ts + read-time hydration in worker/src/api/cache-handlers.ts | cache key: stablecoin-charts (+ live stablecoins cache at read time) | GET /api/stablecoin-charts | useStablecoinCharts | Homepage charts |
| Stablecoin detail history | DefiLlama detail/chart, CoinGecko fallback, supply_history fallback paths | On-demand detail handler plus worker/src/cron/snapshot-supply.ts / worker/src/api/backfill-supply-history.ts | Handler-computed detail payload, per-coin D1 cache, supply_history | GET /api/stablecoin/:id for public detail-prefetch/API consumers; GET /api/supply-history for chart history | Detail page view model composes useSupplyHistory, useStablecoins, peg/liquidity/report-card/redemption/yield/stress/flow/blacklist/reserve hooks; usePrefetchStablecoin uses /api/stablecoin/:id for hover prefetch | Stablecoin detail market chart, Compare |
| Per-coin supply history | Cached stablecoins payload snapshot, CoinGecko or DefiLlama backfills | worker/src/cron/snapshot-supply.ts, worker/src/api/backfill-supply-history.ts | supply_history | GET /api/supply-history | useSupplyHistory, useCompareDataModel | Stablecoin detail page, Compare |
| Depeg events + peg summary | Stablecoin cache prices + DEX corroboration | worker/src/cron/detect-depegs.ts (+ pending confirmation) | depeg_events, depeg_pending | GET /api/depeg-events, GET /api/peg-summary | useInfiniteDepegEvents, usePegSummary | Depeg page, homepage peg columns, detail cards |
| Depeg Duration Resolver + Reviewer | Confirmed canonical depeg incidents, stablecoin metadata, supply history, DEWS, liquidity, redemption backstops, first-publication manifests, errata, and later canonical outcomes | worker/src/cron/compute-depeg-resolver.ts plus worker/src/cron/compute-depeg-resolver-review.ts helper after DDRv2 sealing/publication | DDRv2 incident/link/lock-state/public-prediction/publication/errata tables, depeg_resolver_assessments, cache["depeg-resolver:snapshot"], cache["depeg-resolver-review:snapshot"], cache["ddr:repair-debt:v1"], worker_repair_tasks (ddr-repair-required-event) | GET /api/depeg-resolver, GET /api/depeg-resolver-review, GET /api/status (dataQuality.repairDebt) | useDepegResolver, useDepegResolverReview | Depeg page DDR and DDRR modules, /status repair-debt diagnostics |
| DEX liquidity + DEX implied prices | DefiLlama Yields, DefiLlama Protocols, Curve, Uniswap/Aerodrome/PancakeSwap subgraphs, protocol-native APIs (Fluid, Balancer, Raydium, Orca, Meteora), Fluid DexReservesResolver on supported EVM chains, Aerodrome/Velodrome Slipstream Sugar view contracts on Base/Optimism, plus CG/GT/DexScreener/CG Tickers -> [discovery cron] -> dex_pool_staging (D1) | Discovery runs in worker/src/cron/dex-discovery/orchestrator.ts (t1/t2/t3 priority, backoff, staleness sorting, live FX/metal refs). At 10,40, sync-dex-liquidity-stage loads direct/API/subgraph/view-contract sources; its direct API phase owns serial provider execution plus circuit/timeout handling in worker/src/cron/dex-liquidity/orchestrator-phases/direct-api.ts. The stage merges fresh rows with confidence decay, constructs the exact ordered pool graph, and writes schema-v1 192-KiB chunks while releasing each serialized pool/profile object. The handoff includes the already-loaded trust-filtered primary-price map; if an observed asset is missing, the scoring consumer loads the strict cache once and fills only absent prices before primary-relative publication guards run. At 16,46, sync-dex-liquidity prefers the source slot six minutes earlier, reuses that exact stage when retrying after consumption, otherwise falls back to the newest ready stage within 55 minutes, consumes D1 only, scores/publishes, and then yields to charts. Direct pools use DexApiPool, source family direct_api, and outrank overlapping DL pools only under the existing exact/unique identity and volume rules. | dex_pool_staging -> dex_liquidity_scoring_stages / dex_liquidity_scoring_stage_chunks -> dex_liquidity_run_rows / dex_liquidity_publication_generations -> published dex_liquidity, plus dex_liquidity_history, dex_prices, per-source cache["circuit:<source>"] breaker rows aggregated on read into providerCircuitHealth | GET /api/dex-liquidity, GET /api/dex-liquidity-history, GET /api/status (publicationHealth.surfaces["dex-liquidity"], providerCircuitHealth, dependencyHealth.dependencies["dex-liquidity"]) | useDexLiquidity, useDexLiquidityHistory | Liquidity page, Compare, report-card inputs, /status liquidity health, provider-circuit health, publication-health, and dependency root-cause cards |
| Blacklist / freeze tracker | Etherscan v2, TronGrid, RPC providers, frozen operator recovery manifests | worker/src/cron/sync-blacklist.ts + helper modules under worker/src/cron/blacklist/; guarded one-off recovery in worker/scripts/reconcile-night-watch-blacklist.ts | blacklist_events, typed/generation-fenced blacklist_sync_state, blacklist_current_balances, blacklist_amount_repair_queue, blacklist_provider_scan_telemetry, blacklist_reconciliation_runs | GET /api/blacklist, GET /api/blacklist-summary, GET /api/status (dataQuality.blacklistReconciliation) | useBlacklistEventsPage, useBlacklistSummary | FreezeWatch page, public/admin recovery diagnostics |
| Mint/Burn flow tracker | Alchemy logs (configured issuance chains; currently Ethereum plus native Arbitrum for USDai) | worker/src/cron/sync-mint-burn.ts + worker/src/cron/mint-burn/run-state.ts, slot dispatch via worker/src/handlers/scheduled/mint-burn-slot.ts | mint_burn_events, mint_burn_hourly, mint_burn_sync_state | GET /api/mint-burn-flows, GET /api/mint-burn-events | useMintBurnFlows, useMintBurnFlowsCoin, useMintBurnEvents | Flows page, homepage flow snapshot, coin overlays |
| Live reserve composition | Protocol reserve APIs, dashboards, and on-chain/accounting reads via adapter-specific fetches | worker/src/cron/sync-live-reserves.ts; isolated recovery in worker/src/handlers/scheduled/reserve-recovery.ts | reserve_composition, reserve_sync_state, generation-fenced worker_scheduled_checkpoints | GET /api/stablecoin-reserves/:id, GET /api/report-cards/v9, GET /api/status | useStablecoinReserves, useReportCardsV9 | Stablecoin detail reserve card, report-card collateral quality inputs, reserve-drift/status surfaces |
| Redemption backstops + effective exit | Stablecoin cache, DEX liquidity snapshot, live reserve-sync metadata, and redeemability config registry | worker/src/cron/sync-redemption-backstops.ts | redemption_backstop, redemption_backstop_history | GET /api/redemption-backstops, GET /api/report-cards/v9 | useRedemptionBackstops, useReportCardsV9 | Stablecoin detail redemption card, report-card liquidity inputs |
| Stability Index (PSI) | Stablecoin cache + active depeg state + DEWS stress breadth | worker/src/cron/stability-index.ts, daily worker/src/cron/snapshot-psi.ts | stability_index_samples, stability_index | GET /api/stability-index, GET /api/status (publicationHealth.surfaces["psi"], dependencyHealth.dependencies["psi"]) | useStabilityIndex, useStabilityIndexDetail | Stability Index pages, digest snapshot, /status publication/dependency health |
| DEWS stress signals | Stablecoins + liquidity + blacklist + mint/burn + yield + PSI inputs | worker/src/cron/compute-dews.ts | stress_signals, stress_signal_history, stress_signals_latest, cache dews freshness sentinel, exact publication pointer cache["dews:published-generation"] | GET /api/stress-signals, GET /api/status (publicationHealth.surfaces["dews"], dependencyHealth.dependencies["dews"]) | useStressSignals, useStressSignalDetail | Depeg tracker risk panels, homepage radar snapshot, /status publication/dependency health |
| Yield intelligence | Canonical current report-cards:v9 publication for hourly scoring and API-time hydration, on-chain rate calls, DefiLlama pools, supplemental protocol snapshots, price fallbacks, benchmark feeds, and source-risk evidence | worker/src/cron/sync-yield-data.ts, worker/src/cron/sync-yield-supplemental.ts, helpers under worker/src/cron/yield-sync/, and worker/src/cron/fetch-tbill-rate.ts | yield_data, yield_history, yield_publication_generations, source decisions, yield-rankings, benchmark and supplemental caches | GET /api/yield-rankings, GET /api/yield-history, GET /api/yield-adapter-manifest, GET /api/status | useYieldRankings, useYieldHistory, useYieldAdapterManifest | Yield page, stablecoin detail, methodology source monitor, and status health |
| Daily digest | Anthropic Claude + PSI snapshot context | worker/src/cron/daily-digest.ts, worker/src/lib/telegram-digest-outbox.ts | daily_digest, exact-payload telegram_digest_outbox, + static build sync to data/digests.json | GET /api/daily-digest, GET /api/digest-archive, GET /api/digest-snapshot | useDailyDigest, useDigestArchive, useDigestSnapshot | Digest page + archive |
| Bluechip ratings | Bluechip rating publications | worker/src/cron/sync-bluechip.ts | cache key: bluechip-ratings | GET /api/bluechip-ratings | useBluechipRatings | /about/bluechip/, Compare, stablecoin badges, Screener Picker |
| USDS freeze status | USDS contract storage/call probes | worker/src/cron/sync-usds-status.ts | cache key: usds-status | GET /api/usds-status | useUsdsStatus | USDS status card |
| Public daily dataset snapshots | Completed D1/cache artifacts: stablecoins cache, complete current canonical V9 Safety Score publication, prior-day PSI snapshot, exact published DEWS generation, and optional current DEX liquidity rows. The writer reloads and atomically fences the exact V9 publication identity before sealing the immutable row. | worker/src/cron/snapshot-public-dataset.ts | public_snapshots | GET /api/snapshots/index, GET /api/snapshots/:date.json, GET /api/snapshot/:date/stablecoin/:id | — | External integrations and historical dataset consumers |
| Safety Scores + dependency graph | Peg summary, DEX liquidity, redemption backstops, reserves, attribution, stablecoin metadata, and reviewed dependencies; V9 consumes the publication-exact base input and peg-provenance seed | worker/src/cron/prepare-safety-score-v9-input.ts, worker/src/cron/compute-safety-score-v9.ts, and fenced supply attribution | Private inputs: report-cards:fixed-input:exact, report-cards:v9-peg-provenance-seed:exact, and the V9 attribution generation; canonical artifacts: report-cards:v9 and report-cards:v9:publication-health | GET /api/report-cards/v9, GET /api/status | useReportCardsV9 | Safety Scores, Portfolio, Dependency Map, homepage, Yield, status, digest, and Telegram |
| Status reliability | Internal router probes + production-domain HTTP canaries + DB/cache-only structural canaries + status synthesis | worker/src/cron/status-self-check.ts, worker/src/cron/data-invariant-canary.ts, worker/src/api/status.ts, worker/src/api/public-status-history.ts, static dependency registry shared/lib/data-dependency-registry.ts | status_state, status_transitions, status_probe_runs, status_discrepancy_state, worker_canary_runs; derived dependencyHealth is response-only | Public: GET /api/health, GET /api/public-status-history; admin: GET /api/status, GET /api/status-history (canaries) | Public: useHealth, usePublicEndpointProbes, usePublicStatusHistory; admin: useStatus, useEndpointProbes, useStatusHistory | /status public health board, /admin operator dashboard |
| Telegram pulse | Telegram subscribers, pending queue, usage analytics, and delivery diagnostics | worker/src/api/telegram-pulse.ts snapshot publisher on the five-minute Telegram lane | cache key: telegram:pulse:snapshot | GET /api/telegram-pulse | useTelegramPulse | /pharoswatchbot/ pulse strip |
| Telegram risk alerts | DEWS, depeg, safety, launch, and reserve snapshot deltas plus D1 direct/preset/global/snooze preference state | worker/src/cron/dispatch-telegram-alerts.ts, source-specific candidate/routing in dispatch-telegram-authoritative-planning.ts, durable manifest coordination in telegram-alert-target-plans/ | Immutable telegram_alert_source_events, source-resolution/candidate/plan/job/target lineage, exact telegram_pending_alerts transport rows | Admin status/health and Access-gated Telegram operations APIs; no public mutation API | No direct client hook | Private/group Telegram risk-alert delivery through the pending queue |
| Personalized Telegram daily recap | Canonical tape_events plus existing D1 subscriber, direct-watchlist, preset, snooze, and global-family state; no provider/API or AI calls | worker/src/cron/telegram-recap-planner.ts (DB-only due-page planner), worker/src/lib/telegram-recap-facts.ts, worker/src/lib/telegram-recap-ranking.ts, worker/src/lib/telegram-recap-formatting.ts | telegram_recap_preferences, telegram_recap_targets, exact telegram_pending_alerts rows with source_type = personalized_recap | No public API; private commands and signed Mini App state/mutation | Mini App Settings Daily Recap section | Private Telegram chats, one material recap message per local date |
| Chain analytics | Stablecoins cache aggregate circulating buckets, chainCirculating buckets (already aggregated by DefiLlama), report card cache (safety scores for quality sub-factor) | worker/src/api/chains.ts (compute on read from stablecoins + report-card D1 caches and emit freshness metadata); worker/src/cron/snapshot-chain-supply.ts writes daily totals to D1 | Live leaderboard: computed on-the-fly from D1 caches with _meta freshness; history: chain_supply_history | GET /api/chains | useChains, useChainProfileData, useChainStablecoins | /chains/ leaderboard, /chains/[chain]/ profile pages |
| Alt-peg / non-USD share | supply_history rows for commodity-pegged and fiat non-USD stablecoins | worker/src/api/non-usd-share.ts computes historical aggregate shares on read from daily supply snapshots | supply_history | GET /api/non-usd-share | useNonUsdShare | /alt-pegs/ market-share chart and non-USD/commodity context |
| Timeline / Tape events | Depeg, freeze, safety-score, PSI, DEWS, mint/burn, yield, methodology, cemetery, and lifecycle source tables/static registries | worker/src/cron/project-tape.ts projects source transitions through class-specific tape projectors on the DEWS/PSI DB-only lane | tape_events | GET /api/events | useEvents, useLatestEvents, useTimelineFeedData | /timeline/ cross-class event feed and homepage timeline modules |
The DEX flow has an additive measured-execution subflow. Pinned Uniswap
V3 on Ethereum, Polygon, and Arbitrum, PancakeSwap V3, and Base Aerodrome Slipstream QuoterV2/factory RPC
reads, the Fluid resolver adapter, reviewed Curve CryptoSwap get_dy pools,
the Ethereum hook-free Uniswap V4 PoolManager/StateView/Quoter shadow adapter,
the exact Ethereum legacy Curve 3pool StableSwap get_dy(int128,int128,uint256)
deployment, native Solana
Raydium CLMM/Orca Whirlpool exact quotes, and reviewed Tron SunSwap V2
factory/reserve plus SUN Smart Router or pinned V2 Router proofs enter
worker/src/cron/measured-execution/ through the isolated
sync-cl-exit-depth job. Fluid's address-only official ticker rows receive
canonical tracked-token metadata only in the bounded target copy, and target
construction admits only exact pools on pinned resolver deployments; unsupported
chains and identity-poor discovery fingerprints remain unresolved. Curve CryptoSwap activation verifies pinned runtime
code/dependency identities and the on-chain coins(i) order before active
quotes can become score-eligible. The legacy 3pool path separately binds the
pool and main-registry runtime hashes, registry LP token, registry and pool
token order, and token decimals at the quote block. Its two counter-stablecoin
directions are joined atomically, so a partial packet falls back to the existing
reserve simulation instead of satisfying physical-pool coverage. The measured
packet remains diagnostic until both directions have three complete and three
successful fresh cycles. External pool
metadata therefore cannot choose physical quote indices alone. The prior
retained-pool target generation is
stored in dex_measured_execution_targets; raw proof and validated quote
profiles are generation-fenced in dex_measured_execution_quotes. The 10,40
source stage carries this target graph into its exact bounded D1 handoff. The
16,46 sync-dex-liquidity consumer prefers that source slot, reuses that
exact stage when retrying after consumption, otherwise falls back to the newest
ready stage within 55 minutes, and
consumes only a published prior quote generation, exposing proof-free profiles
and explicit capability gates through the existing DEX API before charts runs
serially. Mature fresh last-known-good profiles can remain route-only across a
temporary liquidity shortlist rotation, without re-entering aggregate liquidity
inputs; for the 3pool the route compiler reconstructs both sibling
directions from the same retained packet or admits neither. A measured target
rotation or quote failure leaves an independently complete exact AMM model
available instead of attaching a measurement gate to that fallback; unrelated
capability gates and actual measured/exact conflicts still fail closed. Native Solana and
Tron joins apply explicit reviewed active/shadow registry policy after full
proof and current-target validation. Only active native profiles enter the P4
capacity compiler and physical-pool completeness denominator; shadow profiles
retain activation-pending, and case-sensitive native pool identities remain
case-sensitive through route selection. The reviewed wM/USDC Raydium CLMM
policy still captures a pool segment and replays the direct quote's fee,
output, and post-swap sqrt price, but it is shadow-only after the first
post-activation scoring consumers exceeded the Worker memory limit. Generic
Raydium, Orca, Meteora, and unreviewed measured cohorts remain
score-ineligible while their activation evidence is pending. Fresh Solana LKG
evidence is permitted only after explicit operational collection failure;
semantic or malformed rows remain barriers. SunSwap V2's activation and
rollback history is incident context only; current registry state is shadow and
score-ineligible while target and quote collection continue for revalidation.
A Smart Router response containing only multi-hop candidates
may use the pinned V2 Router's exact direct-path quote; invalid direct candidates
and missing, failed, stale, or identity-mismatched profiles remain target-level fail-closed. SunSwap census
rows are excluded from liquidity scoring and price consensus; its latest-only
TronGrid state reads are accepted only inside a bounded before/after block
bracket.
The private report-cards:fixed-input:exact row is the deterministic compiler-input bridge. It retains the exact V8-shaped input schema only because V9 compilation and replay consume that structure; it is never served as a V8 rating.
Safety Score V9 supply attribution remains on the dedicated +8 trigger. Exact V9 input preparation now runs serially after each successful 16,46 DEX publication and receives that publication's generation ID; compilation runs at 22,52. If the DEX consumer throws, is locked, or deliberately withholds publication, the dependent preparation child records a neutral not-started skip instead of a second synthetic failure; a nominally successful DEX result without an exact generation still fails closed. Preparation rejects a snapshot that does not capture the expected DEX generation, and compilation re-reads the latest accepted DEX generation before enrichment and again before evaluation so an older candidate cannot publish. Delayed or overlapping invocations skip before loading their runner graphs. The supply-attribution producer due interval is quantized below the compiler acceptance window so the quarter-hour trigger grid produces roughly 30-minute healthy captures instead of a 45-minute beat. Compilation requires a finished same-version quarter-hour core slot. An ok slot admits directly; a degraded slot admits only when the durable publication ledger proves that the same Worker published the current stablecoins cache in that slot. The compiler then requires the fixed input's stablecoin timestamp to equal the live cache generation, so isolated row-coverage gaps can become asset-local V9 evidence without allowing stale or no-write stablecoin runs through.
The compiler requires matching fixed-input, peg-provenance, attribution, methodology, and evaluation-build identities. It then evaluates V9 and writes the accepted report-cards:v9 publication with matching health. Global or identity-level failures hold the prior accepted publication. A complete supply-attribution generation that belongs to the same fixed input but finished just after that input's scoring clock is treated as a neutral cadence defer instead of publishing an aggregate-only partial candidate; malformed, rejected, stale, registry, or inventory-incompatible attribution still fails closed through the normal publication gates and records a clause-specific reason. Asset-local producer failures do not freeze unrelated ratings while at least 90% of active assets remain unaffected, and tolerated partial publications remain cron-healthy while surfacing affected assets in metadata.
The V9 compiler captures DEX, redemption, and live-reserve load health before
fallback filtering. Immediately before canonical persistence, an acceptance
fence combines those global source states, the existing active-result and
rated-count floors, and newly binding producer-failed deterioration against
the last accepted V9 envelope. Producer-failed deterioration becomes a global
hold only when fewer than 90% of active assets remain unaffected; isolated
failures above that healthy-coverage floor do not freeze unrelated ratings.
The accepted publication and current health commit atomically. A held attempt
updates only report-cards:v9:publication-health, leaving accepted ratings and
timestamps unchanged.
The V9-only supply-attribution enrichment may also bind an aggregate asset supply
to a reviewed route-ID inventory. The wM observer requires the complete
Ethereum, Arbitrum, Base, Plume, and Solana deployment packet, verifies pinned
runtime/controller identities at fixed-clock blocks or slots, and conserves the
existing aggregate supply while allocating it across routes. The Centrifuge
observer applies the same all-or-nothing rule only to the allowlisted JTRSY and
ACRDX burn/mint inventories: it binds every official EVM deployment to exact
runtime code, a non-proxy implementation slot, and the authorized Centrifuge
Spoke, then binds the official Token-2022 Solana mint to its exact direct
authority in one finalized context. It never admits lock/mint or adapter
inventories whose totalSupply() sums could double-count backing. The XAUT observer
binds the configured Tether transparency disclosure to one finalized Ethereum
token/treasury/adapter observation and the complete reviewed XAUt0
representation-group inventory. The issuer's totalAuthorized - notIssued
amount is admitted as circulating liabilities only when finalized
totalSupply() and treasury balanceOf() independently match the two disclosed
inputs and quarantined supply is zero. It emits one non-group canonical row and
one pooled group row carrying the exact locked share of circulating liabilities
and common failure domains, without claiming destination-chain shares. Any
missing, duplicate, stale, skewed, issuer/on-chain-mismatched,
identity-mismatched, inventory-mismatched, materially unresolved, or
non-conserving packet fails closed; V8 and public payloads remain unchanged.
Reserve sync may carry a nested V9-only exact route attempt into the
redemption-backstop preload and then the V9 extension. The first such path is
FPI's Controller Pool observation, which is bound to the same successful issuer
collateral adapter result and one pinned Ethereum block. Accepted and rejected
attempts remain outside public V8 reserve, redemption, and report-card payload
semantics.
GET /api/report-cards/v9 exposes the canonical, fully identified V9
publication. The active frontend, yield, Telegram, chain analytics, and
V9-compatible history all consume that publication directly. Held V9 remains
available only as the last accepted API/UI snapshot with explicit held
metadata. Current-data consumers, organic safety alerts, and organic history
writes fail closed without falling back to V8; independent depeg and incident
pipelines continue.
Scheduling Backbone
Cron expressions are deployed from worker/wrangler.toml; shared/lib/cron-jobs.ts owns canonical schedule/job metadata and shared/lib/scheduled-runner-registry.ts owns expression-to-runner dispatch. Use Worker Infrastructure: Cron Scheduling for execution details and npm run check:cron-sync / npm run check:cron-connections for the authoritative live inventory and connection-budget report.
Freshness Contract (Frontend)
API hooks that use useApiQuery follow the interval supplied by their caller:
staleTime = intervalrefetchInterval = 2 * interval
Defined centrally in src/hooks/use-api-query.ts. Cron-backed hooks should pass the producer cadence unless a documented route-specific exception applies. Current exceptions include /api/health (1-minute diagnostic polling, not cron-backed) and /api/usds-status (15-minute UI polling over a daily source snapshot).
Notes
- Core aggregate boundary:
shared/data/stablecoins/listing-decisions.jsonclassifies the catalog, whileshared/lib/stablecoins/aggregate-registry.tsprojects activecore-stablecoinandcash-equivalententries for monetary aggregates. PSI, digest market/supply totals, current homepage market cap, chain totals/history, and non-USD share consume that projection. Depeg, DEWS, price, per-asset history, and digest risk-signal lanes continue monitoring every active listing, including variants and stable-value investments. Client ranking filters use the compactlistingClassfield incoins.client.generated.json, not the full decision ledger. New PSI and digest snapshots identify the aggregate boundary ascore-stablecoins-v1so consumers can distinguish legacy rows. - DEX price bridge: The half-hourly DEX liquidity cron now rebuilds
dex_prices.price_sources_jsonfrom the final retained priced-pool surface after dedupe, caps, scoring filters, and unit normalization, publishing one aggregate per protocol. The quarter-hourly pricing cron reads these vialoadDexPriceSources()and promotes at most one individually-weighted consensus source per protocol:fluid-dex(weight 3),balancer-dex(weight 3),curve-dex(weight 3),uniswap-v3-dex(weight 2),uniswap-v4-dex(weight 2),raydium-dex(weight 2),orca-dex(weight 2),meteora-dex(weight 2),pancakeswap-dex(weight 2),aerodrome-dex(weight 2),velodrome-dex(weight 2). These promoted protocol sources only enter primary consensus when corroborated or when no non-DEX voices exist, and the overlappingdex-promotedaggregate (weight 1) is withheld whenever at least one promoted protocol candidate passes freshness and TVL validation for the same asset, even if that candidate is then excluded for lack of corroboration. The aggregate DEX fallback enters consensus only when no protocol candidate clears those pre-corroboration checks. DEX admission/merge skip reasons are emitted into logs and cron metadata so stale rows, malformed snapshots, TVL filters, missing registry mappings, and duplicate identities can be traced without scraping the raw tables. - Abort-aware high-volume publication: DEX liquidity and DEWS persistence pass the cron
AbortSignalinto chunked D1 batches, retrying D1 operations, and final freshness-sentinel guards. If timeout or lease-loss aborts the run after a partial batch, the run fails before publishingfreshness:dex-liquidity,freshness:dews, or the exact DEWS publication pointer. Durable DEWS consumers, canaries, and freshness reporting use the pointer rather than rawMAX(computed_at)rows. - Cache passthrough endpoints include freshness metadata via
_metaand/orX-Data-Age. - Chain profile pages intentionally coordinate two APIs:
GET /api/chainsfor the summary card andGET /api/stablecoinsfor composition. The detailed sections stay hidden until both snapshots share the sameupdatedAt, which keeps incomplete or mismatched data from being presented as a full per-chain breakdown. chain_supply_historyremains a forward-only internal dataset until the post-2026-04-08 baseline. Earlier rows were written before shared chain-label canonicalization and are not approved for public charting./api/dex-liquidityis meta-aware on the frontend: the page uses worker freshness metadata (and degraded-runWarningheaders) rather than client fetch time to assess staleness.- Liquidity history now carries
coverageClass/coverageConfidence; trend and durability consumers should treat low-confidence snapshots as informational, not authoritative baselines. dex_liquidity_historyis retained for the public 365-day history window; older daily snapshots are pruned during successfulsync-dex-liquiditypersistence instead of living as an indefinite research archive.- Transient measured-execution, scoring-stage, liquidity-run, price-run, and pool-staging rows are pruned by their owning producers in bounded oldest-first D1 passes. Cleanup telemetry is additive to cron metadata and cleanup failure cannot invalidate an already successful publication.
- Admin/backfill endpoints bypass edge cache via
cacheBypassflags inshared/lib/api-endpoints/. - The stablecoins cache loader distinguishes
ok,degraded, anderrorstates. Operator-facing or published consumers (/status, daily digest, safety snapshot) now fail closed on non-okcache reads instead of treating broken cache state as an empty valid dataset. consensusSourcesflows from the price-consensus cron stage through thestablecoinscache →/api/stablecoinsand/api/peg-summary→useStablecoins/usePegSummaryhooks →PriceTransparencyCardon the detail page andCoverageBadgesource-count enrichment on the coverage page.priceSourceConfidenceProfileflows from DEX-inclusive primary pricing through thestablecoinscache and/api/stablecoins. It is omitted for non-DEX prices and currently remains a data/API transparency field rather than a UI dependency.