Atomic Leverage and Multi-Protocol Strategies with Flashloan Actions

Atomic Leverage and Multi-Protocol Strategies with Flashloan Actions

Borrow temporary liquidity inside an Enso Bundle, run a complete DeFi workflow, and repay before the transaction ends.

Some DeFi strategies have a sequencing problem. You need the asset before you can post it as collateral. You need the position before you can borrow the funds that finance the position. You need liquidity in the middle of a workflow that only produces that liquidity at the end.

Flashloans break this loop by making assets available for the length of a single transaction. Flashloan support in Enso is a composable Bundle API action: borrow assets, execute a sequence of DeFi operations, and repay the loan inside one atomic transaction. If the workflow completes and repays, the transaction succeeds. If an action fails or the repayment cannot be satisfied, everything reverts.

From specialized contracts to composable actions

Flashloans have traditionally meant learning each liquidity provider's interface and callback model. Aave, Morpho, Balancer, and Uniswap do not expose flash liquidity in the same way. Some lend from a central protocol, others from a specific pool, and fees, supported assets, and callback requirements all vary. Then you still have to connect the loan to the rest of the strategy: swaps, collateral deposits, borrowing, repayment, balance management, and final asset delivery.

The Bundle API standardizes that work. You choose the flashloan provider, the asset, the amount, and the actions to execute once liquidity arrives, and Enso compiles the whole sequence into signer-ready transaction data. Switching from one lender to another changes one field.

Opening a leveraged position in one transaction

Consider a user who wants leveraged WETH exposure through a Morpho Markets V1 market, starting from 1 ETH. To increase the position size, the workflow must acquire additional WETH, deposit the combined amount as collateral, and borrow USDC against it.

As an Enso flashloan bundle:

Wrap ETH → flashloan USDC → swap USDC to WETH → deposit all WETH → borrow USDC → repay flashloan

The user's own WETH and the WETH acquired with the temporary USDC go into the new collateral position together. Once that collateral is deposited, the workflow borrows USDC against it, and that newly borrowed USDC repays the flashloan. In the documented version of this flow, 1 ETH in becomes a Morpho position holding roughly 1.45 WETH of collateral against 1,800 USDC of debt, all in one transaction.

If the swap fails, the collateral cannot be deposited, or the final borrow does not produce enough USDC to repay the loan, the transaction reverts. Nothing is left half-open between steps.

Looping is the general shape of this. A loop means depositing collateral, borrowing against it, turning the borrowed asset back into more collateral, and repeating until the position sits at the leverage you want. Done by hand, it is a run of separate transactions, each paying gas and slippage, with the position stuck at the wrong leverage in between while the user keeps clicking.

Under the hood

Flashloans are available through the Enso Bundle API. The builder defines the actions and their execution order.

Bundle request → flash borrow → callback actions → repayment → transaction completion

The builder defines the flashloan action

The flashloan is an action inside an Enso bundle. You specify the protocol providing it, the token or tokens to borrow, the amount, any assets the user contributes, the tokens expected after execution, the address that receives the final output, and the callback: a non-empty array of actions that run with the borrowed liquidity. Conceptually:

Flashloan USDC from Morpho

With the borrowed USDC:
  1. Swap USDC into WETH
  2. Read the total WETH balance
  3. Deposit WETH as collateral
  4. Borrow USDC against the new position
  5. Use that USDC to repay the flashloan

Those actions live inside the flashloan's callback.

Enso compiles the bundle

The application sends the action sequence to the Bundle API, Enso converts it into a single transaction, and the user signs and submits that transaction from the selected wallet. There is no separate flashloan transaction for the application to monitor or continue manually. The loan is embedded in the same transaction as the strategy.

Enso currently integrates flashloans across Morpho, Bend, Dolomite, Aave V3, Hyperlend, Balancer V3, Uniswap V3 and Kodiak. Not every protocol is deployed on every chain, and on some networks the liquidity comes from a fork rather than the original deployment: Bend on Berachain is a Morpho fork, Hyperlend on HyperEVM is an Aave V3 fork, and Kodiak on Berachain is a Uniswap V3 fork.

What this gives products

Leveraged position entry. Users can enter a leveraged lending or yield position through one atomic transaction instead of a manual series of deposits, borrows, swaps and redeposits.

Position restructuring. Temporary liquidity can coordinate workflows that move collateral or debt between supported positions, without leaving the user exposed between separate transactions.

Multi-protocol strategies. Liquidity can be borrowed from one integration, transformed and deployed through others, and repaid once the destination position has been created.

A cleaner abstraction. Wallets and fintech applications can present a clear outcome while Enso handles the ordered protocol interactions underneath. The interface never has to expose every temporary asset or intermediate action. It shows what the user contributes, the position they will receive, the debt or leverage involved, and the expected result.

Conclusion

Users should not have to think about temporary liquidity, callback interfaces, adapter contracts or repayment ordering. They should pick the position they want to create and understand the assets, debt, fees and risks that come with it.

Enso Flashloans let builders package the rest into one coordinated transaction. Borrowed liquidity enters the workflow when it is needed, powers the intermediate operations, and is repaid before execution completes.

Build your first flashloan bundle.