Afonso_DiazGrouping transactions
    Updated 2025-01-24
    with

    stablecoins as (
    select 'ibc/CA6FBFAF399474A06263E10D0CE5AEBBE15189D6D4B2DD9ADE61007E68EB9DB0' as token_address

    union all

    select 'sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l' as token_address

    union all

    select 'ibc/F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349' as token_address

    union all

    select 'ibc/F4D1E5464C064539D68DE94118951D79053BADE84674EF4FB95428BAB1C31FDB' as token_address

    union all

    select 'ibc/6C00E4AA0CC7618370F81F7378638AE6C48EFF8C9203CE1C2357012B440EBDB7' as token_address
    ),

    main as (
    select
    tx_id,
    block_timestamp,
    swapper,
    platform,
    symbol_in,
    symbol_out,
    case
    when amount_in_usd is not null then amount_in_usd
    when amount_out_usd is not null then amount_out_usd
    when token_in in (select token_address from stablecoins) then amount_in
    when token_out in (select token_address from stablecoins) then amount_out
    end as amount_usd
    QueryRunArchived: QueryRun has been archived