MadiBurned stablecoins
    Updated 2023-04-13
    with df as (select date_trunc('{{Period}}', BLOCK_TIMESTAMP) as date, tx_id,
    attributes:burn:amount/pow(10,6) as amount,
    case when attributes:burn:currency = 'ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4' then 'axlUSDC'
    when attributes:burn:currency = 'ibc/CBF67A2BCF6CAE343FDF251E510C8E18C361FC02B23430C121116E0811835DEF' then 'axlUSDT' end as currency
    from terra.core.ez_messages
    where message_type = '/ibc.applications.transfer.v1.MsgTransfer' and TX_SUCCEEDED = 'TRUE'
    and attributes:burn:currency in ('ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4', 'ibc/CBF67A2BCF6CAE343FDF251E510C8E18C361FC02B23430C121116E0811835DEF')
    )

    select date, currency, count(DISTINCT tx_id) as tx_count, sum(amount) as amountt,
    sum (amountt) over (PARTITION BY currency order by date) as "Cumualtive sum",
    sum (tx_count) over (PARTITION BY currency order by date) as "Cumualtive txs"
    from df
    where date >= CURRENT_DATE - {{DaysAgo}}
    group by 1,2 order by 3 desc




    /*
    ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4 - axlUSDC,6
    ibc/CBF67A2BCF6CAE343FDF251E510C8E18C361FC02B23430C121116E0811835DEF - axlUSDT, 6
    ibc/3696F81A930C1C23BB1764A2C4C628E01142A3D95403A7CC2086E2160DEE0C6D -- UST
    ibc/FA7775734CC73176B7425910DE001A1D2AD9B6D9E93129A5D0750EAD13E4E63A -- USDC
    ibc/79D7EC473FB1070FB54007C55E69F33EDE372BB39B6B6711F4AB6A135AA3565F -- USDC
    ibc/9BDC39883851E0F62C9EF8281A6DBE8F733D9440FC59C6BC4567B41D79540FD3 -- UST
    ibc/2E435CEEEBA18CCB2719E0182BC5D142A364D6CCE9957DE6E1AC4D62127D2913 -- axlFRAX
    ibc/192CE21811502C16A6E34BE14F9263721EBAB6C8F0798F42AD5DE6385D6BF846 --USDC
    */
    Run a query to Download Data