ArioRing add/remove liquidity Volume
    Updated 2024-05-05
    -- forked from Ring add/remove liquidity @ https://flipsidecrypto.xyz/edit/queries/82bb0935-549d-460f-9d24-411e18fdd026
    with Ring_liq_TX as (
    select
    block_timestamp,
    tx_hash
    from blast.core.fact_event_logs
    where ORIGIN_TO_ADDRESS = '0x7001f706acb6440d17cbfad63fa50a22d51696ff'
    and TX_STATUS = 'SUCCESS'
    and block_timestamp > '2024-02-29'
    --and tx_hash = '0xa0d4b909366c5f6a46cb36ca5de4a88d4a9d85fa147c53d416dc09fdbc5b6123'
    group by 1,2
    ),
    Add_Liquidity as (
    select
    'Add Liquidity' as Status,
    block_timestamp,
    tx_hash,
    CONTRACT_ADDRESS as Token_address,
    ORIGIN_FROM_ADDRESS as LP,
    livequery.utils.udf_hex_to_int(substr(data, 3, 64))::float/pow(10,18) as Amount
    from blast.core.fact_event_logs join Ring_liq_TX using(block_timestamp, tx_hash)
    where 1=1
    and topics[0]::string = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' -- Transfer
    and TX_STATUS = 'SUCCESS'
    and Amount > 0
    and concat('0x', substr(topics[2], 27, 40))::string = '0x7001f706acb6440d17cbfad63fa50a22d51696ff'
    and concat('0x', substr(topics[1], 27, 40))::string = ORIGIN_FROM_ADDRESS
    and TOKEN_ADDRESS in ('0x4300000000000000000000000000000000000004',
    '0x4300000000000000000000000000000000000003')
    group by 1,2,3,4,5,6
    ),
    Add_liquidity_ETH as (
    select
    'Add Liquidity' as Status,
    block_timestamp,
    tx_hash,
    QueryRunArchived: QueryRun has been archived