kasadeghTop First Destination Wallets
    Updated 2022-07-31
    with bridged_transaction_info as (
    select
    block_timestamp, block_id, tx_id, 'mint' as type, to_address as wallet_address, to_address,to_address_name, to_label, contract_address, symbol , amount , amount_usd
    from flipside_prod_db.polygon.udm_events
    where
    origin_address = '0x0000000000000000000000000000000000000000' and from_address = '0x0000000000000000000000000000000000000000'
    and event_type = 'erc20_transfer'
    and event_id is not null
    and amount > 0 and amount is not null
    and symbol is not null
    and tx_id !='0x883d6feefe71a23ec3114c960f3d22fb18f91948a968880cc78cc17d378a2078'

    )

    , transfers_transactions as (
    select
    block_timestamp, block_id, tx_id, 'transfer' as type, from_address as wallet_address, to_address, to_address_name, to_label, contract_address, symbol, amount, amount_usd
    from flipside_prod_db.polygon.udm_events
    where from_address in (select wallet_address from bridged_transaction_info)
    and event_id is not null
    and symbol is not null
    )

    , All_transactions as (
    select * from bridged_transaction_info union ALL SELECT * from transfers_transactions
    )

    , bridged_transactions_with_next_tranasctions as (
    select
    *
    , lead(contract_address, 1) over (partition by wallet_address order by block_id) as next_contract_address
    , lead(symbol, 1) over (partition by wallet_address order by block_id) as next_symbol
    , lead(amount, 1) over (partition by wallet_address order by block_id) as next_amount
    , lead(amount_usd, 1) over (partition by wallet_address order by block_id) as next_amount_usd
    , lead(to_address, 1) over (partition by wallet_address order by block_id) as next_to_address
    , lead(to_address_name, 1) over (partition by wallet_address order by block_id) as next_to_address_name
    Run a query to Download Data