Another Flash-loan arbitrage bot that:
- is low cost, works on Polygon;
- uses AAVE for flash-loans;
- performs swaps on Uniswap v3 (the DEX);
- makes use of established patterns when they exist;
- prefers open-source tools but does not shy away from freemium services.
Decentralized exchanges (DEXs) often exhibit price discrepancies due to the impact of large trades. This system aims to take advantage of these discrepancies through flash loans, which allow borrowing large amounts of cryptocurrency without collateral, provided the loan is repaid within the same transaction.
Key features of this system include:
- Price Arbitrage: Capitalize on price misalignment's between exchanges. Large trades can create imbalances in liquidity pools, distorting prices and causing slippage.
- Smart Contract Relay: Utilize a Solidity smart contract to act as a relay between the controller and the exchanges, ensuring efficient and secure transactions.
- Modular and Extensible Design: Built with a modular architecture, allowing for easy integration of additional features and support for other exchanges.
- Node.js - JavaScript runtime.
- TypeScript - Typed superset of JavaScript.
- Hardhat - Ethereum development environment.
- Alchemy - Ethereum node provider.
- Solidity - A programming language for writing smart contracts.
- Uniswap v3 - Decentralized exchange on Binance Smart Chain.
Ensure you have the following installed:
Additionally, you will need:
- An Ethereum wallet with sufficient funds to cover gas fees. You can create a new wallet using the script in the
scripts
folder. - An account on Alchemy with a new project created to obtain the API key.
- Deployed smart contracts on the Polygon network. The Remix IDE is a good tool to perform the deployment.
-
Clone the repository:
git clone https://github.com/jorgejch/dex-arbitrage.git cd dex-arbitrage
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory and add your configuration as in the.env.example
file.
-
Compile the TypeScript files:
npm run build
-
Run the deployment script:
npm run start
This repository is for educational and informational purposes only. It is not investment advice or a recommendation to buy or sell any financial instrument. The information provided here should not be used as the basis for any investment decision. Always conduct your own research and consult with a qualified financial advisor before making any investment decisions. The authors and contributors are not responsible for any financial losses or damages incurred as a result of using this software. The contents are subject to change without notice.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.