Skip to content

Rotwang9000/flashbank-net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฆ FlashBank.net - Revolutionary Just-in-Time Flash Loan Network

The world's first IMMUTABLE flash loan network where your ETH never leaves your wallet

๐Ÿš€ Deployment Status (November 24, 2025)

Network Status Contract Address Verified
Sepolia โœ… Live Router + Demo contracts โœ… Yes (v2 API)
Arbitrum โœ… Live 0x5c0156da501BC97DD35017Fb20624B7f1Ce7E095 โœ… Yes
Base โœ… Live 0xBDcC71d5F73962d017756A04919FBba9d30F0795 โš ๏ธ Manual needed
Ethereum โœ… Live 0xBDcC71d5F73962d017756A04919FBba9d30F0795 โณ Pending
Website โœ… Live flashbank.net โœ… Yes

Note: As of November 2025, all Sepolia contracts are now verified using Etherscan v2 API with @nomicfoundation/hardhat-verify@^2.1.3.

๐Ÿ“‹ Detailed Status: See STATUS_SUMMARY.md and DEPLOYMENT_STATUS.md

๐ŸŒ Website: flashbank.net โœ… LIVE
๐Ÿ“š Docs: docs.flashbank.net
๐Ÿ’ก How It Works: Flash Loan Concept Guide
๐Ÿ”ง Correct Design: Revolutionary Architecture โš ๏ธ READ THIS FIRST
๐ŸŠ Current Pool: Pool Mechanics (needs fixing)


๐Ÿ”„ November 2025 Router Upgrade (WETH-First)

โœ… Major update: Liquidity now flows through the new FlashBankRouter contract.
๐Ÿ” No deposits: Providers keep WETH in their wallets and simply approve the router.
๐Ÿช™ Token-ready: The router tracks commitments per ERC-20, starting with WETH.

Chain Router Address WETH Token Demo Borrower
Sepolia (soft launch) NEXT_PUBLIC_SEPOLIA_ROUTER_ADDRESS 0xdd13E55209Fd76AfE204dBda4007C227904f0a81 NEXT_PUBLIC_SEPOLIA_DEMO_BORROWER_ADDRESS
Base deploy via scripts/deploy-router.js 0x4200000000000000000000000000000000000006 TBD
Arbitrum deploy via scripts/deploy-router.js 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1 TBD
Ethereum deploy via scripts/deploy-router.js 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 TBD

Why the Router Matters

  • WETH stays in your wallet. You simply approve the router and set a limit.
  • Permit-ready. ERC-20s with EIP-2612 can authorize FlashBank without on-chain approvals (coming soon in the UI).
  • Token registry. Adding a new asset is a single setTokenConfig callโ€”no redeployments.
  • ETH bridge. Borrowers can still receive native ETH by flashing WETH and unwrapping inside the router.

Provider Flow (WETH Example)

  1. Wrap ETH โ†’ receive WETH in the same wallet you already use.
  2. Approve FlashBankRouter once (or sign a permit).
  3. Call setCommitment(token, limit, expiry, paused) to advertise how much WETH you're willing to lend.
  4. Pause/resume at any time. No withdrawalsโ€”just drop the limit to zero.
  5. Every flash loan that includes your WETH credits the fee straight back to you in the same block.

Router Configuration & Limits

The router owner can configure per-token settings via setTokenConfig:

  • Fee Range: 0.01% - 1% (1-100 basis points)

    • Enforced minimum prevents race-to-zero fee competition
    • Enforced maximum protects borrowers from excessive fees
  • Max Borrow Percentage: 1% - 100% of pool (100-10000 basis points)

    • Prevents single borrower from monopolising entire pool
    • Default: 50% (5000 bps) - allows multiple concurrent loans
    • Example: With 100 WETH committed, max single loan = 50 WETH
  • Max Flash Loan: Optional absolute cap per transaction (in wei)

    • Set to 0 for unlimited (subject to pool size and max borrow %)

These limits ensure fair access and sustainable fee economics whilst maintaining protocol flexibility.

New Environment Variables

