0xHaM-dpopular_destinations copy
    Updated 2023-10-15
    -- forked from Antonidas / popular_destinations @ https://flipsidecrypto.xyz/Antonidas/q/avyPaSaMHtrg/popular_destinations
    with
    popular_destinations as (
    select
    block_timestamp,
    tx_id,
    msg:attributes[0]:value as contract_address
    from terra.core.fact_msgs
    where msg:attributes[0]:key ilike '%contract_address%'
    and msg_type = 'wasm'
    and tx_succeeded = TRUE
    -- and block_timestamp > current_date - 365
    )
    ,
    raw_stats as (
    select
    block_timestamp,
    contract_address,
    TX_SENDER
    from popular_destinations
    JOIN terra.core.fact_transactions using(tx_id, block_timestamp)
    ),
    labels as (
    select address, project_name from terra.core.dim_address_labels
    union all
    select 'terra19z3qj8lwrhla6x58jt5338e3hktfrn6x63ua4226wk2c7psh62psfghzu7', 'astroport'
    )
    select
    count(DISTINCT TX_SENDER) as address
    from raw_stats r
    join labels l on r.contract_address = l.address AND project_name = 'astroport'



    with popular_destinations as (
    select
    Run a query to Download Data