Query editor
WITH events AS (SELECTblock_time,topic1 AS user,CASE WHEN topic0 = from_hex('0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d') THEN varbinary_to_int256(data)ELSE -varbinary_to_int256(data)END AS amountFROM ethereum.logsWHERE contract_address = from_hex('0x966a707d9787fd5be0c38900f393f0ff86a0ac1b')AND topic0 IN (from_hex('0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d'), from_hex('0x7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5'))),cumulative AS (SELECTuser,SUM(amount) AS net_balanceFROM eventsGROUP BY user)SELECTuser,net_balanceFROM cumulativeWHERE net_balance > 0ORDER BY net_balance DESCLIMIT 1000;