Skip to main content

Market

Isolated lending market with configurable IRM and collateral delegation.

OctoLend_Market.png

Overview

The Lending Market is OctoLend’s single-asset credit engine. It accepts deposits of one asset, issues vault shares to LPs, holds user collateral (plus any delegated collateral from a Collateral Vault), mints/burns “debt tokens” to track borrower liabilities, and orchestrates interest, withdrawals, and liquidations.

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

Purpose

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

Core Components

  • Collateral Asset: Token address used as collateral (standard Stellar/OZ FT compatible).
  • Loan Asset: The single underlying asset supplied and borrowed in the market.
  • LLTV (Liquidation Loan-To-Value): Maximum borrowing percentage before liquidation risk.
    • Example: LLTV of 80% means for a collateral value equivalent of 100,themaximumonecanborrowinvalueis100, the maximum one can borrow in value is 80. If the loan value exceeds 80(e.g.,80 (e.g., 80.0001), the position becomes liquidatable.
  • Oracle: Smart contract address pricing the collateral asset (e.g., vs USD) used to compute LTV and liquidation logic.
  • IRM (Interest Rate Model): Smart contract address that computes the borrowing rate and debt token pricing for the market.
  • Delegation (optional): If a Collateral Vault address is set, the borrower’s borrowable amount considers both posted collateral and delegated collateral (via get_allocation).

Collateral Asset

  • Supply collateral: Borrowers deposit the designated collateral asset into the market; balances are tracked per borrower.
  • Withdraw collateral: Allowed only if the remaining collateral value stays above the requirement implied by the loan and LLTV. The market rejects withdrawals that would make the position under-collateralized.
  • Delegated collateral: The market queries the Collateral Vault for current allocated amounts to the borrower. Delegation increases effective collateral and is considered in capacity and liquidation math.

Loan Asset

  • Deposit / Mint: LPs supply the underlying and receive market vault shares. The market routes newly supplied assets to the Treasury for safekeeping.
  • Withdraw / Burn: Lenders can withdraw anytime, subject to available liquidity. Market vault share is burned.

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 endpoint: https://reflector.network/

Liquidation

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

Where:
borrowed_value = borrowed_debt_tokens × debt_token_price
collateral_value = (posted_collateral + delegated_collateral) × oracle_price

Available to liquidate:
The protocol computes, in value terms, how much of a position is liquidatable to restore it within the Liquidation Threshold.

Liquidation Flow

  1. Liquidator repays up to the available amount to the Treasury.
  2. Liquidator receives collateral worth repay × (1 + liquidation_bonus_bps), priced by the oracle.
  3. Seizure order: Borrower’s own collateral first; if insufficient, the shortfall is pulled from delegated collateral (via the Collateral Vault).
  4. Debt tokens are burned to reflect the repaid value.

Parameters

  • Liquidation Threshold (bps): Maximum allowed LTV before a position becomes eligible.
  • Liquidation Bonus (bps): Premium paid in collateral to liquidators.

Interest Rate Model

The Interest Rate Model bound to the market computes:

  • Instantaneous annualized borrow rate from utilization and model state.
  • Debt compounding between accruals (updates total debt assets).
  • Debt token price used to value and settle all borrower liabilities.

Different IRM profiles (utilization-based, fixed-rate, or fixed-with-kink) can be selected at market creation.

Collateral Delegation

By default, delegation is disabled, but it can be enabled during market initialization. When enabled, the Market will check the delegation position of a borrower in calculating borrow capacity.

Borrowing & Repayment

  • Borrow capacity: Based on the risk-adjusted value of a borrower’s posted collateral + delegated collateral, priced by the oracle and bounded by the market’s Liquidation Threshold (LLTV).
  • Borrow:
    • Capacity and available liquidity are checked.
    • Debt is recorded in the Market contract with the amount principal / debt_token_price.
    • The underlying token is transferred from the Treasury to the borrower.
  • Repay:
    • The underlying token is transferred to the Treasury.
    • Debt tokens are burned in the amount repay / debt_token_price.
    • Borrower can withdraw collateral.

Access Control

  • Admin: Can pause/unpause the market and manage roles.
  • Treasury: Serves as the funding endpoint for borrows and repayments.
  • Pause state: When paused, the market disallows state-changing operations (e.g., borrowing); read functions continue to work.