protocol-subgraphs
protocol-subgraphs copied to clipboard
Negative values for borrowedReservesCount in User schema
There are occurrences of negative values for borrowedReservesCount field in the User schema.
To Reproduce
On the playground https://thegraph.com/hosted-service/subgraph/aave/protocol-v2?version=current the borrowedReservesCount can be a negative value.
{
users (where: {borrowedReservesCount_lt:0}) {
id
borrowedReservesCount
reserves {
reserve {
name
}
currentTotalDebt
currentATokenBalance
}
}
}
Expected behavior
The borrowedReservesCount should be always >=0. I assumed that a negative value meant that no reserves have been used for borrowing, however by querying
{
users (where: {borrowedReservesCount_lt:0}) {
id
borrowedReservesCount
reserves (where: {currentTotalDebt_gt:0}) {
reserve {
name
}
currentTotalDebt
currentATokenBalance
}
}
}
you can see that there are reserves with non zero debt (e.g.
{
"id": "0x0360414fa5e5846f687096c82e1434151743e886",
"borrowedReservesCount": -1,
"reserves": [
{
"reserve": {
"name": "USD Coin"
},
"currentTotalDebt": "488152768",
"currentATokenBalance": "0"
}
]
}
honestly I think this should just be removed completely :sweat_smile: it's a bit unnecessary bloat on the subgraph