shadilTotal bet amount for Baseball games since two weeks ago
    Updated 2022-08-22
    with q1 as (select optimism.core.fact_event_logs.event_inputs:from as bettor,
    optimism.core.fact_event_logs.event_inputs:value/pow(10, case
    when optimism.core.fact_event_logs.contract_address ilike lower('0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9') then 18
    when optimism.core.fact_event_logs.contract_address ilike lower('0x7f5c764cbc14f9669b88837ca1490cca17c31607') then 6
    when optimism.core.fact_event_logs.contract_address ilike lower('0x94b008aa00579c1307b0ef2c499ad98a8ce58e58') then 6
    when optimism.core.fact_event_logs.contract_address ilike lower('0xda10009cbd5d07dd0cecc66161fc93d7c9000da1') then 18
    when optimism.core.fact_event_logs.contract_address ilike lower('0xc40f949f8a4e094d1b49a23ea9241d289b7b2819') then 18
    when optimism.core.fact_event_logs.contract_address ilike lower('0xcb8fa9a76b8e203d8c3797bf438d8fb81ea3326a') then 18
    when optimism.core.fact_event_logs.contract_address ilike lower('0x4200000000000000000000000000000000000006') then 18
    when optimism.core.fact_event_logs.contract_address ilike lower('0xe405de8f52ba7559f9df3c368500b6e6ae6cee49') then 18 end) as total,
    regexp_substr_all(substr(joined_table1.data, 3, len(joined_table1.data)),'.{64}')[1] as s1,
    concat('0x', substr(s1, 25, len(s1))) as ad,
    date_trunc('day', optimism.core.fact_event_logs.block_timestamp) as date_time
    from optimism.core.fact_event_logs join optimism.core.fact_event_logs joined_table1
    on joined_table1.tx_hash = optimism.core.fact_event_logs.tx_hash
    where optimism.core.fact_event_logs.origin_from_address = optimism.core.fact_event_logs.event_inputs:from
    and optimism.core.fact_event_logs.block_timestamp >= '2022-08-05' -- Since two weeks ago
    ),

    q2 as (
    SELECT q1.*, table1.match_name from q1
    join (select '0xc7e8b40bfc2609becfab32dee7330b687b0611fd' as match_address, 'Chicago White Sox | Minnesota Twins' as match_name
    from dual union
    select '0xb55a10da20ba4f2ddfdb470103143e6baba769dd' as match_address, 'Milwaukee Brewers | Chicago Cubs' as match_name
    from dual union
    select '0x06eb14d138161508f02d517f4d3c792efde1d692' as match_address, 'Houston Astros | Kansas City Royals' as match_name
    from dual union
    select '0xd438a559b880293808079aec4d12432221fc73a5' as match_address, 'Arizona Diamondbacks | San Francisco Giants' as match_name
    from dual union
    select '0x108267d6cd22291568e9260df5c122122de26e83' as match_address, 'Oakland Athletics | Toronto Blue Jays' as match_name
    from dual union
    select '0x6d62cc028082fb750957375129fd3d313867fc60' as match_address, 'Los Angeles Dodgers | Colorado Rockies' as match_name
    from dual union
    select '0xedb993c2532d2dee8e80b1ce9e99bf2531f8d805' as match_address, 'Detroit Tigers | Cleveland Guardians' as match_name
    from dual union
    select '0xe91a8ca5ee5e6bd615039a5595b3d57fca18a488' as match_address, 'Chicago White Sox | Minnesota Twins' as match_name
    Run a query to Download Data