superflyDaily interaction with top 20 contracts by contracts
    Updated 2022-12-20
    with tab1 as (
    select
    message_value:contract as contract,
    count(*) as count1
    from terra.core.ez_messages
    where message_type like '%Contract%'
    group by 1
    order by 2 desc
    limit 20
    )

    select
    date_trunc('day', block_timestamp) as date1,
    message_value:contract,
    count(*) as count1
    from terra.core.ez_messages
    where message_type like '%Contract%'
    and message_value:contract in (select contract from tab1)
    group by 1,2
    Run a query to Download Data