Educational flash loan smart contracts and tooling built with Hardhat. This repository demonstrates Uniswap V2-style flash swaps and related patterns for research and learning purposes.
| Platform | Link |
|---|---|
| 📱 Telegram | t.me/novustch |
| wa.me/14105015750 | |
| 💬 Discord | discordapp.com/users/985432160498491473 |
Feel free to reach out for implementation assistance or integration support.
This project provides a minimal yet practical setup to explore flash loans/flash swaps. It focuses on safe developer workflows (compilation, testing, and local deployments) while keeping the smart contract code approachable.
- Contracts
contracts/FlashLoaner.sol: Example flash swap/flash loan executor.contracts/UniswapV2Library.sol: Minimal helpers adapted for Uniswap V2 interactions.contracts/interfaces/*: Lightweight interfaces for ERC-20 and Uniswap V2 components.
- Tooling
- Hardhat configuration (
hardhat.config.ts) - TypeScript support (
tsconfig.json) - NPM scripts (
package.json)
- Hardhat configuration (
- Node.js LTS (recommended) and npm or yarn
- Git
- Install dependencies
npm install
# or
yarn- Compile contracts
npm run compile- Run tests
npm test- Start a local node (optional)
npm run node- Deploy to a network (example: localhost)
npm run deploy -- --network localhostAdjust the --network flag in line with your Hardhat network settings.
contracts/
FlashLoaner.sol
UniswapV2Library.sol
interfaces/
IERC20.sol
IUniswapV2Callee.sol
IUniswapV2Pair.sol
IUniswapV2Router01.sol
IUniswapV2Router02.sol
hardhat.config.ts
package.json
tsconfig.json
Populate any required environment variables (e.g., RPC URLs, private keys) for deployments. A common approach is to use a local .env file and load it in hardhat.config.ts (dotenv). Ensure you never commit secrets to version control.
- This repository is for learning and experimentation. Flash loans are advanced and risky.
- The example
FlashLoanercontract assumes Uniswap V2-compatible pairs. Adapt addresses and logic for your target network. - Thoroughly review and extend unit tests before attempting any non-local deployment.
- Not audited. Use at your own risk.
- Do not deploy to production networks without a professional audit and extensive testing.
- Flash loan strategies can be economically brittle and highly sensitive to MEV and slippage.
- Expand documentation with detailed walkthroughs.
- Add more test coverage and scenario examples.
- Provide multiple DEX/AMM examples for comparison.
This project is provided for educational purposes. Unless otherwise stated, it is available under an open-source license; see the repository's license file if/when added.