◉ Pulse
FlipZ3ro avatar
#79 today ▲ 20

FlipZ3ro/rh-flash-toolkit

Solidity AI

Foundry-based toolkit for Flash Loan (Morpho Blue) and Flash Swap (Uniswap V2) on RobinhoodChain (chainId 4663). Includes Solidity contracts, Foundry scripts, and standalone Python runner.

Created Jul 28, 2026
Stars
13
Today
+1
Forks
9
Quality
90/100
Momentum
28

README

Fetched from GitHub on Nov 16, 2026, 4:13 PM UTC · README.md

View original on GitHub

Third-party content — Open Source Pulse is not the owner of this repository.

This README belongs to FlipZ3ro/rh-flash-toolkit and its contributors. We fetch it directly from the project’s public GitHub repository and display it for reference only. All text, code, images and trademarks remain the property of their respective authors. See the repository for its license terms. Copyright / takedown policy.

rh-flash-toolkit

Foundry-based toolkit untuk Flash Loan (Morpho Blue) dan Flash Swap (Uniswap V2) di RobinhoodChain (chainId 4663).


💸 Donate

If this helped you, support the dev:

  • EVM: 0x9Cd42f217574aA4418C9C7a8770f2711401caFfd
  • SOL: QWXyYvMnLsSLBqWTDVmSvnPK8TYMdozozNaEMpMhepo

📊 Bagaimana Transfer Flow Kelihatan di Explorer

Flash Swap (Uniswap V2)

Flash Swap flow

  Pair       ──── amount X token ────▶  Borrower   (loan sent)
  Borrower   ──── amount X * 1000/997 ──▶  Pair    (repay + 0.3% fee)

  ▶ Net cost: 0.3% dari amount (fee UniV2 hardcoded)

Flash Loan (Morpho Blue)

Flash Loan flow

  Morpho     ──── amount X token ────▶  Borrower   (loan sent)
  Borrower   ──── amount X token ────▶  Morpho     (repay — exact same amount)

  ▶ Net cost: 0 (Morpho flash loan gratis — cuma bayar gas)

Kunci: UniV2 balik lebih (fee 0.3% hardcoded). Morpho balik persis sama (0 fee protocol).


📁 Struktur Project

rh-flash-toolkit/
├── src/                          Solidity contracts
│   ├── FlashSwap.sol             Uniswap V2 flash swap borrower
│   ├── MorphoFlash.sol           Morpho Blue flash loan borrower
│   └── FlashToolkit.sol          Combined helpers
├── script/                       Foundry deploy + exec scripts
│   ├── Deploy.s.sol
│   └── ExecFlashLoan.s.sol
├── test/
│   └── Flash.t.sol               Foundry tests
├── execute.py                    Standalone Python runner (no Foundry needed)
├── foundry.toml                  Foundry config
├── .env.example                  Config template
└── docs/                         Flow diagrams
    ├── flash-swap.svg
    └── flash-loan.svg

🚀 Quick Start

Option A — Foundry (recommended)

# Install foundry kalau belum
curl -L https://foundry.paradigm.xyz | bash && foundryup

# Clone + setup
cd rh-flash-toolkit
cp .env.example .env
# edit .env: isi PRIVATE_KEY

# Build
forge build

# Deploy MorphoFlash + FlashSwap contracts
forge script script/Deploy.s.sol --rpc-url robinhood --broadcast
# → catat alamat kedua contract, masukin ke .env (MORPHO_FLASH_ADDR + FLASH_SWAP_ADDR)

# Run flash loan
forge script script/ExecFlashLoan.s.sol --rpc-url robinhood --broadcast

Option B — Python standalone (no Foundry)

pip install web3 eth_account py-solc-x
cp .env.example .env  # edit PRIVATE_KEY

python execute.py deploy-morpho
python execute.py flash-loan USDG 1000000
python execute.py deploy-swap
python execute.py flash-swap 0.5

Lihat SETUP-WINDOWS.md untuk step-by-step Windows.


🧠 Perbedaan Inti

Flash Swap (Uniswap V2)

  • Sumber: pool AMM (pair token0/token1)
  • Mekanik: pair.swap(amountOut, 0, to, data) dengan data != "" → pair kirim token, panggil callback uniswapV2Call, repay di akhir
  • Fee: WAJIB 0.3% — hardcoded di require(balance0Adjusted * balance1Adjusted >= reserve0 * reserve1 * 1000^2). Repay = amount * 1000 / 997 (≈0.3009%)
  • Batas: amountOut < reserve (ga bisa pinjam > likuiditas pool)

Flash Loan (Morpho Blue)

  • Sumber: lending protocol Morpho core
  • Mekanik: morpho.flashLoan(token, amount, data) → Morpho kirim token, panggil onMorphoFlashLoan, approve balik, Morpho tarik via transferFrom
  • Fee: 0 — Morpho flash loan gratis, cuma bayar gas
  • Batas: amount <= balanceOf(morpho, token) (total idle liquidity di Morpho)

🎯 Kapan Pakai Yang Mana

✅ Flash Swap COCOK untuk Arbitrase 2-pool

