Query editor
/* ============================================================================Tsunami — headline counters (fork of tydro/8807765; one row, one tile per column)----------------------------------------------------------------------------Changed from the original:- launches come from the launch registry (both TokenLaunched signatures,both factories) instead of one topic; the original dropped the 19legacy-signature launches and their curves' trades.- protocol_revenue_eth / creator_revenue_eth are, as before, ETH paid out ofcurves (cash); full revenue incl. hook fees is in the revenue section.- volume column names are unchanged so the existing counter tiles keep working.========================================================================== */WITH launches AS (SELECT launched_at AS block_time, curve, token,coalesce(fee_share, 0x0000000000000000000000000000000000000000) AS fee_shareFROM query_9105569),grads AS (SELECT DISTINCT curve FROM query_9105569 WHERE graduated),eth_px AS (SELECT timestamp AS hr, price AS px FROM prices.hourWHERE blockchain = 'ink' AND contract_address = 0x4200000000000000000000000000000000000006),trades AS (SELECT l.block_time, l.tx_from AS trader,CASE WHEN l.topic0 = 0x69c2c4bbea56030830cfa2a660af4e5e5f9922742272cac7cccfa1d78f18d568THEN cast(bytearray_to_uint256(l.topic1) AS double)ELSE cast(bytearray_to_uint256(bytearray_substring(l.data, 1, 32)) AS double)END / 1e18 AS ethFROM ink.logs lJOIN (SELECT DISTINCT curve FROM launches) c ON c.curve = l.contract_addressWHERE l.topic0 IN (0x69c2c4bbea56030830cfa2a660af4e5e5f9922742272cac7cccfa1d78f18d568,0xb2888c28870dcbc5cc52fecadfbeeb35cf0b439bfd459ade61b675289c008be0)AND l.block_number >= 54686019),t AS (SELECT tr.block_time, tr.trader, tr.eth, tr.eth * e.px AS usdFROM trades trLEFT JOIN eth_px e ON e.hr = date_trunc('hour', tr.block_time)),rev AS (SELECT CASE WHEN tc."to" = 0x686cae1154db17c85d2f17815ec32eff254e1d42 THEN 'protocol'WHEN fs.fee_share IS NOT NULL THEN 'creator' END AS bucket,sum(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 launchesWHERE 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'AND tc.block_number >= 54686019GROUP BY 1)SELECT(SELECT count(*) FROM launches) AS launches_all,(SELECT count(*) FROM launches WHERE block_time >= now() - INTERVAL '24' hour) AS launches_24h,(SELECT count(*) FROM launches WHERE block_time >= now() - INTERVAL '7' day) AS launches_7d,(SELECT count(*) FROM launches WHERE fee_share != 0x0000000000000000000000000000000000000000) AS launches_with_creator_share,(SELECT count(*) FROM grads) AS graduations_all,round(100.0 * (SELECT count(*) FROM grads) / nullif((SELECT count(*) FROM launches), 0), 2) AS graduation_rate_pct,(SELECT count(*) FROM t) AS curve_trades_all,