ramishoowWhich games received the most activity, both in total users and total $ volume?
    Updated 2022-08-23
    --Which games received the most activity, both in total users and total $ volume?
    with code1 as (SELECT concat('0x',substr(data,27,40)) as game_contract,ethereum.public.udf_hex_to_int( substr(data,3+17*64,64) ) as SportID, case when SportID = 9001 then 'NCAA - American Footbal '
    --when SportID = 9005 then 'NCAA - Basketball'
    when SportID = 9002 then 'NFL - American Footbal 'when SportID = 9003 then 'MLB - Baseball ' when SportID = 9004 then 'NBA - Basketball' when SportID = 9005 then 'NCAA - Basketball' when SportID = 9006 then 'NHL - Hockey '
    when SportID = 9007 then 'MMA' when SportID = 9008 then 'WNBA' when SportID = 9010 then 'MLS - Soccer' when SportID = 9011 then 'EPL - Soccer'when SportID = 9012 then 'Ligue 1 - Soccer' when SportID = 9013 then 'Bundesliga - Soccer'
    when SportID = 9014 then 'La Liga - Soccer'when SportID = 9015 then 'Serie A - Soccer' when SportID = 9016 then 'UEFA Champions League - Soccer' END as Sport
    from optimism.core.fact_event_logs where topics[0] = '0x889e2060e46779287c2fcbf489c195ef20f5b44a74e3dcb58d491ae073c1370f' and BLOCK_TIMESTAMP::DATE>=CURRENT_DATE-14),
    --when SportID = 9016 then 'UEFA Champions League - Soccer' END as Sport
    code2 as (select FROM_ADDRESS,TO_ADDRESS,RAW_AMOUNT from optimism.core.fact_token_transfers where ORIGIN_TO_ADDRESS='0x170a5714112daeff20e798b6e92e25b86ea603c1'
    and CONTRACT_ADDRESS='0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9' and FROM_ADDRESS='0x170a5714112daeff20e798b6e92e25b86ea603c1') select sum (b.RAW_AMOUNT/1e18) as USD, case when a.Sport like '%Footbal%' then 'American_Footbal' when a.Sport like '%Baseball%' then 'Baseball'
    when a.Sport like '%Basketball%' then 'Basketball' when a.Sport like '%Hockey%' then 'Hockey' when a.Sport like '%MMA%' then 'MMA' when a.Sport like '%WNBA%' then 'WNBA' when a.Sport like '%Soccer%' then 'Soccer' end as sports
    from code1 a JOIN code2 b on a.game_contract=b.TO_ADDRESS group by sport order by 1 DESC
    Run a query to Download Data