Query editor
WITHtimeline AS (SELECT "timestamp" AS dayFROM utils.daysWHERE "timestamp" >= TIMESTAMP '2025-03-27'),revenue_received AS (SELECTd.day, r.fees, r.other_fees, COALESCE(r.fees, 0) + COALESCE(r.other_fees, 0) AS total_fees, SUM(COALESCE(r.fees, 0)) OVER (ORDER BY d.day) AS cum_fees, SUM(COALESCE(r.other_fees, 0)) OVER (ORDER BY d.day) AS cum_other_fees, SUM(COALESCE(r.fees, 0) + COALESCE(r.other_fees, 0))OVER (ORDER BY d.day) AS cum_total_feesFROM (SELECT DISTINCT DATE_TRUNC('day', evt_block_time) AS dayFROM resupply_ethereum.feedeposit_evt_receivedrevenue) dLEFT JOIN (SELECTDATE_TRUNC('day', evt_block_time) AS day, SUM(CAST(_fees AS DOUBLE) / 1e18) AS fees, SUM(CAST(_otherFees AS DOUBLE) / 1e18) AS other_feesFROM resupply_ethereum.feedeposit_evt_receivedrevenueGROUP BY 1) rON d.day = r.day),-- TVL scenarios in USDtvl_scenarios AS (SELECT * FROM (VALUES(24000000.0), -- 20M-- (30000000.0), -- 30M-- (40000000.0), -- 40M(48000000.0) -- 50M) AS v(tvl_usd))SELECTrr.day, rr.total_fees, ts.tvl_usd AS tvl-- sreUSD revenue allocations, 0.15 * rr.total_fees AS sre_onpeg_revenue, 0.25 * rr.total_fees AS sre_offpeg_revenue -- assumes max +10% uplift → 25% total to sreUSD-- daily yield to holders (per day, not annualized), (0.15 * rr.total_fees) / ts.tvl_usd AS onpeg_daily_yield, (0.25 * rr.total_fees) / ts.tvl_usd AS offpeg_daily_yield-- annualized APR (simple ×365), ((0.15 * rr.total_fees) / ts.tvl_usd) * 365 * 100 AS onpeg_apr, ((0.25 * rr.total_fees) / ts.tvl_usd) * 365 * 100 AS offpeg_apr-- optional: per-second rate scaled to 1e18 like the adapter/policy expects, ((0.15 * rr.total_fees) / (ts.tvl_usd * 86400)) * 1e18 AS onpeg_rate_per_sec_1e18, ((0.25 * rr.total_fees) / (ts.tvl_usd * 86400)) * 1e18 AS offpeg_rate_per_sec_1e18FROM revenue_received rr