hmxinternDaily Active Users (DAU)
    Updated 2024-09-16
    with hlp_logs as (
    select
    date_trunc('day', BLOCK_TIMESTAMP) as time,
    DECODED_LOG['account'] as account,
    'HLP' as action
    from blast.core.fact_decoded_event_logs
    where CONTRACT_ADDRESS = lower('0xF0D92907236418Fa8Ee900E384b4c6928f7cADfc')
    and EVENT_NAME in ('AddLiquidity', 'RemoveLiquidity')
    ),
    trades_logs as (
    select date_trunc('day', BLOCK_TIMESTAMP) as time,
    DECODED_LOG['primaryAccount'] as account,
    'Trade' as action
    from blast.core.fact_decoded_event_logs
    where CONTRACT_ADDRESS = lower('0x0a8D9c0A4a039dDe3Cb825fF4c2f063f8B54313A')
    and EVENT_NAME in ('LogIncreasePosition', 'LogDecreasePosition')
    ),
    collat_logs as (
    select date_trunc('day', BLOCK_TIMESTAMP) as time,
    DECODED_LOG['primaryAccount'] as account,
    'Trade' as action
    from blast.core.fact_decoded_event_logs
    where CONTRACT_ADDRESS = lower('0xE7D96684A56e60ffBAAe0fC0683879da48daB383')
    and EVENT_NAME in ('LogDepositCollateral', 'LogWithdrawCollateral')
    ),
    active_address as (
    select time,
    case when count(distinct action) = 1 then max(action) else 'BOTH' end as action,
    account
    from (
    select * from hlp_logs
    union all
    select * from trades_logs
    union all
    select * from collat_logs
    )
    QueryRunArchived: QueryRun has been archived