Query editor
WITH-- Get current balances (wallets that actually hold tokens)currentTransfers AS ((SELECT"to" AS address,SUM(CAST(value AS INT256)) AS balanceFROMerc20_ethereum.evt_TransferWHEREcontract_address = 0x8164b40840418c77a68f6f9eedb5202b36d8b288GROUP BY"to")UNION ALL(SELECT"from" AS address,- SUM(CAST(value AS INT256)) AS balanceFROMerc20_ethereum.evt_TransferWHEREcontract_address = 0x8164b40840418c77a68f6f9eedb5202b36d8b288AND "from" != 0x0000000000000000000000000000000000000000GROUP BY"from")),currentBalances AS (SELECTaddress,SUM(balance) / 1e18 AS balanceFROMcurrentTransfersGROUP BYaddressHAVINGSUM(balance) > CAST(0 AS INT256)),-- Find when each wallet first received tokensfirstTokenReceipt AS (SELECT"to" AS wallet,MIN(evt_block_time) AS first_token_timeFROMerc20_ethereum.evt_TransferWHEREcontract_address = 0x8164b40840418c77a68f6f9eedb5202b36d8b288AND "to" != 0x0000000000000000000000000000000000000000GROUP BY"to"),-- Find first GM call for each walletfirstGmCall AS (SELECT"from" AS wallet,MIN(block_time) AS first_gm_time