Liquidity Bonds — Technical Architecture

Liquidity Bonds are a protocol for lending staking rights of ADA without giving custody of ADA to the borrowing party. The lender, apart from interest paid in any native token on an epoch-to-epoch basis, gets Bond Tokens representing their lending position each of 100 ADA face value. They can be used to transfer their position or use it in other protocols.

Terms of the loan are agreed upon upfront and have limitations such that the length of the loan is bounded and every Bond Token will be able to be redeemed, at longest, at the end of the maximum duration. It is worth noting here that just as the lend side is transferable, so is the borrow side. An NFT, minted at creation of a borrow offer, governs what stake key is attached to the entire position.

Despite being referred to as ‘bonds’, terms of the loan specify a duration, which is a maximum a specific position will be able to be maintained for. The loaned ADA is non-custodial as it remains locked inside the smart contracts until duration meets maturity, at which point the funds are returned to the lenders. This interaction allows the borrow side to be undercollateralized.

1.1 Validators

Bond Writer Validator (BWV) is a ‘borrow offer’. A party expresses their intent to issue bonds to a willing buyer, i.e. a party willing to lend them ADA. Locks some prepaid margin, which upon issuance is deposited to the following validator. Worth noting that the offer must be filled completely in order to be accepted.

Open (Position) Validator represents an active loan that’s successfully been made. It holds in trust the ADA lent out, only allowing interest payments to be made, closing the position or changing the stake key. Its terms are fixed and the borrower may now direct the stake wherever they please, attaching any stake key to the UTxO. If the terms are not met, i.e interest payments not made, an open position becomes closable by the lender.

Bond Token (BT) Minting Policy creates the native bond tokens that represent the underlying position it is meant to represent the stake in. As with any other Cardano Native Token, they are freely exchangeable and can be used to interoperate with other protocols. They are always guaranteed to be backed by its face value of 100 ADA each.

Closed (Position) Validator holds ADA plus all the interest accumulated during the active time of the bond. Its purpose is to allow redemption of Bond Tokens for their face value plus accumulated interest. In this UTxO the ADA is staked to a predetermined key ‘ogLender’ (usually the original lender, but can be left as a free variable to be decided by whomever purchases the bond). Upon closing, a few % of the total interest is deposited to the Optim treasury.

2 High Level Workflow

A “position” is a uniquely-identified by the Uniqueness NFT UTxO that carries all of the lent ADA and/or paid interest, locked to the appropriate script (BWV, Open or Closed).

2.1 Posting An Offer

To post a borrow offer the prospect borrower must specify few parameters:

An offer is locked at BWV script. Until an offer gets accepted, it can be canceled by the owner at any time.

2.2 Accepting an offer and bonds issuance

A lender then comes in and sees the offer’s parameters up to their expectations, decides to lend out the money. They must also provide some parameters:

They once again get asked to confirm and sign a transaction, in which they receive the tokens representing the amount of bonds they purchased. The position’s UTxO moves to Open script, where it sits until bond closing.

2.3 Bond Maintenance

The borrower is now able to change the stake key attached to the position and the position is guaranteed to be kept open as long as its terms are met. Anyone might make margin adding calls, depositing more interest to a position. Having no restrictions on who can do that opens additional features like subsidizing bonds by third parties. Should the borrower miss payments, anyone can force close the position.

2.4 Closing a position

Once bond duration is over, or in the case there is not enough interest paid, a position is eligible for normal or premature closing accordingly. Anyone is permitted to close a position. Upon closing the UTxO moves to Closed script.

2.5 Redeeming

After being closed, the position is ready for bond tokens redemption by their holders, sitting at Closed script with Original Lender staking credentials, providing additional rewards to the original lender.

3 Scripts Technical

When scripts depend on minting policies we use CurrencySymbol rather than ValidatorHash. otmAddr is Optim’s address and used to receive fees.

3.1 Common Terms and Constants

A month refers to a period of 30 days exactly (6 epochs). Epoch Boundary refers to the exact LAST slot in the epoch 327. Epoch refers to the length of an epoch in slots (seconds) i.e. 432000. Stake Key may be arbitrary when not explicitly stated to be enterprise or locking.stake.

3.2 NFT Minting Policy

This universal minting policy is used for two kinds of NFTs:

3.3 Bond Token

Also known as BT. Minting policy for the primary tokens of the product. Minted upon entering Open state and burned after entering Closed state. Invariant: Backed by at least 100 ADA redeemable at worst 2 years after receiving the token.

3.4 Bond Writer Validator

Validator for posting bond offer to be presented to potential lenders.The parameters for the bond’s lifetime are specified in the datum. Should ensure that the Open state is entered with the correct parameters and guard minting of BT. This state can be canceled by the holder of the corresponding Ownership NFT, or (as a security measure to prevent funds getting stuck) by the owner of the stake key specified in the datum.

3.5 Open Validator

State representing active loans. In this state the position is maintained by adding margin as specified in the datum. If the position falls below its maintenance margin, or if it has run its course, it can be closed by any sender. The value in this state is delegated to the borrower’s pool of choice, and the credential can be changed by the holder of the corresponding Ownership NFT.

3.6 Closed Validator

State representing completed loans. In this state holders of BT can redeem each token for the 100 ADA face value, plus a proportional cut of the interest paid in rewards. The staking credential in this state is provided by the original lender.

4 Transaction Flow

Examples of a few sequential interactions.

Pooled Loans

This system is a second order dapp to liquidity bonds, being a self-contained application that interfaces with it. The purpose of it is to pool funds such that they may execute against a bond, which normally requires 1M+ ADA. Specifically, the design is a little awkward when dealing with continual-funding fundraising initiatives. It works best when a borrower wants to take one loan and one loan only.

The pool creator must ensure that the correct amount of pool tokens are deposited to the pooling validator (and the correct number of bonds made). This is easily checked frontend-wise, and even on-chain-wise as the number N = pool tokens in utxo + (ada in utxo / 100) is known in advance and whether or not this invariant is broken.

Pool Token

Minting policy for the primary tokens of the product. Minted upon entering Open state and burned when the last bond token gets claimed.

Open Pool Validator

Pool validator allowing a loan to be filled by multiple lenders. The datum specifies the compatibility requirements for the Bond Writing Validator to be matched. Once all pool tokens have been bought, this position can be paired with a borrower’s BWV UTxO to mint the bond tokens and send them to a corresponding Closed Pool state.

Closed Pool Validator

Pool validator receiving initial bond tokens. Holders of pool tokens can redeem them for bond tokens once the bond has been written, and redeem those in turn once the position enters the Closed state.

Transaction Flow

Pool Closed
Once all Bond Tokens have been claimed, the pool is terminated.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store