Lone Mint Kookaburra
Medium
The getAllLoans
function in the DebitaV3Aggregator
contract always omits the latest loan in its returned array, regardless of the offset
and limit
values provided. This results in incomplete data and unreliable results when querying all loans.
- In DebitaV3Aggregator.sol:708, there is conditional error.
if ((i + offset + 1) >= loanID) {
break;
}
This condition prematurely terminates the loop when the index i + offset + 1
equals loanID
No response
No response
No response
- The latest loan data is always missing from the returned loans array, causing incomplete data retrieval for users or external systems.
- This bug affects data integrity, making the function unreliable for querying the full set of loans.
- Depending on the application logic, this may lead to financial misrepresentation or operational errors when using this function's output.
No response
Update the conditional logic to allow the loop to iterate through loanID
inclusively.
Replace:
- if ((i + offset + 1) >= loanID) {
+if ((i + offset) >= loanID) {
break;
}