Query editor
-- COMP Dormant Supply Tracker-- Tracks COMP held by wallets with zero outbound activity (COMP or any tx) since bucket yearWITH-- Step 1: Current COMP balance per walletcomp_balances AS (SELECTaddress,SUM(amount) AS balanceFROM (SELECT"to" AS address,CAST(value AS DOUBLE) / 1e18 AS amountFROM erc20_ethereum.evt_TransferWHERE contract_address = 0xc00e94cb662c3520282e6f5717214004a7f26888UNION ALLSELECT"from" AS address,-CAST(value AS DOUBLE) / 1e18 AS amountFROM erc20_ethereum.evt_TransferWHERE contract_address = 0xc00e94cb662c3520282e6f5717214004a7f26888) tWHERE address != 0x0000000000000000000000000000000000000000GROUP BY addressHAVING SUM(amount) > 0),-- Step 2: Last COMP outbound date per walletlast_comp_out AS (SELECT"from" AS address,MAX(evt_block_time) AS last_comp_transferFROM erc20_ethereum.evt_TransferWHERE contract_address = 0xc00e94cb662c3520282e6f5717214004a7f26888AND "from" != 0x0000000000000000000000000000000000000000GROUP BY "from"),-- Step 3: Last general tx date per walletlast_eth_tx AS (SELECTt."from" AS address,MAX(t.block_time) AS last_txFROM ethereum.transactions tINNER JOIN comp_balances b ON t."from" = b.addressGROUP BY t."from"),-- Step 4: First inbound COMP date (fallback for wallets that never sent anything)first_comp_in AS (SELECT"to" AS address,MIN(evt_block_time) AS first_inboundFROM erc20_ethereum.evt_TransferWHERE contract_address = 0xc00e94cb662c3520282e6f5717214004a7f26888GROUP BY "to"),