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

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


_28
stateDiagram-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


_20
sequenceDiagram
_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

Setup:

  • pushToDrawDownSink = true
  • Automatically borrows to target health (1.3)
  • Funds flow to your configured destination

What happens:


_10
1. You deposit: 1000 FLOW
_10
2. ALP calculates: 1000 × 0.8 = 800 effective collateral
_10
3. ALP auto-borrows: 800 / 1.3 = 615.38 MOET
_10
4. Funds flow: Via DrawDownSink (to FYV, wallet, etc.)
_10
5. 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:


_10
1. You deposit: 1000 FLOW
_10
2. Position created with collateral only
_10
3. Health factor: Infinite (no debt)
_10
4. You manually borrow when ready

Best for: Users who want full manual control

Health States Through Lifecycle

State 1: Overcollateralized (HF > 1.5)


_10
graph 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:


_10
Collateral: $2000 effective
_10
Debt: $800 MOET
_10
HF: 2000 / 800 = 2.5
_10
_10
Can borrow additional: ~$731 MOET (to reach HF 1.3)

State 2: Healthy (HF 1.1 - 1.5)


_10
graph 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:


_10
Collateral: $800 effective
_10
Debt: $615.38 MOET
_10
HF: 800 / 615.38 = 1.30 ✓
_10
_10
Status: Perfect! At target health

State 3: Undercollateralized (HF < 1.1)


_10
graph 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:


_10
Collateral: $680 effective (price dropped!)
_10
Debt: $615.38 MOET
_10
HF: 680 / 615.38 = 1.10
_10
_10
Status: At minimum threshold
_10
Action: Consider rebalancing

State 4: At Risk (HF 1.0 - 1.1)


_11
graph 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:

  1. Add substantial collateral immediately
  2. Repay significant portion of debt
  3. Trigger emergency rebalancing
  4. Monitor constantly

Example:


_10
Collateral: $640 effective
_10
Debt: $615.38 MOET
_10
HF: 640 / 615.38 = 1.04
_10
_10
Status: CRITICAL - 4% from liquidation!

State 5: Liquidatable (HF < 1.0)


_10
graph 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:


_10
1. Keeper/Protocol detects HF < 1.0
_10
2. Seizes portion of collateral
_10
3. Repays debt (with liquidation bonus)
_10
4. Position brought to HF = 1.05
_10
5. You keep remaining collateral (if any)

Learn more: Liquidation System

Position Operations

Depositing More Collateral


_10
graph 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


_10
graph 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


_10
graph 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


_10
graph 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:


_10
graph 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:

  1. Repay all debt: Zero MOET debt
  2. Withdraw all collateral: Remove all deposited assets
  3. Clean state: Position now empty

Example:


_10
1. Check debt: 492.31 MOET
_10
2. Repay: 492.31 MOET → Debt = 0
_10
3. Check collateral: 1000 FLOW
_10
4. Withdraw: 1000 FLOW → Collateral = 0
_10
5. Position closed ✓

Advanced: Multiple Positions

You can have multiple positions for different strategies:


_13
graph 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


_13
graph 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:


_10
Position.DrawDownSink = FYV Strategy Sink
_10
Position.TopUpSource = FYV Strategy Source
_10
Position.minHealth = 1.1
_10
Position.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


_14
sequenceDiagram
_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


_14
sequenceDiagram
_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:

Next Steps