Appearance
Architecture Overview
Market Manager admin
Protocol-level administrator that deploys new lending markets and maintains the registry of deployed markets (controlled via multisig). Admin transfer follows a 2-step process (propose_new_admin → accept_proposed_admin).
Market admin
Operator of a specific market who sets parameters, controls operating status, and manages fees for that market. Market configuration changes (pool creation, pool config updates, market config updates) are time-locked: changes are queued first and applied after the time-lock period (queue_in_pool_set → apply_pool_set, queue_in_market_update → apply_market_update).
User
Anyone who deposits to earn yield, borrows against posted assets, manages positions, or views market information. Users can compose multiple operations atomically via submit_requests_batch (e.g., flash borrow + swap + deposit + borrow). Each user position is identified by an ObligationKey { user: Address, seed: Option<BytesN<32>> }, allowing a single address to maintain multiple isolated positions.
Market Manager (smart contract)
Factory and registry contract that creates new markets and keeps a discoverable directory of deployed markets. Pool creation and configuration are unified under a time-locked pool set flow (queue_in_pool_set → apply_pool_set).
Market (smart contract)
The contract where lending and borrowing occur. It manages asset pools, enforces market rules, tracks user positions, and coordinates with external price feeds and exchanges, including liquidations and other safeguards. Markets support 7 statuses (Active, BorrowFrozen, BorrowFrozenByAdmin, DepositFrozen, DepositFrozenByAdmin, Frozen, FrozenByAdmin), and individual pools carry per-pool status flags (4-bit bitfield) for fine-grained operation control.
Insurance fund (smart contract)
A per-market safety buffer funded by fees. It absorbs residual losses after liquidations before any shortfall is socialized to lenders. Bad debt coverage follows a two-phase process (issue_cover_bad_debt → claim_cover_bad_debt_results). The insurance fund can also freeze a market via fund_update_market_status.
INFO
Learn more in Insurance Fund
Asset pool
A per-asset liquidity pool (e.g., XLM, USD) that holds data about total deposits, plain collateral supplied, and total loans for that asset.
Pool structure (pool config → pool state)
The market's policy and accounting layer. It defines pool rules and tracks live totals such as available liquidity, borrowed amounts, collateral, and fees. Each pool includes a reactive interest rate modifier (ir_reactivity_constant, target_utilization_ratio_bps, interest_rate_modifier) that dynamically adjusts rates based on utilization.
User obligations
A user's position record in a market, keyed by ObligationKey, that summarizes deposits, collateral, and borrows, and is used to assess whether the position remains safe. The optional seed in the key allows a single address to hold multiple isolated positions.
Cross-pool
Shared risk engine that evaluates positions across assets, allows collateral in one pool to support borrowing in another, and determines when liquidations are permitted.
AMM DEX
External exchange used for token swaps when needed during composable batch operations (e.g., flash borrow + swap + deposit).
Oracle
External price service that provides current asset prices so the market can value collateral and debt and run risk checks.
Liquidator
Permissionless third party that repays debt on unhealthy positions in exchange for collateral at a discount (liquidation bonus).
Detailed Component Reference
| Component | What it is | What it does | How it interacts |
|---|---|---|---|
| Market Manager admin | Protocol-level administrative role controlled via a multisig |
|
|
| Market Admin | Administrative actor for a specific (owned) market |
|
|
| User | Standard protocol participant (lender/borrower/reader) |
|
|
| Market Manager | Registry and factory for markets |
|
|
| Markets | Main functional contract of the protocol | There are 2 types of markets:
Functions
|
|
| Asset pool | Per-asset loan pools inside a market (e.g. XLM, USD) |
|
|
| Insurance fund | A per-market safety buffer implemented as a smart contract, funded primarily by protocol fees (take rate and configured portions of operation fees), with optional inflows from high-utilization exit fees and donations |
|
|
| Pool structure (pool config → pool state) | Internal representation of pool rules and live figures |
|
|
| User obligations | Unified storage for all user positions in a market, keyed by ObligationKey |
|
|
| Cross-pool | Shared risk and health logic across pools |
|
|
| AMM DEX (Swap Provider) | External swap venue (configurable via update_swap_provider) |
|
|
| Oracle | External SEP-40 price oracle |
|
|
| Liquidator | External, permissionless actor (not the borrower) |
|
|