yvUSD API
the yvUSD API aggregates and serves a mix of onchain data (vault/strategy accounting and APR-oracle reads) and an offchain service that periodically computes and caches results for fast frontend access.
Sources Of Truth
- Vault/strategy accounting is onchain (ERC-4626
totalAssets,totalSupply, strategy debt allocations, fee config) - APR oracle is onchain and provides strategy-level APR estimation
- APR service aggregates these inputs into a debt-weighted vault APR and exposes it via a cached API
Onchain APR Oracle
The API is configured to read an onchain APR oracle address. This oracle is used to fetch strategy APRs and to compute derivatives like Locked yvUSD's locker bonus APR.
APR Service (Offchain)
The yvUSD API:
- Indexes strategy membership from onchain events.
- Hydrates onchain metadata for strategies and vaults.
- Computes a debt-weighted APR for each configured vault.
The service is designed so frontends can read APR data without performing expensive onchain reads on every request.
API Routes
The API exposes routes like:
GET /api/health: Health and data freshness.GET /api/sync: run a full sync + recompute cycle (typically triggered by cron).GET /api/aprs: return precomputed APR results.GET /api/aprs/<address>: APR for a single vault address.GET /api/snapshot: raw indexed strategy cache.
Data Freshness
APR outputs can be stale if:
- The sync job has not run recently.
- One of the configured RPC endpoints is degraded.
- A particular strategy type requires an offchain calculator that fails or is temporarily disabled.
In these cases, vault operations (deposit/withdraw/report) continue unaffected; only the rate display is impacted.