elsina✅ Supply: single number
    Updated 2023-04-13
    with all_transfers as (
    select
    sender as addr,
    sum(amount::number/1e6) as volume
    from terra.core.ez_transfers
    where currency = 'uluna' and amount is not null and tx_succeeded = true-- and message_type = '/ibc.applications.transfer.v1.MsgTransfer'
    group by 1

    union all

    select
    receiver as addr,
    -sum(amount::number/1e6) as volume
    from terra.core.ez_transfers
    where currency = 'uluna' and amount is not null and tx_succeeded = true-- and message_type = '/ibc.applications.transfer.v1.MsgTransfer'
    group by 1
    ),
    balance as (
    select
    addr,
    sum(volume::number) as wallet_balance
    from all_transfers
    group by 1 having wallet_balance > 0
    ),
    circulating_supply as (
    select sum(wallet_balance) as "Circulating Supply"
    from balance
    ),
    rec as (
    select
    receiver,
    sum(amount)/1e4 as rec_vol
    from terra.core.ez_transfers
    where currency = 'uluna'
    group by 1
    ),
    Run a query to Download Data