saeedmzn[DYORSwap] - distribution by traded volume
    Updated 2025-04-14
    with prices as (
    select date, symbol, price_usd
    from $query('f6135fb8-7180-419a-8cf9-57cfbf3107c8')
    ),
    dyor_txns as (
    select tx_hash
    from ink.core.fact_event_logs
    where ORIGIN_TO_ADDRESS = '0x9b17690de96fcfa80a3acaefe11d936629cd7a77'
    and topic_0 = '0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822'
    ),
    token_transfers as (
    select *
    from ink.core.ez_token_transfers
    where tx_hash in (select tx_hash from dyor_txns)
    ),
    indexes as (
    select tx_hash,
    min(event_index) min_index,
    max(event_index) max_index
    from token_transfers
    group by 1
    ),
    final as (
    with swap_from as (
    select BLOCK_TIMESTAMP::date date,
    tx_hash,
    ORIGIN_FROM_ADDRESS trader,
    t.symbol token_in,
    amount amount_in,
    case when amount_usd is not null then amount_usd
    when amount_usd is null and p.symbol is not null then amount * price_usd
    else 0 end as amount_in_usd
    from ink.core.ez_token_transfers t
    left join indexes using (tx_hash)
    left join prices p on (p.symbol = t.symbol and p.date = BLOCK_TIMESTAMP::date)
    where event_index = min_index
    Last run: 12 days ago
    RANGE
    NUM_TRADERS
    1
    More than $10K58
    2
    $5 - $102261
    3
    $500 - $1K312
    4
    $50 - $1001085
    5
    $100 - $5001572
    6
    Less than $119160
    7
    $10 - $504105
    8
    $1K - $10K493
    9
    $1 - $58583
    9
    179B
    1s