How to Borrow
Once you have supplied collateral to UnitFlow Lending, you can borrow up to 66.67% of its USD value. Borrowed funds are transferred directly to your wallet. Interest accrues continuously and is tracked by debt tokens (dUSDC or dEURC). You can repay at any time — partial or full — and withdraw your collateral once your debt is cleared.
Prerequisites
- Wallet connected to Arc Testnet
- Collateral already supplied — see How to Supply
- Available borrow capacity shown in the Position Panel (Borrowing Power Used must be below 100%)
Understanding Borrow Capacity
The maximum you can borrow is determined by your collateral value and the Loan-to-Value ratio:
maxBorrowUSD = totalCollateralUSD × 0.6667 // 66.67% LTV // Example: $1,000 USDC supplied // maxBorrowUSD = $1,000 × 0.6667 = $666.70 // You can borrow up to 666.70 USDC (or ~617.31 EURC at $1.08)
The Borrowing Power Used bar in the Position Panel shows what percentage of your maximum borrow capacity is currently in use. Keep this well below 100% to avoid liquidation risk.
Borrowing Step-by-Step
1. Open the Borrow Tab
In the Action Panel, click the Borrow tab. Select the asset you want to borrow — USDC or EURC.
2. Check Available Capacity
The label above the input shows Available: X.XXXX ASSET — this is the maximum you can borrow in that asset at the current oracle price. Clicking MAX fills the input with this value minus a small buffer (0.01 tokens) to avoid rounding reverts.
3. Enter an Amount
Type the amount you want to borrow. As you type, a preview panel appears showing:
- Borrow APY — the annualised interest rate you will pay
- Health Factor After — your projected health factor once the borrow is executed. This updates live as you change the amount.
The health factor preview is colour-coded: green (safe), yellow, orange, red (dangerous). Do not borrow an amount that would push your health factor below 1.5 unless you actively monitor your position.
4. Confirm the Borrow
Click Confirm. Borrowing does not require an ERC-20 approval — the pool transfers tokens to you, not the other way around. Your wallet will prompt you to sign a single transaction:
LendingPool.borrow( asset: 0x3600...0000, // USDC address amount: 500_000, // 0.5 USDC (6 decimals) onBehalfOf: 0xYourAddress )
Once confirmed, the borrowed tokens appear in your wallet and your Position Panel updates to show the new debt and health factor.
Repaying Your Debt
1. Open the Repay Tab
Switch to the Repay tab in the Action Panel. Select the asset you borrowed.
2. Enter an Amount or Repay All
The label shows Debt: X.XXXX ASSET — your current outstanding balance including accrued interest. Click MAX to repay the full debt in one transaction. The hook passes type(uint256).max to the contract, which repays exactly the outstanding balance regardless of how much interest has accrued since you entered the amount.
3. Approve (first time only)
Repaying transfers tokens from your wallet to the pool, so an ERC-20 approval is required. On first repay the button reads Approve & Confirm. The hook approves MaxUint256 so subsequent repays need no approval.
4. Confirm the Repay
Click Approve & Confirm (or Confirm if already approved). The pool burns your dTokens proportional to the repaid amount and your health factor improves immediately.
LendingPool.repay( asset: 0x3600...0000, amount: type(uint256).max, // repay full debt onBehalfOf: 0xYourAddress )
Withdrawing Collateral
1. Open the Withdraw Tab
Switch to the Withdraw tab. Select the asset you want to withdraw. The label shows Supplied: X.XXXX ASSET — your current uToken balance converted to underlying.
2. Enter an Amount
If you have an active borrow, a Health Factor After preview appears as you type. Withdrawing collateral reduces your health factor — ensure it stays above 1.0 after the withdrawal.
3. Confirm the Withdrawal
Click Confirm. No approval is needed — the pool burns your uTokens and sends the underlying plus accrued interest to your wallet.
LendingPool.withdraw( asset: 0x3600...0000, amount: type(uint256).max, // withdraw everything to: 0xYourAddress )
The transaction reverts if:
- The pool has insufficient liquidity (all funds are borrowed)
- The withdrawal would push your health factor below 1.0
Risk Management
| Action | Effect on Health Factor |
|---|---|
| Supply more collateral | Increases HF ✅ |
| Repay debt | Increases HF ✅ |
| Borrow more | Decreases HF ⚠️ |
| Withdraw collateral | Decreases HF ⚠️ |
| Interest accrues on debt | Slowly decreases HF over time ⚠️ |
| Interest accrues on supply | Slowly increases HF over time ✅ |
Because borrow interest accrues continuously, a position that starts at HF 1.5 will drift lower over time if no repayments are made. Monitor your position regularly, especially during periods of high utilisation when borrow rates are elevated.
Frequently Asked Questions
Can I borrow the same asset I supplied?
Yes. You can supply USDC and borrow USDC, or supply EURC and borrow USDC, or any combination. The pool treats each asset independently.
Is there a minimum borrow amount?
There is no enforced minimum in the current contracts, but very small borrows may not be economical given gas costs.
What happens if I don't repay?
Interest continues to accrue, gradually reducing your health factor. Once it falls below 1.0, your position becomes liquidatable — a third party can repay up to 50% of your debt and receive your collateral at a discount. See Liquidations for details.
Can I repay someone else's debt?
The repay function accepts an onBehalfOf parameter, so yes — you can repay debt on behalf of any address. This is used by the liquidation engine internally.