Skip to content

Commit

Permalink
fix: issue-119
Browse files Browse the repository at this point in the history
  • Loading branch information
fann95 committed Nov 3, 2023
1 parent 7a61667 commit 4d355d8
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions contracts/LiquidityBorrowingManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,6 @@ contract LiquidityBorrowingManager is
borrowing.borrowedAmount
);
(removedAmt == 0).revertError(ErrLib.ErrorCode.LIQUIDITY_IS_ZERO);
// prevent overspent
// Subtract the removed amount and fees from borrowedAmount and feesOwed
borrowing.borrowedAmount -= removedAmt;
borrowing.feesOwed -= feesAmt;
Expand All @@ -723,18 +722,11 @@ contract LiquidityBorrowingManager is
_removeKeysAndClearStorage(borrowing.borrower, params.borrowingKey, empty);
feesAmt += liquidationBonus;
} else {
// make changes to the storage
BorrowingInfo storage borrowingStorage = borrowingsInfo[params.borrowingKey];
borrowingStorage.dailyRateCollateralBalance = 0;
borrowingStorage.feesOwed = borrowing.feesOwed;
borrowingStorage.borrowedAmount = borrowing.borrowedAmount;
// Calculate the updated accLoanRatePerSeconds
borrowingStorage.accLoanRatePerSeconds =
holdTokenRateInfo.accLoanRatePerSeconds -
FullMath.mulDiv(
uint256(-collateralBalance),
Constants.BP,
borrowing.borrowedAmount // new amount
);
}
// Transfer removedAmt + feesAmt to msg.sender and emit EmergencyLoanClosure event
Vault(VAULT_ADDRESS).transferToken(
Expand Down

0 comments on commit 4d355d8

Please sign in to comment.