Query editor
WITH smart_contracts_list AS (select distinct addressfrom tac.traceswhere "type" like 'create%'and address is not nulland successand code != 0x and code is not null)SELECTROW_NUMBER() OVER(ORDER BY sum((L1_fee + gas_used*gas_price) /power(10,18)) DESC) as gas_rank, coalesce(lo.name, m.contract_project, '-') as protocol, coalesce(l.contract_name, m.contract_name, cast(tx.to as varchar)) as contract, get_href('https://basescan.org/' || 'address/' || CAST(tx.to AS varchar), coalesce(l.contract_name, m.contract_name, cast(tx.to as varchar))) AS contract_linked, SUM((COALESCE(tx.l1_fee, 0) + tx.gas_used * tx.gas_price) / 1e18) AS gas_spend, SUM((COALESCE(tx.l1_fee, 0) + tx.gas_used * tx.gas_price) / 1e18 * p.price) AS gas_spend_usd, count(*) as tx_cnt, count(DISTINCT tx."from") as usersFROM tac.transactions txINNER JOIN smart_contracts_list b on tx.to = b.address -- filtering for contractsLEFT JOIN prices.usd_latest p on p.symbol = 'ETH' and blockchain is null -- pull gas token price-- map the contract address from two diff. sourcesLEFT JOIN labels.owner_addresses l on l.address = b.address and l.blockchain = 'tac'left join labels.owner_details lo on lo.owner_key = l.owner_keyLEFT JOIN contracts.contract_mapping m on m.contract_address = b.address and m.blockchain = 'tac'-- excluding system tx, including only past 30 daysWHERE tx.block_time > NOW() - interval '30' day AND gas_price > 0GROUP BY 2,3,4ORDER BY 1LIMIT 1000