Karena kamu udah butuh swap token sebagai bagian strategi:

  1. Pinjam token A dari pool 1 (via flash swap)
  2. Jual di pool 2 dengan harga lebih tinggi
  3. Balikin token A + fee 0.3% ke pool 1
  4. Sisa = profit

Fee 0.3% "terbayar" karena arb spread biasanya > 0.3%. Flash swap = swap + pinjaman jadi satu, efisien untuk arb dua-pool. Tidak perlu modal awal, tidak perlu approve token dulu.

❌ Flash Swap TIDAK cocok untuk pinjam murni (non-swap)

Kalau cuma butuh "pinjam lalu balikin" tanpa aksi swap (self-liquidation, collateral swap, refinance), fee 0.3% itu murni kerugian. Tidak ada spread yang nutup.

✅ Flash Loan Morpho COCOK untuk pinjaman murni

0 fee, cocok untuk operasi yang tidak menghasilkan spread:

  • Self-liquidation — tutup posisi sendiri sebelum kena likuidasi
  • Collateral swap — ganti jaminan tanpa nutup posisi
  • Debt refinance — pindah utang antar protocol
  • Leverage looping — buka/tutup posisi leverage
  • Arbitrase juga bisa — bahkan lebih untung karena 0 fee

🧭 Aturan Praktis

Butuh pinjam token + langsung swap di AMM    → Flash Swap (kalau ga ada 0-fee source)
Butuh pinjam murni / ada Morpho 0-fee        → Flash Loan (SELALU lebih murah)

Di RobinhoodChain, Morpho tersedia & 0 fee, jadi untuk hampir semua kasus Flash Loan Morpho menang — kecuali arb yang spesifik butuh token yang cuma tersedia di UniV2 pool dan Morpho tidak punya token itu.


📌 Public Protocol Addresses (RobinhoodChain)

Contract Address
Morpho Blue core 0x9D53d5E3bd5E8d4Cbfa6DB1ca238AEA02E651010
Uniswap V2 factory 0x8bCeAA40b9ACdFAEDF85Adf4FF01f5aD6517937f
USDG token 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168
WETH token 0x0bd7d308f8e1639fab988df18a8011f41eacad73

Verify di explorer: https://robinhoodchain.blockscout.com

RPC: https://rpc.mainnet.chain.robinhood.com — chainId 4663


⚠️ Disclaimer

Toolkit ini experimental/educational. Kode contract audited-informal aja — baca sendiri sebelum pakai modal besar. Flash loan/swap bisa gagal (revert) kalau logic dalam callback keliru — dan tetap kena biaya gas. Test di small amount dulu sebelum scale up.


📜 License

MIT — pakai sesuka hati, tapi kalau kepake buat cari cuan, pertimbangin donate 🙏 (address di atas).

Rendered by GitHub from the repository’s README. Scroll to read the full file.

First trending

Jul 28, 2026

first spotted on the list

Best rank

#16

highest position reached

Appearances

3

times on the trending list

Star velocity

0.12

stars per day since creation

Activity — last 60 days

daily counts, collected every 6 hours
  • Stars
  • Forks
  • Merged PRs
  • Issues
  • Closed issues

Collecting activity data since launch — check back in a few days.

Star history

total stars per snapshot
91011121314FlipZ3ro/rh-flash-toolkit · Jul 28, 2 PM UTC: 10 starsFlipZ3ro/rh-flash-toolkit · Jul 28, 7 PM UTC: 12 starsFlipZ3ro/rh-flash-toolkit · Jul 29, 2 AM UTC: 13 stars2 PM8 PM2 AM

Rank history

position on trending · lower is better
#1#10#20#30#40#50#60#70#80Jul 28, 2 PM UTC: rank #16Jul 28, 7 PM UTC: rank #43Jul 29, 2 AM UTC: rank #792 PM8 PM2 AM

3D card for your website

Live HTML card with a pointer tilt. Paste the iframe on any website.

<iframe src="https://www.notionpulse.cc/embed/FlipZ3ro/rh-flash-toolkit" width="420" height="240" style="border:0;max-width:100%;background:transparent" loading="lazy" title="FlipZ3ro/rh-flash-toolkit — trending on Open Source Pulse"></iframe>

Stars badge

Show current stars in your README or profile. Auto-updates every 6 hours.

FlipZ3ro/rh-flash-toolkit stars badge
Markdown
[![FlipZ3ro/rh-flash-toolkit](https://www.notionpulse.cc/api/badge/FlipZ3ro/rh-flash-toolkit.svg)](https://www.notionpulse.cc/repo/FlipZ3ro/rh-flash-toolkit)
HTML
<a href="https://www.notionpulse.cc/repo/FlipZ3ro/rh-flash-toolkit"><img src="https://www.notionpulse.cc/api/badge/FlipZ3ro/rh-flash-toolkit.svg" alt="FlipZ3ro/rh-flash-toolkit stars badge" /></a>

Repository of the Day

#16 Repository of the Day

Repository of the Week

#16 Repository of the Week

Repository of the Month

#16 Repository of the Month