Query editor
-- Comprehensive Owner Actions with Address Analysis and Exchange DetectionWITH all_addresses AS (SELECT DISTINCT "from" as address FROM erc20_ethereum.evt_TransferWHERE contract_address = 0xc11158c5da9db1d553ed28f0c2ba1cbedd42cfcbAND "from" != 0x0000000000000000000000000000000000000000UNIONSELECT DISTINCT "to" as address FROM erc20_ethereum.evt_TransferWHERE contract_address = 0xc11158c5da9db1d553ed28f0c2ba1cbedd42cfcbAND "to" != 0x0000000000000000000000000000000000000000),address_balances AS (SELECTaddress,SUM(amount_change) as current_balance,MAX(running_balance) as max_balance_ever,MIN(first_interaction) as first_acquired_date,SUM(total_acquired) as total_acquired,SUM(total_sent) as total_dumped,COUNT(*) as total_transactionsFROM (SELECT"to" as address,value as amount_change,SUM(value) OVER (PARTITION BY "to" ORDER BY evt_block_time) as running_balance,MIN(evt_block_time) OVER (PARTITION BY "to") as first_interaction,value as total_acquired,0 as total_sentFROM erc20_ethereum.evt_TransferWHERE contract_address = 0xc11158c5da9db1d553ed28f0c2ba1cbedd42cfcbAND "to" != 0x0000000000000000000000000000000000000000UNION ALLSELECT"from" as address,-value as amount_change,-SUM(value) OVER (PARTITION BY "from" ORDER BY evt_block_time) as running_balance,MIN(evt_block_time) OVER (PARTITION BY "from") as first_interaction,0 as total_acquired,value as total_sentFROM erc20_ethereum.evt_TransferWHERE contract_address = 0xc11158c5da9db1d553ed28f0c2ba1cbedd42cfcbAND "from" != 0x0000000000000000000000000000000000000000) tGROUP BY address),address_labels AS (SELECTab.address,ab.current_balance / 1e18 as current_balance_tokens,ab.max_balance_ever / 1e18 as max_balance_tokens,ab.first_acquired_date,ab.total_acquired / 1e18 as total_acquired_tokens,ab.total_dumped / 1e18 as total_dumped_tokens,ab.total_transactions,-- Address type detection with contract checkCASEWHEN EXISTS (SELECT 1 FROM ethereum.creation_traces ctWHERE ct.address = ab.address