adriaparcerisasTrado swaps by asset
    Updated 3 days ago
    -- forked from Trado swaps @ https://flipsidecrypto.xyz/studio/queries/eb696c0e-a44f-4591-801f-100bcdcd6dd8

    -- unrwap wflow to flow 0x9db24dee5d3d7cca9ebbbf738ec78722c24f49bb16de4f23f45906b61efab267
    -- wrap flow to wflow 0x6f81ff66eaaea5214b89c7c22ca37a1b0a2010f22438fd9419968d768d9f371d

    with
    swaps as (
    select x.tx_hash, x.origin_from_address, x.contract_address, y.tx_fee, x.block_timestamp
    from flow.core_evm.fact_event_logs x
    join flow.core_evm.fact_transactions y
    on x.tx_hash=y.tx_hash
    where (y.to_address='0x3EF68D3f7664b2805D4E88381b64868a56f88bC4' or x.origin_function_signature='0xac9650d8')
    and x.TX_SUCCEEDED='TRUE'
    and x.contract_address in ('0x1b97100ea1d7126c4d60027e231ea4cb25314bdb','0x7f27352d5f83db87a5a3e00f4b07cc2138d8ee52','0xd3bf53dac106a0290b0483ecbc89d40fcc961f3e','0x5598c0652b899eb40f169dd5949bdbe0bf36ffde')
    ),
    news as (
    select distinct origin_from_address as swapper, contract_address, min(trunc(block_timestamp,'day')) as debut
    from swaps group by 1,2
    )
    select
    trunc(block_timestamp,'day') as date,
    case when x.contract_address='0x1b97100ea1d7126c4d60027e231ea4cb25314bdb' then 'ankrFLOWEVM'
    when x.contract_address='0x7f27352d5f83db87a5a3e00f4b07cc2138d8ee52' then 'USDC.e'
    when x.contract_address='0x5598c0652b899eb40f169dd5949bdbe0bf36ffde' then 'stFlow'
    else 'wFLOW'
    end as asset,
    count(distinct origin_from_address) as active_swappers,
    count(distinct swapper) as new_swappers,
    sum(new_swappers) over (partition by asset order by date) as total_swappers,
    count(DISTINCT tx_hash) as swaps,
    sum(swaps) over (partition by asset order by date) as total_swaps,
    sum(tx_fee) as flow_fees,
    avg(tx_fee) as avg_tx_flow_fee
    from swaps x left join news y on trunc(block_timestamp,'day')=debut and x.contract_address=y.contract_address
    group by 1,2 order by 1 desc

    Last run: 3 days ago
    DATE
    ASSET
    ACTIVE_SWAPPERS
    NEW_SWAPPERS
    TOTAL_SWAPPERS
    SWAPS
    TOTAL_SWAPS
    FLOW_FEES
    AVG_TX_FLOW_FEE
    1
    2025-05-05 00:00:00.000wFLOW2027136511241.4426216e-112.003641111e-13
    2
    2025-05-05 00:00:00.000USDC.e2015736485257.213108e-122.003641111e-13
    3
    2025-05-04 00:00:00.000wFLOW3027150510881.9466428e-111.9466428e-13
    4
    2025-05-04 00:00:00.000USDC.e2015749484899.537103e-121.946347551e-13
    5
    2025-05-04 00:00:00.000ankrFLOWEVM10142120433.92222e-131.96111e-13
    6
    2025-05-03 00:00:00.000USDC.e3015783484401.581239e-111.905107229e-13
    7
    2025-05-03 00:00:00.000stFlow106915466.26576e-133.13288e-13
    8
    2025-05-03 00:00:00.000wFLOW4027184510383.2251356e-111.919723571e-13
    9
    2025-05-02 00:00:00.000stFlow216935455.987540289e-81.197508058e-8
    10
    2025-05-02 00:00:00.000USDC.e4015749483571.405351169e-72.755590528e-9
    11
    2025-05-02 00:00:00.000wFLOW6027154509542.004212621e-71.855752427e-9
    12
    2025-05-02 00:00:00.000ankrFLOWEVM10142220421.05693e-122.642325e-13
    13
    2025-05-01 00:00:00.000wFLOW4127148509001.9200164e-112.000017083e-13
    14
    2025-05-01 00:00:00.000ankrFLOWEVM21142520402.22068e-122.22068e-13
    15
    2025-05-01 00:00:00.000USDC.e2015743483088.489742e-121.974358605e-13
    16
    2025-04-30 00:00:00.000wFLOW80270113508520.00016909364827.482019831e-7
    17
    2025-04-30 00:00:00.000ankrFLOWEVM501412320350.000169093610.000003675948044
    18
    2025-04-30 00:00:00.000USDC.e5015789482652.0794519e-112.188896737e-13
    19
    2025-04-29 00:00:00.000ankrFLOWEVM41141620120.00017074320160.00001422860013
    20
    2025-04-29 00:00:00.000USDC.e4015786481760.000037258617114.282599668e-7
    ...
    708
    52KB
    14s