About this project

FlashLoanArbitrage is a decentralized finance (DeFi) arbitrage bot built with Node.js. It monitors ETH/USDC prices across five platforms—Chainlink (oracle), Uniswap V2, SushiSwap, Curve Finance, and Balancer—and automatically executes flash-loan arbitrage trades when the price spread reaches at least 0.9%. ## How It Works The bot operates in two parts: 1. **Smart Contract**: Takes a flash loan in USDC from a selected protocol, converts the user's ETH to USDC, buys ETH at a lower price on one exchange, sells it at a higher price on another, repays the loan plus fees and gas, and returns the profit in ETH. 2. **CLI Script (`goflash.js`)**: Polls prices every 60 seconds, displays real-time values with change indicators, and triggers the smart contract when a profitable spread is detected. ## Supported Flash Loan Protocols - **Aave** — up to 10,000,000 USDC, 0.05% fee - **dYdX** — up to 500,000 USDC, 0.05% fee - **Uniswap V3** — up to 5,000,000 USDC, 0.01% fee - **Balancer** — up to 1,000,000 USDC, 0.02% fee ## Setup & Usage 1. Clone the repository and copy `goflash.js` and `package.json` into a folder. 2. Install dependencies: `npm install` 3. Run: `node goflash.js` 4. On first launch, create a new wallet or import an existing one via private key. The key is saved to `wallet.json`. 5. Use the interactive CLI menu to select a flash loan protocol, set the loan amount (10 ETH minimum), and start arbitrage monitoring. ## Key Features - Interactive menu powered by Inquirer - Real-time price display with up/down/unchanged indicators - Wallet management (create, import, recreate) - Gas fee safeguards: loans above 10 ETH require ≥0.1 ETH wallet balance - Automatic RPC reconnection on failures - Profit accounting after flash loan fees, trading fees (0.1%), slippage (0.05%), and gas ## Security Notes - Never commit `wallet.json` to version control; add it to `.gitignore` - Keep private key backups offline - Use a dedicated wallet for bot operations - Start with small amounts to test ## Dependencies - ethers ^6.11.1 - inquirer ^8.2.6 - chalk ^4.1.2 ## License Shared as-is for educational purposes. Use at your own risk.