Query editor
WITH created_coins AS (-- Get all created coins with their poolsSELECTcoin_address,pool_id,coined_atFROM dune.zorateam.result_zora_20_created_coins),first_coin_time AS (-- Get timestamp of first coin creationSELECTMIN(coined_at) AS first_coin_creation_atFROM created_coins),token_prices AS (-- Retrieve erc20 pricesSELECTcontract_address,price,timestamp AS block_timeFROM prices.hourWHERE blockchain = 'base'AND timestamp >= (SELECT first_coin_creation_at FROM first_coin_time)),contract_volume AS (-- Buy volumeSELECTamountSold * prices.price AS volume_usd,buyer AS trader_addressFROM zora_base.coin_evt_coinbuy coinbuyLEFT JOIN token_prices pricesON prices.contract_address = coinbuy.currencyAND date_trunc('hour', coinbuy.evt_block_time) = prices.block_timeUNION ALL-- Sell volumeSELECTamountPurchased * prices.price AS volume_usd,seller AS trader_addressFROM zora_base.coin_evt_coinsell coinsellLEFT JOIN token_prices pricesON prices.contract_address = coinsell.currencyAND date_trunc('hour', coinsell.evt_block_time) = prices.block_time)SELECT-- Direct contract trade statsSUM(contract_volume.volume_usd)/POW(10,18) AS direct_volume,COUNT(DISTINCT contract_volume.trader_address) AS direct_traders,-- Dex trades stats (all dex pools with Coin)(SELECT SUM(amount_usd) FROM dune.zorateam.result_zora20_dex_trades) AS dex_volume,(SELECT COUNT(DISTINCT trader_address) FROM dune.zorateam.result_zora20_dex_trades) AS dex_traders,-- Coin pool trades stats (zora originiated Coin pools)(SELECT