darush90User Interaction Rank In Hot Contracts (>100 $ETH Paid Fee) copy copy
    -- forked from User Interaction Rank In Hot Contracts (>100 $ETH Paid Fee) copy @ https://flipsidecrypto.xyz/edit/queries/c403e5cf-0a10-4b6a-9ac3-87f243d16949

    -- forked from User Interaction Rank In Hot Contracts (>100 $ETH Paid Fee) @ https://flipsidecrypto.xyz/edit/queries/238789ca-1a4b-4e41-ac22-a6777e694f40

    {{param_wcwB}}{{param_lp4n}}{{param_33fW}} with
    top_contracts as (
    select CONTRACT_ADDRESS, ifnull(CONTRACT_NAME,ADDRESS_NAME) as CONTRACT_NAME, TOTAL_FEE
    from
    (select
    value[0]::string as CONTRACT_ADDRESS,
    value[1]::string as SYMBOL,
    value[2]::string as CONTRACT_NAME,
    value[3]::string as TOTAL_FEE
    from (select livequery.live.udf_api('https://flipsidecrypto.xyz/api/queries/4d9e7c78-d47c-46b4-b201-08e03c23e28c/latest-run')
    as response), lateral FLATTEN (input => response:data:data))
    left join ethereum.core.dim_labels
    on CONTRACT_ADDRESS=ADDRESS
    ),

    top_contracts_users as
    (select CONTRACT_ADDRESS, CONTRACT_NAME, TOTAL_FEE,
    FROM_ADDRESS as user,
    min(BLOCK_TIMESTAMP) as min_date,
    rank() over (partition by CONTRACT_ADDRESS order by min_date asc) as rank
    from ethereum.core.fact_transactions a
    join top_contracts b
    on CONTRACT_ADDRESS=TO_ADDRESS
    group by 1,2,3,4),

    eth_og_users as
    (select user, count(CONTRACT_ADDRESS) as contracts
    from top_contracts_users
    where rank<=1000
    group by 1)

    select