Make use of Flash loan from DY/DX to earn more from Compound.
- Solidity (Writing Smart Contracts)
- Javascript (Testing)
- Hardhat (Development Framework)
- Ethers.js (Blockchain Interaction)
- Alchemy (Blockchain Connection)
- Metamask (Account Management)
- Compound Protocol (Supply or Borrow Tokens and Earn cTokens)
- dYdX Solo Margin (Flash Loan Provider)
- Install NodeJS. We recommend using the latest LTS (Long-Term-Support) version, and preferably installing NodeJS via NVM.
- Create an Alchemy account, you'll need to create an app for the Ethereum chain, on the mainnet network
Make sure to enter the project directory before attempting to run the project related commands:
cd flashloan_masterclass_hardhat
If the directory doesn't exist, you can execute pwd
to find out your current path, and ls
to see the files and folders available to you.
npm install
Before running any scripts, you'll want to create a .env file with the following values (see .env.example):
- ALCHEMY_API_KEY=""
npx hardhat test
- Other Flashloan Providers
- DY/DX - Decentralized Exchange offering flashloans with cheap fees; that is used on this example code. Alternative Flashloan Providers that can be used or to investigate
- Uniswap V2 Flashswaps
- Example Uniswap FlashSwap can be found here
- Aave Flashloan
- Kollateral - A liquidity aggregator
- Augment your profits with trading bot - TradingBot Masterclass
- Uses of Flash loans
- Arbitrage - use the vast funds to make profits from price discrepencies e.g on Exchange.
- Leverage - increase exposure e.g earn more with Yield Farming on protocols like Compound.