Yousefi_1994Terra 6 - Daily Contracts deployed
    Updated 2023-01-12
    with contracts_deployed as (
    select
    block_timestamp,
    message_value:contract as contract_address
    from terra.core.ez_messages
    where message_type = '/cosmwasm.wasm.v1.MsgExecuteContract'
    and message_value:contract is not null
    and tx_succeeded = true
    ),
    contracts_deployed_results_1 as (
    select
    contract_address,
    min(block_timestamp) as deploy_time
    from contracts_deployed
    group by contract_address
    ),
    contracts_deployed_results_2 as (
    select
    *
    from contracts_deployed_results_1
    where deploy_time::date >= '2022-12-12'
    and deploy_time::date < '2023-01-07'
    )

    select
    deploy_time::date as "Days",
    case
    when deploy_time::date >= '2022-12-12' and deploy_time::date < '2022-12-25' then 'Before Christmas Holidays'
    when deploy_time::date >= '2022-12-25' and deploy_time::date < '2023-01-07' then 'Christmas Holidays'
    end as "Period",
    count(distinct contract_address) as "Number of Contracts Deployed"
    from contracts_deployed_results_2
    group by "Days", "Period"
    order by "Days"
    Run a query to Download Data