jackguyBridger Destinations 4
    Updated 2022-08-01
    with tab1 as (
    select
    from_address,
    min(date_trunc('week', block_timestamp)) as min_week
    FROM ethereum.transactions
    WHERE to_label = 'polygon'
    AND to_label_subtype = 'bridge'
    GROUP BY 1
    ), tab2 as (
    SELECT
    ORIGIN_FROM_ADDRESS,
    min(block_timestamp) as mbt
    FROM polygon.core.fact_event_logs
    WHERE ORIGIN_FROM_ADDRESS in (SELECT from_address from tab1)
    GROUP BY 1
    )

    SELECT
    project_name,
    count(*)
    FROM polygon.core.fact_event_logs
    LEFT outer JOIN tab2
    ON tab2.ORIGIN_FROM_ADDRESS = polygon.core.fact_event_logs.ORIGIN_FROM_ADDRESS
    AND tab2.mbt = block_timestamp
    LEFT outer JOIN polygon.core.dim_labels
    on contract_address = address
    WHERE mbt is not NULL
    AND not contract_address is NULL
    and not project_name is NULL
    GROUP BY 1
    ORDER by 2 DESC
    LIMIT 10
    Run a query to Download Data