Updated 2025-04-15
    with

    main as (
    select
    tx_hash,
    block_timestamp,
    signer_id as user,
    deposit / 1e24 as amount,
    'Stake' as event_name
    from
    near.core.fact_actions_events_function_call
    where
    receipt_succeeded
    and method_name = 'deposit'
    and receiver_id = 'storage.herewallet.near'

    union all

    select
    tx_hash,
    block_timestamp,
    signer_id as user,
    args:amount::bigint / 1e24 as amount,
    'Unstake' as event_name
    from
    near.core.fact_actions_events_function_call
    where
    receipt_succeeded
    and method_name = 'withdraw'
    and receiver_id = 'storage.herewallet.near'
    )

    select
    count(distinct tx_hash) as transactions,
    count(distinct user) as users,
    transactions / count(distinct block_timestamp::date) as daily_average_transactions,
    Last run: 24 days ago
    TRANSACTIONS
    USERS
    DAILY_AVERAGE_TRANSACTIONS
    DAILY_AVERAGE_USERS
    1
    46387467049587.92648984.979721
    1
    37B
    162s