Skip to content

This project is a **Flash Loan Simulator** built in Solidity, designed to teach and demonstrate how **flash loans** work in decentralized finance (DeFi) — **without using actual lending pools or liquidity protocols**.

Notifications You must be signed in to change notification settings

MrinalSingh04/Flash_Loan_Simulator_smartContract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

🔄 Flash Loan Simulator (Educational Smart Contract)

This project is a Flash Loan Simulator built in Solidity, designed to teach and demonstrate how flash loans work in decentralized finance (DeFi) — without using actual lending pools or liquidity protocols.


🧠 What is a Flash Loan?

A flash loan is a type of uncollateralized loan offered by DeFi protocols (like Aave and dYdX) that must be borrowed and repaid within the same transaction. If the loan isn't repaid with interest in that single transaction, it automatically reverts, meaning no funds are lost.

Key Concepts:

  • Atomicity: All operations happen in a single transaction.
  • No collateral required.
  • Useful for arbitrage, collateral swaps, liquidation protection, etc.

🎯 What Does This Project Do?

This project simulates the flash loan process in a simplified, beginner-friendly way.

✅ Core Features:

  • Simulates a liquidity pool where users can deposit ETH.
  • A flashLoan() function sends ETH to a borrower and expects it to be returned within the same transaction.
  • If not repaid, the transaction reverts, mimicking real flash loan behavior.
  • A separate receiver contract (FlashLoanReceiver) demonstrates how to borrow and repay within executeOperation().

❓ Why Build This Simulator?

Flash loans are conceptually powerful but complex to learn in live DeFi environments due to:

  • Complex protocol codebases (e.g., Aave).
  • Gas costs and risk of actual fund loss.
  • Inaccessible or hard-to-debug test environments.

This simulator:

  • Provides zero-risk experimentation.
  • Keeps the logic transparent and self-contained.
  • Helps you understand how flash loans are structured internally.
  • Prepares you to interact with real-world DeFi protocols.

📜 License

MIT License. Feel free to fork and build upon it for your learning journey.

About

This project is a **Flash Loan Simulator** built in Solidity, designed to teach and demonstrate how **flash loans** work in decentralized finance (DeFi) — **without using actual lending pools or liquidity protocols**.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published