bachisolend users
    Updated 2022-08-04
    with solend_user_dtls as (select ft.signers[0] as wallets
    from solana.fact_transactions ft
    join solana.dim_labels dl
    on ft.instructions[0]:programId = dl.address
    where dl.label_subtype != 'token_contract'
    and dl.label != 'solana'
    and ft.succeeded = 'TRUE'
    and dl.label = 'solend')

    select day, count(distinct active_users) as daily_active_users, sum(daily_active_users) over (order by day asc) as cumulative_active_users from
    (
    select date(block_timestamp) as day, signers[0] as active_users, count(distinct tx_id) as no_of_txns
    from solana.core.fact_transactions
    where succeeded = 'TRUE' and block_timestamp >= dateadd(month, -3, getdate())
    and signers[0] in (select wallets from solend_user_dtls)
    group by day, active_users
    having no_of_txns >= 1
    order by no_of_txns desc
    )
    group by day order by day desc
    Run a query to Download Data