Optim Labs
8 min readSep 29, 2022


Liquidity Bonds — Technical Architecture

  1. Summary

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:

  • Bond Amount Total number of bonds being issued, each with face value of 100 ADA.
  • Epoch Rewards This is the price for one epoch of owning the rights to direct the stake key.
  • Interest Buffer Represents the number of epochs in advance that the loan must have its interest paid for in order to survive. Say, a month (6 epochs) of buffer would cause the position to be closed if the interest was paid for only 5 at any point. Concretely, at epoch 10 of the loan with a buffer of 6 sets, if the total Epoch Rewards accounts for 15 instead of 16 (or more) epochs, it will be forcefully closed.
  • Duration Denominated in epochs, this is the maximum length of a loan. It must be smaller than 2 years (2*73 epochs). The position may be closed earlier if the interest payments are not made.
  • Stake Key The first Stake Key used to stake the loan with. Can be changed later by the current owner of Ownership NFT using the Stake Key Change call.
  • Token Name The unique token name based on UTxO spent when posting a borrow offer. Used by NFTs (Uniqueness NFT and Ownership NFT) as well as by bond tokens later on.

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:

  • Original Lender This can be the lender’s stake key and will be used to provide them additional staking rewards while the bond token owners move to redeem the underlying ADA + interest.
  • Start The epoch the bonds were successfully issued. Checked on-chain.

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:

  • Uniqueness NFT This is an NFT at the token level and uniquely corresponds with the Bond Tokens and Ownership NFT assets sharing the same token name. Identifies a particular bond.
  • Ownership NFT This token represents the borrower’s rights and allows re-delegating the locked funds. As a native asset, this allows the borrower’s position to be resold on a secondary market.

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.

  1. Posting Bond
    A borrower posts their Bond Writing Validator, minting the Uniqueness NFT (sent to BWV) and Ownership NFT (sent to a borrower themselves).
  2. Writing Bond
    Lender takes the offer, getting the bond tokens and putting the funds into the Open Bond.
  3. Deposit more margin
    Suppose the loan is at epoch forward enough to warrant adding more margin for one epoch.
  4. Changing borrower’s staking key
    If a borrower needs, they may change their staking key showing their Ownership NFT token and supplying a new key.
  5. Closing Bond
    Example assumes we ran the bond for the full duration with no problems and are closing at the last epoch with exactly enough ADA rewards for simplicity.
  6. Redeeming Bond
    In a closed position the bonds may be redeemed. A lender comes in and redeems their ADA.

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

  1. Creating Pool
    Lender creates a Pool by buying one or more pool tokens.
  2. Pool tokens sold
    Pool tokens are sold until the Borrow offer has been fully funded.
  3. Matching against a BWV
    The pool is matched against an outstanding Bond Writer Validator as if the pool was a single entity.
  4. Exchange PT -> BT
    Lenders will exchange Pool Tokens for a corresponding amount of Bond Tokens.

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