Abbas_ra21Daily 3
    Updated 2025-02-03
    -- forked from Daily 3 @ https://flipsidecrypto.xyz/edit/queries/bf03de4d-bc4b-4f11-a65b-e8f83f8c1cb5

    select
    date_trunc('Week',block_timestamp) AS Week,
    TOKEN_SYMBOL AS Token,
    sum(
    case
    when Amount_USD is not null then Amount_USD
    else Amount * Price
    end
    ) AS Volume
    from
    base.defi.ez_lending_deposits A
    inner join base.price.ez_prices_hourly B on B.TOKEN_ADDRESS = A.TOKEN_ADDRESS
    and HOUR = date_trunc('hour', BLOCK_TIMESTAMP)
    where
    Platform = 'Moonwell'
    group by
    1,2