freeman_7blind-white copy
    Updated 2024-10-16
    -- forked from modestus50 / blind-white @ https://flipsidecrypto.xyz/modestus50/q/effUzHuzpEFo/blind-white
    -- Getting the first 100 buyers
    with buying_transaction as (
    SELECT
    block_timestamp as date_time,
    origin_from_address as address,
    tx_hash as buying_hash,
    amount_out as amount_bought
    FROM ethereum.defi.ez_dex_swaps
    WHERE CONTRACT_ADDRESS = lower('0xC23588834D97647F30544dF720cb9455867e4823')
    and token_in = lower('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2')
    order by block_timestamp
    LIMIT 100
    ),

    -- Getting all sell transaction for this particular token
    sell_transaction as(
    select
    block_timestamp as date_time,
    origin_from_address as address,
    tx_hash as sell_hash,
    amount_in as amount_sold,
    amount_out_usd as amount_usd
    FROM ethereum.defi.ez_dex_swaps
    WHERE CONTRACT_ADDRESS = lower('0xC23588834D97647F30544dF720cb9455867e4823')
    and token_in = lower('0x84f171f4c7b43966231847cc6e60416e6c3a7360')
    )

    -- Matching the early buyers with address found in sell transaction to spot when they sold.
    SELECT
    b.date_time as bought_time,
    b.address as address,
    b.buying_hash as buying_hash,
    b.amount_bought as amount_bought,
    s.date_time as sold_time,
    s.sell_hash as selling_hash,
    QueryRunArchived: QueryRun has been archived