MLDZMNactiv2
    Updated 2023-04-04
    with t1 as (select
    distinct event_inputs:toDelegate as delegates
    from arbitrum.core.fact_event_logs
    where event_name in ('DelegateChanged')
    and CONTRACT_ADDRESS ilike '0x912ce59144191c1204e64559fe8253a0e49e6548'
    ),

    t2 as (
    select
    case when FROM_ADDRESS in (select delegates from t1) then 'Delegates' else 'Other wallets' end as wallet_type,
    count (Distinct tx_hash) as no_txn,
    no_txn/count(distinct FROM_ADDRESS) as txn_per_wallet,
    sum (Tx_fee) as total_fee,
    count (Distinct block_timestamp::Date) as active_days,
    min (block_timestamp) as first_transaction
    from arbitrum.core.fact_transactions
    where STATUS ='SUCCESS'
    group by 1)

    select
    wallet_type,
    avg(txn_per_wallet)
    from t2
    group by 1
    Run a query to Download Data