mz0111Inflows and Outflows 3
    Updated 2022-11-02
    --credit to cryptoicicle
    with txns as (
    select
    iff(origin_to_address = '0x25ace71c97b33cc4729cf772ae268934f7ab5fa1', 'OP-->ETH', 'ETH-->OP') as type,
    block_timestamp,
    tx_hash,
    amount_usd,
    origin_from_address
    from ethereum.core.ez_eth_transfers
    where origin_to_address in (
    '0x25ace71c97b33cc4729cf772ae268934f7ab5fa1' -- Optimism --> ETH
    ,'0x99c9fc46f92e8a1c0dec1b1747d010903e884be1' -- ETH --> Optimism
    )
    and block_timestamp >= '2022-01-01'
    )

    select
    date_trunc('week',block_timestamp) as date,
    type,
    count(distinct tx_hash) as n_txns,
    count(distinct origin_from_address) as n_wallets,
    sum(amount_usd) as amount_usd
    from txns
    group by 1 , 2