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

Mathematical Foundations of FCM

This document explains the mathematical models and formulas that power Flow Credit Market. Understanding these fundamentals helps you reason about system behavior and make informed decisions.

tip

These mathematical foundations ensure FCM operates predictably and safely. All formulas are implemented on-chain and can be verified by examining the smart contracts.

Core Variables

Token-Level Variables

VariableSymbolDescription
Price$P_t$Price of token $t$ in MOET terms
Collateral Factor$CF_t$Usable percentage of token $t$ value (0 < $CF_t$ ≤ 1)
Borrow Factor$BF_t$Multiplier for borrowed token $t$ (typically 1.0)
Amount$A_t$Quantity of token $t$

Position-Level Variables

VariableSymbolDescription
Effective Collateral$EC$Total usable collateral value in MOET
Effective Debt$ED$Total debt value in MOET
Health Factor$HF$Ratio of collateral to debt
Target Health$TargetHF$Desired health ratio (typically 1.3)
Min Health$MinHF$Minimum before rebalancing (typically 1.1)
Max Health$MaxHF$Maximum before rebalancing (typically 1.5)

Interest Variables

VariableSymbolDescription
Interest Index$I_t(n)$Interest index for token $t$ at time $n$
Scaled Balance$ScaledBalance$Balance divided by interest index
True Balance$TrueBalance$Actual balance including accrued interest
Interest Rate$r$Annual interest rate

Fundamental Formulas

1. Effective Collateral

The effective collateral is the sum of all collateral assets multiplied by their prices and collateral factors:


_10
EC = ∑(A_t × P_t × CF_t), t ∈ Collateral

Example:


_10
Collateral assets:
_10
- 1000 FLOW @ $1 each, CF = 0.8
_10
- 500 USDC @ $1 each, CF = 0.9
_10
_10
EC = (1000 × 1 × 0.8) + (500 × 1 × 0.9)
_10
= 800 + 450
_10
= $1250 MOET

2. Effective Debt

The effective debt is the sum of all borrowed assets multiplied by their prices and borrow factors:


_10
ED = \sum_t \in Debt A_t × P_t × BF_t

Borrow Factor (BF) is a risk adjustment multiplier applied to debt. While typically set to 1.0 for standard assets like MOET, the borrow factor can be increased above 1.0 for riskier or more volatile borrowed assets. This makes the effective debt higher than the nominal debt, requiring more collateral to maintain the same health factor. For example, a BF of 1.2 means borrowing $100 of that asset counts as $120 of effective debt, providing an extra safety margin for the protocol.

Example:


_10
Debt:
_10
- 800 MOET @ $1 each, BF = 1.0
_10
_10
ED = 800 × 1 × 1.0
_10
= $800 MOET

3. Health Factor

The health factor is the ratio of effective collateral to effective debt:


_10
HF = (EC / ED)

Critical thresholds:

  • $HF < 1.0$: Position is liquidatable
  • $HF = 1.0$: Exactly at liquidation threshold
  • $HF > 1.0$: Position is solvent

Example:


_10
EC = $1250, ED = $800
_10
_10
HF = 1250 / 800 = 1.5625

4. Maximum Borrowing Capacity

The maximum amount that can be borrowed to reach target health:


_10
MaxBorrow = EC / TargetHF

Derivation:


_10
We want: HF = EC / ED = TargetHF
_10
Therefore: ED = EC / TargetHF

Example:


_10
EC = $1250
_10
TargetHF = 1.3
_10
_10
Max Borrow = 1250 / 1.3 = $961.54 MOET

Auto-Borrowing Mathematics

Initial Auto-Borrow Amount

When a user deposits collateral with pushToDrawDownSink=true, the system calculates the initial borrow amount:


_10
BorrowAmount = (EC / TargetHF)

Step-by-step calculation:

  1. Calculate effective collateral:

_10
EC = A_collateral × P_collateral × CF_collateral

  1. Calculate target debt:

