jonestrinhDAO SOL
    Updated 2023-01-04
    with total as (
    select
    date_trunc('day', block_timestamp) as dt,
    program_name as name,
    sum(amount) as amount
    from solana.core.fact_gov_actions
    where action = 'LOCK'
    group by 1,2

    union all

    select
    date_trunc('day', block_timestamp) as dt,
    program_name as name,
    (-1)*sum(amount) as amount
    from solana.core.fact_gov_actions
    where action = 'EXIT'
    group by 1,2
    )

    select
    dt,
    name,
    sum(amount) as net_lock
    from total
    where dt >= current_date - interval '6 month'
    group by 1,2
    Run a query to Download Data