Updated 2025-05-19
    with

    main as (
    select
    tx_hash,
    block_timestamp,
    origin_from_address as swapper,
    a.contract_address as token_in,
    b.contract_address as token_out,
    a.amount as amount_in,
    b.amount as amount_out,
    a.amount_usd as amount_in_usd,
    b.amount_usd as amount_out_usd,
    a.symbol as symbol_in,
    b.symbol as symbol_out,
    nvl(amount_in_usd, amount_out_usd) as amount_usd
    from
    ronin.core.ez_token_transfers a
    join
    ronin.core.ez_token_transfers b using (tx_hash, block_timestamp)
    where
    a.contract_address != b.contract_address
    and b.to_address = origin_from_address
    and a.to_address != '0x22cefc91e9b7c0f3890ebf9527ea89053490694e'
    and b.to_address != '0x22cefc91e9b7c0f3890ebf9527ea89053490694e'
    and a.from_address != '0x0000000000000000000000000000000000000000'
    and b.from_address != '0x0000000000000000000000000000000000000000'
    and tx_hash not in (select distinct tx_hash from ronin.core.fact_transactions where input_data = '0x')
    )

    select
    count(distinct tx_hash) as swaps,
    count(distinct swapper) as swappers,
    sum(amount_usd) as volume_usd,
    avg(amount_usd) as average_amount_usd,
    swaps / count(distinct block_timestamp::date) as daily_average_swaps,
    Last run: 11 days ago
    SWAPS
    SWAPPERS
    VOLUME_USD
    AVERAGE_AMOUNT_USD
    DAILY_AVERAGE_SWAPS
    DAILY_AVERAGE_SWAPPERS
    1
    29134241624002517641304.78239.33899039512612.225108703.030303
    1
    70B
    23s