SalehTotal
    Updated 2025-01-27
    with lst_deposit as (
    select
    block_timestamp::date as date
    ,tx_hash
    ,DEPOSITOR
    ,TOKEN_SYMBOL
    ,AMOUNT_USD
    from avalanche.defi.ez_lending_deposits
    where year(block_timestamp) = '2024'
    and PLATFORM='Benqi'
    )
    ,lst_withdraw as (
    select
    block_timestamp::date as date
    ,tx_hash
    ,DEPOSITOR
    ,TOKEN_SYMBOL
    ,-1*AMOUNT_USD
    from avalanche.defi.ez_lending_withdraws
    where year(block_timestamp) = '2024'
    and PLATFORM='Benqi'
    )
    ,lst_all as (
    select 'Deposit' as type, * from lst_deposit
    union all
    select 'Withdraw' as type, * from lst_withdraw
    )
    select
    count(DISTINCT tx_hash) as "Lending transactions"
    ,count(DISTINCT DEPOSITOR) as Depositors
    ,count(DISTINCT TOKEN_SYMBOL) as "Pools"
    ,sum(AMOUNT_USD) as "Net Lending Volume-USD"
    ,max(AMOUNT_USD) as "MAX.Lending Volume-USD"
    ,avg(AMOUNT_USD) as "AVG.Lending Volume-USD"
    from lst_all
    Last run: 2 months ago
    Lending transactions
    DEPOSITORS
    Pools
    Net Lending Volume-USD
    MAX.Lending Volume-USD
    AVG.Lending Volume-USD
    1
    1968122682514128043090.7815391488.21611.33594391
    1
    57B
    2s