h4wkbase 2
    Updated 4 days ago
    -- forked from base total @ https://flipsidecrypto.xyz/studio/queries/1a3cedcc-7661-430c-a016-18be2367e48d

    with base as (
    select b.*
    from solana.core.fact_transactions a
    join lateral flatten (input => log_messages) logs
    join (select * from solana.core.fact_transfers
    where mint = 'DBRiDgJAMsM95moTzJs7M9LnkGErpbv9v6CUR1DXnUu5'
    and block_timestamp >= '2025-02-01') b using (tx_id, block_timestamp)
    join (select tx_id from solana.core.fact_events
    where program_id = 'DBrLFG4dco1xNC5Aarbt3KEaKaJ5rBYHwysqZoeqsSFE'
    and block_timestamp >= '2025-02-01') using (tx_id)
    where a.block_timestamp >= '2025-02-01'
    and logs.value = 'Program log: Instruction: ClaimToken'
    UNION ALL
    select *
    from $query('a4d30562-9cd3-4a63-a76a-56d408223107')
    )
    , claimers as (
    select tx_to as claimer,
    count(distinct tx_id) as tx_count,
    sum(amount) as total_claim,
    any_value(tx_id) as sample_tx,
    case when total_claim < 1000 then '1. Claim < 1,000 DBR'
    when total_claim < 10000 then '2. Claim < 10,000 DBR'
    when total_claim < 100000 then '3. Claim < 100k DBR'
    when total_claim < 500000 then '4. Claim < 500k DBR'
    else '5. Claim = 500k DBR' end as type
    from base
    group by 1
    )
    , seller as (
    select claimer,
    type,
    total_claim,
    sum(zeroifnull(case when swap_from_mint = 'DBRiDgJAMsM95moTzJs7M9LnkGErpbv9v6CUR1DXnUu5' then swap_from_amount end)) as selling,
    Last run: 4 days ago
    SELLING_TYPE
    USER_COUNT
    1
    Holding928
    2
    Sell All398
    3
    Sell Some185
    4
    Accumulate More71
    4
    75B
    57s