jackguy2023-09-30 10:31 AM
    Updated 2024-12-03
    with tab0 as (
    SELECT
    address,
    label
    from cosmos.gov.fact_validators
    ), tab1 as (
    SELECT
    tx_id as tx1,
    msg_index as mi1
    FROM cosmos.core.fact_msg_attributes
    WHERE msg_type LIKE 'send_packet'
    AND ATTRIBUTE_VALUE LIKE 'channel-391'
    ), tab2 as (
    SELECT
    block_timestamp as bt,
    tx_id as txs,
    TRY_CAST(PARSE_JSON(ATTRIBUTE_VALUE):amount::STRING AS FLOAT) / power(10, 6) as amount
    FROM cosmos.core.fact_msg_attributes
    LEFT outer JOIN tab1
    on tx1 = tx_id
    WHERE ATTRIBUTE_KEY LIKE 'packet_data'
    AND msg_type LIKE 'send_packet'
    AND LEFT(PARSE_JSON(ATTRIBUTE_VALUE):denom::STRING,
    CHARINDEX('/', PARSE_JSON(ATTRIBUTE_VALUE):denom::STRING) - 1) in (SELECT address from tab0) --2073
    ), tab3 as (
    SELECT
    DISTINCT tx_from
    FROM cosmos.core.fact_transactions
    LEFT outer JOIN tab2
    on txs = tx_id
    WHERE tx_id in (SELECT txs from tab2)
    )

    SELECT
    *,
    sum(new_users) over (ORDER BY first_week) as total_users
    Last run: 11 days ago
    FIRST_WEEK
    NEW_USERS
    TOTAL_USERS
    1
    2021-11-01 00:00:00.0001434358
    2
    2022-05-09 00:00:00.00032512426
    3
    2021-08-23 00:00:00.0001202564
    4
    2021-02-22 00:00:00.000263561
    5
    2021-03-29 00:00:00.000631126
    6
    2021-12-06 00:00:00.0001395120
    7
    2021-02-15 00:00:00.000298298
    8
    2023-01-16 00:00:00.0005415971
    9
    2023-08-14 00:00:00.0003819534
    10
    2022-06-13 00:00:00.0008912949
    11
    2025-02-17 00:00:00.000446505
    12
    2022-06-06 00:00:00.0008912860
    13
    2023-10-09 00:00:00.00020120145
    14
    2024-03-25 00:00:00.00029240383
    15
    2023-07-24 00:00:00.0003119405
    16
    2024-02-05 00:00:00.000143135016
    17
    2024-11-25 00:00:00.0003146290
    18
    2024-09-30 00:00:00.00042445809
    19
    2021-03-22 00:00:00.000601063
    20
    2021-09-27 00:00:00.0001273439
    ...
    214
    8KB
    119s