LLM Notice: This documentation site supports content negotiation for AI agents. Request any page with Accept: text/markdown or Accept: text/plain header to receive Markdown instead of HTML. Alternatively, append ?format=md to any URL. All markdown files are available at /md/ prefix paths. For all content in one file, visit /llms-full.txt
Skip to main content

Credit Market Mechanics

ALP operates as a decentralized lending protocol where users can deposit collateral and borrow assets. Understanding the core mechanics is essential for effectively managing positions and maximizing capital efficiency. The auto-borrowing feature, scaled interest system, and multi-token support create a powerful yet accessible lending platform.

Basic Lending Mechanics

Collateral Deposits

When you deposit tokens into ALP, they become collateral that backs your borrowing capacity. However, not all collateral value is usable for borrowing.


_10
graph LR
_10
Deposit[Deposit<br/>1000 FLOW<br/>@ $1 each] --> Factor[Apply<br/>Collateral Factor<br/>0.8]
_10
Factor --> Effective[Effective Collateral<br/>$800]
_10
_10
Effective --> Borrow[Can Borrow<br/>$615 @ HF 1.3]
_10
_10
style Effective fill:#bfb,stroke:#333,stroke-width:2px

Each token has a collateral factor that determines what percentage of its value can be used. For example, depositing 1,000 FLOW worth $1,000 with a collateral factor of 0.8 results in $800 of effective collateral. This safety buffer protects the protocol against price volatility and ensures positions remain solvent even with market fluctuations.

Borrowing Limits

Your borrowing capacity depends on two key factors:

  1. Effective Collateral: Total collateral value × collateral factor
  2. Target Health Ratio: Minimum ratio of collateral to debt

Formula:


_10
\text{Maximum Borrow} = \frac{\text{Effective Collateral}}{\text{Target Health Ratio}}

See FCM Mathematical Foundations for detailed formulas and derivations.

Example with target health of 1.3:

  • Effective collateral: $800 (from 1,000 FLOW at 0.8 factor)
  • Target health: 1.3
  • Maximum borrow: $800 / 1.3 ≈ $615.38

Health Factor

The health factor is the most important metric for your position:


_10
\text{Health Factor} = \frac{\text{Effective Collateral Value}}{\text{Effective Debt Value}}

Health Factor States:

  • HF > 1.5 (Overcollateralized): Your position can safely borrow more. This is the trigger point for auto-borrowing.
  • HF: 1.3 - 1.5 (Healthy): Optimal state with good safety margin. Position is balanced and secure.
  • HF: 1.1 - 1.3 (Below Target): Below the target health factor. Consider repaying debt or adding collateral.
  • HF: 1.0 - 1.1 (At Risk): Approaching liquidation threshold. Urgent action needed to avoid liquidation.
  • HF < 1.0 (Liquidatable): Position is underwater and can be liquidated. Immediate action required.

Auto-Borrowing Feature

ALP includes an innovative auto-borrowing feature that automatically manages your position to maintain optimal health ratios.

How Auto-Borrowing Works


_14
sequenceDiagram
_14
participant User
_14
participant ALP
_14
participant DrawDownSink
_14
_14
User->>ALP: Deposit 1000 FLOW<br/>pushToDrawDownSink=true
_14
ALP->>ALP: Calculate effective<br/>collateral: $800
_14
ALP->>ALP: Calculate max borrow<br/>at HF 1.3: $615.38
_14
ALP->>ALP: Auto-borrow 615.38 MOET
_14
ALP->>DrawDownSink: Push MOET
_14
DrawDownSink->>User: Funds deployed
_14
ALP->>User: Position created<br/>HF = 1.3
_14
_14
Note over User,DrawDownSink: Automatic optimization!

When you create a position with pushToDrawDownSink=true, you deposit collateral (e.g., 1,000 FLOW), the system calculates your maximum safe borrowing capacity, automatically borrows MOET to reach target health (1.3), and sends the borrowed MOET to your DrawDown Sink.

Example:


