Query editor
WITHcleaned_txs AS (SELECTblock_time, amt_usd, CONCAT( CAST ('<a href="https://etherscan.io/address/' AS VARCHAR), CAST ("attacker_initiator" AS VARCHAR), CAST ('#tokentxns" target="_blank">🔗</a> ' AS VARCHAR), CAST ("attacker_initiator" AS VARCHAR)) AS "attacker_initiator" -- taken from the brilliant @tayvano <3, CONCAT( CAST ('<a href="https://etherscan.io/address/' AS VARCHAR), CAST ("victim_sender" AS VARCHAR), CAST ('#tokentxns" target="_blank">🔗</a> ' AS VARCHAR), CAST ("victim_sender" AS VARCHAR)) AS "victim_sender" -- taken from the brilliant @tayvano <3, CONCAT( CAST ('<a href="https://etherscan.io/address/' AS VARCHAR), CAST ("attacker_recipient" AS VARCHAR), CAST ('#tokentxns" target="_blank">🔗</a> ' AS VARCHAR), CAST ("attacker_recipient" AS VARCHAR)) AS "attacker_recipient" -- taken from the brilliant @tayvano <3, CONCAT( CAST ('<a href="https://etherscan.io/tx/' AS VARCHAR), CAST ("tx_hash" AS VARCHAR), CAST ('" target="_blank"> 🔗 </a> ' AS VARCHAR), CAST ("tx_hash" AS VARCHAR)) AS "tx_hash" -- taken from the brilliant @tayvano <3, symbol, amt AS amt_tokens, "type"FROM dune.coldfire_team.result_eth_drainer_txs_rawORDER BY block_time DESC)SELECTDATE_TRUNC('week', block_time) AS week, "type", SUM(amt_usd) AS sum_usd_stolenFROM cleaned_txsGROUP BY 1,2-- SELECT-- attacker_initiator-- , MIN(block_time) AS min_block_time-- , MAX(block_time) AS max_block_time-- , COUNT(DISTINCT victim_sender) AS unique_victim_ct-- , COUNT(DISTINCT tx_hash) AS unique_tx_hash_ct-- , SUM(amt_usd) AS sum_usd_stolen-- FROM erc20s_price_vol-- GROUP BY 1