permarycombative-bronze
    Updated 2024-10-08
    with aave_users as (
    select
    'aave' as protocol,
    depositor_address as wallet_address
    from ethereum.aave.ez_deposits
    where block_timestamp >= current_date - interval '3 months'
    ),

    compound_users as (
    select
    'compound' as protocol,
    supplier as wallet_address
    from ethereum.compound.ez_deposits
    where block_timestamp >= current_date - interval '3 months'
    ),

    silo_users as (
    select
    'silo' as protocol,
    depositor as wallet_address
    from ethereum.defi.ez_lending_deposits
    where block_timestamp >= current_date - interval '3 months'
    )

    select
    'aave' as protocol,
    count(wallet_address) as unique_user_count,
    (select(count(distinct wallet_address)from (
    SELECT wallet_address FROM aave_users
    UNION
    SELECT wallet_address FROM compound_users
    UNION
    SELECT wallet_address FROM silo_users
    )) AS total_unique_users
    from aave_users
    union all
    QueryRunArchived: QueryRun has been archived