BondDocumentation

Lending Protocol

Technical documentation for the Bond lending smart contracts.

Architecture

The Bond lending protocol is a custom implementation deployed on the 0G Network. It uses a modular contract architecture with separate contracts for core lending logic, asset management, interest rate calculations, and oracle price feeds.

Core Contracts

LendingManager

Central contract managing lending pools, user positions, supply/borrow operations, and collateral state. Orchestrates interactions between other contracts.

LendingInterface

Read-only interface contract providing aggregated views of market data, user positions, and protocol metrics. Used by the frontend for efficient data fetching.

CoinFactory

Factory contract for creating and managing lending pool assets. Handles deposit and loan token minting/burning for each supported asset.

LendingCoreAlgorithm

Pure math contract implementing the interest rate model, health factor calculation, liquidation threshold checks, and utilisation-based rate curves.

LendingVaults

Vault management contract handling isolated lending pools, risk separation, and per-vault accounting.

Oracle

Price oracle integration using Chainlink-compatible AggregatorV3 feeds. Provides real-time asset valuations for collateral assessment and liquidation checks.

RewardContract

Manages protocol incentive distribution and reward accrual for lending participants.

Lending Modes

Mode 0: High Liquidity

Standard shared lending pool with market-driven interest rates. All assets in this mode share the same risk pool and collateral is cross-margined.

Mode 1: Risk Isolation

Isolated lending pools with capped exposure. Each asset has a maximum lending amount, limiting protocol exposure to volatile or newer assets.

Mode 2+: Homogeneous

Specialised lending pools with custom LTV ratios for specific asset pairs or strategies.

Key Parameters (Per Asset)

collateralFactor

Max borrow power as % of supply value

liquidationThreshold

Collateral ratio triggering liquidation

liquidationPenalty

Fee applied to collateral during liquidation

reserveFactor

Protocol's share of interest revenue (0-1)

bestLendingRatio

Optimal utilisation threshold (basis points)

bestDepositInterestRate

Supply rate at optimal utilisation (basis points)

supplyCap

Maximum amount that can be supplied

borrowCap

Maximum amount that can be borrowed