Sbhn_NPfeather circul 1
    Updated 2023-01-28
    --credit : https://app.flipsidecrypto.com/velocity/queries/a84b31f9-a341-4ce0-9558-d1a832be5479
    with transfer_luna_from_user as (
    select
    sender as address,
    - (sum(amount))/1e6 as amount
    from terra.core.ez_transfers
    where currency = 'uluna'
    and tx_succeeded = true
    and block_timestamp>= '2023-01-07' and block_timestamp <= '2023-01-21'
    group by address
    ),
    transfer_luna_to_user as (
    select
    receiver as address,
    (sum(amount))/1e6 as amount
    from terra.core.ez_transfers
    where currency = 'uluna'
    and tx_succeeded = true
    and block_timestamp>= '2023-01-07' and block_timestamp <= '2023-01-21'
    group by address
    ),
    results_1 as (
    select * from transfer_luna_from_user
    union
    select * from transfer_luna_to_user
    ),
    results_2 as (
    select
    address as holder,
    sum(amount) as amount_of_hold
    from results_1
    group by holder
    having amount_of_hold > 0
    )

    select
    Run a query to Download Data