Query editor
-- This query used incompatible data types from Dune SQL alpha and may need to be updated.-- More details can be found on https://dune.com/docs/query/dunesql-changes/WITH--Calculate number of prizes per network and drawIDprizeDistribution AS (--ETHEREUM POST DPRSELECTdate_trunc('day', call_block_time) AS day,'Ethereum' AS network,drawId,json_query(output_0, 'lax $.bitRangeSize') AS bitRange,substr(json_query(output_0, 'lax $.tiers'),2,length(json_query(output_0, 'lax $.tiers')) -2) AS tiers,CAST(json_query(output_0, 'lax $.dpr') AS int) / power(10, 9) AS dpr,CAST(json_query(output_0, 'lax $.prize') AS double) / power(10, 6) AS prizeFROMpooltogether_v4_ethereum.PrizeTierHistoryV2_call_getPrizeTierWHEREcall_success = true--ETHEREUM PRE DPRUNION ALLSELECTdate_trunc('day', evt_block_time) AS day,'Ethereum' AS network,drawId,json_query(prizeDistribution, 'lax $.bitRangeSize') AS bitRange,substr(json_query(prizeDistribution, 'lax $.tiers'),2,length(json_query(prizeDistribution, 'lax $.tiers')) -2) AS tiers,0 AS dpr,CAST(json_query(prizeDistribution, 'lax $.prize') AS double) / power(10, 6) AS prizeFROMpooltogether_v4_ethereum.PrizeDistributionBuffer_evt_PrizeDistributionSetWHEREdrawID < 447 --DPR On Ethereum started on draw 447--OPTIMISM POST DPRUNION ALLSELECTdate_trunc('day', call_block_time) AS day,'Optimism' AS network,drawId,json_query(output_0, 'lax $.bitRangeSize') AS bitRange,substr(json_query(output_0, 'lax $.tiers'),2,length(json_query(output_0, 'lax $.tiers')) -2) AS tiers,CAST(json_query(output_0, 'lax $.dpr') AS int) / power(10, 9) AS dpr,CAST(json_query(output_0, 'lax $.prize') AS double) / power(10, 6) AS prizeFROMpooltogether_v4_optimism.PrizeTierHistoryV2_call_getPrizeTierWHEREcall_success = true