NEXT_PUBLIC_SEPOLIA_ROUTER_ADDRESS=0x...
NEXT_PUBLIC_SEPOLIA_WETH_ADDRESS=0xdd13E55209Fd76AfE204dBda4007C227904f0a81
NEXT_PUBLIC_SEPOLIA_DEMO_BORROWER_ADDRESS=0x...
NEXT_PUBLIC_SEPOLIA_PROOF_SINK_ADDRESS=0x...
NEXT_PUBLIC_BASE_ROUTER_ADDRESS=0x...
NEXT_PUBLIC_BASE_WETH_ADDRESS=0x4200000000000000000000000000000000000006
NEXT_PUBLIC_ARBITRUM_ROUTER_ADDRESS=0x...
NEXT_PUBLIC_ETHEREUM_ROUTER_ADDRESS=0x...

Set the _ROUTER_ADDRESS values after running:

npx hardhat run scripts/deploy-router.js --network <network>

โ„น๏ธ The legacy FlashBankRevolutionary addresses (deposits) remain deployed but the primary UX now goes through the router/WETH workflow. Legacy instructions later in this README are kept for historical context.


๐ŸŽฏ What is FlashBank?

FlashBank is a revolutionary just-in-time flash loan network where your ETH never permanently leaves your account. Unlike traditional DeFi protocols that require you to deposit funds and trust the protocol, FlashBank uses temporary custody - your ETH is only pulled from your wallet for microseconds during flash loan execution, then automatically returned.

๐Ÿ”ฅ The Revolutionary Innovation

  1. ๐Ÿฆ Approval System: You approve FlashBank to temporarily use your ETH (stays in wallet)
  2. ๐Ÿ’ฐ Capital Efficiency: Your ETH can earn yield elsewhere while participating
  3. โšก Just-in-Time Liquidity: Contract pulls ETH only when needed for flash loans
  4. ๐ŸŽฏ Closest Match Selection: Pulls from accounts with ETH amounts closest to loan size
  5. ๐ŸŽฐ Fair Profit Distribution: Only ETH that gets lent receives profits
  6. ๐Ÿ”„ Automatic Return: ETH automatically returned to your wallet after flash loan

๐Ÿš€ Why This Changes Everything

Traditional DeFi FlashBank Revolution
ETH locked in contract 24/7 ETH stays in your wallet
Permanent counterparty risk Microsecond risk only
Capital inefficiency Maximum capital efficiency
Proportional free-riding Fair lottery system (no free-riding)
Manual commitments Automatic balance checking
Single-point-of-failure Distributed just-in-time liquidity
Must trust protocol Trust only smart contract logic

โš ๏ธ Implementation Status

โœ… REVOLUTIONARY CONTRACT READY: New FlashBankRevolutionary.sol implements the just-in-time system โœ… COMPREHENSIVE TESTING: Full test suite for multi-user scenarios โœ… PRODUCTION READY: Gas optimized, security audited, immutable

See CORRECT_ARCHITECTURE.md for the complete revolutionary design.

๐Ÿ›ก๏ธ Zero Rug-Pull Guarantee

  • NON-UPGRADEABLE contract (impossible to change code)
  • No proxy patterns (immutable forever)
  • Maximum fee hardcoded to 10% (cannot be increased)
  • No admin backdoors (owner cannot steal funds)

โšก How It Works

  1. Deposit ETH to earn from flash loan fees
  2. MEV bots borrow ETH for arbitrage/liquidation strategies
  3. Either: Strategy succeeds โ†’ profit shared with depositors
  4. Or: Strategy fails โ†’ ETH returned immediately
  5. Your ETH can ONLY: be returned to you or returned + profit added

๐Ÿ’ฐ Economics

For ETH Holders (Lenders)

  • Earn from flash loan fees - Get paid when your ETH is used for flash loans
  • Zero permanent risk - ETH only at risk during flash loan execution
  • Capital efficiency - Your ETH can earn elsewhere while participating
  • Full control - Pause, resume, or adjust participation anytime

For MEV Traders (Borrowers)

  • Lower borrowing costs - Competitive fees compared to traditional protocols
  • No capital required - Access flash loans through committed liquidity
  • Immutable security - Contract cannot be changed or rug-pulled
  • Reliable execution - Trustless system with automatic returns

Realistic Returns

Flash Loan Example (100 ETH):
- FlashBank Fee: 0.02% = 0.02 ETH
- Traditional Protocol: 0.09% = 0.09 ETH
- Savings per loan: 0.07 ETH

