Query editor
--The goal of this query is to find the walletS still holding the brett tokens; which are also part of the initial 100 buyersWITHtransferEvents AS (SELECTcontract_address,evt_block_number,evt_block_time,evt_index, --Not necessary because it was never used in the succeeding CTEsevt_tx_hash, --Not necessary because it was never used in the succeeding CTEs"from","to","value"FROM erc20_{{blockchain}}.evt_transferWHEREevt_block_number >={{initial_block_number}}ANDcontract_address = {{token_address}}),firstTransfers AS (SELECT"to" AS address,MIN(evt_block_time) AS first_transfer_timeFROMtransferEventsGROUP BY "to"),initialbalances AS (SELECTt."to" AS address,SUM(CAST(t.value AS INT256)) AS initial_balance,f.first_transfer_time AS initial_buy_timeFROMtransferEvents t JOIN firstTransfers f ON t."to"=f.address AND t.evt_block_time = f.first_transfer_timeGROUP BY t."to", f.first_transfer_time),currentTransfers AS ((SELECT"to" AS address,SUM(CAST(value AS INT256)) AS balance --positive changes in the balance of the walletFROM transferEventsGROUP BY "to")UNION ALL(SELECT"from" AS address,- SUM(CAST(value AS INT256)) AS balance --negative changes in the balance of the walletFROM transferEventsWHERE "from" != 0x0000000000000000000000000000000000000000GROUP BY "from")),currentBalances AS (SELECTaddress,SUM(balance)/{{decimal}} AS balanceFROM currentTransfers