Flipside TeamFS near report - usdc supply
    Updated 2024-07-02
    with usdc_issue as
    (select BLOCK_TIMESTAMP, try_parse_json(CLEAN_LOG):event as event,
    try_parse_json(CLEAN_LOG):data[0]:amount/1e6 as amount,
    try_parse_json(CLEAN_LOG):data[0]:owner_id as owner_id,
    TX_HASH, CLEAN_LOG
    from near.core.fact_logs
    where RECEIVER_ID='17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1'
    and try_parse_json(CLEAN_LOG):event in ('ft_mint', 'ft_burn'))

    select *
    from
    (select date_trunc(month,BLOCK_TIMESTAMP) as "Date",
    sum(case when event='ft_mint' then amount else 0 end) as "Mint",
    sum(case when event='ft_burn' then -amount else 0 end) as "Burn",
    "Mint"+"Burn" as net,
    sum(net) over (order by "Date") as "Supply"
    from usdc_issue
    group by 1)
    where "Date">='2023-12-01'


    QueryRunArchived: QueryRun has been archived