🍋
LEH (BETA)
  • Welcome to LEH
  • TG & Community
  • Getting Started
  • Health Overview
  • Liquidations
  • Audits
  • Insurance Fund
  • Socialized Losses
  • Perps
  • Settlement
  • Time in Force (TIF)
  • Oracle Peg Orders
  • Bug Bounties
  • Staking
  • Token Vaults
  • Deployers & Launchpad
  • Funding
  • Fees
  • Bots
  • Tokens & Market Overview
  • Token Listings
  • Perps Listings
  • Stable Price
  • Flash Loans
  • LEH Ops
  • Risks
Powered by GitBook
On this page

Flash Loans

PreviousStable PriceNextLEH Ops

Last updated 1 year ago

CtrlK

Flash loans are executed by constructing a Solana transaction, where the starting instruction is the FlashLoanBegin and the final instruction is FlashLoanEnd from the LEH V4 program. The intermediate instructions can invoke any Solana program of choice. FlashLoanBegin transfers tokens from the LEH vaults to the designated token accounts, while FlashLoanEnd returns any excess amount per token back to the vaults compared to the initial amount before the transaction.

The swap functionality in the LEH Web UI essentially executes a margin trade using Jupiter.

Constraints:

  • Borrowing for a particular token can only occur once.

  • Flash loans cannot be invoked via cross-program invocation.

  • Only LEH instructions allowed are FlashLoanBegin and FlashLoanEnd.

  • The initial health of the involved LEH account at the end of the transaction must either be above 0 or better than the initial health before the transaction.