Afonso_DiazGrouping txns
    Updated 2025-05-18
    with

    swaps 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
    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')
    ),

    main as (
    select
    *,
    nvl(amount_in_usd, amount_out_usd) as amount_usd,
    iff(token_in = '0xf988f63bf26c3ed3fbf39922149e3e7b1e5c27cb', amount_in, amount_out) as amount,
    iff(token_in = '0xf988f63bf26c3ed3fbf39922149e3e7b1e5c27cb', 'Sell', 'Buy') as type
    Last run: 26 days ago
    TYPE
    TX_TYPE
    TRANSACTIONS
    1
    Buy$1,000 - $5,000526
    2
    Buy$10 - $5019649
    3
    Buy$10,000 - $100,0004
    4
    Buy$100 - $50014191
    5
    Buy$5,000 - $10,00016
    6
    Buy$50 - $10011513
    7
    Buy$500 - $1,0001686
    8
    BuyLess than $1017310
    9
    BuyMore than $100,0001594
    10
    Sell$1,000 - $5,000165
    11
    Sell$10 - $502693
    12
    Sell$10,000 - $100,0002
    13
    Sell$100 - $5002383
    14
    Sell$5,000 - $10,0008
    15
    Sell$50 - $1001392
    16
    Sell$500 - $1,000404
    17
    SellLess than $102169
    18
    SellMore than $100,0001045
    18
    534B
    14s