This repository has been archived by the owner on May 26, 2023. It is now read-only.
0x52 - User is unable to partially payback loan if they aren't able to post enough isoUSD to bring them back to minOpeningMargin #161
Labels
0x52
high
User is unable to partially payback loan if they aren't able to post enough isoUSD to bring them back to minOpeningMargin
Summary
The only way for a user to reduce their debt is to call closeLoan. If the amount repaid does not bring the user back above minOpeningMargin then the transaction will revert. This is problematic for users that wish to repay their debt but don't have enough to get back to minOpeningMargin as it could lead to unfair liquidations.
Vulnerability Detail
The checks above are done when a user calls closeLoan. This ensures that the user's margin is back above minOpeningMargin before allowing them to remove any collateral. This is done as a safeguard to block loans users from effectively opening loans at lower than desired margin. This has the unintended consequence that as user cannot pay off any of their loan if they do not increase their loan back above minOpeningMargin. This could prevent users from being able to save a loan that is close to liquidation causing them to get liquidated when they otherwise would have paid off their loan.
Impact
User is unable to make partial repayments if their payment does not increase margin enough
Code Snippet
https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Isomorph/contracts/Vault_Synths.sol#L197-L248
Tool used
Manual Review
Recommendation
I recommend adding a separate function that allows users to pay off their loan without removing any collateral:
The text was updated successfully, but these errors were encountered: