Distinguishing the repaid from liquidated loans using the the available raw data

Hello Aave community members!

Looking at the on-chain data, I am having troubles finding a good identifier of the loans that got liquidated for any reason. I am able to correctly identify loans that got repaid on time by the borrowers, but struggling to flag those where the collateral decreased in value or the borrowed debt increased in value.

I am assuming that something in the on-chain data (for example, a specific value in one of the transaction pieces of data) would clearly identify such loans, so asking if anyone has done it and can help me out.

Thank you in advance!

You can distinguish what type of action is being performing by the events that are emitted. When a liquidation occurs, the transaction will emit a LiquidationCall event.

The Aave protocol subgraphs index these events and provide an endpoint to query transaction data.

1 Like

Thank you so much for the answer. I have a dataset containing AAVE transactions, but I guess I am missing some transactions, because the 4 types of events I have a re deposit/borrow/repay/withdraw. All of those events are initiated from the users interacting with AAVE - the ‘from’ address is the user in all 4 types of events and the ‘to’ address is always AAVE’s address.

I will look into that to confirm my understanding and extract the missing events.

Thank you for your help!