Borrower Guide

This guide shows how to take a flash loan from FlashBank for MEV and arbitrage strategies. You will deploy a small borrower contract that receives funds, executes your strategy, and repays amount + fee within the callback.

Interface

Your contract must implement executeFlashLoan(uint256 amount, uint256 fee, bytes data) and return true on success.

interface IL2FlashLoan { function executeFlashLoan(uint256 amount, uint256 fee, bytes calldata data) external returns (bool); }
interface IFlashBank { function flashLoan(uint256 amount, bytes calldata data) external; }

Minimal Solidity Example

contract MyArbBot is IL2FlashLoan {
    address payable immutable flashBank;
    constructor(address payable _flashBank) { flashBank = _flashBank; }

    function start(uint256 amount, bytes calldata data) external {
        IFlashBank(flashBank).flashLoan(amount, data);
    }

    function executeFlashLoan(uint256 amount, uint256 fee, bytes calldata data) external returns (bool) {
        require(msg.sender == flashBank, "only FlashBank");
        // TODO: implement your MEV/arb strategy using this contract's balance
        // ... your logic ...

        // Repay amount + fee before returning
        (bool ok, ) = flashBank.call{ value: amount + fee }("");
        require(ok, "repay failed");
        return true;
    }

    receive() external payable {}
}

Script Snippet (ethers v6)

const borrower = new ethers.Contract(borrowerAddress, borrowerAbi, wallet);
await borrower.start(ethers.parseEther("10"), "0x"); // Request 10 ETH

Rules & Limits

  • Minimum loan: 0.01 ETH
  • Maximum single loan: 10,000 ETH (subject to available liquidity)
  • Fee: 0.02% of the amount (fee = (amount * 2) / 10000)
  • Repay amount + fee within executeFlashLoan, otherwise the transaction reverts

Tips

  • Pass DEX routes/pools in data and decode inside executeFlashLoan.
  • Fail safely: revert or return false on a missed opportunity; funds are returned to providers.
  • Optimise gas; your EOA funds the transaction.