_10
ED_target = (EC / TargetHF)

  1. Borrow to reach target:

_10
Borrow = ED_target = (EC / TargetHF)

Complete example:


_15
User deposits: 1000 FLOW
_15
FLOW price: $1.00
_15
Collateral factor: 0.8
_15
Target health: 1.3
_15
_15
Step 1: EC = 1000 × 1.00 × 0.8 = $800
_15
_15
Step 2: ED_target = 800 / 1.3 = $615.38
_15
_15
Step 3: Borrow = $615.38 MOET
_15
_15
Result:
_15
- Collateral: 1000 FLOW ($800 effective)
_15
- Debt: 615.38 MOET
_15
- Health: 800 / 615.38 = 1.30

Rebalancing Mathematics

Overcollateralized Rebalancing (HF > MaxHF)

When health exceeds maximum, calculate additional borrowing capacity:


_10
AdditionalBorrow = (EC / TargetHF) - CurrentED

Proof:


_10
Want: HF_new = TargetHF
_10
HF_new = EC / ED_new = TargetHF
_10
ED_new = EC / TargetHF
_10
_10
Additional borrow = ED_new - CurrentED
_10
= (EC / TargetHF) - CurrentED

Example:


_13
Current state:
_13
- EC = $800
_13
- ED = $400
_13
- HF = 800 / 400 = 2.0 (> MaxHF of 1.5)
_13
_13
Calculate additional borrow:
_13
ED_target = 800 / 1.3 = $615.38
_13
Additional = 615.38 - 400 = $215.38 MOET
_13
_13
After borrowing $215.38:
_13
- EC = $800 (unchanged)
_13
- ED = $615.38
_13
- HF = 800 / 615.38 = 1.30

Undercollateralized Rebalancing (HF < MinHF)

When health falls below minimum, calculate required repayment:


_10
RequiredRepayment = CurrentED - (EC / TargetHF)

Proof:


_10
Want: HF_new = TargetHF
_10
HF_new = EC / ED_new = TargetHF
_10
ED_new = EC / TargetHF
_10
_10
Required repayment = CurrentED - ED_new
_10
= CurrentED - (EC / TargetHF)

Example:


_15
Price drops! Collateral value decreases.
_15
_15
New state:
_15
- EC = $640 (was $800, FLOW dropped 20%)
_15
- ED = $615.38 (unchanged)
_15
- HF = 640 / 615.38 = 1.04 (< MinHF of 1.1)
_15
_15
Calculate required repayment:
_15
ED_target = 640 / 1.3 = $492.31
_15
Repayment = 615.38 - 492.31 = $123.07 MOET
_15
_15
After repaying $123.07:
_15
- EC = $640 (unchanged)
_15
- ED = $492.31
_15
- HF = 640 / 492.31 = 1.30

Interest Mathematics

Scaled Balance System

Instead of updating every position's balance when interest accrues, FCM stores a "scaled" version of each balance that remains constant over time. This scaled balance is the actual balance divided by a global interest index, allowing the protocol to track interest for thousands of positions with minimal gas costs.


_10
ScaledBalance = \frac{TrueBalance}{I_t}

Where:

  • $ScaledBalance$: Stored scaled balance
  • $TrueBalance$: Actual balance including interest
  • $I_t$: Current interest index

Key insight: Scaled balance stays constant while interest index grows.

Interest Index Growth

The interest index is a global multiplier that starts at 1.0 and grows over time based on the current interest rate. Every time the protocol updates, the index increases slightly, and this single update effectively compounds interest for all positions simultaneously.


_10
I_t(n+1) = I_t(n) × (1 + r × \Delta t)

Where:

  • $r$: Annual interest rate (e.g., 0.10 for 10%)
  • $\Delta t$: Time elapsed (in years)

For compound interest:


_10
I_t(n) = I_0 × e^{r × t}

Where $e$ is Euler's number (≈2.718).

True Balance Calculation

