Soheil_MKTotal user profits by Sports
    Updated 2022-08-25
    with T1 as (
    SELECT
    TX_HASH,
    ORIGIN_FROM_ADDRESS,
    concat('0x',substr(data,27,40)) as Contract,
    ethereum.public.udf_hex_to_int(substr(data,3+17*64,64) ) as tag,
    HEX_DECODE_STRING(substr(data,3+13*64,64)) as home,
    HEX_DECODE_STRING(substr(data,3+15*64,64) ) as away,
    Case
    when tag = 9001 then 'American Footbal'
    when tag = 9002 then 'American Footbal '
    when tag = 9003 then 'Baseball '
    when tag = 9004 then 'Basketball'
    when tag = 9005 then 'Basketball'
    when tag = 9006 then 'Hockey '
    when tag = 9007 then 'MMA'
    when tag = 9008 then 'Basketball'
    when tag = 9010 then 'Soccer'
    when tag = 9011 then 'Soccer'
    when tag = 9012 then 'Soccer'
    when tag = 9013 then 'Soccer'
    when tag = 9014 then 'Soccer'
    when tag = 9015 then 'Soccer'
    when tag = 9016 then 'Soccer'
    END as Sports
    from
    optimism.core.fact_event_logs
    where
    topics[0] = '0x889e2060e46779287c2fcbf489c195ef20f5b44a74e3dcb58d491ae073c1370f'
    and BLOCK_TIMESTAMP::DATE>=CURRENT_DATE-14
    ),


    T2 as (
    select
    TX_HASH as TX_HASH,
    Run a query to Download Data