From fbbf1affa482382ac44f78b130af4a867ab61da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Fingen?= Date: Tue, 7 May 2024 14:45:40 +0100 Subject: [PATCH] chore: forge fmt --- contracts/src/CollateralRegistry.sol | 11 +-- contracts/src/HintHelpers.sol | 2 +- contracts/src/test/SortedTroves.t.sol | 2 +- .../CollateralRegistryTester.sol | 4 +- .../src/test/TestContracts/DevTestSetup.sol | 26 ++++-- contracts/src/test/redemptions.t.sol | 90 +++++++++---------- 6 files changed, 74 insertions(+), 61 deletions(-) diff --git a/contracts/src/CollateralRegistry.sol b/contracts/src/CollateralRegistry.sol index 13504e18..6dcc49aa 100644 --- a/contracts/src/CollateralRegistry.sol +++ b/contracts/src/CollateralRegistry.sol @@ -118,7 +118,9 @@ contract CollateralRegistry is LiquityBase, ICollateralRegistry { uint256 redeemedAmount; } - function redeemCollateral(uint256 _boldAmount, uint256 _maxIterationsPerCollateral, uint256 _maxFeePercentage) external { + function redeemCollateral(uint256 _boldAmount, uint256 _maxIterationsPerCollateral, uint256 _maxFeePercentage) + external + { _requireValidMaxFeePercentage(_maxFeePercentage); _requireAmountGreaterThanZero(_boldAmount); _requireBoldBalanceCoversRedemption(boldToken, msg.sender, _boldAmount); @@ -135,7 +137,8 @@ contract CollateralRegistry is LiquityBase, ICollateralRegistry { // We only compute it here, and update it at the end, // because the final redeemed amount may be less than the requested amount // Redeemers should take this into account in order to request the optimal amount to not overpay - uint256 redemptionRate = _calcRedemptionRate(_getUpdatedBaseRateFromRedemption(_boldAmount, totals.boldSupplyAtStart)); + uint256 redemptionRate = + _calcRedemptionRate(_getUpdatedBaseRateFromRedemption(_boldAmount, totals.boldSupplyAtStart)); require(redemptionRate <= _maxFeePercentage, "CR: Fee exceeded provided maximum"); // Implicit by the above and the _requireValidMaxFeePercentage checks //require(newBaseRate < DECIMAL_PRECISION, "CR: Fee would eat up all collateral"); @@ -195,9 +198,7 @@ contract CollateralRegistry is LiquityBase, ICollateralRegistry { } // Updates the `baseRate` state with math from `_getUpdatedBaseRateFromRedemption` - function _updateBaseRateAndGetRedemptionRate(uint256 _boldAmount, uint256 _totalBoldSupplyAtStart) - internal - { + function _updateBaseRateAndGetRedemptionRate(uint256 _boldAmount, uint256 _totalBoldSupplyAtStart) internal { uint256 newBaseRate = _getUpdatedBaseRateFromRedemption(_boldAmount, _totalBoldSupplyAtStart); //assert(newBaseRate <= DECIMAL_PRECISION); // This is already enforced in `_getUpdatedBaseRateFromRedemption` diff --git a/contracts/src/HintHelpers.sol b/contracts/src/HintHelpers.sol index 89540cca..97baf19a 100644 --- a/contracts/src/HintHelpers.sol +++ b/contracts/src/HintHelpers.sol @@ -69,7 +69,7 @@ contract HintHelpers is LiquityBase, Ownable, CheckContract { uint256 currentId = troveManager.getTroveFromTroveIdsArray(arrayIndex); // Skip this Trove if it's unredeeamable and not in the sorted list - if (!sortedTroves.contains(currentId)) { continue; } + if (!sortedTroves.contains(currentId)) continue; uint256 currentInterestRate = troveManager.getTroveAnnualInterestRate(currentId); diff --git a/contracts/src/test/SortedTroves.t.sol b/contracts/src/test/SortedTroves.t.sol index 7f19ef76..258545ab 100644 --- a/contracts/src/test/SortedTroves.t.sol +++ b/contracts/src/test/SortedTroves.t.sol @@ -199,7 +199,7 @@ contract MockTroveManager { function _sortedTroves_removeFromBatch(TroveId id) external { _sortedTroves.removeFromBatch(TroveId.unwrap(id)); } - + function _sortedTroves_findInsertPosition(uint256 annualInterestRate, Hints memory hints) external view diff --git a/contracts/src/test/TestContracts/CollateralRegistryTester.sol b/contracts/src/test/TestContracts/CollateralRegistryTester.sol index a69242e5..9568b7c6 100644 --- a/contracts/src/test/TestContracts/CollateralRegistryTester.sol +++ b/contracts/src/test/TestContracts/CollateralRegistryTester.sol @@ -8,7 +8,9 @@ import "../../CollateralRegistry.sol"; for testing the parent's internal functions. */ contract CollateralRegistryTester is CollateralRegistry { - constructor(IBoldToken _boldToken, IERC20[] memory _tokens, ITroveManager[] memory _troveManagers) CollateralRegistry(_boldToken, _tokens, _troveManagers) {} + constructor(IBoldToken _boldToken, IERC20[] memory _tokens, ITroveManager[] memory _troveManagers) + CollateralRegistry(_boldToken, _tokens, _troveManagers) + {} function unprotectedDecayBaseRateFromBorrowing() external returns (uint256) { baseRate = _calcDecayedBaseRate(); diff --git a/contracts/src/test/TestContracts/DevTestSetup.sol b/contracts/src/test/TestContracts/DevTestSetup.sol index c383bb8f..8178fc57 100644 --- a/contracts/src/test/TestContracts/DevTestSetup.sol +++ b/contracts/src/test/TestContracts/DevTestSetup.sol @@ -166,7 +166,10 @@ contract DevTestSetup is BaseTest { return (ATroveId, BTroveId, CTroveId, DTroveId); } - function _setupForRedemption(TroveInterestRates memory _troveInterestRates) internal returns (uint256, uint256, TroveIDs memory) { + function _setupForRedemption(TroveInterestRates memory _troveInterestRates) + internal + returns (uint256, uint256, TroveIDs memory) + { TroveIDs memory troveIDs; priceFeed.setPrice(2000e18); @@ -200,11 +203,14 @@ contract DevTestSetup is BaseTest { return _setupForRedemption(troveInterestRates); } - - function _redeemAndCreateZombieTrovesAAndB(TroveIDs memory _troveIDs) internal returns (uint256, uint256, TroveIDs memory) { + function _redeemAndCreateZombieTrovesAAndB(TroveIDs memory _troveIDs) + internal + returns (uint256, uint256, TroveIDs memory) + { // Redeem enough to leave to leave A with 0 debt and B with debt < MIN_NET_DEBT uint256 redeemFromA = troveManager.getTroveEntireDebt(_troveIDs.A) - troveManager.BOLD_GAS_COMPENSATION(); - uint256 redeemFromB = troveManager.getTroveEntireDebt(_troveIDs.B) - troveManager.BOLD_GAS_COMPENSATION() - troveManager.MIN_NET_DEBT() / 2; + uint256 redeemFromB = troveManager.getTroveEntireDebt(_troveIDs.B) - troveManager.BOLD_GAS_COMPENSATION() + - troveManager.MIN_NET_DEBT() / 2; uint256 redeemAmount = redeemFromA + redeemFromB; // Fully redeem A and leave B with debt < MIN_NET_DEBT @@ -214,17 +220,21 @@ contract DevTestSetup is BaseTest { assertEq(troveManager.getTroveEntireDebt(_troveIDs.A), BOLD_GAS_COMP); assertLt(troveManager.getTroveEntireDebt(_troveIDs.B) - BOLD_GAS_COMP, troveManager.MIN_NET_DEBT()); - // Check A and B tagged as Zombie troves + // Check A and B tagged as Zombie troves assertEq(troveManager.getTroveStatus(_troveIDs.A), 5); // status 'unredeemable' assertEq(troveManager.getTroveStatus(_troveIDs.A), 5); // status 'unredeemable' } - function _redeemAndCreateZombieTroveAAndHitB(TroveIDs memory _troveIDs) internal returns (uint256, uint256, TroveIDs memory) { + function _redeemAndCreateZombieTroveAAndHitB(TroveIDs memory _troveIDs) + internal + returns (uint256, uint256, TroveIDs memory) + { // Redeem enough to leave to leave A with 0 debt and B with debt < MIN_NET_DEBT uint256 redeemFromA = troveManager.getTroveEntireDebt(_troveIDs.A) - troveManager.BOLD_GAS_COMPENSATION(); // Leave B with net_debt > min_net_debt - uint256 redeemFromB = troveManager.getTroveEntireDebt(_troveIDs.B) - troveManager.BOLD_GAS_COMPENSATION() - troveManager.MIN_NET_DEBT() - 37; - + uint256 redeemFromB = troveManager.getTroveEntireDebt(_troveIDs.B) - troveManager.BOLD_GAS_COMPENSATION() + - troveManager.MIN_NET_DEBT() - 37; + uint256 redeemAmount = redeemFromA + redeemFromB; // Fully redeem A and leave B with debt > MIN_NET_DEBT diff --git a/contracts/src/test/redemptions.t.sol b/contracts/src/test/redemptions.t.sol index 4cd09ed8..301f85e5 100644 --- a/contracts/src/test/redemptions.t.sol +++ b/contracts/src/test/redemptions.t.sol @@ -4,7 +4,7 @@ import "./TestContracts/DevTestSetup.sol"; contract Redemptions is DevTestSetup { function testRedemptionIsInOrderOfInterestRate() public { - (uint256 coll, , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (uint256 coll,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); uint256 debt_A = troveManager.getTroveEntireDebt(troveIDs.A); uint256 debt_B = troveManager.getTroveEntireDebt(troveIDs.B); @@ -43,7 +43,7 @@ contract Redemptions is DevTestSetup { // - Troves can be redeemed down to gas comp function testFullRedemptionDoesntCloseTroves() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); uint256 debt_A = troveManager.getTroveEntireDebt(troveIDs.A); uint256 debt_B = troveManager.getTroveEntireDebt(troveIDs.B); @@ -58,7 +58,7 @@ contract Redemptions is DevTestSetup { } function testFullRedemptionLeavesTrovesWithDebtEqualToGasComp() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); uint256 debt_A = troveManager.getTroveEntireDebt(troveIDs.A); uint256 debt_B = troveManager.getTroveEntireDebt(troveIDs.B); @@ -73,7 +73,7 @@ contract Redemptions is DevTestSetup { } function testFullRedemptionSkipsTrovesAtGasCompDebt() public { - (uint256 coll, , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (uint256 coll,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); uint256 debt_A = troveManager.getTroveEntireDebt(troveIDs.A); uint256 debt_B = troveManager.getTroveEntireDebt(troveIDs.B); @@ -105,7 +105,7 @@ contract Redemptions is DevTestSetup { // - Accrued Trove interest contributes to redee into debt of a redeemed trove function testRedemptionIncludesAccruedTroveInterest() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); // Fast-forward to generate interest vm.warp(block.timestamp + 1 days); @@ -132,7 +132,7 @@ contract Redemptions is DevTestSetup { // --- Zombie Troves --- function testFullyRedeemedTroveBecomesZombieTrove() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); _redeemAndCreateZombieTrovesAAndB(troveIDs); @@ -140,7 +140,7 @@ contract Redemptions is DevTestSetup { } function testTroveRedeemedToBelowMIN_NET_DEBTBecomesZombieTrove() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); _redeemAndCreateZombieTrovesAAndB(troveIDs); @@ -148,7 +148,7 @@ contract Redemptions is DevTestSetup { } function testTroveRedeemedToAboveMIN_NET_DEBTDoesNotBecomesZombieTrove() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); _redeemAndCreateZombieTroveAAndHitB(troveIDs); @@ -156,7 +156,7 @@ contract Redemptions is DevTestSetup { } function testZombieTrovesRemovedFromSortedList() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); // Check A,B,C,D in sorted list assertTrue(sortedTroves.contains(troveIDs.A)); @@ -177,7 +177,7 @@ contract Redemptions is DevTestSetup { } function testZombieTroveCantBeRedeemedFrom() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); _redeemAndCreateZombieTrovesAAndB(troveIDs); @@ -189,23 +189,23 @@ contract Redemptions is DevTestSetup { redeem(E, redeemAmount); // Check B's debt unchanged from redeemAmount < debt_B; - assertEq(debt_B, troveManager.getTroveEntireDebt(troveIDs.B)); + assertEq(debt_B, troveManager.getTroveEntireDebt(troveIDs.B)); redeemAmount = debt_B + 1; redeem(E, redeemAmount); // Check B's debt unchanged from redeemAmount > debt_B; - assertEq(debt_B, troveManager.getTroveEntireDebt(troveIDs.B)); + assertEq(debt_B, troveManager.getTroveEntireDebt(troveIDs.B)); } function testZombieTrovesCanReceiveRedistGains() public { uint256 interestRate_E = 5e16; // 5% uint256 troveDebtRequest_E = 2250e18; - uint256 troveColl_E = 25e17; + uint256 troveColl_E = 25e17; uint256 price = 2000e18; priceFeed.setPrice(price); - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); _redeemAndCreateZombieTrovesAAndB(troveIDs); @@ -236,7 +236,7 @@ contract Redemptions is DevTestSetup { troveInterestRates.C = 3e17; // 30% troveInterestRates.D = 4e17; // 40% - ( , , TroveIDs memory troveIDs) = _setupForRedemption(troveInterestRates); + (,, TroveIDs memory troveIDs) = _setupForRedemption(troveInterestRates); _redeemAndCreateZombieTrovesAAndB(troveIDs); @@ -254,7 +254,7 @@ contract Redemptions is DevTestSetup { uint256 expectedDebt_B = debt_B * (1e18 + troveInterestRates.B) / 1e18; // 20% increase assertEq(troveManager.getTroveEntireDebt(troveIDs.A), expectedDebt_A); // 10% increase - assertEq(troveManager.getTroveEntireDebt(troveIDs.B), expectedDebt_B); // 20% increase + assertEq(troveManager.getTroveEntireDebt(troveIDs.B), expectedDebt_B); // 20% increase } function testZombieTrovesCanAccrueInterestThatBringThemAboveMIN_NET_DEBT() public { @@ -264,18 +264,18 @@ contract Redemptions is DevTestSetup { troveInterestRates.C = 3e17; // 30% troveInterestRates.D = 4e17; // 40% - ( , , TroveIDs memory troveIDs) = _setupForRedemption(troveInterestRates); + (,, TroveIDs memory troveIDs) = _setupForRedemption(troveInterestRates); _redeemAndCreateZombieTrovesAAndB(troveIDs); - assertLt(troveManager.getTroveEntireDebt(troveIDs.A), troveManager.MIN_NET_DEBT()); - assertLt(troveManager.getTroveEntireDebt(troveIDs.B), troveManager.MIN_NET_DEBT()); + assertLt(troveManager.getTroveEntireDebt(troveIDs.A), troveManager.MIN_NET_DEBT()); + assertLt(troveManager.getTroveEntireDebt(troveIDs.B), troveManager.MIN_NET_DEBT()); // 100 years passes vm.warp(block.timestamp + 36500 days); - assertGt(troveManager.getTroveEntireDebt(troveIDs.A), troveManager.MIN_NET_DEBT()); - assertGt(troveManager.getTroveEntireDebt(troveIDs.B), troveManager.MIN_NET_DEBT()); + assertGt(troveManager.getTroveEntireDebt(troveIDs.A), troveManager.MIN_NET_DEBT()); + assertGt(troveManager.getTroveEntireDebt(troveIDs.B), troveManager.MIN_NET_DEBT()); } function testZombieTrovesCanReceiveRedistGainsThatBringThemAboveMIN_NET_DEBT() public { @@ -286,7 +286,7 @@ contract Redemptions is DevTestSetup { uint256 price = 2000e18; priceFeed.setPrice(price); - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); _redeemAndCreateZombieTrovesAAndB(troveIDs); @@ -301,10 +301,10 @@ contract Redemptions is DevTestSetup { // assertFalse(troveManager.checkRecoveryMode(price)); assertLt(troveManager.getCurrentICR(troveID_E, price), troveManager.MCR()); - assertLt(troveManager.getTroveEntireDebt(troveIDs.A), troveManager.MIN_NET_DEBT()); - assertLt(troveManager.getTroveEntireDebt(troveIDs.B), troveManager.MIN_NET_DEBT()); + assertLt(troveManager.getTroveEntireDebt(troveIDs.A), troveManager.MIN_NET_DEBT()); + assertLt(troveManager.getTroveEntireDebt(troveIDs.B), troveManager.MIN_NET_DEBT()); - // A liquidates E + // A liquidates E liquidate(A, troveID_E); assertEq(troveManager.getTroveStatus(troveID_E), 3); // Status 3 - closed by liquidation @@ -312,13 +312,13 @@ contract Redemptions is DevTestSetup { assertTrue(troveManager.hasRedistributionGains(troveIDs.B)); assertGt(troveManager.getTroveEntireDebt(troveIDs.A), troveManager.MIN_NET_DEBT()); - assertGt(troveManager.getTroveEntireDebt(troveIDs.B), troveManager.MIN_NET_DEBT()); + assertGt(troveManager.getTroveEntireDebt(troveIDs.B), troveManager.MIN_NET_DEBT()); } // --- Borrower ops on zombie troves --- function testZombieBorrowerCanCloseZombieTrove() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); _redeemAndCreateZombieTrovesAAndB(troveIDs); @@ -329,15 +329,15 @@ contract Redemptions is DevTestSetup { assertEq(troveManager.getTroveStatus(troveIDs.A), 5); // Status 5 - 'unredeemable' assertEq(troveManager.getTroveStatus(troveIDs.B), 5); // Status 5 - 'unredeemable' - closeTrove(A, troveIDs.A); - closeTrove(B, troveIDs.B); + closeTrove(A, troveIDs.A); + closeTrove(B, troveIDs.B); assertEq(troveManager.getTroveStatus(troveIDs.A), 2); // Status 2 - 'closed by owner' assertEq(troveManager.getTroveStatus(troveIDs.B), 2); // Status 2 - 'closed by owner' } function testZombieBorrowerCanDrawFreshDebtToAboveMIN_NET_DEBT() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); _redeemAndCreateZombieTrovesAAndB(troveIDs); @@ -371,7 +371,7 @@ contract Redemptions is DevTestSetup { } function testZombieTroveDrawingFreshDebtToAboveMIN_NET_DEBTChangesStatusToActive() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); _redeemAndCreateZombieTrovesAAndB(troveIDs); @@ -409,7 +409,7 @@ contract Redemptions is DevTestSetup { } function testZombieTroveDrawingFreshDebtToAboveMIN_NET_DEBTInsertsItToSortedList() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); _redeemAndCreateZombieTrovesAAndB(troveIDs); @@ -451,7 +451,7 @@ contract Redemptions is DevTestSetup { } function testZombieBorrowerDrawsFreshDebtToAboveMIN_NET_DEBTReducesPendingInterestTo0() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); _redeemAndCreateZombieTrovesAAndB(troveIDs); @@ -492,7 +492,7 @@ contract Redemptions is DevTestSetup { } function testZombieTroveBorrowerCanNotDrawFreshDebtToBelowMIN_NET_DEBT() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); _redeemAndCreateZombieTrovesAAndB(troveIDs); @@ -546,7 +546,7 @@ contract Redemptions is DevTestSetup { } function testZombieTroveBorrowerCanNotUseNormalWithdrawBoldFunction() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); _redeemAndCreateZombieTrovesAAndB(troveIDs); @@ -582,7 +582,7 @@ contract Redemptions is DevTestSetup { } function testZombieTroveBorrowerCanNotAddColl() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); _redeemAndCreateZombieTrovesAAndB(troveIDs); @@ -597,12 +597,12 @@ contract Redemptions is DevTestSetup { // B attempts to repay and can't (since would leave Trove at debt < MIN_NET_DEBT) vm.startPrank(B); vm.expectRevert("BorrowerOps: Trove does not have active status"); - borrowerOperations.addColl(troveIDs.B, collTopUp); + borrowerOperations.addColl(troveIDs.B, collTopUp); vm.stopPrank(); } function testZombieTroveBorrowerCanNotChangeInterestRate() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); _redeemAndCreateZombieTrovesAAndB(troveIDs); @@ -618,10 +618,10 @@ contract Redemptions is DevTestSetup { vm.expectRevert("BorrowerOps: Trove does not have active status"); borrowerOperations.adjustTroveInterestRate(troveIDs.B, newInterestRate, troveIDs.B, troveIDs.B); vm.stopPrank(); - } + } function testZombieTroveAccruedInterestCanBePermissionlesslyApplied() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); _redeemAndCreateZombieTrovesAAndB(troveIDs); @@ -639,10 +639,10 @@ contract Redemptions is DevTestSetup { assertEq(troveManager.calcTroveAccruedInterest(troveIDs.A), 0); assertEq(troveManager.calcTroveAccruedInterest(troveIDs.B), 0); - } + } function testZombieTroveCanBeLiquidated() public { - ( , , TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); + (,, TroveIDs memory troveIDs) = _setupForRedemptionAscendingInterest(); _redeemAndCreateZombieTrovesAAndB(troveIDs); @@ -661,13 +661,13 @@ contract Redemptions is DevTestSetup { // assertFalse(troveManager.checkRecoveryMode(price)); assertLt(troveManager.getCurrentICR(troveIDs.B, price), troveManager.MCR()); - assertEq(troveManager.getTroveStatus(troveIDs.B), 5); + assertEq(troveManager.getTroveStatus(troveIDs.B), 5); // E liquidates B liquidate(E, troveIDs.B); assertEq(troveManager.getTroveStatus(troveIDs.B), 3); // Status 3 - closed by liquidation - } + } // TODO: tests borrower for combined adjustments - debt changes and coll add/withdrawals. - // Borrower should only be able to close OR leave Trove at >= min net debt. + // Borrower should only be able to close OR leave Trove at >= min net debt. }