When you need to know the actual current balance of a position (including all accrued interest), you multiply the stored scaled balance by the current interest index. This calculation happens on-demand only when the position is accessed, not on every block.


_10
TrueBalance(t) = ScaledBalance × I_t

Example:


_10
Initial deposit: 1000 MOET
_10
Initial index: I_0 = 1.0
_10
Scaled balance: ScaledBalance = 1000 / 1.0 = 1000
_10
_10
After 1 year at 10% APY:
_10
Interest index: I_1 = 1.0 × e^(0.10 × 1) ≈ 1.105
_10
True balance: TrueBalance = 1000 × 1.105 = 1105 MOET
_10
_10
User's debt grew from 1000 to 1105 MOET (10.5% with compound interest)

Why Scaled Balances?

The scaled balance system is a gas optimization that makes FCM economically viable even with thousands of active positions. By storing balances in a scaled form and only updating a single global index, the protocol avoids the prohibitive cost of updating every position on every block.

Without scaled balances:


_10
Every block (every ~2 seconds):
_10
- Update interest index
_10
- Iterate through ALL positions
_10
- Update each position's balance
_10
- Gas cost: O(n) where n = number of positions

With scaled balances:


_10
Every block:
_10
- Update interest index only
_10
- Gas cost: O(1)
_10
_10
When position is touched:
_10
- Calculate true balance: scaled × index
_10
- Gas cost: O(1) per position

Result: Massive gas savings for the protocol!

Liquidation Mathematics

Liquidation Trigger

A position becomes liquidatable when:


_10
HF < 1.0

Equivalently:


_10
EC < ED

Liquidation Target

Liquidations aim to restore health to a target (typically 1.05):


_10
Target HF = 1.05

Collateral Seized Calculation

The amount of collateral to seize depends on the implementation approach used by the protocol.

Simplified Formula (used in basic examples and documentation):


_10
CollateralSeized = (DebtRepaid × (1 + bonus)) / PriceCollateral

Where:

  • $DebtRepaid$: Amount of debt repaid by liquidator (in MOET or debt token)
  • $bonus$: Liquidation bonus (e.g., 0.05 for 5%)
  • $PriceCollateral$: Market price of collateral token in MOET terms

Complete Formula (actual FCM implementation):


_10
CollateralSeized = [(DebtRepaid × PriceDebt) / BorrowFactor] × (1 + bonus) / (PriceCollateral × CollateralFactor)

Where:

  • $DebtRepaid$: Amount of debt repaid by liquidator
  • $PriceDebt$: Oracle price of debt token (in MOET terms, typically 1.0 for MOET)
  • $BorrowFactor$: Risk parameter for debt (typically 1.0)
  • $bonus$: Liquidation bonus (e.g., 0.05 for 5%)
  • $PriceCollateral$: Oracle price of collateral token (in MOET terms)
  • $CollateralFactor$: Risk parameter for collateral (e.g., 0.8 for FLOW)

Why the difference? The simplified formula assumes debt price = 1.0, borrow factor = 1.0, and ignores the collateral factor in seizure (treating it as only affecting borrowing capacity). The complete formula properly accounts for all risk parameters and token prices as implemented in the actual protocol.

For MOET debt with typical parameters:

  • $PriceDebt$ = 1.0 (MOET)
  • $BorrowFactor$ = 1.0
  • This simplifies the numerator to: $(DebtRepaid × 1.0)/ 1.0 = DebtRepaid$

The collateral factor appears in the denominator because it affects how much collateral value must be seized to repay the effective debt. Since effective collateral is calculated as $CollateralAmount × PriceCollateral × CollateralFactor$, seizing collateral to cover debt requires dividing by the CollateralFactor to get the actual token amount.

Example using simplified formula:


