Quickstarts
Cross-Chain Flash Loan
NEXT WALKTHROUGH: Bridge Tokens Both Ways →
STEP 1 OF 3
ALL QUICKSTARTS →
ONE L1 TRANSACTION · executorL1.execute()
The L2 rows run on L2 from their own execution entries; the L1 transaction consumes their precomputed results.
L1
pool lends 10,000 tokens to executorL1
L1→L2
bridgeL1 locks them; a proxy call has bridgeL2 mint wrapped tokens to executorL2
L2
executorL2 claims an NFT that needs a 10,000 balance
L2→L1
wrapped tokens burned on L2, escrow released to executorL1
L1
executorL1 repays the pool · [flash-loan] PASS
Pool, executor and NFT are test-only mocks from src/periphery/defiMock; bridgeL1 and bridgeL2 are Bridge.sol, a test-fixture app built on cross-chain proxies (card 07). Locally, the scenario script plays composer.

WHAT THIS PROVESOn two local anvil chains, one L1 transaction borrows 10,000 tokens, sends them to L2 and back, and repays the pool before the repayment check runs.

WHAT IT DOESN'TIt does not use real proofs or a live node. The script does the composer's job and posts the entries in a separate transaction first, and the batch is accepted by an accept-all proof system.

DAPP DEVELOPERS

Cross-Chain Flash Loan

A flash loan must be repaid in the transaction that takes it. Here that transaction is on L1, and the borrowed tokens go to an L2 and back before the repayment check runs.

The pool, the executor and the NFT are test-only mocks from src/periphery/defiMock, not a lending protocol, and the bridge is Bridge.sol, a test-fixture app built on cross-chain proxies. What carries over to your dApp is the shape: L1 calls L2, L2 calls back to L1, all inside one L1 transaction.

WHAT YOU'LL LEARN
  • 01 · RUN ITRun the flash-loan scenario on a local L1 and L2 and see it pass. You need Git, jq, Foundry 1.7.1 and bash 4 or newer. Same setup as Run Your First Round Trip, then one scenario.
  • 02 · BORROW ON L1, USE IT ON L2How the executor sends the loan to L2 and calls its L2 twin, which calls back to L1.
  • 03 · REPAID BEFORE THE TRANSACTION ENDSWhy the pool's balance check passes only because the return leg landed on L1 first.

Verified against eez-core-protocol Git commit 9a1f815; interfaces may move.

UP NEXTBridge Tokens Both Ways