Query editor
-- fusi.ng: headline numbers for counter tiles. One row; make one Counter visualization per column.with pools as (select * from query_8932001),swaps as (select p.eth_quoted, abs(cast(s.amount0 as double)) / 1e18 as eth_leg, s.evt_tx_hash as tx_hash, s.evt_block_time as block_timefrom uniswap_v4_ethereum.PoolManager_evt_Swap sjoin pools p on p.pool_id = s.id),prices as (select date_trunc('hour', minute) as hour, avg(price) as eth_usdfrom prices.usd where blockchain = 'ethereum' and symbol = 'WETH' and minute >= timestamp '2026-09-01'group by 1),traders as (select count(distinct t."from") as nfrom ethereum.transactions twhere t.block_time >= timestamp '2026-09-01' and t.hash in (select tx_hash from swaps)),fees as (-- same sources as 03_protocol_fees, ETH side only, collapsed to one numberselect sum(fee_eth) as protocol_fees_eth from (select(case when bytearray_substring(l.data, 13, 20) in (0x0000000000000000000000000000000000000000, 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2)then cast(bytearray_to_uint256(bytearray_substring(l.data, 65, 32)) as double) else 0 end+ case when bytearray_substring(l.data, 45, 20) in (0x0000000000000000000000000000000000000000, 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2)then cast(bytearray_to_uint256(bytearray_substring(l.data, 97, 32)) as double) else 0 end) / 1e18 as fee_ethfrom ethereum.logs lwhere l.contract_address in (0x7dC54744bA6037DD7B5220326dC7A4488a6524C6, 0xd711136c067F88f2C952c4E0eE068253f139abB4,0x357ffD979B2D4aDd7122728b7dF1e38F2cB4cCEE, 0x4E09e2bF71A670319b7931DCd4C960C0e2AB415B,0x6fADf16e8C462b372CAdC2d483eF0799096b2435, 0x3490fF94267fbfa1a6EEE93E1bC7487A2a4D6407,0x7Ea0E4EAF4824e6765a73Dd7B845Cd1449524ee4)and l.topic0 in (0x0882c041184196deba5e6e7b70fbdc84e91708e7817026720b852212051ab68e,0xcd5a45445fb06ac191ddb189c8227c0fa98e65a0041c0a0456ea3f7aaf1bef75)union allselect(case when bytearray_substring(l.data, 45, 20) in (0x0000000000000000000000000000000000000000, 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2)then cast(bytearray_to_uint256(bytearray_substring(l.data, 97, 32)) as double) else 0 end+ case when bytearray_substring(l.data, 77, 20) in (0x0000000000000000000000000000000000000000, 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2)then cast(bytearray_to_uint256(bytearray_substring(l.data, 129, 32)) as double) else 0 end) / 1e18from ethereum.logs lwhere l.contract_address in (0x6fADf16e8C462b372CAdC2d483eF0799096b2435, 0x3490fF94267fbfa1a6EEE93E1bC7487A2a4D6407, 0x7Ea0E4EAF4824e6765a73Dd7B845Cd1449524ee4)and l.topic0 = 0x28ca6e09169efeb8d6239e0e19debf99ccd2e359362835f68a03b0686369e3c7union allselect cast(bytearray_to_uint256(bytearray_substring(l.data, 1, 32)) as double) / 1e18from ethereum.logs lwhere l.contract_address in (0xED630B4A74c8D655C2c7e48dE1BCC185E5f08F79, 0x9BdC70AD51ea0093c399cbc720D6a448b9772a94, 0x357816dfF417A3eaE0e5C3767728e059464AE713)and l.topic0 = 0xdcdcaef5de7ddddb7ef392b97e6b32c1c43fd5f5ed468fd987baaa3c5252f5f5))select(select count(distinct token) from pools) as launches,(select count(distinct token) from pools where launched_at >= now() - interval '7' day) as launches_7d,(select sum(eth_leg) from swaps where eth_quoted) as volume_eth,(select sum(s.eth_leg * p.eth_usd) from swaps s left join prices p on p.hour = date_trunc('hour', s.block_time) where s.eth_quoted) as volume_usd,(select count(*) from swaps) as trades,(select n from traders) as unique_traders,(select protocol_fees_eth from fees) as protocol_fees_eth