_22
Liquidatable position:
_22
- Collateral: 1000 FLOW @ $0.60 = $600 total value
_22
- Effective collateral: $600 × 0.8 CF = $480
_22
- Debt: 650 MOET @ $1.00
_22
- HF = 480 / 650 = 0.738 < 1.0
_22
_22
Partial liquidation using simplified formula:
_22
- Liquidator repays: 150 MOET
_22
- Liquidation bonus: 5%
_22
- Collateral seized = (150 × 1.05) / 0.60 = 262.5 FLOW
_22
- Value of seized collateral: 262.5 × $0.60 = $157.50
_22
_22
After partial liquidation:
_22
- Remaining collateral: 1000 - 262.5 = 737.5 FLOW @ $0.60 = $442.50
_22
- Effective collateral: $442.50 × 0.8 = $354.00
_22
- Remaining debt: 650 - 150 = 500 MOET
_22
- New HF = 354.00 / 500 = 0.708 (still liquidatable)
_22
_22
Liquidator's profit:
_22
- Paid: $150 (debt repayment)
_22
- Received: $157.50 worth of FLOW
_22
- Profit: $7.50 (5% bonus on $150)

Example using complete formula:


_32
Same liquidatable position as above.
_32
_32
Partial liquidation using complete formula:
_32
- DebtRepaid: 150 MOET
_32
- PriceDebt: 1.0 (MOET)
_32
- BorrowFactor: 1.0
_32
- Liquidation bonus: 5% (0.05)
_32
- PriceCollateral: 0.60 (FLOW in MOET terms)
_32
- CollateralFactor: 0.8
_32
_32
CollateralSeized = (150 × 1.0 / 1.0) × 1.05 / (0.60 × 0.8)
_32
= 157.50 / 0.48
_32
= 328.125 FLOW
_32
_32
Value of seized collateral: 328.125 × $0.60 = $196.875
_32
_32
After partial liquidation:
_32
- Remaining collateral: 1000 - 328.125 = 671.875 FLOW @ $0.60 = $403.125
_32
- Effective collateral: $403.125 × 0.8 = $322.50
_32
- Remaining debt: 650 - 150 = 500 MOET
_32
- New HF = 322.50 / 500 = 0.645 (still liquidatable, but lower than simplified)
_32
_32
Liquidator's profit:
_32
- Paid: $150 (debt repayment)
_32
- Received: $196.875 worth of FLOW
_32
- Profit: $46.875 (31.25% effective bonus!)
_32
_32
Note: The complete formula gives the liquidator significantly more collateral because
_32
it divides by the CollateralFactor. This compensates for the risk discount applied
_32
to the collateral. In practice, the actual FlowCreditMarket implementation uses the
_32
quoteLiquidation() function which calculates the exact amounts needed to reach the
_32
target health factor of 1.05.

Required Debt Repayment for Target Health

To restore a position to the target health factor (typically 1.05), we need to find how much debt to repay. This is complex because seizing collateral also reduces the effective collateral simultaneously.

Goal: Achieve a specific target health factor after liquidation:


_10
HF_target = EC_after / ED_after

The challenge: Both EC and ED change during liquidation:


_10
EC_after = EC_current - (Collateral Seized × Price × CF)
_10
ED_after = ED_current - Debt Repaid

Using the simplified seizure formula:


_10
Collateral Seized = (Debt Repaid × (1 + bonus)) / Price

The effective collateral value seized is:


_10
EC_seized = Collateral Seized × Price × CF
_10
= [(Debt Repaid × (1 + bonus)) / Price] × Price × CF
_10
= Debt Repaid × (1 + bonus) × CF

Substituting into the target health equation:


_10
HF_target = [EC_current - Debt Repaid × (1 + bonus) × CF] / [ED_current - Debt Repaid]

Solving for Debt Repaid:


_10
HF_target × (ED_current - Debt Repaid) = EC_current - Debt Repaid × (1 + bonus) × CF
_10
_10
HF_target × ED_current - HF_target × Debt Repaid = EC_current - Debt Repaid × (1 + bonus) × CF
_10
_10
HF_target × ED_current - EC_current = HF_target × Debt Repaid - Debt Repaid × (1 + bonus) × CF
_10
_10
HF_target × ED_current - EC_current = Debt Repaid × [HF_target - (1 + bonus) × CF]

