DeepHigh
  • Welcome
  • Architecture
    • Compound
    • Venus
  • Threat Modeling
    • Identification of Function
    • Risk Library
    • Threat Enumeration
      • Enumeration
    • Risk Tree
  • Lending Invariant
    • Invariant
      • Aave V3
      • Venus
      • Euler V2
      • BIFI
      • Inverse Finance
      • Omni
      • BendDAO
      • Airpuff
      • Goldfinch
      • Wildcat
    • General Precautions
  • Edge Function
    • Flash Loan
    • BadDept
      • Auction
    • Mode
      • E-Mode
    • Leverage
    • Custom Pool
Powered by GitBook
On this page
  • Essential Invariants
  • Flexible Invariant
  • Protocol
  1. Edge Function

Flash Loan

PreviousGeneral PrecautionsNextBadDept

Last updated 7 months ago

Flash Loan allows users to borrow assets without collateral, provided the loan is repaid within the same transaction. Primarily used in DeFi for arbitrage, refinancing, and liquidation, Flash Loans offer rapid, high-liquidity lending opportunities. However, they also introduce security risks like reentrancy attacks and price manipulation, necessitating careful protocol design.

Essential Invariants

  • The loaned principal amount must be repaid in full by the end of the transaction.

  • A precise fee, as defined by the protocol, must be collected along with the loan amount.

  • The flash loan process, including borrowing and repayment, must be completed within a single atomic transaction.

Flexible Invariant

  • If a partial repayment is allowed, leave the unpaid amount as debt under specific conditions.

Protocol

Open Source Liquidity ProtocolAaveAave
Logo