boomer77weekly luna burned
    Updated 2022-05-05
    with burn as (select date_trunc('week', block_timestamp) as dt, sum(offer_amount) as luna_b, (luna_b*-1) as luna_burned
    from terra.swaps
    where offer_currency = 'LUNA' and tx_status = 'SUCCEEDED' and year(block_timestamp) = '2022'
    group by 1),

    mint as (select date_trunc('week', block_timestamp) as dt, sum(offer_amount) as luna_b, (luna_b*1) as luna_minted
    from terra.swaps
    where ask_currency = 'LUNA' and tx_status = 'SUCCEEDED' and year(block_timestamp) = '2022'
    group by 1)

    select a.dt, a.luna_burned, b.luna_minted, (a.luna_burned + b.luna_minted) as net_luna
    from burn a
    left join mint b on a.dt = b.dt