misaghlbOptimistic Bears (Redux) - distribution from optimism to ethereum
    Updated 2022-11-09
    with raw as (
    select
    block_timestamp,
    symbol as name,
    tx_hash,
    ORIGIN_FROM_ADDRESS,
    amount_usd,
    amount
    from ethereum.core.ez_token_transfers
    where origin_to_address ='0x25ace71c97b33cc4729cf772ae268934f7ab5fa1'
    and date(block_timestamp) >= '2022-07-01'
    and name in ('WBTC', 'USDC', 'USDT', 'LUSD', 'SNX', 'DAI')
    and name is not NULL

    UNION

    select
    block_timestamp,
    'ETH' as name,
    tx_hash,
    ORIGIN_FROM_ADDRESS,
    amount_usd,
    amount
    from ethereum.core.ez_eth_transfers
    where origin_to_address = '0x25ace71c97b33cc4729cf772ae268934f7ab5fa1'
    and date(block_timestamp) >= '2022-07-01'
    )
    select date_trunc('week', block_timestamp) as date, name,
    case when amount_usd < 100 then 'Less Than $100'
    when amount_usd >= 100 and amount_usd < 500 then '$100 - $500'
    when amount_usd >= 500 and amount_usd < 2000 then '$500 - $2000'
    when amount_usd >= 2000 and amount_usd < 10000 then '$2000 - $10000'
    when amount_usd >= 10000 then 'More Than $10000' end as dist,
    count (distinct tx_hash) as tx_count,
    sum (tx_count) over (partition by dist order by date) as cumu_tx_count
    from raw
    Run a query to Download Data