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.

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
Maximum Borrow = Effective Collateral / 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
Health Factor = Effective Collateral Value / Effective Debt Value


_20
graph TD
_20
subgraph "Health Factor States"
_20
HF1[HF > 1.5<br/>Overcollateralized]
_20
HF2[HF: 1.3 - 1.5<br/>Healthy]
_20
HF3[HF: 1.1 - 1.3<br/>Below Target]
_20
HF4[HF: 1.0 - 1.1<br/>At Risk]
_20
HF5[HF < 1.0<br/>Liquidatable]
_20
end
_20
_20
HF1 --> Action1[Can borrow more]
_20
HF2 --> Action2[Optimal state]
_20
HF3 --> Action3[Should repay<br/>or add collateral]
_20
HF4 --> Action4[Urgent action<br/>needed]
_20
HF5 --> Action5[Liquidation<br/>imminent]
_20
_20
style HF1 fill:#bbf
_20
style HF2 fill:#bfb
_20
style HF3 fill:#ffa
_20
style HF4 fill:#fbb
_20
style HF5 fill:#f00,color:#fff

Your position's health can be understood across a spectrum: when HF > 1.5 you're overcollateralized and can borrow more; HF between 1.3 and 1.5 represents the healthy range; HF between 1.1 and 1.3 means you're below target and should repay or add collateral; HF between 1.0 and 1.1 puts you at risk of liquidation; and HF < 1.0 means your position is liquidatable and requires immediate action.

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


_14
graph LR
_14
subgraph "Auto-Borrowing Benefits"
_14
B1[Maximized<br/>Capital Efficiency]
_14
B2[Simplified<br/>Management]
_14
B3[Immediate<br/>Liquidity]
_14
B4[Automated<br/>Rebalancing]
_14
end
_14
_14
B1 --> Result[Optimal<br/>Position]
_14
B2 --> Result
_14
B3 --> Result
_14
B4 --> Result
_14
_14
style Result fill:#bfb,stroke:#333,stroke-width:3px

  1. Maximized Capital Efficiency: Automatically uses available borrowing capacity
  2. Simplified Position Management: No need to manually calculate safe borrow amounts
  3. Immediate Liquidity: Receive borrowed funds instantly upon deposit
  4. Automated Rebalancing: System maintains optimal health as market conditions change

When to Use Auto-Borrowing

Use auto-borrowing when:

  • You want to maximize capital efficiency
  • You're comfortable with leveraged positions
  • You trust automated position management
  • You want immediate access to borrowed funds

Don't use auto-borrowing when:

  • You want conservative collateralization
  • You prefer manual position control
  • You're testing or learning the protocol
  • You don't need immediate borrowing

Interest System

ALP uses a sophisticated interest system based on scaled balances and interest indices.

How Interest Accrues


_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).


_12
graph LR
_12
subgraph "Utilization vs Interest Rate"
_12
Low[0-80%<br/>Low Utilization<br/>Gradual increase]
_12
Opt[80%<br/>Optimal<br/>Target balance]
_12
High[80-100%<br/>High Utilization<br/>Steep increase]
_12
end
_12
_12
Low --> Opt
_12
Opt --> High
_12
_12
style Opt fill:#bfb
_12
style High fill:#fbb

Typical Rate Curve:


_10
Low Utilization (0-80%): Gradual rate increase
_10
Optimal Zone (80%): Target balance point
_10
High Utilization (80-100%): Steep rate increase to encourage repayment

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.

Example:


_10
Initial borrow: 1000 MOET
_10
Interest index at borrow: 1.0
_10
After 1 year at 10% APY:
_10
- New interest index: ~1.105 (continuous compounding)
_10
- Debt owed: 1000 * 1.105 = 1,105 MOET

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.

Oracle Safety Features


