afonsoTop 10 LUNA holders
    Updated 2023-04-13
    with t1 as (
    select
    sender as wallet_address,
    sum(amount::number/pow(10, 6)) as total_amount
    from terra.core.ez_transfers
    where tx_succeeded = 1
    and currency = 'uluna'
    and amount is not null
    group by wallet_address

    union all

    select
    receiver as wallet_address,
    -sum(amount::number/pow(10, 6)) as total_amount
    from terra.core.ez_transfers
    where tx_succeeded = 1
    and currency = 'uluna'
    group by wallet_address
    )

    select
    wallet_address,
    sum(total_amount::number) as total_balance
    from t1
    group by wallet_address
    having total_balance > 0
    order by total_balance desc
    limit 10
    Run a query to Download Data