Sbhn_NPtotal depositors mars
    Updated 2023-02-13
    with base as (select distinct tx_id
    from osmosis.core.fact_msg_attributes
    where attribute_value = 'osmo1c3ljch9dfw5kf52nfwpxd2zmj2ese7agnx0p9tenkrryasrle5sqf3ftpg'
    and tx_succeeded = 'TRUE'
    ),

    borrow as (
    select distinct tx_id as tx_id from osmosis.core.fact_msg_attributes
    where tx_id in (select * from base)
    and attribute_key = 'action'
    and attribute_value = 'borrow'
    ),

    deposit as (
    select distinct tx_id as tx_id from osmosis.core.fact_msg_attributes
    where tx_id in (select * from base)
    and attribute_key = 'action'
    and attribute_value = 'deposit'
    )


    select count(distinct attribute_value) as depositors
    from osmosis.core.fact_msg_attributes
    where tx_id in (select * from deposit)
    and msg_type = 'message'
    and attribute_key = 'sender'
    Run a query to Download Data