zackmendelTotal Uniswap Interface Fees
    Updated 2024-10-24
    -- 2023-10-17 for first fee 0.15% --https://blockworks.co/news/uniswap-fee-structure-traders
    -- Assets subject to the fee include “[ether] ETH, USDC, WETH, USDT, DAI, WBTC, agEUR, GUSD, LUSD, EUROC, XSGD,” and both the input and output tokens must be among those subject for the fee to be collected.

    -- 2024-04-10 for Second fee 0.25% --https://coinengineer.io/uniswap-fees-increase-to-0-25-for-most-swaps-on-mainnet-and-layer-2/
    -- Tokens pairs with interface fees

    -- Tokens are subject to fees only when traded through Uniswap Labs interfaces on mainnet and supported L2s.
    -- Swaps from one stablecoin to another stablecoin are excluded from this fee if they are tied to the same underlying asset (for example, USDT to USDC).
    -- Wraps between ETH and WETH are excluded from this fee.
    -- Sum of volume of tokens is not null
    WITH stables AS (
    SELECT
    DISTINCT symbol_in AS stables,
    sum (amount_in_usd) AS usd_volume
    FROM ethereum.defi.ez_dex_swaps
    WHERE platform LIKE 'uniswap%'
    AND symbol_in LIKE '%USD%' OR symbol_in IN ('USDC', 'USDT', 'DAI', 'TUSD', 'HUSD', 'GUSD', 'EURS', 'EUROC', 'sUSD', 'FRAX', 'FEI', 'alUSD', 'RSV', 'PAX', 'UST', 'mUSD', 'LUSD', 'ESD', 'AMPL', 'agEUR')
    GROUP BY 1
    HAVING sum (amount_in_usd) IS NOT NULL
    ),

    filter_1 AS (
    SELECT
    'Ethereum' AS chain,
    'L1' AS chain_type,
    CASE
    WHEN symbol_in IN ('ETH', 'USDC', 'WETH', 'USDT', 'DAI', 'WBTC', 'agEUR', 'GUSD', 'LUSD', 'EUROC', 'XSGD')
    AND symbol_out IN ('ETH', 'USDC', 'WETH', 'USDT', 'DAI', 'WBTC', 'agEUR', 'GUSD', 'LUSD', 'EUROC', 'XSGD') THEN 'Needed_pair'
    ELSE 'No_fees'
    END AS filter,
    CONCAT (symbol_in, '-', symbol_out) AS token_pair,

    amount_in_usd AS volume,
    tx_hash,
    block_timestamp
    FROM ethereum.defi.ez_dex_swaps
    QueryRunArchived: QueryRun has been archived