Query editor
/* All distribution volumes, long format per day. Both for IDA and GDA (instant distributions). The process is the same for both */-- Events for IDA distributionswith index_updated_events as (select * from query_3380612),ida_volumes as (selectindex_updated_events.*,--this calculates the actual token amount distributed as a function of the index value and the total units distributed(total_units_pending + total_units_approved) * (new_index_value - old_index_value) as value_distributedfrom index_updated_events),ida_volumes_usd as (selectida.*,p.price as price_usd,ida.value_distributed / pow(10, 18) * p.price as value_distributed_usdfrom ida_volumes idaleft join dune.superfluid_hq.result_daily_super_token_prices pon ida.blockchain = p.blockchain and ida.token = p.super_token and ida.block_date = p.day),ida_final as (selectdate(block_time) as date,blockchain as blockchain,sum(value_distributed_usd) as value_distributed_usdfrom ida_volumes_usdgroup by date(block_time), blockchainorder by date asc),-- events for GDA distributionsinstant_distribution_updated_events as (select * from query_3380668),gda_volumes_usd as (selectgda.*,p.price as price_usd,gda.actual_amount / pow(10, 18) * p.price as value_distributed_usdfrom instant_distribution_updated_events gdaleft join dune.superfluid_hq.result_daily_super_token_prices pon gda.blockchain = p.blockchain and gda.token = p.super_token and gda.block_date = p.day),gda_final as (selectdate(block_time) as date,blockchain as blockchain,sum(value_distributed_usd) as value_distributed_usdfrom gda_volumes_usdgroup by date(block_time), blockchainorder by date asc),-- merging the ida and gda volumesjoined_dist_volume as (SELECTCOALESCE(t1.date, t2.date) AS date,COALESCE(t1.blockchain, t2.blockchain) as blockchain,COALESCE(t1.value_distributed_usd, 0) AS ida_volume,COALESCE(t2.value_distributed_usd, 0) AS gda_volumeFROM ida_final as t1