Pine Analyticsmiddle-olive
    Updated 2024-10-15
    with tab1 as (
    SELECT
    DISTINCT tx_hash
    FROM ethereum.defi.ez_dex_swaps
    where (platform LIKE '%uniswap%'
    or platform LIKE '%Uniswap%')
    and block_timestamp > '2022-01-01'
    )

    SELECT
    date_trunc('week', block_timestamp) as week,
    sum(
    case when tx_hash in (SELECT * from tab1)
    then TX_FEE_PRECISE
    else 0 end
    ) as uniswap_fees,
    sum(
    case when not tx_hash in (SELECT * from tab1)
    then TX_FEE_PRECISE
    else 0 end
    ) as other_fees,
    (uniswap_fees/(uniswap_fees + other_fees)) * 100 as uniswap_fee_percent

    FROM ethereum.core.fact_transactions
    WHERE block_timestamp > '2022-01-01'
    GROUP by 1






    QueryRunArchived: QueryRun has been archived