dannyamahAptos Q1 Users
    Updated 2024-04-26
    -- forked from Total Users @ https://flipsidecrypto.xyz/edit/queries/abd31678-6d40-462f-99a0-9cbce4a72576

    WITH protocol AS (
    SELECT
    event_address AS Event_Address,
    COUNT(DISTINCT tx_hash) AS Number_of_Transactions,
    COUNT(DISTINCT account_address) AS Unique_Account_Addresses
    FROM
    aptos.core.fact_events
    WHERE
    block_timestamp >= '2024-01-01'
    AND block_timestamp <= '2024-03-31'
    GROUP BY 1
    ),

    label AS (
    SELECT
    l.label AS Project_Name,
    l.label_type AS Project_Type,
    p.number_of_transactions AS Transaction_Number,
    p.event_address AS Event_Address
    FROM protocol AS p

    JOIN aptos.core.dim_labels AS l
    ON p.event_address = l.ADDRESS
    ),

    event AS (
    SELECT
    SPLIT(PAYLOAD_FUNCTION, '::')[0] AS Event,
    t.*
    FROM
    aptos.core.fact_transactions AS t

    JOIN label
    ON SPLIT(t.PAYLOAD_FUNCTION, '::')[0] = label.event_address
    QueryRunArchived: QueryRun has been archived