Skip to content

XLS-0066d Lending Protocol #240

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

Open
wants to merge 42 commits into
base: master
Choose a base branch
from

Conversation

Tapanito
Copy link
Contributor

Discussion thread can be found here: #190
Development branch can be found here: TBD

@sappenin
Copy link
Collaborator

@Tapanito this PR seems ready to merge -- do you agree?

(Note that per the DRAFTS section of the CONTRIBUTING guidelines, merging does not mean endorsement or even a completed spec, but instead offers a way for spec editors to more easily edit using PRs).

@Tapanito
Copy link
Contributor Author

Tapanito commented Dec 4, 2024

Before merging, I'd like to have at least one review by an engineer to ensure everything is in order. In addition, similarly to Single Asset Vault, it is simpler/more convenient to edit a PR with various small design changes (e.g. names), rather than open a new PR for each of them. As a result, keeping a PR open allows to have a spec. that is more readily in-alignment with implementation.

@sappenin
Copy link
Collaborator

sappenin commented Dec 4, 2024

Makes sense, especially if it's more convenient. Just didn't want you (or anyone reading along) to think that merging here implies "finished product" (that's why we have a d designator, to indicate draft status).

Tapanito and others added 7 commits January 27, 2025 16:40
- Adds VaultNode to LoanBroker object to track in which owner directory of the Vaults pseudo-account the LoanBroker object is referenced.
- Adds LoanBrokerNode to Loan object to track in which owner directory of the LoanBroker object the Loan is references.
- Replaces CurrentTime to LastClosedLedger.CloseTime.
- Changes the LoanBroker.Delete transaction to automatically return any outstanding Cover to the LoanBroker.Owner.
- Adds a balance check to the LoanBrokerCoverDeposit transaction when depositing XRP.
- Adds a check to LoanBrokerCoverWithdraw to ensure the CoverAvailable does not drop below Mimimum Cover Required.
@Tapanito
Copy link
Contributor Author

Tapanito commented Jan 28, 2025 via email

@Tapanito
Copy link
Contributor Author

Tapanito commented Jan 28, 2025 via email

Copy link
Collaborator

@ximinez ximinez left a comment

Choose a reason for hiding this comment

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

Updates look good.

@Tapanito
Copy link
Contributor Author

Tapanito commented Mar 19, 2025 via email

@ximinez
Copy link
Collaborator

ximinez commented Mar 20, 2025

No, since we introduced a pseudo-account for the LoanBroker, the deposit will go there

Right, I wasn't thinking about that, but if there is a loan default, and funds have to be paid out of the Cover Amount, wouldn't that go to the SAV?

@Tapanito
Copy link
Contributor Author

No, since we introduced a pseudo-account for the LoanBroker, the deposit will go there

Right, I wasn't thinking about that, but if there is a loan default, and funds have to be paid out of the Cover Amount, wouldn't that go to the SAV?

Yes, 100%, the cover amount liquidation, in essence, will become a transfer of asset from one pseduo-account to another, with some accounting state changes.

@ximinez
Copy link
Collaborator

ximinez commented Mar 21, 2025

No, since we introduced a pseudo-account for the LoanBroker, the deposit will go there

Right, I wasn't thinking about that, but if there is a loan default, and funds have to be paid out of the Cover Amount, wouldn't that go to the SAV?

Yes, 100%, the cover amount liquidation, in essence, will become a transfer of asset from one pseduo-account to another, with some accounting state changes.

Right, so they should be the same currency, no? I'm fine with it being an STAmount as long as we're on the same page that the transaction should fail if it's not the same currency as the SAV.

@Tapanito
Copy link
Contributor Author

Tapanito commented Apr 29, 2025 via email

@ximinez
Copy link
Collaborator

ximinez commented Apr 29, 2025

Yeah, I think the potential for confusion is a very good argument, that I couldn't agree more with. Let's add LoanSequence to LoanBroker. Though, this still might have the issue of UX confusion, as if I tried looking up all my Loans I might have a lot of Loans with LoanSequence number 1. However, I think this is the most elegant solution, and the UIs should be weary of this nuance

Agreed, we should emphasize that the "key" is the LoanBrokerID/LoanSequence combo, not the Owner/Sequence combo we see in other places. I also hope that LoanSequence will be different enough that the it's clear this is something different.

Copy link
Collaborator

@ximinez ximinez left a comment

Choose a reason for hiding this comment

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

Forgot to post this last night...

@Tapanito Tapanito force-pushed the xls-66-lending-protocol branch from 1a3e31d to ed5a62d Compare June 13, 2025 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants