Skip to main content
Pharos
PHAROSlive stablecoin signals

Data Flow Map

End-to-end source-to-UI flows for each major data domain.

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

DomainExternal SourcesWorker Ingest / ComputeStorage LayerAPI SurfaceFrontend Hook(s)Primary UI
Stablecoin core list + pricesDefiLlama, CoinGecko, CMC, DexScreener, Pyth Network, Binance, Kraken, Bitstamp, Coinbase, RedStone, GeckoTerminal probe, 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 referencesworker/src/cron/sync-fx-rates.ts, worker/src/cron/sync-stablecoins.ts, stage modules under worker/src/cron/sync-stablecoins/, worker/src/lib/authoritative-price-sources.ts, worker/src/lib/price-consensus.ts, worker/src/lib/price-validation.tscache keys: fx-rates, stablecoinsGET /api/stablecoinsuseStablecoinsHomepage, Compare, Dependency Map, many cards
Aggregate stablecoin chartsDefiLlama aggregate chart history, D1 supply_history overlays for structural supplemental tracked assets, live stablecoins cache for the trailing pointworker/src/cron/sync-stablecoin-charts.ts + read-time hydration in worker/src/api/cache-handlers.tscache key: stablecoin-charts (+ live stablecoins cache at read time)GET /api/stablecoin-chartsuseStablecoinChartsHomepage charts
Stablecoin detail historyDefiLlama detail/chart, CoinGecko fallback, supply_history fallback pathsOn-demand detail handler plus worker/src/cron/snapshot-supply.ts / worker/src/api/backfill-supply-history.tsHandler-computed detail payload, per-coin D1 cache, supply_historyGET /api/stablecoin/:id, GET /api/supply-historyuseStablecoinDetailViewModel, useSupplyHistory, usePrefetchStablecoin for hover prefetch onlyStablecoin detail market chart, Compare
Per-coin supply historyCached stablecoins payload snapshot, CoinGecko or DefiLlama backfillsworker/src/cron/snapshot-supply.ts, worker/src/api/backfill-supply-history.tssupply_historyGET /api/supply-historyuseSupplyHistory, useCompareDataModelStablecoin detail page, Compare
Depeg events + peg summaryStablecoin cache prices + DEX corroborationworker/src/cron/detect-depegs.ts (+ pending confirmation)depeg_events, depeg_pendingGET /api/depeg-events, GET /api/peg-summaryuseInfiniteDepegEvents, usePegSummaryDepeg page, homepage peg columns, detail cards
DEX liquidity + DEX implied pricesDefiLlama 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)worker/src/cron/dex-discovery/orchestrator.ts (t1/t2/t3 tiered priority + exponential backoff, staleness sorting + live FX/metal validation refs) and worker/src/cron/dex-liquidity/* orchestrator merge (max(0.5, 1 - ageHours / 48) confidence decay + live FX/metal validation refs); GeckoTerminal request/parse normalization is shared in worker/src/cron/dex-liquidity/geckoterminal-shared.ts; direct/API/subgraph/view-contract fetchers (fetch-fluid.ts, fetch-balancer.ts, fetch-raydium.ts, fetch-orca.ts, fetch-meteora.ts, fetch-pancakeswap.ts, fetch-slipstream.ts) run during Step 1 of syncDexLiquidity(), normalized via DexApiPool type (worker/src/lib/dex-api-common.ts), preferred over overlapping DL pools only when identity is exact/uniquely derived and measured 24h volume exists, source family direct_apidex_pool_staging -> dex_liquidity, dex_liquidity_history, dex_pricesGET /api/dex-liquidity, GET /api/dex-liquidity-historyuseDexLiquidity, useDexLiquidityHistoryLiquidity page, Compare, report-card inputs, /status liquidity health card
Blacklist / freeze trackerEtherscan v2, TronGrid, RPC providersworker/src/cron/sync-blacklist.ts + helper modules under worker/src/cron/blacklist/blacklist_events, blacklist_sync_stateGET /api/blacklist, GET /api/blacklist-summaryuseBlacklistEventsPage, useBlacklistSummaryBlacklist page
Mint/Burn flow trackerAlchemy 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.tsmint_burn_events, mint_burn_hourly, mint_burn_sync_stateGET /api/mint-burn-flows, GET /api/mint-burn-eventsuseMintBurnFlows, useMintBurnFlowsCoin, useMintBurnEventsFlows page, homepage flow snapshot, coin overlays
Live reserve compositionProtocol reserve APIs, dashboards, and on-chain/accounting reads via adapter-specific fetchesworker/src/cron/sync-live-reserves.tsreserve_composition, reserve_sync_stateGET /api/stablecoin-reserves/:id, GET /api/report-cards, GET /api/statususeStablecoinReserves, useReportCardsStablecoin detail reserve card, report-card collateral quality inputs, reserve-drift/status surfaces
Redemption backstops + effective exitStablecoin cache, DEX liquidity snapshot, live reserve-sync metadata, and redeemability config registryworker/src/cron/sync-redemption-backstops.tsredemption_backstop, redemption_backstop_historyGET /api/redemption-backstops, GET /api/report-cardsuseRedemptionBackstops, useReportCardsStablecoin detail redemption card, report-card liquidity inputs
Stability Index (PSI)Stablecoin cache + active depeg state + DEWS stress breadthworker/src/cron/stability-index.ts, daily worker/src/cron/snapshot-psi.tsstability_index_samples, stability_indexGET /api/stability-indexuseStabilityIndex, useStabilityIndexDetailStability Index pages, digest snapshot
DEWS stress signalsStablecoins + liquidity + blacklist + mint/burn + yield + PSI inputsworker/src/cron/compute-dews.tsstress_signals, stress_signal_historyGET /api/stress-signalsuseStressSignals, useStressSignalDetailDepeg tracker risk panels, homepage radar snapshot
Yield intelligenceOn-chain rate calls, DefiLlama pools, cached supplemental protocol snapshots, CoinGecko price fallback, risk-free rate cacheworker/src/cron/sync-yield-data.ts, worker/src/cron/sync-yield-supplemental.ts, helper modules under worker/src/cron/yield-sync/, worker/src/cron/fetch-tbill-rate.tsyield_data, source-aware yield_history, cache yield-rankings, structured benchmark cache risk_free_rates, legacy USD mirror risk_free_rate, supplemental/on-chain health cachesGET /api/yield-rankings, GET /api/yield-historyuseYieldRankings, useYieldHistoryYield page, stablecoin detail
Daily digestAnthropic Claude + PSI snapshot contextworker/src/cron/daily-digest.tsdaily_digest + static build sync to data/digests.jsonGET /api/daily-digest, GET /api/digest-archive, GET /api/digest-snapshotuseDailyDigest, useDigestArchive, useDigestSnapshotDigest page + archive
Report cards + dependency graphPeg summary + DEX liquidity + redemption backstops + bluechip + stablecoin metadata/dependenciesworker/src/api/report-cards.ts compute on read; worker/src/cron/publish-report-card-cache.ts publishes the shared report_card_cache artifact for dependent consumers such as Chain Health and the Telegram safety-alert laneAPI read path: cache-driven upstream + in-memory compute; downstream artifacts: report_card_cache, cache["alert:safety-source-cache"]GET /api/report-cardsuseReportCardsSafety Scores, Portfolio, Dependency Map, homepage safety snapshot
Status reliabilityReal-HTTP self probes + status synthesisworker/src/cron/status-self-check.ts, worker/src/api/status.ts, worker/src/api/public-status-history.tsstatus_state, status_transitions, status_probe_runs, status_discrepancy_statePublic: GET /api/health, GET /api/public-status-history; admin: GET /api/status, GET /api/status-historyPublic: useHealth, usePublicEndpointProbes, usePublicStatusHistory; admin: useStatus, useEndpointProbes, useStatusHistory/status public health board, /admin operator dashboard
Coverage discoveryCoinGecko category API, DL stablecoins residualsworker/src/cron/discovery-scan.ts (weekly, Monday-only), worker/src/cron/sync-stablecoins/intake.ts (DL residuals)discovery_candidatesGET /api/status (discoveryCandidates field), plus direct admin GET /api/discovery-candidates / POST /api/discovery-candidates/:id/dismiss— (admin only)/admin/ operator dashboard, Pipeline section
Chain analyticsStablecoins 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 D1Live leaderboard: computed on-the-fly from D1 caches with _meta freshness; history: chain_supply_historyGET /api/chainsuseChains, useChainProfileData, useChainStablecoins/chains/ leaderboard, /chains/[chain]/ profile pages

Scheduling Backbone

Cron schedules are declared in worker/wrangler.toml, mirrored in shared/lib/cron-jobs.ts, and orchestrated by worker/src/handlers/scheduled.ts. docs/worker-infrastructure.md is the maintained schedule reference; this section is a compact flow map.

  • */15 * * * *: sync-fx-rates (cooldown-gated to 30 min) first, then sync-stablecoins (including depeg detection + pending confirmation), then downstream-safe snapshot-supply retry / snapshot-chain-supply / report-card cache publish
  • 9,24,39,54 * * * *: isolated status self-check
  • 3 */6 * * *: blacklist sync (every 6h)
  • 4,34 * * * *: mint/burn critical lane (every 30 minutes)
  • 6 */2 * * *: DEX discovery staging (every 2h)
  • 13,43 * * * *: mint/burn extended lane (every 30 minutes)
  • 10,40 * * * *: DEX liquidity scoring
  • 16,46 * * * *: stablecoin charts (30-minute trigger, 1-hour write cooldown)
  • 26,56 * * * *: DEWS, then PSI on the DB-only decoupled lane
  • 20 * * * *: core yield publication
  • 25 */4 * * *: supplemental yield-source refresh
  • 11 */4 * * *: live reserve sync, then redemption backstop sync, then Kinesis supply sync, then collateral-drift checks/alerts (every 4h)
  • 2,7,12,17,22,27,32,37,42,47,52,57 * * * *: Telegram subscriber alerts (DEWS, depeg, safety, and launch promotions)
  • */5 * * * *: manual digest trigger poll (POST /api/trigger-digest flag consumer)
  • 0 3 * * *: status-probe TTL prune + cron-history TTL prune (daily housekeeping)
  • 0 8 * * *: snapshot-supply fallback, safety-grade snapshot, T-bill rate, PSI daily snapshot, USDS status
  • 5 8 * * *: bluechip sync, daily digest, weekly recap (Mondays), discovery scan (Mondays)
  • 0 6 1 * *: monthly yield coverage audit

