Skip to main content

Market

Isolated lending market with configurable IRM and optional collateral delegation.

OctoLend_Market.png

Overview

The Lending Market is OctoLend’s single-asset credit engine implemented as a Soroban vault. It accepts deposits of one loan asset, issues vault shares to LPs, holds borrower collateral (plus any delegated collateral from a Collateral Vault), tracks borrower liabilities internally as debt shares, and orchestrates interest accrual, withdrawals, and liquidations fully on-chain.

Each market is self-contained: its parameters, oracle, and interest rate model are bound to that specific market instance.

Purpose

  • Create isolated lending pools with predictable, local risk.
  • Support collateral posted directly by borrowers and collateral delegated via a Collateral Vault.
  • Price debt deterministically via the market’s Interest Rate Model (IRM), enabling transparent accounting and liquidation logic.

Core Components

  • Collateral Asset: Token used as collateral by borrowers (standard Stellar FT-compatible).
  • Loan Asset: The single underlying asset supplied by LPs and borrowed by users.
  • LLTV (Liquidation Loan-To-Value): Maximum borrowing ratio (in basis points) before liquidation eligibility.
    • Example: LLTV of 80% means 100ofcollateralvaluesupportsupto100 of collateral value supports up to 80 of borrowing. Any excess renders the position liquidatable.
  • Oracle: Smart contract providing price and decimals for the collateral asset; used for LTV, borrow capacity, and liquidation checks.
  • IRM (Interest Rate Model): Contract bound to the market that computes utilization, borrow rates, interest compounding, and the debt price.
  • Delegation (optional): If a Collateral Vault is configured, the borrower’s effective collateral includes both posted collateral and delegated collateral allocated to the market.

Collateral Asset

  • Supply collateral: Borrowers deposit the designated collateral asset into the market; balances are tracked per borrower.
  • Withdraw collateral: Permitted only if the remaining collateral value (posted + delegated) continues to satisfy LLTV constraints. Withdrawals that would render the position under-collateralized are rejected.
  • Delegated collateral: The market queries the Collateral Vault for the borrower’s currently allocated delegation. Delegation increases effective collateral and is included in borrow capacity and liquidation calculations. Accrued delegation fees are not netted out of delegated collateral for these calculations.

Loan Asset

  • Deposit / Mint: LPs supply the underlying asset and receive market vault shares. Supplied assets are held directly by the market contract.
  • Withdraw / Burn: LPs may withdraw subject to available on-chain liquidity; corresponding vault shares are burned. Interest is compounded and market fees are accrued prior to execution.

Oracle

  • SEP-40–style price feed for the collateral asset:

    • price(asset, timestamp) → price with declared decimals
    • decimals() → price precision
  • Oracles are set per market and used to compute collateral value, LTV, borrow capacity, and liquidation math.

  • Oracle updates after initialization are subject to an on-chain timelock.

  • Example oracle provider: https://reflector.network/

Liquidation

LTV (monitoring):
LTV_bps = borrowed_value / collateral_value × 10_000

Where:
borrowed_value = debt_shares × debt_price
collateral_value = (posted_collateral + delegated_collateral) × oracle_price

Delegation fees accrue off-balance-sheet and are not deducted from delegated collateral when computing collateral value, LTV, borrow capacity, or liquidation thresholds.

Liquidatable amount:
If a position breaches the LLTV, the protocol permits liquidation of the full borrowed value.

Liquidation Flow

  1. The liquidator repays underlying assets to the market contract.
  2. The liquidator receives collateral worth repaid_value × (1 + liquidation_bonus_bps), priced by the oracle.
  3. Seizure order: The borrower’s posted collateral is seized first. If insufficient, the remaining shortfall is recorded as a pending seize against delegated collateral, to be settled by the Collateral Vault.
  4. Corresponding debt shares are burned to reflect the repaid liability.

Parameters

  • Liquidation Threshold (LLTV, bps): Maximum allowed LTV before liquidation eligibility.
  • Liquidation Bonus (bps): Premium paid in collateral to liquidators.

Interest Rate Model

The Interest Rate Model bound to the market computes:

  • The current annualized borrow rate as a function of utilization and internal model state.
  • Continuous compounding of total debt assets between accruals.
  • The debt price used to value, accrue, repay, and liquidate borrower liabilities.

IRM parameters are set once at market initialization; the model exposes real-time getters for rates and debt price.

Collateral Delegation

Collateral delegation is disabled by default and may be enabled during market initialization. When enabled, the market incorporates the borrower’s delegated collateral allocation from the Collateral Vault into borrow capacity and liquidation calculations. Delegation does not rehypothecate assets and does not affect the loan asset liquidity held by the market.

Borrowing & Repayment

  • Borrow capacity: Determined by the oracle-priced value of posted collateral plus delegated collateral, bounded by the market’s LLTV.
  • Borrow:
    • Interest is compounded and fees are accrued.
    • Borrow capacity and market liquidity are checked.
    • Debt shares equal to borrowed_amount / debt_price are recorded for the borrower.
    • Underlying assets are transferred from the market contract to the borrower.
  • Repay:
    • Underlying assets are transferred back to the market contract.
    • Debt shares equal to repaid_amount / debt_price are burned (capped to outstanding debt).
    • After repayment, collateral withdrawals are permitted subject to LLTV constraints.

Access Control

  • Admin: May pause or unpause the market, configure fees and fee beneficiary, set or update the oracle (subject to timelock), toggle delegation support, and configure the Collateral Vault.
  • Pause state: When paused, all state-changing operations (borrowing, repaying, collateral actions, liquidations, and vault deposits/withdrawals) are blocked, while read-only functions remain available.