For participants with 10 ETH committed:
- Typical monthly earnings: Variable based on flash loan volume
- Annual returns: Depend on MEV opportunities and participation

๐Ÿš€ Live Deployment

Multi-Chain Deployment

Arbitrum Mainnet โœ…

  • FlashBank Pool: 0x5c0156da501BC97DD35017Fb20624B7f1Ce7E095
  • MEV Receiver: 0x6dAb2aCeF1cc2B545BcCc101e420fA711Bb03592
  • Deployment: Block 23462096 (2025-09-28)
  • Explorer: Arbiscan

Ethereum Mainnet ๐Ÿ”„

  • Status: Ready for deployment
  • Contract: Same FlashBankRevolutionary.sol (compatible with all EVM chains)

Base ๐Ÿ”„

  • Status: Ready for deployment
  • Contract: Same FlashBankRevolutionary.sol (compatible with all EVM chains)

Security Verification

โœ… Contract verified on Arbiscan
โœ… 25 security tests passed
โœ… Non-upgradeable confirmed
โœ… Open source code auditable


๐Ÿ”ง Quick Start

For WETH Liquidity Providers

const router = new ethers.Contract(
  process.env.NEXT_PUBLIC_SEPOLIA_ROUTER_ADDRESS,
  FlashBankRouterABI,
  signer
);
const weth = new ethers.Contract(
  process.env.NEXT_PUBLIC_SEPOLIA_WETH_ADDRESS,
  WETH9_ABI,
  signer
);

// 1. Wrap some ETH so you have WETH on hand
await weth.deposit({ value: ethers.parseEther("5") });

// 2. Approve (or permit) the router once
await weth.approve(router.getAddress(), ethers.MaxUint256);

// 3. Advertise your commitment (limit + optional expiry)
await router.setCommitment(
  weth.getAddress(),
  ethers.parseEther("3"), // lend up to 3 WETH
  0,                      // no expiry
  false                   // active
);

// 4. Pause/resume instantly
await router.setCommitment(weth.getAddress(), ethers.parseEther("3"), 0, true);

For MEV Bots

const router = new ethers.Contract(
  process.env.NEXT_PUBLIC_SEPOLIA_ROUTER_ADDRESS,
  FlashBankRouterABI,
  signer
);

// Borrow 100 WETH (unwrap to native ETH inside the router)
await router.flashLoan(
  process.env.NEXT_PUBLIC_SEPOLIA_WETH_ADDRESS,
  ethers.parseEther("100"),
  true,               // receive native ETH
  strategyCalldata    // forwarded to IL2FlashLoan.executeFlashLoan
);

Web Interface

Visit flashbank.net for the multi-chain interface:

  • ๐Ÿ”— Connect Wallet (MetaMask, WalletConnect)
  • ๐ŸŒ Switch Networks (Arbitrum, Ethereum, Base)
  • ๐Ÿฆ Commit ETH (approval-based, stays in wallet)
  • ๐Ÿ“Š Monitor Earnings in real-time across all chains
  • โธ๏ธ Pause/Resume participation anytime
  • ๐Ÿ’ธ Withdraw Profits instantly

๐Ÿ“Š Pool Statistics

Network Total Committed Active Providers Flash Loan Fee Status
Arbitrum 0 ETH 0 0.02% โœ… Live
Ethereum - - 0.02% ๐Ÿ”„ Ready for Deployment
Base - - 0.02% ๐Ÿ”„ Ready for Deployment

Real-time stats available at flashbank.net - Switch between networks to see live data


๐Ÿ›ก๏ธ Security Features

Immutable Security

  • Cannot be upgraded - code is frozen forever
  • No proxy contracts - what you see is what you get
  • Hardcoded limits - fees cannot exceed 10%
  • No emergency exits - owner cannot drain funds

Flash Loan Protection

  • Reentrancy guards prevent recursive attacks
  • Amount limits prevent protocol drain
  • Automatic reversion if strategy fails
  • Fee validation prevents overflow attacks

Access Controls

  • Only depositors can withdraw their funds
  • Only owner can adjust operational parameters
  • No backdoors for unauthorized access
  • Transparent operations - all functions public

๐Ÿ—๏ธ Technical Architecture

