Position Lifecycle
A Position in ALP represents your lending account. Understanding the complete lifecycle from creation to closure helps you manage your positions effectively and maximize your DeFi strategy. A position's lifecycle is all about managing the health factor. Stay in the healthy range (1.1-1.5), use automation for hands-free management, and always have a plan for when prices move against you.
A Position tracks everything about your lending activity. It maintains a complete record of your collateral deposits (the assets you've deposited), debt obligations (the amounts you've borrowed), health metrics (your current safety status), and DeFi connectors (automation via Sinks and Sources that enable seamless integration with other protocols).
Position Lifecycle Overview
_28stateDiagram-v2_28 [*] --> Created: Deposit Collateral_28 Created --> Healthy: Auto-borrow (optional)_28 Healthy --> Overcollateralized: Add Collateral / Repay Debt_28 Overcollateralized --> Healthy: Auto-borrow More_28 Healthy --> Undercollateralized: Price Drop / Interest_28 Undercollateralized --> Healthy: Auto-repay / Add Collateral_28 Undercollateralized --> AtRisk: Further Price Drop_28 AtRisk --> Undercollateralized: Emergency Action_28 AtRisk --> Liquidatable: HF < 1.0_28 Liquidatable --> Undercollateralized: Partial Liquidation_28 Healthy --> [*]: Close Position_28 Overcollateralized --> [*]: Close Position_28_28 note right of Created_28 Initial deposit_28 HF = ∞ (no debt)_28 end note_28_28 note right of Healthy_28 HF: 1.1 - 1.5_28 Target: 1.3_28 end note_28_28 note right of AtRisk_28 HF: 1.0 - 1.1_28 Urgent action needed!_28 end note
Creating a Position
The Creation Flow
_20sequenceDiagram_20 participant User_20 participant ALP_20 participant Position_20 participant FYV_20_20 User->>ALP: Deposit 1000 FLOW_20 ALP->>Position: Create position_20 Position->>Position: Calculate borrowing capacity_20_20 alt With Auto-Borrowing_20 Position->>Position: Borrow 615 MOET_20 Position->>FYV: Push to DrawDownSink_20 FYV-->>User: Deploy to yield strategy_20 Note over Position: Health = 1.3_20 else Without Auto-Borrowing_20 Note over Position: Health = ∞<br/>(no debt yet)_20 end_20_20 ALP-->>User: Return position reference
Option 1: With Auto-Borrowing (Recommended for FCM)
Setup:
pushToDrawDownSink = true- Automatically borrows to target health (1.3)
- Funds flow to your configured destination
What happens:
_101. You deposit: 1000 FLOW_102. ALP calculates: 1000 × 0.8 = 800 effective collateral_103. ALP auto-borrows: 800 / 1.3 = 615.38 MOET_104. Funds flow: Via DrawDownSink (to FYV, wallet, etc.)_105. Final state: Health = 1.3, fully optimized
Best for: FCM users who want maximum automation and capital efficiency
Option 2: Without Auto-Borrowing (Conservative)
Setup:
pushToDrawDownSink = false- No automatic borrowing
- You control when to borrow
What happens:
_101. You deposit: 1000 FLOW_102. Position created with collateral only_103. Health factor: Infinite (no debt)_104. You manually borrow when ready
Best for: Users who want full manual control
Health States Through Lifecycle
State 1: Overcollateralized (HF > 1.5)
_10graph LR_10 A[HF > 1.5<br/>Very Safe] --> B{Auto-borrow<br/>enabled?}_10 B -->|Yes| C[Borrow more MOET]_10 B -->|No| D[Stay safe]_10 C --> E[Health = 1.3]_10_10 style A fill:#bfb_10 style E fill:#bfb
Characteristics: This state is very safe from liquidation and allows you to borrow significantly more. However, it's not capital efficient if you're not using auto-borrowing.
Actions available: You can borrow additional funds, withdraw excess collateral, or let the system auto-borrow to reach the target health factor.
Example:
_10Collateral: $2000 effective_10Debt: $800 MOET_10HF: 2000 / 800 = 2.5_10_10Can borrow additional: ~$731 MOET (to reach HF 1.3)
State 2: Healthy (HF 1.1 - 1.5)
_10graph TD_10 A[HF: 1.1 - 1.5<br/>Healthy Range]_10 A --> B[Optimal: 1.3]_10 A --> C[Upper: 1.5]_10 A --> D[Lower: 1.1]_10_10 style A fill:#bbf_10 style B fill:#bfb
Characteristics: This is the target operational range with balanced risk/reward and no automatic actions triggered.
Actions available: You can perform normal deposits and withdrawals, borrow within limits, and make repayments as desired.
Example:
_10Collateral: $800 effective_10Debt: $615.38 MOET_10HF: 800 / 615.38 = 1.30 ✓_10_10Status: Perfect! At target health
State 3: Undercollateralized (HF < 1.1)
_10graph LR_10 A[HF < 1.1<br/>Below Target] --> B{TopUpSource<br/>configured?}_10 B -->|Yes| C[Auto-repay]_10 B -->|No| D[Manual action<br/>required!]_10 C --> E[Health = 1.3]_10 D --> F[Risk liquidation]_10_10 style A fill:#ffa_10 style E fill:#bfb_10 style F fill:#fbb
Characteristics: This position is below target and needs attention. Auto-rebalancing may trigger, and risk increases significantly if the price continues dropping.
Urgent actions: You should add more collateral, repay some debt, and ensure TopUpSource has sufficient funds available.
Example:
_10Collateral: $680 effective (price dropped!)_10Debt: $615.38 MOET_10HF: 680 / 615.38 = 1.10_10_10Status: At minimum threshold_10Action: Consider rebalancing
State 4: At Risk (HF 1.0 - 1.1)
_11graph LR_11 A[HF: 1.0 - 1.1<br/>CRITICAL] --> B[Immediate<br/>Action]_11 B --> C{Can add<br/>collateral?}_11 B --> D{Can repay<br/>debt?}_11 C -->|Yes| E[Add collateral NOW]_11 D -->|Yes| F[Repay debt NOW]_11 E --> G[Safety Restored]_11 F --> G_11_11 style A fill:#fbb_11 style G fill:#bfb
Characteristics:
- 🔴 High liquidation risk
- 🔴 Immediate action required
- 🔴 May be liquidated very soon
Immediate actions:
- Add substantial collateral immediately
- Repay significant portion of debt
- Trigger emergency rebalancing
- Monitor constantly
Example:
_10Collateral: $640 effective_10Debt: $615.38 MOET_10HF: 640 / 615.38 = 1.04_10_10Status: CRITICAL - 4% from liquidation!
State 5: Liquidatable (HF < 1.0)
_10graph LR_10 A[HF < 1.0<br/>LIQUIDATABLE] --> B[Liquidation<br/>Triggered]_10 B --> C[Collateral<br/>Seized]_10 C --> D[Debt<br/>Repaid]_10 D --> E[HF = 1.05<br/>Partial Liquidation]_10_10 style A fill:#f00,color:#fff_10 style E fill:#ffa
What happens:
- ⛔ Position can be liquidated by anyone
- ⛔ Collateral seized with penalty
- ⛔ Partial or full liquidation
The process:
_101. Keeper/Protocol detects HF < 1.0_102. Seizes portion of collateral_103. Repays debt (with liquidation bonus)_104. Position brought to HF = 1.05_105. You keep remaining collateral (if any)
Learn more: Liquidation System
Position Operations
Depositing More Collateral
_10graph LR_10 A[Deposit<br/>More Collateral] --> B[Effective<br/>Collateral ↑]_10 B --> C[Health<br/>Factor ↑]_10 C --> D{HF > 1.5?}_10 D -->|Yes| E[Auto-borrow<br/>if enabled]_10 D -->|No| F[Stay in range]_10_10 style A fill:#bbf_10 style C fill:#bfb
Effects: Depositing more collateral increases your effective collateral and improves your health factor. It may trigger auto-borrowing if enabled and provides an additional safety buffer.
Withdrawing Collateral
_10graph LR_10 A[Withdraw<br/>Collateral] --> B[Effective<br/>Collateral ↓]_10 B --> C[Health<br/>Factor ↓]_10 C --> D{HF < 1.1?}_10 D -->|Yes| E[Blocked or<br/>Liquidation Risk]_10 D -->|No| F[Withdrawal<br/>Succeeds]_10_10 style A fill:#ffa_10 style E fill:#fbb
Conditions: Withdrawals must maintain your health factor above the minimum threshold, cannot cause undercollateralization, and may be blocked if deemed unsafe by the protocol.
Borrowing Funds
_10graph LR_10 A[Borrow<br/>MOET] --> B[Debt ↑]_10 B --> C[Health<br/>Factor ↓]_10 C --> D{HF > min?}_10 D -->|Yes| E[Borrow<br/>Succeeds]_10 D -->|No| F[Borrow<br/>Blocked]_10 E --> G[Interest<br/>Starts]_10_10 style A fill:#bbf_10 style F fill:#fbb
Effects: Borrowing funds increases your debt and decreases your health factor. Interest starts accruing immediately, and you must ensure your position stays above the minimum health threshold.
Repaying Debt
_10graph LR_10 A[Repay<br/>MOET] --> B[Debt ↓]_10 B --> C[Health<br/>Factor ↑]_10 C --> D[More Safety<br/>Buffer]_10 D --> E[Can Borrow<br/>More if Needed]_10_10 style A fill:#bfb_10 style C fill:#bfb
Effects: Repaying debt decreases your total debt, improves your health factor, reduces ongoing interest payments, and increases your safety margin against liquidation.
Closing a Position
Requirements
To fully close a position:
_10graph TD_10 A[Want to Close] --> B{All debt<br/>repaid?}_10 B -->|No| C[Repay all debt first]_10 B -->|Yes| D{All collateral<br/>withdrawn?}_10 D -->|No| E[Withdraw all collateral]_10 D -->|Yes| F[Position Closed ✓]_10 C --> B_10 E --> D_10_10 style F fill:#bfb
Steps:
- Repay all debt: Zero MOET debt
- Withdraw all collateral: Remove all deposited assets
- Clean state: Position now empty
Example:
_101. Check debt: 492.31 MOET_102. Repay: 492.31 MOET → Debt = 0_103. Check collateral: 1000 FLOW_104. Withdraw: 1000 FLOW → Collateral = 0_105. Position closed ✓
Advanced: Multiple Positions
You can have multiple positions for different strategies:
_13graph TD_13 User[Your Account]_13 User --> P1[Position 1<br/>Conservative<br/>HF: 2.0]_13 User --> P2[Position 2<br/>Balanced<br/>HF: 1.3]_13 User --> P3[Position 3<br/>Aggressive<br/>HF: 1.1]_13_13 P1 --> S1[Stable Strategy]_13 P2 --> S2[Yield Farming]_13 P3 --> S3[Leveraged]_13_13 style P1 fill:#bfb_13 style P2 fill:#bbf_13 style P3 fill:#ffa
Benefits: Multiple positions allow you to maintain separate risk profiles, use different collateral types, isolate liquidation risk, and implement diverse strategies simultaneously.
Example uses:
- Position 1: Conservative (HF 2.0) with stablecoin collateral
- Position 2: Balanced (HF 1.3) with FLOW, deployed to FYV
- Position 3: Aggressive (HF 1.1) with volatile assets, manual management
Automation with DeFi Actions
Full FCM Automation Setup
_13graph TB_13 Position[Your Position]_13 Position -->|DrawDownSink| FYV[FYV Strategy]_13 FYV -->|TopUpSource| Position_13_13 Auto1[Overcollateralized] -.-> Position_13 Position -->|Auto-borrow MOET| FYV_13_13 Auto2[Undercollateralized] -.-> FYV_13 FYV -->|Provide MOET| Position_13_13 style Position fill:#f9f,stroke:#333,stroke-width:3px_13 style FYV fill:#bfb,stroke:#333,stroke-width:3px
Configuration:
_10Position.DrawDownSink = FYV Strategy Sink_10Position.TopUpSource = FYV Strategy Source_10Position.minHealth = 1.1_10Position.maxHealth = 1.5
Result:
- ✅ Automatic borrowing when overcollateralized
- ✅ Automatic repayment when undercollateralized
- ✅ Yield protects your position
- ✅ True set-and-forget experience
Learn more: DeFi Actions Integration
Best Practices
Position Creation
- ✅ Start with conservative health targets (1.5+) if learning
- ✅ Test with small amounts first
- ✅ Understand auto-borrowing before enabling
- ✅ Set up monitoring from day one
Ongoing Management
- ✅ Check health factor daily
- ✅ Set up automated alerts for HF < 1.3
- ✅ Keep liquid funds for emergencies
- ✅ Monitor collateral token prices
Risk Management
- ✅ Maintain health buffer above 1.3
- ✅ Diversify collateral types when possible
- ✅ Use stable assets for lower risk
- ✅ Have emergency repayment plan ready
Before Closing
- ✅ Track total debt including accrued interest
- ✅ Plan repayment timeline
- ✅ Understand any fees or penalties
- ✅ Withdraw collateral promptly after repayment
Common Scenarios
Scenario 1: Price Drop Response
_14sequenceDiagram_14 participant Price_14 participant Position_14 participant FYV_14_14 Price->>Position: FLOW drops 20%_14 Position->>Position: HF: 1.3 → 1.04_14 Position->>Position: Below min (1.1)!_14 Position->>FYV: Request 123 MOET_14 FYV->>Position: Provide MOET_14 Position->>Position: Repay debt_14 Position->>Position: HF: 1.04 → 1.3 ✓_14_14 Note over Position,FYV: Automatic liquidation prevention!
Scenario 2: Price Recovery
_14sequenceDiagram_14 participant Price_14 participant Position_14 participant FYV_14_14 Price->>Position: FLOW recovers to $1_14 Position->>Position: HF: 1.3 → 1.625_14 Position->>Position: Above max (1.5)!_14 Position->>Position: Borrow 123 MOET_14 Position->>FYV: Push MOET_14 FYV->>FYV: Deploy to yield_14 Position->>Position: HF: 1.625 → 1.3 ✓_14_14 Note over Position,FYV: Automatic capital optimization!
Mathematical Foundation
For detailed mathematical formulas and proofs underlying position operations:
- Health Factor Calculations: FCM Math - Health Factor
- Auto-Borrowing Math: Auto-Borrowing Mathematics
- Rebalancing Formulas: Rebalancing Mathematics
- Price Impact Analysis: Price Impact on Health
- Complete Lifecycle Example: Position Lifecycle Math
Next Steps
- Understand rebalancing: Rebalancing Mechanics
- Set up automation: DeFi Actions Integration
- Protect against liquidation: Liquidation System
- Learn credit mechanics: Credit Market Mechanics