Skip to content

Commit

Permalink
fix: Remove unnecessary check in setInterestIndividualDelegate
Browse files Browse the repository at this point in the history
  • Loading branch information
bingen committed Sep 4, 2024
1 parent 7bafe74 commit ef2c751
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions contracts/src/BorrowerOperations.sol
Original file line number Diff line number Diff line change
Expand Up @@ -824,8 +824,7 @@ contract BorrowerOperations is LiquityBase, AddRemoveManagers, IBorrowerOperatio
InterestIndividualDelegate(_delegate, _minInterestRate, _maxInterestRate);
// Can’t have both individual delegation and batch manager
if (interestBatchManagerOf[_troveId] != address(0)) {
_requireInterestRateInRange(_newAnnualInterestRate, _minInterestRate, _maxInterestRate);
// Not needed, implicitly checked in the condition above and in removeFromBatch
// Not needed, implicitly checked in removeFromBatch
//_requireValidAnnualInterestRate(_newAnnualInterestRate);
removeFromBatch(_troveId, _newAnnualInterestRate, _upperHint, _lowerHint, _maxUpfrontFee);
}
Expand Down
8 changes: 4 additions & 4 deletions contracts/src/test/interestIndividualDelegation.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ contract InterestIndividualDelegationTest is DevTestSetup {
vm.stopPrank();

// Try to switch to individual delegate (C) along with new interest
uint256 newAnnualInterestRate = 1e15;
uint256 newAnnualInterestRate = 1e14;
vm.startPrank(A);
vm.expectRevert(BorrowerOperations.InterestNotInRange.selector);
vm.expectRevert(BorrowerOperations.InterestRateTooLow.selector);
borrowerOperations.setInterestIndividualDelegate(troveId, C, 1e16, 20e16, newAnnualInterestRate, 0, 0, 10000e18);
vm.stopPrank();
}
Expand All @@ -229,9 +229,9 @@ contract InterestIndividualDelegationTest is DevTestSetup {
vm.stopPrank();

// Try to switch to individual delegate (C) along with new interest
uint256 newAnnualInterestRate = 21e16;
uint256 newAnnualInterestRate = 101e16;
vm.startPrank(A);
vm.expectRevert(BorrowerOperations.InterestNotInRange.selector);
vm.expectRevert(BorrowerOperations.InterestRateTooHigh.selector);
borrowerOperations.setInterestIndividualDelegate(troveId, C, 1e16, 20e16, newAnnualInterestRate, 0, 0, 10000e18);
vm.stopPrank();
}
Expand Down

0 comments on commit ef2c751

Please sign in to comment.