Skip to content

Data Pipeline

The app is read-only against Postgres. All time-series data is produced by off-chain jobs in scripts/ that read on-chain state (and a few external APIs) and upsert into the onchain_credit schema. Every lending venue is measured with the same convention (see Metric Methodology): the realised ratio of an on-chain compounding index between two blocks, annualised by the actual elapsed time, so /carries compares venues like-for-like.

Refreshers (cron)

JobCadenceWritesWhat it reads
refreshers/token-yields.ts6htoken_yield_apyShare-to-asset rate per wrapper via archive eth_call (convertToAssets(1e18) for ERC-4626, getStETHByWstETH for wstETH, getRate() for weETH/ezETH, an external rateSource for osETH); stores share_rate, 24h supply_apy, and 30d apy_30d
refreshers/fluid-ll.ts6hfluid_ll_apyFluid Liquidity Layer supply/borrow exchange prices, annualised over the 6h window
refreshers/fluid-dex.ts6hfluid_dex_apyFluid DEX swap fees + smart-col/smart-debt reserves; fee_apy_usd = fee_window_usd × 1460 / (tvl_col + tvl_debt)
refreshers/aave-v3.ts6haave_v3_reserve_apyAave v3 liquidityIndex / variableBorrowIndex (RAY-scaled), annualised
refreshers/sparklend.ts6hsparklend_reserve_apySame as Aave, against SparkLend's pool (separate table to avoid token-key collisions)
refreshers/sofr-rates.tsDailysofr_ratesNY Fed SOFR + compounded 30d/90d/180d averages + the compounding index
refreshers/yield-token-assets.tsDailyassetsRolls up token_yield_apy into the Asset Coverage table rows (current APY, 1M/YTD/1Y returns, market cap)
refreshers/vault-risk-params.tsWeeklyvault_risk_paramsPer-strategy max-LTV + liquidation threshold on-chain, with a changed_at audit
refreshers/vault-capacity.tsWeeklyvault_capacityPer-strategy borrow-cap / supply-cap headroom (Aave/Spark static caps; Fluid dynamic caps)

The Fluid LL/DEX series also have daily rollup tables (fluid_ll_apy_daily, fluid_dex_apy_daily) that the carry charts read on the 6M / 1Y / YTD views.

Ad-hoc jobs

  • sync-fluid-vaults.ts — run on demand (not a cron). Pulls Fluid's vault API, computes supply TVL, classifies each vault, checks coverage, and upserts fluid_vault_registry with a status (see Carry Strategies). Run with --dry-run to preview the active / below-floor / blocked split without writing. Must be re-run after a new yield adapter or DEX-pool snapshot lands for the affected vaults to flip to active.
  • resolve-oracles.ts — read-only oracle audit / drift guard (see Oracle Transparency).
  • backfill-*.ts — one-off history backfills (e.g. backfill-fluid-core.ts reconstructs deep Fluid history from core-storage reads; per-asset backfills seed token_yield_apy for newly added wrappers). These reuse the same annualisation math as the live refreshers.

On-chain access

src/lib/data/rpc.ts provides the read helpers: eth_call against a public RPC for current state, an archive endpoint for historical-block reads, eth_getStorageAt for packed storage Fluid exposes no clean getter for, and a DefiLlama block-by-timestamp lookup. Prices come from the DefiLlama Coins API.

Private documentation. creddit.xyz