0-MIDTop 10 platform type By Tx Count With New Borrowers on Arbitrum Chain
    Updated 2023-03-02
    with tab1 as (
    select min(BLOCK_TIMESTAMP::date)as date
    ,ORIGIN_FROM_ADDRESS
    from arbitrum.core.fact_token_transfers
    where ORIGIN_FUNCTION_SIGNATURE ='0xd5eed868'
    and ORIGIN_TO_ADDRESS='0x794a61358d6845594f94dc1db02a252b5b4814ad'
    and ORIGIN_FROM_ADDRESS=TO_ADDRESS
    and FROM_ADDRESS<>'0x0000000000000000000000000000000000000000'
    group by 2),
    tab2 as (
    select min(BLOCK_TIMESTAMP::date)as date
    ,ORIGIN_FROM_ADDRESS
    from optimism.core.fact_token_transfers
    where ORIGIN_FUNCTION_SIGNATURE ='0xd5eed868'
    and ORIGIN_TO_ADDRESS='0x794a61358d6845594f94dc1db02a252b5b4814ad'
    and ORIGIN_FROM_ADDRESS=TO_ADDRESS
    and FROM_ADDRESS<>'0x0000000000000000000000000000000000000000'
    group by 2),
    tab3 as (
    select ADDRESS,LABEL_TYPE,PROJECT_NAME
    from arbitrum.core.dim_labels),
    tab4 as (
    select FROM_ADDRESS
    ,TO_ADDRESS
    ,TX_HASH
    from arbitrum.core.fact_transactions)
    select LABEL_TYPE
    ,count(distinct TX_HASH) as tx_count
    ,rank()over(order by tx_count) as rank
    from tab3
    left join tab4
    on tab3.ADDRESS=tab4.TO_ADDRESS
    where FROM_ADDRESS in (select ORIGIN_FROM_ADDRESS from tab1)
    group by 1
    order by 2 desc

    Run a query to Download Data