Updated 8 days ago
    WITH swap_events AS (
    SELECT
    tx_hash,
    origin_to_address AS pool_address,
    block_timestamp,
    DATE_TRUNC('day', block_timestamp) AS swap_day,
    origin_from_address AS trader_address
    FROM
    ink.core.ez_decoded_event_logs
    WHERE
    event_name = 'Swap'
    AND origin_to_address = '0xa8c1c38ff57428e5c3a34e0899be5cb385476507'
    AND block_timestamp IS NOT NULL
    AND tx_succeeded = TRUE
    ),

    token_transfers AS (
    SELECT
    tx_hash,
    contract_address,
    symbol,
    amount_usd
    FROM
    ink.core.ez_token_transfers
    ),

    amounts_with_weth AS (
    SELECT
    t1.tx_hash,
    t1.contract_address,
    t1.symbol,
    t1.amount_usd,
    MAX(CASE WHEN LOWER(t2.symbol) = 'weth' THEN t2.amount_usd END)
    OVER (PARTITION BY t1.tx_hash) AS weth_amount_usd,
    ROW_NUMBER() OVER (PARTITION BY t1.tx_hash ORDER BY LOWER(t1.symbol) ASC) AS row_num
    FROM
    Last run: 8 days ago
    total trades
    total volume traded
    avg trade volume
    avg daily trade volume usd
    LATEST_SWAP_TIMESTAMP
    avg trade volume per trader
    max trade volume by a trader
    1
    3961295667270.2714.03241208845703.79252025-04-28 03:25:57.00079.73760123310014.2
    1
    92B
    5s