Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

lending: Support cross collateralized loans #993

Closed
jstarry opened this issue Dec 31, 2020 · 2 comments · Fixed by #1441
Closed

lending: Support cross collateralized loans #993

jstarry opened this issue Dec 31, 2020 · 2 comments · Fixed by #1441
Assignees
Milestone

Comments

@jstarry
Copy link
Contributor

jstarry commented Dec 31, 2020

Problem

Loans can only be collateralized by a single currency and collateral cannot be pooled for multiple loans

Proposed Changes

Expand Obligation to include a list of borrow / collateral amounts

  • Add authority which will be allowed to repay obligations (and remove obligation tokenization)
  • For each borrow / collateral amount, track the quote currency value and the slot the value were last computed at.
  • Reasonably high max of total currencies per obligation*

Obligation market value calculation

  • Introduce RefreshCollateralValue instruction for computing the market value of obligation collateral
    • Requires reserve and dex accounts for collateral exchange rate and price discovery, respectively
  • Introduce RefreshBorrowValue instruction for computing the market value of obligation borrow amount
    • Requires reserve and dex accounts for interest accrual and price discovery, respectively

Liquidation

  • Liquidation instruction now requires an obligation with recently refreshed market values to determine loan health
@joncinque
Copy link
Contributor

Expand Obligation to include a list of borrow / collateral amounts

Would it be easier to have one borrow type and multiple collateral types? Unless this is to be more like Aave, it could be clearer for people to manage. Then you might also be able to just have a RefreshObligation instruction which takes care of all calculations, rather than separating the collateral and borrow side.

Add authority which will be allowed to repay obligations (and remove obligation tokenization)

We could also create a tokenized market for the authority, as you mentioned 😄

Otherwise, this approach seems good to me!

@jstarry
Copy link
Contributor Author

jstarry commented Feb 12, 2021

Would it be easier to have one borrow type and multiple collateral types? Unless this is to be more like Aave, it could be clearer for people to manage. Then you might also be able to just have a RefreshObligation instruction which takes care of all calculations, rather than separating the collateral and borrow side.

Yeah, not opposed to combine those instructions. I think it's worth the flexibility to allow a many to many relationship for collateral to loans though to support multiple borrow currencies

Otherwise, this approach seems good to me!

Thanks for looking it over!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants