adriaparcerisasterra contracts opcio 2
    Updated 2022-12-20
    -- Construct a dashboard that displays the number of new contracts deployed
    -- and the total number of contracts deployed each week over the past several months.
    -- Your dashboard should also chart the development of stablecoins, including any supply trends.
    with tab1 as (
    select
    distinct tx:body:messages[0]:contract as contract,
    min(block_timestamp) as debut
    from terra.core.fact_transactions
    --where ATTRIBUTE_KEY in ('contract','u_contract_address','contract_name',
    --'contract_version','contract_addr','contract_address','dao_contract_address','pair_contract_addr','nft_contract')
    group by 1
    )
    SELECT
    trunc(debut,'week') as weeks,
    count(distinct contract) as new_contracts,
    sum(new_contracts) over (order by weeks) as total_new_contracts
    from tab1 where debut>=CURRENT_DATE-INTERVAL '{{n_months}} MONTHS'
    group by 1
    order by 1 asc

    Run a query to Download Data