raho2023-07-03 03:52 PM
    Updated 2023-07-03
    with
    all_borrows as (
    select
    date(block_timestamp) as date,
    currency,
    amount,
    amount_scaled,
    action,
    sender,
    recipient
    from
    osmosis.mars.ez_redbank_actions
    where
    currency = 'ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858'
    and action = 'borrow'
    order by
    amount_scaled desc
    )
    select distinct
    (sender) as addresses,
    sum(amount) as total_amount,
    sum(amount_scaled) as total_amount_scaled
    from
    all_borrows
    group by
    1
    order by
    total_amount_scaled desc
    Run a query to Download Data