oooooblahaddress balances 1
    Updated 2023-02-26
    with
    latest_timestamp as (
    select
    max(block_timestamp) as max_timestamp,
    contract_address
    from
    ethereum.core.fact_token_balances as latest_activity
    inner join (
    select distinct
    nft_address
    from
    ethereum.core.ez_nft_sales
    ) distinct_nft on distinct_nft.nft_address = latest_activity.contract_address
    where
    user_address = lower('{{user_address}}')
    group by
    contract_address
    )
    select
    *
    from
    latest_timestamp
    inner join (
    select
    balance,
    contract_address,
    block_timestamp
    from
    ethereum.core.fact_token_balances
    ) balances on latest_timestamp.max_timestamp = balances.block_timestamp
    and latest_timestamp.contract_address = balances.contract_address

    where balance > 0
    order by
    balance DESC
    limit
    Run a query to Download Data