_10
Deposit 1000 Flow with collateralFactor=0.8
_10
Target health = 1.3
_10
_10
Effective collateral = 1000 * 1.0 (price) * 0.8 = 800
_10
Auto-borrow amount = 800 / 1.3 ≈ 615.38 MOET
_10
_10
Result:
_10
- Position health: 1.3 (at target)
_10
- User receives: ~615.38 MOET via DrawDownSink
_10
- Collateral locked: 1000 FLOW

Opting Out of Auto-Borrowing

You can disable auto-borrowing by setting pushToDrawDownSink=false when creating your position. With auto-borrowing disabled, your collateral is deposited without any automatic borrowing occurring, your health factor starts very high (>1.5), and you manually borrow when needed.

Benefits of Auto-Borrowing

Auto-borrowing maximizes capital efficiency by automatically using your available borrowing capacity without requiring manual calculations of safe borrow amounts. When you deposit collateral, the system immediately provides liquidity by borrowing on your behalf, then maintains optimal position health through automated rebalancing as market conditions change. This approach ensures your position always operates at peak efficiency while staying within safe health factor ranges.

Interest System

ALP uses an interest system based on scaled balances and interest indices.


_10
graph TD
_10
User[User Borrows<br/>1000 MOET] --> Scaled[Record Scaled Balance<br/>1000 / 1.0 = 1000]
_10
Scaled --> Time[Time Passes]
_10
Time --> Index[Interest Index<br/>Grows to 1.05]
_10
Index --> Current[Current Debt<br/>1000 × 1.05 = 1050]
_10
_10
Note1[No transaction<br/>needed!]
_10
Time -.-> Note1
_10
_10
style Current fill:#fbb

Instead of updating every user's balance constantly, ALP:

  1. Tracks your scaled balance: actual balance / interest index at deposit
  2. Updates a global interest index as time passes
  3. Calculates your current balance: scaled balance × current interest index

This means your debt and deposits grow automatically without requiring transactions.

See FCM Mathematical Foundations for detailed formulas.

Interest Rates

Interest rates in ALP are determined by the utilization rate (percentage of available capital currently borrowed), a base rate (minimum interest rate when utilization is low), slope rates (how quickly rates increase as utilization rises), and optimal utilization (target utilization for balanced rates).

Interest Rate Curve by Utilization:

Utilization RangeInterest Rate BehaviorPurpose
0% - 80% (Low)Gradual, slow increaseEncourages borrowing while maintaining liquidity
80% (Optimal)Target balance pointIdeal equilibrium between lenders and borrowers
80% - 100% (High)Steep, rapid increaseIncentivizes debt repayment and new deposits

Example rates:

  • At 40% utilization: ~5% APR (gentle slope)
  • At 80% utilization: ~15% APR (optimal point)
  • At 95% utilization: ~50% APR (steep slope to protect liquidity)

Compound Interest

Interest in ALP compounds continuously as the interest index grows, with borrowers paying compound interest on debt, lenders earning compound interest on deposits, and interest index updates reflecting accumulated compounding.

Price Oracle System

Accurate pricing is critical for maintaining protocol solvency. ALP uses a price oracle with multiple safety features.

Price Feeds

All token prices are quoted in terms of the default token (MOET):


_12
graph TD
_12
MOET[MOET<br/>Unit of Account] --> P1[FLOW/MOET<br/>Price]
_12
MOET --> P2[USDC/MOET<br/>Price]
_12
MOET --> P3[stFLOW/MOET<br/>Price]
_12
MOET --> P4[Other Tokens<br/>Prices]
_12
_12
P1 --> Calc[Health Factor<br/>Calculations]
_12
P2 --> Calc
_12
P3 --> Calc
_12
P4 --> Calc
_12
_12
style MOET fill:#fbb,stroke:#333,stroke-width:3px

All token prices are quoted in terms of MOET (FLOW/MOET, USDC/MOET, and other token prices), which simplifies calculations and ensures consistency across the protocol.

The oracle employs staleness checks to ensure prices are recent (typically < 5 minutes old), deviation guards that reject or flag large price jumps, fallback mechanisms providing alternative price sources if the primary fails, and TWAP support using time-weighted average prices to reduce manipulation risk.

