This smart contract performs a flashloan arbitrage between Aave's USDC and DAI. It performs the following operations:
Deposit 1,000,000,000 USDC to a DEX contract (dexContractAddress) using the depositUSDC() function. Buy DAI from the DEX contract using the buyDAI() function. Deposit the DAI bought in the previous step to the DEX contract using the depositDAI() function. Sell the deposited DAI for USDC using the sellDAI() function. The smart contract repays the flashloan and keeps the profit if the arbitrage opportunity is profitable.
- Hardhat
- Aave Protocol V3
- OpenZeppelin
- Clone this repository:
git clone https://github.com/marutint10/FlashLoan-Arbitrage
- Install the Repo:
npm install
- Compile the contract
npx hardhat compile
- deploy the contract:
npx hardhat run scripts/deployDex.js --network <netowrk-name>
- change the address of dexContractAddress
npx hardhat run scripts/deployFlashLoanArbitrage.js --network <netowrk-name>
The smart contract can be used to perform a flashloan arbitrage between Aave's USDC and DAI.
- Call the requestFlashLoan(address _token, uint256 _amount) function, where _token is the token to be flashloaned and _amount is the amount to be flashloaned.
- Wait for the executeOperation() function to execute the arbitrage operation.
- The smart contract will repay the flashloan and keep the profit if the arbitrage opportunity is profitable.
This project is licensed under the MIT License. See the LICENSE file for more information.