arbitrum_internArbitrum Lending Total Breakdown
    Updated 2024-12-24


    select
    -- month,
    event,
    sum(occurrences) as occurrences,
    sum(vol) as vol
    -- sum(vol) over (partition by event order by month) as total_vol

    from (

    SELECT
    date_trunc('month', block_timestamp) as month,
    platform,
    'borrow' as event,
    'loan' as asset_type,
    count(distinct borrower) as wallets,
    sum(amount) as token,
    sum(amount_usd) as vol,
    count(*) as occurrences
    from arbitrum.defi.ez_lending_borrows
    where block_timestamp >= '2024-01-01'
    -- and event_name = 'Borrow'
    group by 1,2,3,4

    union all

    SELECT
    date_trunc('month', block_timestamp) as month,
    platform,
    'deposit' as event,
    'collateral' as asset_type,
    count(distinct depositor) as wallets,
    sum(amount) as token,
    sum(amount_usd) as vol,
    count(*) as occurrences
    QueryRunArchived: QueryRun has been archived