Skip to content

Commit

Permalink
fix: batch managers shifted by one in MultiTroveGetter
Browse files Browse the repository at this point in the history
  • Loading branch information
danielattilasimon committed Aug 29, 2024
1 parent 45f8dc4 commit 79aa4f6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions contracts/src/MultiTroveGetter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,18 @@ contract MultiTroveGetter is IMultiTroveGetter {
assert(address(sortedTroves) != address(0));

data = new DebtPerInterestRate[](_maxIterations);
currId = _startId;
currId = sortedTroves.getPrev(_startId);

for (uint256 i = 0; i < _maxIterations; ++i) {
BatchId interestBatchManager;

(, currId, interestBatchManager,) = sortedTroves.nodes(currId);
if (currId == 0) break;

(, uint256 prevId, BatchId interestBatchManager,) = sortedTroves.nodes(currId);
LatestTroveData memory trove = troveManager.getLatestTroveData(currId);
data[i].interestBatchManager = BatchId.unwrap(interestBatchManager);
data[i].interestRate = trove.annualInterestRate;
data[i].debt = trove.entireDebt;

currId = prevId;
}
}
}

0 comments on commit 79aa4f6

Please sign in to comment.