Final formula:


_10
Debt Repaid = (HF_target × ED_current - EC_current) / [HF_target - (1 + bonus) × CF]

Working example:


_28
Initial position (severely undercollateralized):
_28
- Collateral: 1000 FLOW @ $0.50 (price dropped significantly!)
_28
- EC = 1000 × 0.50 × 0.8 = $400
_28
- ED = 615.38 MOET
_28
- Current HF = 400 / 615.38 = 0.65 < 1.0 (liquidatable!)
_28
- Target HF = 1.05
_28
- Liquidation bonus = 5% (0.05)
_28
- Collateral Factor (CF) = 0.8
_28
_28
Step 1: Calculate required debt repayment
_28
Debt Repaid = (1.05 × 615.38 - 400) / [1.05 - (1.05 × 0.8)]
_28
= (646.15 - 400) / [1.05 - 0.84]
_28
= 246.15 / 0.21
_28
= 1,172.14 MOET
_28
_28
This is more than the total debt! This means the position cannot be restored to HF = 1.05
_28
because there isn't enough collateral. This would be a full liquidation case.
_28
_28
Step 2: Calculate maximum achievable HF
_28
If all debt is repaid (615.38 MOET):
_28
Collateral seized = (615.38 × 1.05) / 0.50 = 1,292.30 FLOW
_28
But we only have 1000 FLOW, so this is a full liquidation.
_28
_28
In full liquidation:
_28
- All 1000 FLOW seized → value = $500
_28
- Effective value for liquidator = $500
_28
- Debt repaid = 500 / 1.05 = $476.19 MOET (limited by collateral available)
_28
- Remaining debt = 615.38 - 476.19 = $139.19 (bad debt for protocol)

Better example with partial liquidation: k


_26
Initial position (moderately undercollateralized):
_26
- Collateral: 1000 FLOW @ $0.78
_26
- EC = 1000 × 0.78 × 0.8 = $624
_26
- ED = 650 MOET
_26
- Current HF = 624 / 650 = 0.96 < 1.0 (liquidatable)
_26
- Target HF = 1.05
_26
- Bonus = 5% (0.05)
_26
- CF = 0.8
_26
_26
Step 1: Calculate debt repayment
_26
Debt Repaid = (1.05 × 650 - 624) / [1.05 - (1.05 × 0.8)]
_26
= (682.5 - 624) / [1.05 - 0.84]
_26
= 58.5 / 0.21
_26
= 278.57 MOET
_26
_26
Step 2: Verify the calculation
_26
Collateral seized = (278.57 × 1.05) / 0.78 = 375.33 FLOW
_26
EC seized = 375.33 × 0.78 × 0.8 = $234.21
_26
EC after = 624 - 234.21 = $389.79
_26
ED after = 650 - 278.57 = $371.43
_26
HF after = 389.79 / 371.43 = 1.049 ≈ 1.05 ✓
_26
_26
Step 3: Liquidator's outcome
_26
Collateral received: 375.33 FLOW @ $0.78 = $292.76
_26
Debt repaid: $278.57
_26
Profit: $292.76 - $278.57 = $14.19 (5.09% return)

Key insights:

  1. The formula works when there's sufficient collateral to reach target HF
  2. When Debt Repaid > ED_current, it indicates a full liquidation scenario
  3. The denominator [HF_target - (1 + bonus) × CF] is typically small (0.21 in this example), meaning small changes in EC/ED require large debt repayments
  4. The liquidation becomes more efficient (smaller debt repayment needed) when the current HF is closer to the target HF

Price Impact Analysis

Health Factor Sensitivity to Price Changes

Given a percentage change in collateral price:


_10
HF_new = HF_old × \frac{P_new}{P_old}

