HeminDaily UST and LUNA Burn(log)
    Updated 2022-04-14
    with tabel_one as (
    SELECT
    date_trunc('day', block_timestamp) as date,
    SUM(CASE WHEN ask_currency LIKE 'UST' AND offer_currency LIKE 'LUNA' THEN token_1_amount_usd END) as LUNA_burn,
    SUM(CASE WHEN ask_currency LIKE 'LUNA' AND offer_currency LIKE 'UST' THEN token_1_amount_usd END) as UST_burn
    FROM terra.swaps
    GROUP BY 1
    ),
    tabel_two as (
    SELECT
    date,
    LUNA_burn,
    UST_burn,
    LUNA_burn - UST_burn as net_UST_mint
    from tabel_one
    )

    SELECT
    date,
    LUNA_burn,
    UST_burn,
    net_UST_mint,
    SUM(net_UST_mint) over (order by date) as total_UST_mint
    from tabel_two
    Run a query to Download Data