primo_dataPolygon Bridger Destinations
    Updated 2022-07-28
    --Q5. Where do people go when they bridge to Polygon from Ethereum? What are the 10 most popular first destinations for Polygon addresses that have just bridged from Ethereum?

    -- https://app.flipsidecrypto.com/velocity/queries/8a25b914-c481-4cbb-9ea4-a4c0f2a98113

    with eth_to_poly_bridge_tx AS (
    select t.block_timestamp transfer_datetime
    , t.tx_hash eth_tx_hash
    , t.from_address wallet
    , e.contract_address transfer_token
    , case when e.contract_address = '0x8484ef722627bf18ca5ae6bcf031c23e6e922b30' then 'ETH' else c.symbol end symbol
    --, (( case when e.event_name = 'Transfer' then e.event_inputs:value else e.event_inputs:amount end )/
    -- pow(10,case when c.decimals is null then 18 else c.decimals end) ) token_amount
    from ethereum.core.fact_transactions t
    inner join ethereum.core.fact_event_logs e
    on t.tx_hash = e.tx_hash
    and e.event_name in ('Transfer', 'LockedEther')
    and e.block_timestamp >= CURRENT_DATE - 30
    left join ethereum.core.dim_contracts c
    on c.address = e.contract_address
    where t.to_address = '0xa0c68c638235ee32657e8f720a23cec1bfc77c77' -- polygon matic bridge
    and t.block_timestamp >= CURRENT_DATE - 30
    --and t.tx_hash = '0xc96d7c6ae503a44f515dec3bdb79e0930427c3b4a14aafb024180032dd707a07'
    ),
    poly_bridged_txs AS (
    SELECT e.*
    , p.block_timestamp matic_blocktimestamp
    , datediff('day',e.transfer_datetime,p.block_timestamp) diff
    ,RANK() OVER (PARTITION BY eth_tx_hash ORDER BY p.block_number) as rank
    , p.tx_hash poly_tx_hash
    --, p.from_address
    , p.to_address
    , l.address_name
    , l.label_type
    , l.label_subtype
    from eth_to_poly_bridge_tx e
    left join polygon.core.fact_transactions p
    Run a query to Download Data