Derivation:


_10
HF_old = EC_old / ED = (A × P_old × CF) / ED
_10
_10
HF_new = EC_new / ED = (A × P_new × CF) / ED
_10
_10
HF_new / HF_old = P_new / P_old
_10
_10
Therefore: HF_new = HF_old × (P_new / P_old)

Example:


_10
Initial: HF = 1.5, Price = $1.00
_10
_10
Price drops 20% to $0.80:
_10
HF_new = 1.5 × (0.80 / 1.00) = 1.5 × 0.80 = 1.20
_10
_10
Price drops 30% to $0.70:
_10
HF_new = 1.5 × (0.70 / 1.00) = 1.5 × 0.70 = 1.05 (approaching danger!)
_10
_10
Price drops 35% to $0.65:
_10
HF_new = 1.5 × (0.65 / 1.00) = 1.5 × 0.65 = 0.975 < 1.0 (liquidatable!)

Maximum Safe Price Drop

What's the maximum price drop before liquidation?


_10
MaxDropPercent = 1 - (1.0 / HF_current)

Derivation:


_10
Want: HF_new = 1.0 (liquidation threshold)
_10
HF_new = HF_old × (P_new / P_old) = 1.0
_10
_10
P_new / P_old = 1.0 / HF_old
_10
_10
P_new = P_old / HF_old
_10
_10
Drop = P_old - P_new = P_old × (1 - 1/HF_old)
_10
_10
Drop % = 1 - 1/HF_old

Examples:


_10
HF = 1.3: Max drop = 1 - 1/1.3 = 23.08%
_10
HF = 1.5: Max drop = 1 - 1/1.5 = 33.33%
_10
HF = 2.0: Max drop = 1 - 1/2.0 = 50.00%
_10
HF = 1.1: Max drop = 1 - 1/1.1 = 9.09% (very risky!)

Multi-Collateral Mathematics

Multiple Collateral Types

With multiple collateral types:


_10
EC = ∑(A_i × P_i × CF_i)

Where the sum is taken over all n collateral token types.

Effective Collateral with Price Correlation

When collateral types are correlated (e.g., FLOW and stFLOW):

Simplified (no correlation):


_10
Risk = \sum_i Risk_i

With correlation (advanced):


_10
Risk = \sqrt{\sum_i\sum_j w_i w_j \sigma_i \sigma_j \rho_ij}

Where:

  • $w_i$: Weight of asset $i$
  • $\sigma_i$: Volatility of asset $i$
  • $\rho_ij$: Correlation between assets $i$ and $j$

Practical impact:


_10
Scenario 1: Uncorrelated collateral
_10
- 50% FLOW (volatile)
_10
- 50% USDC (stable)
_10
- Effective diversification
_10
_10
Scenario 2: Correlated collateral
_10
- 50% FLOW (volatile)
_10
- 50% stFLOW (volatile, correlated with FLOW)
_10
- Limited diversification
_10
- Both can drop together!

Yield Calculations

Simple APY

Annual Percentage Yield without compounding:


_10
APY_simple = ((FinalValue - InitialValue) / InitialValue) × (365 / Days)

Compound APY

With continuous compounding:


_10
APY_compound = e^r - 1

Where $r$ is the continuous annual rate.

Leveraged Yield

When borrowing to increase yield exposure:


_10
Yield_leveraged = Yield_strategy - Interest_borrowed

Example:


_13
Deposit: $1000 collateral
_13
Borrow: $615 at 5% APY
_13
Deploy $615 to strategy earning 10% APY
_13
_13
Costs:
_13
- Interest on borrowed: 615 × 0.05 = $30.75/year
_13
_13
Returns:
_13
- Yield from strategy: 615 × 0.10 = $61.50/year
_13
_13
Net leveraged yield: 61.50 - 30.75 = $30.75/year
_13
Effective APY on your $1000: 30.75 / 1000 = 3.075% extra
_13
Total return: Base yield + leveraged yield

