elenahooAstroport swap count
    Updated 2022-03-28
    with astroport_labels as (
    select
    address,
    address_name
    from terra.labels
    where label = 'astroport'
    and label_subtype = 'pool'
    and address_name like '%LP%'
    )
    select
    date_trunc('day',block_timestamp) as day,
    count(distinct tx_id) as swap_count
    from terra.msg_events
    where event_type = 'from_contract'
    and (event_attributes:"0_from" in (select address from astroport_labels)
    or
    event_attributes:"to" in (select address from astroport_labels)
    )
    and (event_attributes:"1_action" = 'swap' or event_attributes:"0_action" = 'swap' )
    and tx_status = 'SUCCEEDED'
    and block_timestamp >= '2021-12-01'
    and block_timestamp < CURRENT_DATE
    group by day
    order by day asc




    Run a query to Download Data