Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow borrowing if it brings TCR back up to CCR #527

Merged
merged 3 commits into from
Oct 21, 2024

Conversation

bingen
Copy link
Collaborator

@bingen bingen commented Oct 20, 2024

Fixes #511

@bingen bingen added the Recon label Oct 20, 2024
@bingen bingen self-assigned this Oct 20, 2024
@danielattilasimon
Copy link
Collaborator

So all along, opening a Trove below CCR was okay as long as it would tip the TCR above CCR? But borrowing against an existing Trove was a no-go. Well, it's good that we're making it consistent then.

@bingen
Copy link
Collaborator Author

bingen commented Oct 21, 2024

No, I think it was already consistent, see here:
https://github.com/liquity/bold/pull/527/files#diff-d30cc87ed051c6909d6e9b48a0d719549c2272b1418110c6f55618d5ec6d9448L322

The aim is to fix the issue brought up by Alex, where a whale may block borrowing in general (both new and existing troves) by being able to place the system slightly below CCR.

@danielattilasimon
Copy link
Collaborator

Ah, I see, I missed the check being removed from openTrove(). Then we'll also need to change the openTrove() handler in the invariant test.

@@ -1350,26 +1347,14 @@ contract BorrowerOperations is LiquityBase, AddRemoveManagers, IBorrowerOperatio
}
}

function _requireNotBelowCriticalThreshold(uint256 _price) internal view {
if (_checkBelowCriticalThreshold(_price, CCR)) {
revert BelowCriticalThreshold();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes error BelowCriticalThreshold() unused, I believe.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right, I removed BorrowingNotPermittedBelowCT but forgot this one. Thanks for fixing it!

@bingen
Copy link
Collaborator Author

bingen commented Oct 21, 2024

And thanks for fixing the invariant tests too!

Copy link
Collaborator

@danielattilasimon danielattilasimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now!

@bingen bingen merged commit 7e6aae4 into main Oct 21, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Recon M-04: Borrowing from branches can be disabled by one whale or early depositor
2 participants