Query editor
WITH smart_contracts_list AS (select distinct addressfrom ink.traceswhere "type" like 'create%'and address is not nulland successand code != 0x and code is not null)SELECTROW_NUMBER() OVER(ORDER BY sum((gas_used*gas_price) /power(10,18)) DESC) as gas_rank, coalesce(l.contract_name, m.contract_name, cast(tx.to as varchar)) as contract, get_href('https://explorer.inkonchain.com/' || 'address/' || CAST(tx.to AS varchar), coalesce(l.contract_name, m.contract_name, cast(tx.to as varchar))) AS contract_linked, SUM((tx.gas_used * tx.gas_price) / 1e18) AS gas_spend, SUM((tx.gas_used * tx.gas_price) / 1e18 * p.price) AS gas_spend_usd, count(*) as tx_cnt, count(DISTINCT tx."from") as usersFROM ink.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 = 'ink'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 = 'ink'-- excluding system txWHERE gas_price > 0GROUP BY 2,3,4ORDER BY 1LIMIT 1000