Query editor
WITH approved_contracts (contract_address, name, category) AS (SELECT * FROM query_5145294 WHERE category = 'Crime'),exploded AS (SELECTt.hash,al.address AS contract_address,((gas_used*gas_price)/1e18)/cardinality(t.authorization_list) AS gasFROM ethereum.transactions tCROSS JOIN UNNEST(t.authorization_list) AS al(chain_id, address, nonce, r, s, y_parity)WHEREt.block_number >= 22431086AND "type" = 'EIP-7702'AND cardinality(t.authorization_list) > 0),top AS (SELECTcontract_address,COUNT(*) AS authorization_count,SUM(gas) AS gas_used_for_authFROM explodedGROUP BY contract_addressORDER BY authorization_count DESC)SELECTt.contract_address,CASEWHEN cl.name IS NOT NULL THENget_href(get_chain_explorer_address('ethereum', t.contract_address), cl.name)ELSEget_href(get_chain_explorer_address('ethereum', t.contract_address), concat('0x', substr(to_hex(t.contract_address ), 1, 4),'..',substr(to_hex(t.contract_address), -4)))END AS label,COALESCE(cl.name,concat('0x', substr(to_hex(t.contract_address), 1, 4),'..',substr(to_hex(t.contract_address), -4))) AS wl_label,get_href(get_chain_explorer_address('ethereum',concat('0x', to_hex(t.contract_address))),concat(substr(concat('0x', to_hex(t.contract_address)), 1, 4),'..',substr(concat('0x', to_hex(t.contract_address)), -4))) as contract_address_link,gas_used_for_auth AS gas_used,SUM(gas_used_for_auth) OVER () as total_gas_usedFROM top tLEFT JOIN approved_contracts clON t.contract_address = from_hex(cl.contract_address)WHERE cl.contract_address IS NOT NULLORDER BYt.authorization_count DESC