Skip to content

Commit

Permalink
fix: #37
Browse files Browse the repository at this point in the history
  • Loading branch information
xenide committed Dec 31, 2024
1 parent 98d1648 commit df975da
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/asset-management/EulerV2Manager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,10 @@ contract EulerV2Manager is IAssetManager, Owned(msg.sender), RGT {
}

function _calculateChangeAmount(uint256 aReserve, uint256 aManaged) internal view returns (int256 rAmountChange) {
if (aManaged * Constants.WAD < aReserve * lowerThreshold) {
if (
aManaged * Constants.WAD < aReserve * lowerThreshold || aManaged * Constants.WAD > aReserve * upperThreshold
) {
rAmountChange = (aReserve.mulWad(uint256(lowerThreshold).avg(upperThreshold)) - aManaged).toInt256();
assert(rAmountChange > 0);
} else if (aManaged * Constants.WAD > aReserve * upperThreshold) {
rAmountChange =
aReserve.mulWad(uint256(lowerThreshold).avg(upperThreshold)).toInt256() - aManaged.toInt256();
assert(rAmountChange < 0);
}
}

Expand Down

0 comments on commit df975da

Please sign in to comment.