Query editor
-- FraxNet frxUSD Total Supply (All Chains) with Revenue Metrics-- Combines Mainnet frxUSD supply with Chaos Labs Proof of Reserves data-- PoR Contract: 0xCfFA8B54D01962bFDA2c6c06229F576E8a38972c-- frxUSD Token: 0xcacd6fd266af91b8aed52accc382b4e165586e29-- USTB Oracle (for treasury yield): 0xE4fA682f94610cCd170680cc3B045d77D9E528a8-- Historical data from Frax Finance API (before PoR started 2025-11-21)WITH ustb_raw_prices AS (-- Get daily USTB NAV from NewCheckpoint events-- Oracle contract: 0xE4fA682f94610cCd170680cc3B045d77D9E528a8-- NAV is 6 decimals, updates once per business day-- The NAV reported reflects the PREVIOUS day's close-- So report on Tuesday contains Monday's close (which includes Sat/Sun/Mon accrual)SELECTDATE_TRUNC('day', block_time) AS report_day,MAX_BY(CAST(bytearray_to_uint256(bytearray_substring(data, 65, 32)) AS DOUBLE) / 1e6,block_time) AS ustb_priceFROM ethereum.logsWHERE contract_address = 0xE4fA682f94610cCd170680cc3B045d77D9E528a8AND topic0 = 0xe504c4f49db369e9713e2a8c77f9febf3c99ef592a3f617b9bba2b9317e72a3d -- NewCheckpointAND block_time >= DATE '2025-05-01'GROUP BY 1),ustb_with_gaps AS (-- NAV gets reported at the beginning of the next trading day for the previous trading day-- Because prices are delayed by one trading day, the yield_days need to be shifted:-- yield_days = LAG(report_gap) - use the PREVIOUS row's gap for current row's yieldSELECTreport_day,ustb_price,DATE_DIFF('day', LAG(report_day) OVER (ORDER BY report_day), report_day) AS report_gap,(ustb_price / LAG(ustb_price) OVER (ORDER BY report_day)) - 1 AS raw_yieldFROM ustb_raw_prices),ustb_with_yield AS (SELECTreport_day AS day,ustb_price,CASEWHEN LAG(report_gap) OVER (ORDER BY report_day) > 0THEN raw_yield / LAG(report_gap) OVER (ORDER BY report_day)ELSE NULLEND AS daily_yield_rateFROM ustb_with_gaps),historical_api_data AS (-- frxUSDCirculatingSupply from Frax Finance API (before PoR started 2025-11-21)SELECT day, total_reserves FROM (VALUES(DATE '2025-05-01', 79426447.18),(DATE '2025-05-02', 77580760.89),(DATE '2025-05-03', 78523570.16),(DATE '2025-05-04', 78477100.13),(DATE '2025-05-05', 78600260.56),(DATE '2025-05-06', 79145317.98),(DATE '2025-05-07', 78193655.84),