Metiocretop 20 contracts in projects list
    Updated 2022-03-15
    with lst_wallets_90 as (
    select tx_from[0] as wallet
    ,min(block_timestamp)::date as min_date
    from terra.transactions
    group by 1
    having min_date>=CURRENT_DATE - 90
    ),
    tx_ids as (
    select tx_id, tx_from[0] as wallet
    from terra.transactions join lst_wallets_90
    on lst_wallets_90.wallet = tx_from[0]
    -- where tx_status = 'true'
    )
    ,
    contracts as (
    select m.msg_value:contract::string as contract , count(DISTINCT t.wallet) as total_wallets_interacted
    from terra.msgs m , tx_ids t , terra.labels l
    where l.address = contract and contract is not NULL
    and m.tx_id = t.tx_id
    and l.label is not NULL and l.label in ('anchor','terraswap','astroport','mirror','pylon','mars','prism','random earth')
    group by 1
    order by total_wallets_interacted desc
    limit 20
    )

    select contract, label, total_wallets_interacted
    from contracts, terra.labels
    where contract=address
    order by total_wallets_interacted desc
    Run a query to Download Data