Query editor
WITH erc20_balances AS (WITH erc20_in AS (SELECTto AS wallet,SUM(cast(tr.value AS DECIMAL)) as token_fundedFROM erc20_base.evt_Transfer trWHERE tr.contract_address = 0x4ed4E862860beD51a9570b96d89aF5E1B0EfefedGROUP BY 1),erc20_out AS (SELECT"from" AS wallet,SUM(cast(tr.value AS DECIMAL)) as token_spentFROM erc20_base.evt_Transfer trWHERE tr.contract_address = 0x4ed4E862860beD51a9570b96d89aF5E1B0EfefedGROUP BY 1)SELECTerc20_in.wallet,token_funded - COALESCE(token_spent, 0) AS balanceFROM erc20_inLEFT JOIN erc20_out ON erc20_in.wallet = erc20_out.wallet)SELECTwallet,balance / CAST(POW(10.0, 18.0) AS DECIMAL) AS balanceFROMerc20_balances balWHEREbal.balance > 0;