Query editor
withchannel_casters as (SELECTc.fidFROM dune.neynar.dataset_farcaster_casts cWHERE c.deleted_at is nulland c.root_parent_url = 'https://onchainsummer.xyz'), fids as (SELECT*FROM query_3787069), erc20 as (SELECTf_from.fid as i, f_to.fid as j, sum(value/pow(10, tk_stable.decimals)*1) as v --when just stablecoins-- , sum(value/pow(10, p.decimals)*p.price) as vFROM evms.erc20_transfers tr-- LEFT JOIN tokens.native tk ON tk.chain = tr.blockchain AND tk.price_address = tr.contract_addressJOIN tokens.erc20 tk_stable ON tk_stable.symbol IN ('USDC','USDC.e','USDT','USDe')AND tk_stable.blockchain = tr.blockchainAND tk_stable.contract_address = tr.contract_address-- JOIN prices.usd p ON tr.blockchain = p.blockchain-- AND tr.contract_address = p.contract_address-- AND date_trunc('minute',tr.evt_block_time) = p.minute--we want transfers only within the fid graph, so ignore all othersJOIN fids f_from ON f_from.address = tr."from"JOIN fids f_to ON f_to.address = tr.to-- WHERE tk.symbol is not null or tk_stable.symbol is not nullWHERE tr.evt_block_time >= now() - interval '180' dayAND tr.blockchain IN ('ethereum','optimism','base')GROUP BY 1,2), native as (SELECTf_from.fid as i, f_to.fid as j, sum(value/pow(10, tk.decimals)*p.price) as vFROM evms.transactions trJOIN tokens.native tk ON tk.chain = tr.blockchainJOIN prices.usd p ON tk.chain = p.blockchainAND tk.price_address = p.contract_addressAND date_trunc('minute',tr.block_time) = p.minute--we want transfers only within the fid graph, so ignore all othersJOIN fids f_from ON f_from.address = tr."from"JOIN fids f_to ON f_to.address = tr.toWHERE value > 0AND tr.block_time >= now() - interval '180' dayAND tr.blockchain IN ('ethereum','optimism','base')GROUP BY 1,2)SELECTi, j