Abbas_ra21Thrusta Daily Volume
    Updated 2024-05-05
    with tb AS (select
    BLOCK_TIMESTAMP,
    TX_HASH,
    ORIGIN_FROM_ADDRESS AS Trader,
    CONTRACT_ADDRESS AS Token_address,
    ethereum.public.udf_hex_to_int(data)::int/1e18 AS Amount,
    Amount*price AS Amount_USD
    from
    blast.core.fact_event_logs A
    inner join base.price.ez_hourly_token_prices B on B.TOKEN_ADDRESS='0x4200000000000000000000000000000000000006'
    and date_trunc('hour',BLOCK_TIMESTAMP)=B.HOUR
    where
    ORIGIN_TO_ADDRESS in ('0x44889b52b71e60de6ed7de82e2939fcc52fb2b4e','0x98994a9a7a2570367554589189dc9772241650f6','0x337827814155ecbf24d20231fca4444f530c0555'
    ,lower('0xD6F9A29a11326c1C59297b576D30B6169FdB9300'))
    and topics [0] = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
    and CONTRACT_ADDRESS='0x4300000000000000000000000000000000000004'
    and ORIGIN_FUNCTION_SIGNATURE in (
    '0x7ff36ab5',
    '0x18cbafe5',
    '0xfb3bdb41',
    '0x791ac947',
    '0xb6f9de95',
    '0x38ed1739',
    '0xac9650d8',
    '0x49bd339b',
    '0x8f1fda56'
    ) and TX_STATUS='SUCCESS')
    SELECT
    date_trunc('hour',BLOCK_TIMESTAMP) AS Hour,
    sum(Amount_USD) AS Volume,
    avg(Amount_USD) AS "Avg Swap Size",
    sum(Volume) over (order by Hour) AS "Total Volume"
    from tb group by 1
    QueryRunArchived: QueryRun has been archived