LittlerDatanew wallets in polygon through polymarket
    Updated 2025-05-31

    with poly_accounts as (
    select
    tx_hash as creation_hash
    ,block_timestamp as account_creation_date
    ,decoded_log:owner as owner
    ,decoded_log:proxy as poly_account_address
    from polygon.core.ez_decoded_event_logs
    where 1=1
    and block_timestamp > '2021-09-30' --first account created
    and contract_address = '0xaacfeea03eb1561c4e67d661e40682bd20e3541b' --the polymarket contract creating the new accounts
    and topic_0 = '0x4f51faf6c4561ff95f067657e43439f0f856d97c04d9ec9070a6199ad418e235' --creation account topic
    and event_name = 'ProxyCreation' --account creation event
    ),


    owners_first_tx as (
    select
    min(block_timestamp) as first_transaction
    ,account_creation_date
    ,from_address as owner--account withdrawing poly credits
    from polygon.core.fact_transactions as txs
    inner join poly_accounts on txs.from_address = poly_accounts.owner
    group by 2, 3
    Having first_transaction > account_creation_date
    )

    select
    oft.owner
    ,poly_Account_address
    ,creation_hash
    ,oft.account_creation_date
    ,first_transaction
    from owners_first_tx as oft
    left join poly_Accounts on oft.owner = poly_Accounts.owner
    --where oft.owner = '0x795a8a836c050bc8525e116b40432f0f330c9679'
    QueryRunArchived: QueryRun has been archived