User Flows
Comprehensive guides for all user operations in Cylend's privacy-preserving lending protocol
Overview
Cylend supports four main user actions, organized into two flow patterns:
One-Way Flows
Actions that move funds from user to protocol (non-reversible)
- Supply: Deposit collateral into the lending pool
- Repay: Pay back borrowed amounts
Round-Trip Flows
Actions that move funds from protocol to user (reversible)
- Borrow: Take out a loan against collateral
- Withdraw: Remove collateral from the pool
Action Flow Patterns
One-Way Flow: Supply & Repay
These actions use deposit buckets and don't trigger fund releases back to the user:
.png&w=3840&q=75)
User creates or selects deposit
Deposit bucket holds funds on Mantle Ingress contract
Action payload encrypted client-side
Frontend uses Sapphire SDK to encrypt amount, token, and depositId
Submitted to Mantle, relayed to Sapphire
Hyperlane forwards encrypted message cross-chain
Backend service processes action
Calls processAction() on LendingCore, updates position
Deposit amount reduced
Remaining balance in deposit bucket updated, no funds released
Round-Trip Flow: Borrow & Withdraw
These actions trigger fund releases back to the user after validation:
.png&w=3840&q=75)
User submits borrow/withdraw request
Specifies amount and token to receive
Encrypted payload sent to Sapphire
Same encryption flow as one-way actions
LendingCore validates health factor
Ensures user maintains sufficient collateral ratio
Release instruction sent back to Mantle
Hyperlane relays release message if validation passes
Funds released to user wallet
Ingress contract transfers tokens directly to user
The key difference: One-way flows consume deposit buckets without releasing funds, while round-trip flows trigger fund releases after Sapphire validates the action.
Detailed Flow Guides
Explore detailed step-by-step guides for each operation:
Deposit Flow
Create deposit buckets to hold funds for future actions. Supports both native tokens and ERC20s.
- • Create native or ERC20 deposits
- • Track deposit remaining balances
- • Reuse deposits across actions
Supply Flow
Allocate capital as collateral to the lending pool. Enables borrowing against supplied assets.
- • Select existing deposit or create new
- • Encrypted submission to Sapphire
- • Increases collateral position
Borrow Flow
Take out loans against your collateral. Health factor must remain above minimum threshold.
- • Specify borrow amount and token
- • Health factor validation on Sapphire
- • Funds released to wallet if approved
Repay Flow
Pay back borrowed amounts to reduce debt and improve health factor.
- • Create deposit for repayment amount
- • Reduces outstanding borrow position
- • Improves health factor
Withdraw Flow
Remove collateral from the lending pool. Must maintain minimum health factor.
- • Specify withdrawal amount
- • Health factor validation required
- • Collateral released to wallet
Common Patterns
Pattern 1: Simple Supply & Borrow
- 1. Create deposit with 10 USDC
- 2. Supply 10 USDC as collateral
- 3. Borrow 5 USDT against collateral
- 4. Monitor health factor
Pattern 2: Multiple Supplies from One Deposit
- 1. Create deposit with 100 USDC
- 2. Supply 30 USDC (deposit has 70 remaining)
- 3. Supply another 40 USDC (deposit has 30 remaining)
- 4. Supply final 30 USDC (deposit fully spent)
Pattern 3: Repay & Withdraw
- 1. Have outstanding borrow of 5 USDT
- 2. Create deposit with 5 USDT for repayment
- 3. Repay 5 USDT (debt cleared, health factor improves)
- 4. Withdraw collateral back to wallet
Understanding Health Factor
The health factor determines whether you can borrow or withdraw:
Formula:
Health Factor = (Collateral Value × Liquidation Threshold) / Borrowed ValueSafety Levels:
- • ≥ 1.5: Safe - Room for more borrowing
- • 1.0 - 1.5: Caution - Monitor closely
- • < 1.0: Danger - Risk of liquidation
If your health factor drops below 1.0, your position may be liquidated to protect the protocol. Always maintain a healthy collateral ratio!