Is there an efficient way to get all loans on Aave protocol?

Expert

Is there an efficient way to get all loans on Aave? Only way I can think of is to get all the tokenholders of each individual debt token, which involves either using Etherscans API or listening for transfer events every block on like 74 token addresses.

Answers 1

Yes, you can do this with the protocol subgraphs by querying for all UserReserve entities where currentTotalDebt > 0;