Moe11 op por
    Updated 2022-11-07
    with base as (
    select
    block_timestamp,
    tx_hash,
    event_name as event
    from
    optimism.core.fact_event_logs
    where tx_status = 'SUCCESS'
    and contract_address = '0x4200000000000000000000000000000000000042' --OP
    union all
    select
    block_timestamp,
    tx_hash,
    label_type as event
    from
    optimism.core.fact_event_logs l,optimism.core.dim_labels b

    where tx_status = 'SUCCESS'
    and origin_to_address = address
    and contract_address = '0x4200000000000000000000000000000000000042'

    )

    select
    date_trunc(week,block_timestamp)::date as weeks,
    case
    when EVENT ilike '%swap%' or EVENT ilike '%dex%' then 'swap activities'
    when EVENT ilike 'stak%' then 'stake activities'
    when EVENT ilike '%unstak%' then 'un-stake activities'
    when EVENT ilike '%liquidity%' or EVENT ilike '%farm%' then 'Farming activities'
    when EVENT ilike '%nft%' then 'NFT activities'
    when EVENT ilike '%layer2%' then 'Bridging activities'
    else 'other activities'
    Run a query to Download Data