cheeyoung-kekBridger Destinations 2
    Updated 2022-07-31
    with tc_bridge as (
    select
    to_address as address,
    min(block_timestamp) as date
    from polygon.core.fact_token_transfers
    where
    origin_from_address = '0x0000000000000000000000000000000000000000' and
    origin_to_address = '0x0000000000000000000000000000000000000000' and
    from_address = '0x0000000000000000000000000000000000000000'
    and to_address in
    (
    select
    distinct origin_from_address
    from ethereum.core.fact_event_logs
    where (ORIGIN_TO_ADDRESS=lower('0x401f6c983ea34274ec46f84d70b31c151321188b') or
    ORIGIN_TO_ADDRESS=lower('0xa0c68c638235ee32657e8f720a23cec1bfc77c77'))

    )
    group by 1

    ),

    sort as (
    select
    row_number() over (partition by origin_to_address order by block_timestamp asc) as rank,
    origin_to_address
    from polygon.core.fact_event_logs
    join tc_bridge
    on origin_from_address = address and block_timestamp::date > date
    )

    select
    project_name,
    count(*) as tx_count
    from sort a join polygon.core.dim_labels b on a.origin_to_address = b.address
    where
    Run a query to Download Data