Skip to content

Latest commit

 

History

History
226 lines (147 loc) · 7.44 KB

ABL-spec-prose.rst

File metadata and controls

226 lines (147 loc) · 7.44 KB

Asset-Based Lending smart contract

Author: Dmitry Petukhov (https://github.com/dgpv) (C) 2020

With review and help from Russell O'Connor

Contract premise

Alice possesses certain quantity of asset Principal_Asset that she does not currently utilize, but wants to extract some value from.

Bob possesses asset Collateral_Asset, but needs some P amount of asset Principal_Asset temporarily.

Bob does not want to sell Collateral_Asset, because he predicts that its value or utility will be higher in the future than what the current market value, for tax reasons, etc.

Bob is willing to pay the for the temporary use of P while offering C amount of Collateral_Asset as a guarantee of repayment to the creditor.

Contract can be terminated at any time by any settlement that is mutually agreed by the two parties.

Basic Asset-Based Loan contract

t_{0} is the point in time when contract begins

t_{1} is the point in time when the pre-agreed duration has passed since t_{0}

Interest rate R is pre-agreed

Alice is willing to give out P to Bob, provided that:

  • Before t_{1}, she will receive P + P * R
  • Otherwise, at or after t_{1}, she will be able to claim C

Bob is willing to freeze C for certain period, provided that:

  • He will receive P immediately
  • If P + I is repaid before t_{1}, he can recieive C back

Bob agrees that if P + I is not repaid before t_{1}, Alice can claim C for herself.

Contract start: To enter the contract, Alice and Bob create and cooperatively sign a transaction that:

  • Sends P, provided by Alice, to Bob's address
  • Sends C, provided by Bob, to the address of a script that enforces the terms of the contract above

This contract is simple, but limited. It requires for principal to be repaid in one lump sum, it is often preferable for the principal to be repaid in portions over time.

Asset-Based Loan contract with partial repayments

The repayment is split into N installments.

M consecutive missed payments lead to collateral forfeiture.

The contract ends in maximum S \in [\max\{N, M\}+1, N + M] number of steps.

The concrete value of S within this range is pre-agreed.

The rates used for calculation of interest or surcharge are pre-agreed:

  • R_{D} is the rate for regular repayments due
  • R_{E} is the rate for surcharge on early repayments
  • R_{C} is the rate for penalty on the part of collateral returned in the event of default
  • R_{L(1)} \ldots R_{L(M-1)} are the rates for surcharge on late repayment: R_{L(1)} is applied when one payment is missed, R_{L(2)} is applied when two consecutive payments are missed, and so on

n is the number of partial repayments, n \in [0, N]

m is the number of missed payments, m \in [0, M]

B is the outstanding principal balance

F_{P} = \frac{P}{N} is installment size (the "Fraction of P")

D = \min\{F_{P} * (m+1), B\} is the portion of the balance currently due to be repaid [1]

L = \min\{F_{P} * m, B\} is the amount the repayment is late on

C_{uncond} is the amount of collateral that is unconditionally forfeited in the event of default

A_{reg} = D + B * R_{D} + L * R_{L(m)} is the regular repayment amount

A_{early} = B + B * R_{D} + (B-D)*R_{E} + L * R_{L(m)} is the early repayment amount

A_{penalty} = \max\{ B, A_{reg} \} + \max\{ B, A_{reg} \} * R_{C} is used for calculating collateral distribution in the event of default

The contract can progress over total S time periods, and t_{0} \ldots t_{S-1} are the points in time at the beginning of each period.

At t_{0}:

  • n = 0
  • m = 0
  • B = P

Alice is willing to give out P to Bob, provided that:

  • Before each t_{s}, s \in [1, S-1] she will receive A_{reg}, and then:

    • n will be incremented
    • m will be reset to 0
    • B will be decreased by D
  • Otherwise, m will be incremented

  • If m \geq M, or after t_{s}, s \geq S-1, she will be able to claim certain portion of C

Alice agrees that before t_{N-1}, B can be set to 0 if Bob repays A_{early}

Bob is willing to freeze C for certain period, provided that:

  • He will receive P immediately
  • When the condition B=0 is reached during contract execution, he can receive C back

Bob agrees that Alice can claim a portion C for herself if the condition m \geq M is reached during contract execution, or after the point in time t_{s}, s \geq S-1 is reached.

A portion of C that Alice can claim in this case will be dependent on the amount of principal that was repaid previously, and will equal to C_{forfeit} = \max\{C_{uncond}, \min\{C, C * A_{penalty} \div P\}\}, and Bob will receive C - C_{forfeit} portion of the collateral back [2]

Contract start: To enter the contract, Alice and Bob create and cooperatively sign a transaction that:

  • Sends P, provided by Alice, to Bob's address
  • Sends C, provided by Bob, to the address of a script that enforces the terms of the contract above

[1]

With presented simple formula, D for the last repayment equals P \bmod N.

In most cases P will likely be much larger than N, and last repayment will be very small in this case. Simpler formula is easier for understanding, but for real application, it makes sense to just make the last repayment slightly bigger than others, and the more complex formula should be used:

D = \begin{cases}
        F_{P}*(m+1) & \text{if $ (F_{P}*(m+1) + P \bmod N) \geq B $} \\[1ex]%
        B & \text{otherwise}
    \end{cases}
[2]There can be a variant of the contract where the portions of the collateral are returned to the Debtor as the partial repayments are made, rather than at the end of the contract. This variant is not included in this particular specification.

Examples

Calculated amounts on the presented schemes are rounded down.

Example scheme 1 illustrates the contract with:

  • P = 10000, C = 1000
  • N = 4, M = 3, S=7
  • R_{D} = 0.02, R_{E} = 0.001, R_{C} = 0.1, R_{L} = (0.03, 0.055), corresponts to 2%, 0.1%, 10%, (3%, 5.5%)

images/repayment-plan-3x4x7.png

Example scheme 2 illustrates the contract with:

  • P = 10000, C = 1000
  • N = 4, M = 4, S=5
  • R_{D} = 0.02, R_{E} = 0.001, R_{C} = 0.1, R_{L} = (0.03, 0.055, 0.08), corresponts to 2%, 0.1%, 10%, (3%, 5.5%, 8%)

The layout with N=M=(S-1) allows to have the collateral forfeiture event to always happen in one particular period.

images/repayment-plan-4x4x5.png