Risk Metrics

Liquidation Risk Score

A simplified risk score:


_10
\text{Risk Score} = (1 / HF - 1.0) × \text{Volatility Collateral}

Higher score = higher risk.

Value at Risk (VaR)

Maximum expected loss over time period at confidence level 95%:


_10
VaR(95) = EC × σ × z(0.95)

Where:

  • σ: Daily volatility of collateral
  • z(0.95): Z-score for 95% confidence (≈1.645)

Example:


_10
Collateral: $1000 FLOW
_10
Daily volatility: 5%
_10
Confidence: 95%
_10
_10
VaR = 1000 × 0.05 × 1.645 = $82.25
_10
_10
Interpretation: 95% confident that daily loss won't exceed $82.25

Validation & Safety Checks

Health Factor Bounds

All operations must satisfy:


_10
1.0 ≤ MinHF < TargetHF < MaxHF

Typical values: $MinHF = 1.1$, $TargetHF = 1.3$, $MaxHF = 1.5$

Collateral Factor Bounds

For safety:


_10
0 < CF_t ≤ 1.0

Typically:

  • Volatile assets (FLOW): $CF = 0.75 - 0.85$
  • Stable assets (USDC): $CF = 0.90 - 0.95$
  • Liquid staking (stFLOW): $CF = 0.80 - 0.85$

Maximum Leverage

Maximum theoretical leverage:


_10
MaxLeverage = \frac{1}{1 - CF}

Examples:


_10
CF = 0.8: Max leverage = 1 / (1 - 0.8) = 5x
_10
CF = 0.75: Max leverage = 1 / (1 - 0.75) = 4x
_10
CF = 0.9: Max leverage = 1 / (1 - 0.9) = 10x (risky!)

But actual safe borrowing is constrained by target health:

Safe Debt Ratio

Maximum debt-to-collateral ratio while maintaining target health:


_10
SafeDebtRatio = CF / TargetHF

Examples:


_10
CF = 0.8, TargetHF = 1.3: Safe debt ratio = 0.8 / 1.3 ≈ 0.615
_10
CF = 0.75, TargetHF = 1.5: Safe debt ratio = 0.75 / 1.5 = 0.50

This means with CF = 0.8 and TargetHF = 1.3, you can safely borrow up to $0.615 for every $1 of collateral value.

Practical Examples

Complete Position Lifecycle Math


_36
=== Initial Deposit ===
_36
Deposit: 1000 FLOW @ $1.00
_36
CF = 0.8, TargetHF = 1.3
_36
_36
EC = 1000 × 1.00 × 0.8 = $800
_36
Borrow = 800 / 1.3 = $615.38 MOET
_36
HF = 800 / 615.38 = 1.30 ✓
_36
_36
=== Price Drop 20% ===
_36
New price: $0.80
_36
EC = 1000 × 0.80 × 0.8 = $640
_36
ED = $615.38 (unchanged)
_36
HF = 640 / 615.38 = 1.04 < 1.1 ⚠️
_36
_36
Rebalance needed:
_36
ED_target = 640 / 1.3 = $492.31
_36
Repay = 615.38 - 492.31 = $123.07
_36
_36
After repayment:
_36
EC = $640, ED = $492.31
_36
HF = 640 / 492.31 = 1.30 ✓
_36
_36
=== Price Recovery to $1.00 ===
_36
EC = 1000 × 1.00 × 0.8 = $800
_36
ED = $492.31
_36
HF = 800 / 492.31 = 1.625 > 1.5 ⚠️
_36
_36
Rebalance needed:
_36
ED_target = 800 / 1.3 = $615.38
_36
Borrow = 615.38 - 492.31 = $123.07
_36
_36
After borrowing:
_36
EC = $800, ED = $615.38
_36
HF = 800 / 615.38 = 1.30 ✓
_36
_36
Position back to optimal state!

Next Steps