ArioBridger Destinations - top 10 by type
    Updated 2022-08-01
    with bridged_wallets as (
    select
    BLOCK_TIMESTAMP as bridge_date,
    tx_json:receipt:logs[12]:decoded:inputs:to as wallet
    from polygon.core.fact_transactions
    where FROM_ADDRESS = '0x0000000000000000000000000000000000000000' and TO_ADDRESS = '0x0000000000000000000000000000000000000000'
    and STATUS = 'SUCCESS'
    ),
    ALL_TRX AS (
    SELECT
    *,
    RANK() OVER (PARTITION BY from_address ORDER BY BLOCK_TIMESTAMP ASC) as rank
    FROM polygon.core.fact_transactions FT INNER JOIN bridged_wallets B ON FT.FROM_ADDRESS = B.WALLET AND FT.BLOCK_TIMESTAMP > B.bridge_date
    where STATUS = 'SUCCESS'
    ),
    FIRST_DIESTINATION AS (
    SELECT * FROM ALL_TRX WHERE rank = 1
    AND TO_ADDRESS IS NOT NULL
    ),
    final_table as (
    SELECT
    BLOCK_TIMESTAMP
    ADDRESS_NAME,
    LABEL_TYPE,
    LABEL_SUBTYPE,
    PROJECT_NAME,
    MATIC_VALUE,
    TX_FEE
    FROM polygon.core.dim_labels L INNER JOIN FIRST_DIESTINATION FD ON FD.TO_ADDRESS = L.ADDRESS
    )
    select top 10 label_type as destination_type,
    count(*) as number_of_tx
    from final_table
    group by destination_type
    order by number_of_tx DESC

    Run a query to Download Data