Sbhn_NP1inch vs matcha
    Updated 2023-03-04
    with inch as (
    SELECT tx_hash
    FROM ethereum.core.fact_event_logs
    WHERE contract_address in (lower('0x1111111254EEB25477B68fb85Ed929f73A960582'),--1inch v5: Aggregation Router
    lower('0x11111112542D85B3EF69AE05771c2dCCff4fAa26'), --1inch v3: Aggregation Router
    lower('0x1111111254fb6c44bAC0beD2854e76F90643097d'),--1inch v4: Aggregation Router
    lower('0x111111125434b319222CdBf8C261674aDB56F3ae')) --1inch v2: Aggregation Router
    ),

    matcha as (
    SELECT tx_hash
    FROM ethereum.core.fact_event_logs
    WHERE contract_address in (lower('0xDef1C0ded9bec7F1a1670819833240f027b25EfF'))
    )

    SELECT
    '1Inch' as type,
    date_trunc('day', block_timestamp) as date,
    sum(AMOUNT_IN_USD) as volume_usd,
    count(DISTINCT tx_hash) as swaps,
    count(DISTINCT origin_from_address) as users
    FROM ethereum.core.ez_dex_swaps
    WHERE tx_hash in (select tx_hash from inch)
    and date>= CURRENT_DATE -180
    GROUP BY 1 ,2
    having volume_usd < 1e9

    UNION ALL

    SELECT
    'Matcha' as type,
    date_trunc('day', block_timestamp) as date,
    sum(AMOUNT_IN_USD) as volume_usd,
    count(DISTINCT tx_hash) as swaps,
    count(DISTINCT origin_from_address) as users
    FROM ethereum.core.ez_dex_swaps
    Run a query to Download Data