Freshness Contract (Frontend)

API hooks that use useApiQuery follow the interval supplied by their caller:

  • staleTime = interval
  • refetchInterval = 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

  • DEX price bridge: The half-hourly DEX liquidity cron now rebuilds dex_prices.price_sources_json from 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 via loadDexPriceSources() and promotes at most one individually-weighted consensus source per protocol: fluid-dex (weight 3), balancer-dex (weight 3), 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 overlapping dex-promoted aggregate (weight 1) is withheld whenever promoted per-protocol bridge data exists for the same asset. 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.
  • Cache passthrough endpoints include freshness metadata via _meta and/or X-Data-Age.
  • Chain profile pages intentionally coordinate two APIs: GET /api/chains for the summary card and GET /api/stablecoins for composition. The detailed sections stay hidden until both snapshots share the same updatedAt, which keeps incomplete or mismatched data from being presented as a full per-chain breakdown.
  • chain_supply_history remains 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-liquidity is meta-aware on the frontend: the page uses worker freshness metadata (and degraded-run Warning headers) 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.
  • Admin/backfill endpoints bypass edge cache via cacheBypass flags in shared/lib/api-endpoints/.
  • The stablecoins cache loader distinguishes ok, degraded, and error states. Operator-facing or published consumers (/status, daily digest, safety snapshot) now fail closed on non-ok cache reads instead of treating broken cache state as an empty valid dataset.
  • consensusSources flows from the price-consensus cron stage through the stablecoins cache → /api/stablecoins and /api/peg-summaryuseStablecoins / usePegSummary hooks → PriceTransparencyCard on the detail page and CoverageBadge source-count enrichment on the coverage page.
  • priceSourceConfidenceProfile flows from DEX-inclusive primary pricing through the stablecoins cache and /api/stablecoins. It is omitted for non-DEX prices and currently remains a data/API transparency field rather than a UI dependency.