dethectiveWallet Age per token - Using swaps
    Updated 2025-01-31
    WITH wallet_age as (
    SELECT
    swapper,
    min(block_timestamp) as first_tx,
    count(*) as tot_tx
    from
    solana.defi.ez_dex_swaps
    where
    swapper in (
    SELECT
    DISTINCT(swapper)
    FROM
    solana.defi.ez_dex_swaps
    where
    swap_to_mint = '{{token_address}}'
    )
    GROUP BY
    swapper
    ),
    token_age as (
    SELECT
    min(block_timestamp) as token_age
    FROM
    solana.defi.ez_dex_swaps
    where
    swap_to_mint = '{{token_address}}'
    )

    SELECT
    wa.*,
    (SELECT token_age FROM token_age) AS token_age,
    DATEDIFF(hour, wa.first_tx, token_age) AS created_before_hours,
    DATEDIFF(day, wa.first_tx, token_age) AS created_before_days
    FROM
    wallet_age wa;

    QueryRunArchived: QueryRun has been archived