Core Contracts

  • L2FlashPoolImmutable.sol: Main flash loan pool (immutable)
  • MEVFlashLoanReceiver.sol: MEV strategy integration
  • IL2FlashLoan.sol: Interface for flash loan receivers

Key Features

  • Non-upgradeable design for maximum trust
  • Gas optimized for low-cost operations
  • Event logging for full transparency
  • Modular architecture for easy integration

Supported Networks

  • โœ… Arbitrum (live) - 0x5c0156da501BC97DD35017Fb20624B7f1Ce7E095
  • ๐Ÿ”„ Ethereum Mainnet (deployment ready)
  • ๐Ÿ”„ Base (deployment ready)

๐Ÿ“ˆ Roadmap

Phase 1: Foundation โœ…

  • Immutable smart contracts
  • Security testing (25 tests passed)
  • Arbitrum deployment
  • Basic web interface

Phase 2: Growth ๐Ÿšง

  • Advanced web dashboard
  • Real-time analytics
  • Multi-network deployment
  • MEV marketplace integration

Phase 3: Ecosystem ๐Ÿ”ฎ

  • Cross-chain flash loans
  • Governance token (if needed)
  • Advanced yield strategies
  • Institutional partnerships

๐Ÿค Contributing

FlashBank is open source and welcomes contributions!

Development Setup

git clone https://github.com/flashbank-net/flashbank
cd flashbank
npm install
npm run compile
npm test

Running Tests

# Run all tests
npm test

# Run security tests only  
npx hardhat test test/SecurityTests.test.js

# Run with gas reporting
REPORT_GAS=true npm test

Contributing Guidelines

  • All code must pass security tests
  • Follow existing code style
  • Add tests for new features
  • Update documentation

๐Ÿ“„ License

MIT License - see LICENSE for details.


โš ๏ธ Disclaimers

  • Smart contract risk: While extensively tested, smart contracts can have bugs
  • Market risk: Flash loan profits depend on MEV opportunities
  • Regulatory risk: Flash loans may face regulatory scrutiny
  • Do your own research: This is experimental DeFi technology

๐ŸŒ Website Deployment

๐Ÿ“– Complete Guide: WEBSITE_DEPLOYMENT.md

Quick Start

Local Development:

npm run website:dev
# Open http://localhost:3000

Production Preview:

npm run website:preview

GitHub Pages:

  • Automatic deployment on push to main
  • Manual: npm run website:deploy
  • Live URL: https://yourusername.github.io/flashbank-net

๐Ÿ”— Links


Built with โค๏ธ for the DeFi community

Revolutionary trustless flash loans with zero permanent risk ๐Ÿฆโšก


๐Ÿงช Demo Flash Loan (Sepolia)

  • A minimal borrower DemoFlashBorrower.sol is included to prove end-to-end flash loan flow.
  • Deploy it with:
# Use known pool address by network, or override via env
FLASHBANK_ADDRESS=0xBDcC71d5F73962d017756A04919FBba9d30F0795 \
npx hardhat run scripts/deploy-demo-borrower.js --network sepolia
  • Set the website env to enable the button:
NEXT_PUBLIC_SEPOLIA_DEMO_BORROWER_ADDRESS=0xYourDeployedDemo
  • On the website (Sepolia default), use "Oneโ€‘click Demo" to run a small flash loan.
    • You approve the tx, pay gas + exact fee (autoโ€‘calculated), and get proof via events.
    • The UI decodes FlashLoanExecuted and demo events from the tx receipt.
  • Liquidity reminder: The Sepolia FlashBank instance still enforces amount <= totalCommittedLiquidity. Make sure at least one wallet calls commitLiquidity(amount) (or sets a finite commitment limit) and that the same amount of ETH is sent to 0xBDcC71d5F73962d017756A04919FBba9d30F0795 before triggering the demo; otherwise flashLoan reverts with InsufficientLiquidity.
    # Example (Sepolia)
    npx hardhat console --network sepolia
    > const fb = await ethers.getContractAt("FlashBankRevolutionary", "0xBDcC71d5F73962d017756A04919FBba9d30F0795");
    > await fb.commitLiquidity(ethers.parseEther("0.1"));
    > await signer.sendTransaction({ to: fb.target, value: ethers.parseEther("0.1") });

About

No description, website, or topics provided.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors