Query editor
/* ============================================================================Tsunami — daily revenue, ground truth----------------------------------------------------------------------------Native ETH actually paid out of the curve contracts, split by destination:protocol -> the Tsunami fee Safe 0x686cae11..1d42 (SafeProxy/SafeL2)creator -> the launch's FeeShare contractNo fee rate is assumed; this is measured value movement. call_type='call'excludes delegatecalls to the curve implementation, which carry a valuefield but move nothing.Launches come from the launch registry (both TokenLaunched signatures).========================================================================== */WITH launches AS (SELECT curve, coalesce(fee_share, 0x0000000000000000000000000000000000000000) AS fee_shareFROM query_9105569),eth_px AS (SELECT timestamp AS hr, price AS px FROM prices.hourWHERE blockchain = 'ink' AND contract_address = 0x4200000000000000000000000000000000000006),pay AS (SELECT date_trunc('day', tc.block_time) AS day,date_trunc('hour', tc.block_time) AS hr,CASE WHEN tc."to" = 0x686cae1154db17c85d2f17815ec32eff254e1d42 THEN 'protocol'WHEN fs.fee_share IS NOT NULL THEN 'creator' END AS bucket,cast(tc.value AS double) / 1e18 AS ethFROM ink.traces tcJOIN (SELECT DISTINCT curve FROM launches) c ON c.curve = tc."from"LEFT JOIN (SELECT DISTINCT fee_share FROM launches-- launches without a creator share have the zero address,-- which would otherwise match every burn on the chainWHERE fee_share != 0x0000000000000000000000000000000000000000) fs ON fs.fee_share = tc."to"WHERE tc.value > cast(0 AS uint256) AND tc.success AND tc.call_type = 'call')SELECT p.day,round(sum(CASE WHEN p.bucket = 'protocol' THEN p.eth ELSE 0 END), 4) AS protocol_eth,round(sum(CASE WHEN p.bucket = 'creator' THEN p.eth ELSE 0 END), 4) AS creator_eth,round(sum(CASE WHEN p.bucket = 'protocol' THEN p.eth * e.px ELSE 0 END), 2) AS protocol_usd,round(sum(CASE WHEN p.bucket = 'creator' THEN p.eth * e.px ELSE 0 END), 2) AS creator_usdFROM pay p LEFT JOIN eth_px e ON e.hr = p.hrWHERE p.bucket IS NOT NULLGROUP BY 1 ORDER BY 1 DESC