This project use Aave V3 FlashLoan to make profit by buying the ETH discounted sell by B.Protocol Chicken Bond Stability pool contract.
This project also contain a JS script that call the contrat using MEV for two reason
- Be sure to be the first one to call the BAMM CB contrat
- Avoid to be sandwich attack when swapping the token on Uniswap
This project use Aave V3 FlashLoan + Uniswap and MEV Flashbot for the script.
This project has been created to validate my Ethereum Developer Bootcamp Alchemy University certificate, you can find the presentation here.
Ethereum contract deployed : https://etherscan.io/address/0x88804cc0a5d4e2fb3af028bb5273993e217172d5
-
Clone the repo
-
Copy/paste the .env.example file and rename it to .env and fill in the variables
-
Run
forge install
-
Be sure to have set the 'FOUNDRY_ETH_RPC_URL' variable in the .env file, because the test will fork the mainnet
-
Run the following command
forge test
or
forge test -vv #To get more logs
-
Be sure to have set the 'FOUNDRY_ETH_RPC_URL', 'PRIVATE_KEY' and 'ETHERSCAN_API_KEY' variable in the .env file, because the test will fork the mainnet
-
Run the
forge script script/deploy/Deploy.s.sol --broadcast --verify
to deploy and verify the contract
To see the cost of the deployement use forge script script/deploy/Deploy.s.sol -f 'RPC_URL_CHAIN_TO_DEPLOY'
-
Be sure to have deploy the contrat and then copy-past the .env.example file and rename it to .env and fill in the variables.
-
Run
npm install
to install the dependencies -
Now you can run the script with
node script/cron/cron.js
ℹ️ : There is two options on the script :
-
--force true
to force the script to be executed -
--minPrice MIN_PRICE
to set a minimum price where the script will be executed. Actually the script is configured to be run when the BAMM CB have at least 5000 $ETH in LUSD.