rezarwzHow long does it take for early adopters to complete their second transaction?
    Updated 2023-05-16
    with swap_users as(
    SELECT
    BLOCK_TIMESTAMP,
    ORIGIN_FROM_ADDRESS as user_wallet_address,
    'swapping' as EVENT_NAME,
    AMOUNT_IN_USD,
    AMOUNT_OUT_USD,
    PLATFORM,
    SYMBOL_IN,
    SYMBOL_out,
    RANK() OVER (partition by ORIGIN_FROM_ADDRESS order by BLOCK_TIMESTAMP asc)as rank
    FROM ethereum.core.ez_dex_swaps
    where platform in ('uniswap-v2','uniswap-v3')),
    rank1 as(
    SELECT
    BLOCK_TIMESTAMP as first,
    user_wallet_address
    FROM swap_users
    WHERE rank=1 and BLOCK_TIMESTAMP>=current_date-365),
    rank2 as(
    SELECT
    BLOCK_TIMESTAMP as second,
    user_wallet_address
    FROM swap_users
    WHERE rank=2 and BLOCK_TIMESTAMP>=current_date-365),
    base as(
    SELECT
    first,
    second,
    rank1.user_wallet_address
    FROM rank2 join rank1 on rank1.user_wallet_address=rank2.user_wallet_address
    )
    SELECT
    avg(datediff(second,first,second))/3600 as average_hour,
    median(datediff(second,first,second))/3600 as median_hour
    FROM base
    Run a query to Download Data