Addresses with Highest Balances of USDC

I’ve built an R package that provides analytics on the USDC token on multiple blockchains: https://github.com/galen211/usdc

I’m a bit new to graphql and have been trying to figure out how to query the addresses with the highest balance of USDC on Ethereum. I’ve played around for about an hour and haven’t been able to figure out how to get addresses with balances of a given token. The best I’ve been able to do is to get the addresses with the highest count of contract calls. Is there a way to adapt this query for balances?

query ($network: EthereumNetwork!, $address: String!, $limit: Int!, $offset: Int!, $from: ISO8601DateTime, $till: ISO8601DateTime) {
  ethereum(network: $network) {
    smartContractCalls(options: {desc: "count", limit: $limit, offset: $offset}, date: {since: $from, till: $till}, smartContractAddress: {is: $address}) {
      address: caller {
        address
        annotation
        __typename
      }
      max_date: maximum(of: date)
      count
      gasValue(calculate: average)
      __typename
    }
    __typename
  }
}

Getting the top balance holder is not possible for now.

However, you can get top transfers

following is the query for USDT

{
  ethereum {
    transfers(
      options: {desc: "amount", limit: 10, offset: 0}
      date: {since: null, till: null}
      amount: {gt: 1000000}
      currency: {is: "0xdac17f958d2ee523a2206206994597c13d831ec7"}
    ) {
      block {
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
        height
      }
      sender {
        address
        annotation
      }
      receiver {
        address
        annotation
      }
      transaction {
        hash
      }
      amount
      currency {
        symbol
      }
      external
    }
  }
}

Thanks - I will build the transactions query into my package. I think the top balances would be a killer feature. For my project, people want to know about the concentration characteristics of different stablecoins on different networks. On Ethereum a lot of the top stablecoin balances are in DeFi protocols whose addresses are tagged, so knowing how much stablecoin deposits are held by different protocols is highly valuable.

If you want for Ethereum

Then check bloxy.info

Log in there and check APIs

Thanks this is cool - I prob can’t use any service that doesn’t have a free tier though because of the intended audience that my package is distributed to.