Skip to content

Commit

Permalink
fix: Enhance reserves listing function in Pool
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmtzinf committed Jan 3, 2022
1 parent 4bc7a01 commit 2303871
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions contracts/protocol/pool/Pool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -565,14 +565,11 @@ contract Pool is VersionedInitializable, IPool, PoolStorage {
}
}

if (droppedReservesCount == 0) return reserves;

address[] memory undroppedReserves = new address[](reserveListCount - droppedReservesCount);
for (uint256 i = 0; i < reserveListCount - droppedReservesCount; i++) {
undroppedReserves[i] = reserves[i];
// Reduces the length of the reserves array by `droppedReservesCount`
assembly {
mstore(reserves, sub(reserveListCount, droppedReservesCount))
}

return undroppedReserves;
return reserves;
}

/// @inheritdoc IPool
Expand Down

0 comments on commit 2303871

Please sign in to comment.