sarathsolend demographics 1
    Updated 2022-08-03
    with solend_users as (select a.signers[0] as solend_users
    from solana.fact_transactions a
    inner join solana.dim_labels b
    on a.instructions[0]:programId = b.address
    where b.label_subtype != 'token_contract'
    and b.label != 'solana'
    and a.succeeded = 'TRUE'
    and b.label = 'solend'),

    active_users as (select block_timestamp::date as dt, signers[0] as active_users, count(distinct tx_id) as num_txs
    from solana.core.fact_transactions
    where succeeded = 'TRUE' and block_timestamp::date > current_date - 30
    and signers[0] in (select solend_users from solend_users)
    group by 1, 2
    having num_txs >= 1
    order by num_txs desc)

    select dt, count(distinct active_users) as daily_active_users, sum(daily_active_users) over (order by dt asc) as cumulative_active_users
    from active_users
    group by 1
    Run a query to Download Data