Flash Loans

Flash Loans

Flash loans allow borrowing without collateral, provided the borrowed amount is returned within the same transaction. They enable advanced DeFi strategies like arbitrage, liquidations, and collateral swaps.

What Are Flash Loans?

Flash loans are uncollateralized loans that must be repaid in the same transaction they're borrowed. If the loan isn't repaid, the entire transaction reverts as if it never happened.

How it works in a single transaction:

  1. Borrow - Take $1M USDC from the pool

  2. Use Funds - Execute your strategy (arbitrage, swap, etc.)

  3. Return - Pay back $1M + fee

  4. Complete - Transaction succeeds

⚠️ If Step 3 fails, the entire transaction reverts and Steps 1-2 are undone.

Key Properties

Property
Description

No Collateral

Borrow without locking assets

Same Transaction

Borrow and repay atomically

All or Nothing

Fails completely if not repaid

Any Amount

Borrow up to available liquidity

Small Fee

Fixed percentage (0.09%)

Traditional Loan vs Flash Loan

Traditional Loan: Collateral → Borrow → Time passes → Repay

Flash Loan: Borrow → Use → Repay → All in ~1 second

No time = No risk to lender = No collateral needed

Use Cases

1. Arbitrage

Profit from price differences across exchanges.

Example:

  • DEX A: 1 ETH = $1,950

  • DEX B: 1 ETH = $2,000

  • Spread: $50 per ETH

Execution:

  1. Flash borrow $195,000 USDC

  2. Buy 100 ETH on DEX A ($195,000)

  3. Sell 100 ETH on DEX B ($200,000)

  4. Repay $195,000 + $175 fee

  5. Keep profit: ~$4,825

2. Liquidations

Liquidate underwater positions without holding capital.

Example - Underwater Position:

  • Collateral: 1 wcBTC ($8,500)

  • Debt: $7,000 USDC

  • Health Factor: 0.97 (liquidatable)

Execution:

  1. Flash borrow $3,500 USDC

  2. Liquidate position (repay $3,500 debt)

  3. Receive $3,850 worth of wcBTC (10% bonus)

  4. Sell wcBTC for $3,850 USDC

  5. Repay $3,500 + $3 fee

  6. Keep profit: ~$347

3. Collateral Swap

Change collateral type without closing position.

Example - Current Position:

  • Collateral: $10,000 wcBTC

  • Debt: $5,000 USDC

  • Goal: Switch collateral from wcBTC to ETH

Execution:

  1. Flash borrow $5,000 USDC

  2. Repay full debt, freeing wcBTC collateral

  3. Withdraw wcBTC

  4. Swap wcBTC for ETH

  5. Deposit ETH as new collateral

  6. Borrow $5,000 USDC against ETH

  7. Repay flash loan + fee

Result: Same debt, different collateral, one transaction

4. Self-Liquidation

Voluntarily close underwater position efficiently.

Without flash loan:

  1. Find USDC to repay debt

  2. Repay debt

  3. Withdraw collateral

  4. Sell collateral to recover USDC

With flash loan:

  1. Flash borrow USDC

  2. Repay debt

  3. Withdraw collateral

  4. Sell collateral

  5. Repay flash loan

All in one transaction, no external capital needed.

Technical Details

Fee Structure

Parameter
Value

Flash Loan Fee

0.09%

Fee Recipient

Protocol reserves (→ stakers)

Fee Calculation:

Available Liquidity

You can flash borrow up to the total available liquidity in each pool:

Risks & Considerations

For Flash Loan Users

Risk
Description

Execution Risk

Complex logic may fail

Gas Costs

Failed transactions still cost gas

Competition

Others may front-run profitable opportunities

Complexity

Requires smart contract development skills

For the Protocol

Protection
Description

Atomic Execution

No risk of non-repayment

Fee Collection

Guaranteed rewards on success

No Bad Debt

Failed loans revert completely

Flash Loan vs Regular Borrow

Feature
Flash Loan
Regular Borrow

Collateral

None required

Required

Duration

1 transaction

Unlimited

Repayment

Mandatory, immediate

Flexible timing

Fee

0.09% flat

Variable APY

Use Case

Arbitrage, liquidation

Long-term positions

Skill Level

Advanced (needs code)

Beginner friendly

FAQ

Q: Can anyone use flash loans? Flash loans require writing smart contracts. They're primarily for developers and sophisticated users with coding knowledge.

Q: What happens if I can't repay? The entire transaction reverts. It's as if the loan never happened. You only lose gas fees.

Q: Is there a limit to how much I can borrow? You can borrow up to the available liquidity in the pool.

Q: Can I flash borrow multiple assets? Yes, flash loans support borrowing multiple assets in a single transaction.

Q: Where do flash loan fees go? Fees go to protocol reserves and ultimately benefit ZNT stakers.

Last updated