boomer77top 10 depositors holding
    Updated 2022-01-08
    with top as (select sender, sum(deposit_amount) as UST_deposited, count(distinct tx_id) as deposit_tx_count
    from anchor.deposits
    where date(block_timestamp) >= CURRENT_DATE - 30
    group by 1
    order by 2 desc
    limit 10),

    staked_luna as (select address, balance, currency
    from terra.daily_balances
    where currency = 'LUNA' and balance_type = 'staked' and date = CURRENT_DATE - 1
    and address in (select sender from top)),

    liquid_luna as (select address, balance, currency
    from terra.daily_balances
    where currency = 'LUNA' and balance_type = 'liquid' and date = CURRENT_DATE - 1
    and address in (select sender from top)),

    UST as (select address, balance, currency
    from terra.daily_balances
    where currency = 'UST' and date = CURRENT_DATE - 1
    and address in (select sender from top)),

    KRT as (select address, balance, currency
    from terra.daily_balances
    where currency = 'KRT' and date = CURRENT_DATE - 1
    and address in (select sender from top))

    select a.sender, a.ust_deposited, a.deposit_tx_count, b.balance as Staked_LUNA, c.balance as Liquid_LUNA, d.balance as UST, e.balance as KRT
    from top a
    left outer join staked_luna b on a.sender = b.address
    left outer join liquid_luna c on a.sender = c.address
    left outer join UST d on a.sender = d.address
    left outer join KRT e on a.sender = e.address
    order by 2 desc

    Run a query to Download Data