What would be the best way to get all the addresses with a position on a particular reserve?

Expert

What would be the best way to get all the addresses with a position on a particular reserve? Is there a query I can perform on the subgraph to retrieve so?

Answers 1

You can use this subgraph query:

{
userReserves(where: {reserve: "lowercase_asset_address"}){
  user{
    id
  }
  reserve {
    liquidityIndex
    variableBorrowIndex
  }
  scaledATokenBalance
  scaledVariableDebt
    principalStableDebt
  stableBorrowRate
}
}

More info.