A Lender in Decentralized Wonderland

How does Decentralized lending work? Who is the star of that process? #LendroidExplains a Lender’s journey on the protocol.

The title gives it away, doesn’t it? Some mysteries are simply not meant to be. Besides, lenders hate surprises. They prefer low risk, low friction transactions, guaranteed returns and completely protected custody of their funds, preferably decentralized custody. They love smart contracts.

If you are one such lender, welcome to Lendroid. You’re going to love it here.

Lendroid’s Lending Origins

Before we zeroed in on Margin Trading as the ideal use case, Lendroid was already a full-fledged, decentralized, trust-independent lending platform.

For those who know what this means and possess a streak of scepticism, here’s a neat demo of Lendroid ENS loans on Kovan. Right?

On Lendroid the non-custodian margin trading protocol, the lender is the primary participant. How good or effective the protocol is depends on what kind of an experience the lender has on it.

Rules and fail safes have been put in place to not let down the Lender’s basic expectations — of protecting capital and earning risk-free interest in a low-friction manner. If the experience is low on risk and friction, and if it is invariably profitable, then he’ll come back. If it isn’t, he won’t.

Broadly, the process was designed thus:

1. The lender defines specific terms for the loan — amount, interest rate, loan period, loan to value (LTV) — set in a smart contract.

2. A borrower pledges digital assets into an escrow account, and If the lender’s and borrower’s terms match, the smart contract is executed, locking in the collateral and releasing the funds to the borrower.

3. If the borrower satisfies the loan obligations, his collateral is unlocked automatically.

4. If the borrower defaults or the collateral drops below the agreed LTV, the collateral is liquidated.

Try the demo. You know you want to.

A Lender’s Journey on Lendroid

While this journey is described in full in the whitepaper, here’s a quick stroll through a short cut. I trust you will appreciate the trust-independent nature of his experience.

To begin with, like the ‘Maker’ from 0x, the lender broadcasts a loan-offer to all decentralized exchanges. This is an off-chain action. A Funding Account is made available to the lenders to deposit funds into and offer loans from.

Each loan offer is a data packet called the ‘offer object’, containing the terms of the loan, offer parameters, and an associated ECDSA signature.

Jargon alert: The loan terms and parameters are concatenated and hashed to produce a 32 byte-long Keccak SHA3 signature called the offer-hash. The lender signs this offer-hash with their private key to produce the ECDSA signature.

As discussed earlier, it is important that the interests of the Lender — who contributes to the shared liquidity pool — are protected. This is enabled by empowering the Lender to define key parameters within the offer object.

Defining the Offer Object

Off chain, the Lender defines the offer object with a range of parameters [See Table ]. Key among them are -

· Loan Amount and Interest Rate

· Loan Expiration Period

· Offer Expiration Period

A word on the validity of the offer. Based on the demand for a token, a Lender might want to change his offer to reflect a different interest rate or number of token units. Setting a prudent expiry time for the offer allows for this flexibility, without having go on-chain every time he wants to make a change.

Though not part of the offer object as currently envisioned, automatic renewal of loans too is being explored.

Cancelling the Loan Offer

A loan offer is deemed invalid, and therefore is cancelled, in the following cases:

· If a loan offer is availed after its expiration period: In this case, the Loan Smart Contract recognizes that the offer cannot be availed anymore, and triggers an event indicating to all Relayers that the loan with the corresponding hash is invalid. It is in the Relayers’ best interests to not display expired loans in the first place and, even if they do, they have the option to listen in on the LoanOfferCancelled event from the Loan Smart Contract.

· If a Lender decides to cancel an offer that has been left unavailed and unfilled: In this case, the lender can call the Loan Smart contract’s CancelLoan function which further triggers the LoanOfferCancelled event from the same Smart Contract, thus notifying all listening Relayers. Cancelling a loan offer is a fallback mechanism and costs gas. Therefore, it is in the best interests of the lender to set a suitable ExpirationPeriod on the offer to avoid on-chain transactions.

There. Those are pretty much the parts that a Lender sees and is savvy to. Now, all through the protocol, mingled in the journeys of the other players, there are nifty little processes in place to ensure that the Lender’s interests are protected. They make for fascinating reading in the whitepaper. Do let us know what you think.