ArioRing swap stats
    Updated 2024-06-14
    -- forked from Ring hourly swap stats @ https://flipsidecrypto.xyz/edit/queries/88c12d3b-ecf5-4510-993e-4917c11a5d7e
    ---------- Old Version -----------------
    /*
    with Ring_Swap_TX as (
    select
    block_timestamp,
    tx_hash
    from blast.core.fact_event_logs
    where ORIGIN_TO_ADDRESS = '0x6a7c92bddb8d695cfdff5d47487a456cc46e0ee5'
    and TX_STATUS = 'SUCCESS'
    and block_timestamp > '2024-02-29'
    --and tx_hash = '0x288fe263d25623885e2fdfdb4cca36261e86a687af088df3a1cc5af1c6b65413'
    group by 1,2
    ),
    deposit as (
    select
    block_timestamp,
    tx_hash,
    CONTRACT_ADDRESS as Token_in_address,
    ORIGIN_FROM_ADDRESS as Swapper,
    livequery.utils.udf_hex_to_int(substr(data, 3, 64))::float as raw_amount_in_precise
    from blast.core.fact_event_logs join Ring_Swap_TX using(block_timestamp, tx_hash)
    where 1=1
    and topics[0]::string = '0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'
    and TX_STATUS = 'SUCCESS'
    and raw_amount_in_precise > 0
    group by 1,2,3,4,5
    ),
    withdraw as (
    select
    block_timestamp,
    tx_hash,
    CONTRACT_ADDRESS as Token_Out_address,
    concat('0x', substr(topics[2], 27, 40))::string as Swapper_address,
    livequery.utils.udf_hex_to_int(substr(data, 3, 64)) as raw_amount_out_precise
    from blast.core.fact_event_logs join deposit using(block_timestamp, tx_hash)
    QueryRunArchived: QueryRun has been archived