KARTODPopular Contracts on Flow 2
    Updated 2022-05-29
    with list as (
    select
    event_contract,
    count(*) as popularity
    from flow.core.fact_events
    where block_timestamp::date >= '2022-05-09'
    and exists (select tx_id from flow.core.fact_transactions where TX_SUCCEEDED = 1 and flow.core.fact_events.tx_id = flow.core.fact_transactions.tx_id)
    group by event_contract
    order by popularity DESC
    limit 10
    )

    select
    COALESCE(contract_name, e.event_contract) AS Name,
    count(*) as popularity_per_day
    from flow.core.fact_events e
    left join flow.core.dim_contract_labels f ON e.event_contract = f.event_contract
    where block_timestamp::date >= '2022-05-09'
    and e.event_contract in (select event_contract from list)
    group by Name
    order by popularity_per_day desc



    --SELECT
    --*,
    --TRANSACTION_RESULT:events[0]:value
    --FROM flow.core.fact_transactions
    --WHERE BLOCK_TIMESTAMP > '2022-05-09' and TX_ID = '978f85f9f9994f148d5116aa033dddbb862eff0f3076fdd0d8ae49068ce3220a'
    Run a query to Download Data