How Prices Affect Positions

Price changes directly impact your health factor:


_11
graph TD
_11
Initial[Initial State<br/>1000 FLOW @ $1<br/>Debt: $600<br/>HF: 1.67]
_11
_11
Initial --> Up[Price Increase<br/>FLOW → $1.20]
_11
Initial --> Down[Price Decrease<br/>FLOW → $0.80]
_11
_11
Up --> UpResult[New HF: 2.0<br/>Can borrow more!]
_11
Down --> DownResult[New HF: 1.33<br/>May trigger rebalancing]
_11
_11
style UpResult fill:#bfb
_11
style DownResult fill:#ffa

Collateral price increases: Health improves, can borrow more


_10
Before: 1000 FLOW @ $1 = $1000, Debt = $600, HF = 1.67
_10
After: 1000 FLOW @ $1.20 = $1200, Debt = $600, HF = 2.0
_10
→ Can borrow additional ~$200 MOET to have HF = 1.5

Collateral price decreases: Health worsens, may need to repay


_10
Before: 1000 FLOW @ $1 = $1000, Debt = $600, HF = 1.67
_10
After: 1000 FLOW @ $0.80 = $800, Debt = $600, HF = 1.33
_10
→ Close to target health, rebalancing may trigger up to 66.67 MOET for HF = 1.5

Multi-Token Support

ALP supports multiple token types as both collateral and debt.

Collateral Tokens

Any supported token can be used as collateral, including Flow, stFlow, USDC, and other allowlisted tokens. Each token has its own collateral factor, price feed, and interest rate parameters.

Debt Tokens

MOET is the primary debt token in ALP. All borrowing positions are denominated in MOET, which serves as the unit of account for the protocol. This ensures consistent pricing and health factor calculations across all positions.

When you have multiple tokens, ALP converts all collateral and debt to the default token (MOET) value, calculates a single health factor across all positions, and ensures the total position remains solvent.

Example:


_10
Collateral:
_10
- 1000 FLOW @ $1 each, factor 0.8 = $800 effective
_10
- 500 USDC @ $1 each, factor 0.9 = $450 effective
_10
Total effective collateral: $1,250
_10
_10
Debt:
_10
- 800 MOET @ $1 each = $800 debt
_10
Health Factor = 1,250 / 800 = 1.56

Utilization and Protocol Dynamics

Utilization Rate


_10
graph LR
_10
Total[Total Available<br/>Capital] --> Borrowed[Amount<br/>Borrowed]
_10
Total --> Available[Amount<br/>Supplied]
_10
_10
Borrowed --> Util[Utilization Rate<br/>Borrowed / Supplied]
_10
_10
Util --> Low[Low <80%<br/>Lower rates]
_10
Util --> High[High >80%<br/>Higher rates]
_10
_10
style Util fill:#bbf,stroke:#333,stroke-width:2px

The protocol tracks utilization for each token:


_10
\text{Utilization} = \frac{\text{Total Borrowed}}{\text{Total Supplied + Reserves}}

Higher utilization leads to higher interest rates for borrowers, higher yields for lenders, and incentives to add liquidity or repay loans.

Reserve Factor

A portion of interest goes to protocol reserves:


_10
\text{Lender Interest} = \text{Borrower Interest} \times (1 - \text{Reserve Factor})


_10
graph LR
_10
Borrower[Borrower Pays<br/>100 Interest] --> Protocol[Protocol<br/>Reserve Factor]
_10
Protocol --> Reserve[20 to<br/>Reserves]
_10
Protocol --> Lender[80 to<br/>Lenders]
_10
_10
Reserve --> Uses[Insurance Fund<br/>Development<br/>Emergency<br/>Treasury]
_10
_10
style Reserve fill:#ffa
_10
style Lender fill:#bfb

Reserves are used for the protocol insurance fund, development and maintenance, emergency situations, and the governance-controlled treasury.

Mathematical Foundation

For detailed formulas underlying credit market mechanics:

Next Steps