_14
graph LR
_14
subgraph "Oracle Protections"
_14
S1[Staleness Checks<br/><5 min old]
_14
S2[Deviation Guards<br/>Large jumps flagged]
_14
S3[Fallback Sources<br/>Alternative feeds]
_14
S4[TWAP Support<br/>Manipulation resistant]
_14
end
_14
_14
S1 --> Safe[Safe Price<br/>Feed]
_14
S2 --> Safe
_14
S3 --> Safe
_14
S4 --> Safe
_14
_14
style Safe fill:#bfb,stroke:#333,stroke-width:3px

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 ~$108 MOET

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

Multi-Token Support

ALP supports multiple token types as both collateral and debt.

Token Configuration


_22
graph TB
_22
subgraph Collateral
_22
C1[FLOW<br/>Factor: 0.8]
_22
C2[stFLOW<br/>Factor: 0.75]
_22
C3[USDC<br/>Factor: 0.9]
_22
end
_22
_22
subgraph Debt
_22
D1[MOET<br/>Primary]
_22
D2[FLOW<br/>Alternative]
_22
D3[USDC<br/>Alternative]
_22
end
_22
_22
C1 --> Health[Single Health<br/>Factor Calculation]
_22
C2 --> Health
_22
C3 --> Health
_22
_22
D1 --> Health
_22
D2 --> Health
_22
D3 --> Health
_22
_22
style Health fill:#f9f,stroke:#333,stroke-width:3px

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

You can borrow multiple token types including MOET (the primary borrowed asset), Flow, USDC, and other allowlisted tokens. Each position can have multiple simultaneous borrows, with health calculated across all assets.

Cross-Token Calculations

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 ✓ Healthy

Utilization and Protocol Dynamics

Utilization Rate


_10
graph LR
_10
Total[Total Available<br/>Capital] --> Borrowed[Amount<br/>Borrowed]
_10
Total --> Available[Amount<br/>Available]
_10
_10
Borrowed --> Util[Utilization Rate<br/>Borrowed / Total]
_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
Utilization = Total Borrowed / (Total Deposited + 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
Lender Interest = Borrower Interest × (1 - 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.

Risk Management

For Borrowers


_16
graph TD
_16
subgraph "Borrower Risk Management"
_16
R1[Monitor Health<br/>Factor Daily]
_16
R2[Set Alerts<br/>HF < 1.5]
_16
R3[Diversify<br/>Collateral]
_16
R4[Use Stable<br/>Assets]
_16
R5[Watch Price<br/>Volatility]
_16
end
_16
_16
R1 --> Safety[Reduced<br/>Liquidation Risk]
_16
R2 --> Safety
_16
R3 --> Safety
_16
R4 --> Safety
_16
R5 --> Safety
_16
_16
style Safety fill:#bfb,stroke:#333,stroke-width:3px

Borrowers should monitor their health factor by setting up alerts for HF < 1.5, keeping a buffer above the minimum (1.1), and watching for price volatility. Manage collateral wisely by diversifying across multiple tokens, using stable assets for lower risk, and considering collateral factors when depositing.

For Lenders

Lenders should understand the risks including smart contract risk, liquidation risk (if the protocol becomes undercollateralized), and interest rate volatility. To maximize returns, monitor utilization rates, deposit when rates are high, and consider different tokens for better yields.

Summary

Core Mechanics:

  • 💰 Collateral with safety factors (e.g., 0.8 = 80% usable)
  • 📊 Health factor = Effective Collateral / Debt
  • 🤖 Auto-borrowing optimizes capital efficiency
  • 📈 Scaled balance system for efficient interest

Key Formulas:

  • Max Borrow = Effective Collateral / Target Health
  • Health Factor = Effective Collateral / Effective Debt
  • Utilization = Total Borrowed / Total Available

Safety Features:

  • ✅ Oracle staleness checks and deviation guards
  • ✅ Multi-token support with unified health calculation
  • ✅ Reserve factor for protocol insurance
  • ✅ Continuous interest compounding

Mathematical Foundation

For detailed formulas underlying credit market mechanics:

Next Steps


Key Takeaway

ALP's credit market mechanics combine automated efficiency with robust safety features. The auto-borrowing feature, scaled interest system, and multi-token support create a powerful yet accessible lending platform. Understanding these mechanics helps you manage positions effectively and maximize your DeFi strategy.