Query editor
withdex_price as (select symbol as dex_symbol, decimals as dex_decimals, avg(token_price_usd) as dex_pricefrom dex.prices_latest,tokens.erc20where token_address = {{Token Contract Address}}and contract_address = {{Token Contract Address}}and blockchain = '{{Blockchain}}'group by 1,2),supply as (select sum(cast(value as double)*-1) as amountfromerc20_{{Blockchain}}.evt_Transferwhere contract_address = {{Token Contract Address}}and "to" in (0x0000000000000000000000000000000000000000,0x000000000000000000000000000000000000dEaD)union allselect sum(cast(value as double)) as amountfrom erc20_{{Blockchain}}.evt_Transferwhere contract_address = {{Token Contract Address}}and "from"=0x0000000000000000000000000000000000000000)selectdex_symbol as symbol,dex_price as price,sum(amount*dex_price/power(10,dex_decimals)) as market_cap,sum(amount/power(10,dex_decimals)) as circulatingfrom supply,dex_pricegroup by 1,2