nimasadjadiSports receiving the most bets
    Updated 2022-08-22
    with First_table as (select tx_hash,
    origin_from_address,
    raw_amount/1e18 as usd_vol
    from optimism.core.fact_token_transfers
    where block_timestamp >= current_date - 14
    and raw_amount > 0
    and contract_address = '0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9'
    and to_address = '0x170a5714112daeff20e798b6e92e25b86ea603c1'
    and from_address != '0x0000000000000000000000000000000000000000'),

    Second_table as (select date(block_timestamp) as day,
    contract_address,
    sum(usd_vol) as usd_volume,
    row_number () over (partition by day order by usd_volume desc) as count
    from optimism.core.fact_token_transfers a
    join First_table b on a.tx_hash = b.tx_hash
    where raw_amount > 0
    and contract_address != '0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9'
    and contract_address != '0x7f5c764cbc14f9669b88837ca1490cca17c31607'
    and contract_address != '0xda10009cbd5d07dd0cecc66161fc93d7c9000da1'
    and from_address = '0x170a5714112daeff20e798b6e92e25b86ea603c1'
    group by 1,2)

    select day,
    case
    when contract_address = '0x9da29c92014a9c795e340230e844f400e4d08cfd' then 'Baseball'
    when contract_address = '0xac26bd5d705ffa94a6f64889d85d0137949aeaae' then 'Baseball'
    when contract_address = '0xd76b9176a7594c06f063ba3e9e636c0c8542f0c2' then 'Baseball'
    when contract_address = '0xe6bb090e1ff96d02a32e51b4df829cf31392e802' then 'Baseball'
    when contract_address = '0xc648febb78826a60242160b3bcc0425fd58c70a6' then 'American Football'
    when contract_address = '0xb4a6939cc5683c00e83bca6017e1cd0a99c0d0a1' then 'Football'
    when contract_address = '0xdd433e355c4582320eb6f5c0372f0e03ca45717c' then 'Football'
    when contract_address = '0xc63ab1f550165468a9de1211e4055a584ad7a841' then 'UFC'
    when contract_address = '0xd72f7c78f5a8468dcb34dca68bdc97bea263f7d7' then 'Baseball'
    when contract_address = '0x078922a627c2307d49d5350d158cdc37cccabf5b' then 'Baseball'
    when contract_address = '0xb7b84b5c84c57ecd881623b6bf3d16b995c7a8e9' then 'UFC'
    Run a query to Download Data