Stin00USDC Swap Volume on Ethereum and Optimism (in USDC)
    Updated 2022-07-20
    --darvishi
    with
    base as (select *
    from
    optimism.core.dim_labels
    where project_name ilike '%uni%'),

    base2 as (select tx_hash
    from
    optimism.core.fact_event_logs
    where
    event_name = 'Swap'
    and origin_to_address in (select address from base)
    and block_timestamp >= '2022-01-01'),

    base3 as (select block_timestamp,
    event_inputs:from as swapper,
    event_inputs:value/1e6 as swap_size
    from optimism.core.fact_event_logs
    where
    contract_address ilike '0x7F5c764cBc14f9669B88837ca1490cCa17c31607'
    and
    event_name = 'Transfer'
    and tx_hash in (select tx_hash from base2)
    and event_inputs:value > 0),

    base1 as (select *
    from ethereum.core.dim_labels
    where address_name ilike '%uni%'),

    base12 as (select tx_hash
    from
    ethereum.core.fact_event_logs
    where
    event_name = 'Swap'
    and origin_to_address in (select address from base1)
    Run a query to Download Data