Skip to main content

What is a flashloan in a bundled transaction?

A flashloan borrows tokens without upfront collateral and must be repaid in the same transaction. In Enso, flashloans are Bundle actions, not Route requests.

J
Written by Javier Diaz

A flashloan borrows tokens from a lending protocol without upfront collateral, uses them in a series of actions, and repays the borrowed amount plus any protocol fee in the same transaction. If any step fails, the entire transaction reverts and no tokens are moved.

Definition

Flash liquidity is available only for the length of one atomic transaction. The callback that uses the borrowed tokens must finish with enough assets to repay the loan.

How it works

  • You choose the flashloan integration by setting the action’s protocol field, and you include a flashloan action with a non-empty callback.

  • The callback runs after the borrowed tokens arrive: swaps, deposits, borrows, or other supported actions.

  • The borrowed amount plus any protocol fee must be repayable at the end of the callback. If it is not, the transaction reverts.

  • Optional inputs can include extra tokenIn from the user, tokenOut expected after the callback, and a receiver for final output.

How Enso does this

Flashloans are available only through the Bundle API (POST https://api.enso.build/api/v1/shortcuts/bundle). They are not available on the Route endpoint. See Flashloans for required fields (flashloanToken, flashloanAmount, callback) and current integration notes. This article does not list provider names; use the live docs for the protocol slugs you can set.

FAQ

Can I request a flashloan on the Route API?

No. The flashloan docs state that flashloans are only available through the Bundle API.

What happens if repayment fails?

The entire bundle reverts and no tokens are moved.

Related articles

  • How do I use a flashloan in an Enso bundle?

  • How do I build a leverage or looping position in one transaction?

  • What is the Enso Bundle API?

  • How do I bundle multiple DeFi actions into one transaction?

  • What is a same-chain bundle?

Sources

Did this answer your question?