question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Standalone line of credit

See original GitHub issue

What is the Problem Being Solved?

We need a way to generate RUN in the mainnet0 timeframe. Some accounts will have BLD, and no fees will be charged yet.

Description of the Design

  • Tweak the existing x/lien module to serve as the source-of-truth for liens.
    • Add compare-and-swap fields in SetLien request.
  • Add a command for taking a line of credit in RUN against BLD in one’s own account.
    • Required collateralization rate specified in module parameters, modifiable by governance.
    • Module must be able to mint RUN.
  • Same command can repay the LoC, lifting the lien.
    • Need to establish behavior when multiple LoCs are present with different collateralization rates.
  • Switches over to JS-controlled LoC system in mainnet1
    • Need to be able to disable standalone LoC creation
    • JS needs to be able to initialize LoC state from existing standalone LoCs.

Security Considerations

Must ensure conservation of liened BLD vs RUN.

Test Plan

Unit tests.

Manual testing on testnet:

  • cannot take nonzero LoC without BLD
  • produced RUN is transferrable
  • liened BLD is not
  • can change collateralization ratio
  • payoff works

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:22 (21 by maintainers)

github_iconTop GitHub Comments

1reaction
JimLarsoncommented, Nov 17, 2021

Draft interface:

Golang keeper API:

GetLoC(ctx sdk.Context, addr sdk.AccAddress) (collateral, loan sdk.Coins)
SetLoC(ctx sdk.Context, addr sdk.AccAddress, oldCollateral, oldLoan, newCollateral, newLoan sdk.Coins) error

GetLoC() returns zero amounts if no LoC is present.

The SetLoC() call has several checks and effects:

  • The old amounts in SetLoC() must match the current LoC state.
  • In “standalone” mode, the new collateral/loan ratio must match the configured ratio. In JS-master mode, the given amounts are assumed to be correct.
  • If the loan amount is increasing, the new collateral must not be greater than the amount in the given account. However, if the loan is being paid down, it is okay to not have the new required collateral available: the account becomes “under water” from a lien perspective, but you can always pay down a loan.
  • The lien is set to the new collateral amount.
  • If the loan is increasing, the increment is minted and added to the account. If the loan is decreasing, the decrement is removed from the account and burned. There must be enough of the loan denomination available to do this.

The configuration will specify the size of loan that can be taken for one unit of collateral, specifying both denominations. In the expected case of a RUN LoC on BLD, this gives an amount of RUN per liened BLD, which should be more immediately legible than the inverse price of BLD.

Question: should we specialize the API to list loan and collateral to sdk.Coin? This would simplify the configuration and the JSON messages.

1reaction
JimLarsoncommented, Oct 25, 2021

Check with @dtribble as to whether this is a change to mainnet 0 scope, or just a feature that didn’t get top billing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Standalone Letter of Credit Facility Definition - Law Insider
Standalone Letter of Credit Facility means any bi-lateral letter of credit facility provided by a Lender or an Affiliate of a Lender for...
Read more >
Offer Borrowers More Convenience And Flexibility With HELOC
Standalone HELOC. Independent of who originated the loan, this product offers current homeowners a simple way of tapping into their home's equity when...
Read more >
Home Equity Line of Credit (HELOC) | Home Loans - U.S. Bank
A home equity line of credit, or HELOC, is a revolving credit line. It's secured by the equity you've built in your home...
Read more >
Stand-Alone HELOC - Symmetry Lending
Since many borrowers already have a great rate on an existing first mortgage and strong equity in their home, this is a great...
Read more >
What Is A Home Equity Line Of Credit (HELOC)? | Rocket HQ
Though Rocket Mortgage® doesn't offer HELOCs, home equity loans are offered. Here's a side-by-side comparison of both home loan options: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found