Lending Facility & DFC#775
Open
leeftk wants to merge 70 commits intoInverterNetwork:experimental/perfrom
Open
Conversation
FHieser
reviewed
Aug 29, 2025
FHieser
approved these changes
Sep 9, 2025
327f002 to
fac4a11
Compare
FHieser
reviewed
Sep 19, 2025
FHieser
reviewed
Sep 19, 2025
FHieser
reviewed
Sep 30, 2025
| /// @dev Internal function that handles all borrowing logic | ||
| function _borrow( | ||
| uint requestedLoanAmount_, | ||
| address tokenReceiver_, |
Contributor
There was a problem hiding this comment.
Couldnt the borrower and the token receiver be the same in this function?
I do not see a reason why they would be different inputs.
Contributor
There was a problem hiding this comment.
The if (tokenReceiver_ != address(this)) { check could just be:
_msgSender!=address(this) instead and you'd still have nearly the same behaviour.
Contributor
There was a problem hiding this comment.
The reason that I am saying this is because the borrowFor function uses
borrow(requestedLoanAmount_, receiver_, receiver_);
I initially thought with this getup that the receiver also has to provide the initial issuance tokens,
but the borrow always uses _msgSender as the provider anyway
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Implemented a lending facility that allows users to borrow collateral tokens against locked issuance tokens with dynamic fee calculation.
Key Changes
Technical Details
Formulas & Pricing
virtualIssuanceSupply × P_floor(where P_floor is first segment's initial price)borrowAmount ÷ floorPrice(issuance tokens needed)currentlyBorrowedAmount ÷ borrowCapacityrequestedAmount × feeRate(feeRate from DynamicFeeCalculator based on utilization)(borrowableAmount - currentlyBorrowedAmount) ÷ borrowableAmountTesting
Missing