KaskoazulPleasure to burn
    Updated 2022-02-26
    WITH LUNA AS (
    SELECT
    block_timestamp::date AS fecha,
    sum(event_attributes:amount[0]:amount/pow(10,6)) AS LUNA_BURNT,
    sum(LUNA_BURNT) OVER (ORDER BY fecha) AS LUNA_BURNT_CUMULATIVE
    FROM
    terra.msg_events
    WHERE
    event_type = 'burn'
    AND event_attributes:amount[0]:denom = 'uluna'
    AND fecha >= CURRENT_DATE - 30
    GROUP BY 1
    ORDER BY 1
    ),

    UST AS (
    SELECT
    date as fecha,
    sum(balance) as UST_SUPPLY
    FROM
    terra.daily_balances
    WHERE
    currency = 'UST'
    AND fecha >= CURRENT_DATE - 30
    AND balance > 0
    AND balance_type = 'liquid'
    GROUP BY 1
    ORDER BY 1
    )

    SELECT
    l.fecha,
    l.LUNA_BURNT,
    l.LUNA_BURNT_CUMULATIVE,
    u.UST_SUPPLY,
    u.UST_SUPPLY - 12437193962.9145 as UST_SUPPLY_CHANGE
    Run a query to Download Data