Make use of Flashloan from DY/DX to earn more from Compouond.
- Node Version Manager - node version manager
- Yarn - Alternative package manager to NPM
- Truffle - development framework
- Solidity - ethereum smart contract language
- Ganache - local blockchain development
- Web3 - library interact with ethereum nodes
- JavaScript - logic front end and testing smart contracts
- Infura - connection to ethereum networks
- Flashloan - Flashloans allow you to borrow lots of funds for a very small fee without need for collateral do anything else with funds as long as repayments happens in same transaction.
- Metamask Wallet - You need to install Metamask Wallet
- ERC20 - ERC20 Token standards
- Compound Protocol - supply or borrow tokens and earn cTokens
- Flashloan Providers
- DY/DX - Decentralized Exchange offering flashloans with cheap feess; that is used on this example code
Alternative Flashloan Providers that can be used or to investigate
- UniswapV2 Flashswaps - access temporary funds
- Example Uniswap FlashSwap can be found here
- Aave Flashloan - uncollaterized loan that must be returned in same transaction
- Binance Smart Chain - Pancake Swap - PancakeSwap as a fork of Uniswap deployed on Binance Smart Chain has the same functionality for Flashloan using e.g ..pancakeCall vs UniswapV2Cal when considering version2 Uniswap
- Kollateral - a liquidity aggregator
- UniLend - UniLend Flashloans
- UniswapV2 Flashswaps - access temporary funds
- DY/DX - Decentralized Exchange offering flashloans with cheap feess; that is used on this example code
Alternative Flashloan Providers that can be used or to investigate
- Augement your profits with trading bot - TradingBot Masterclass
- Uses of Flashloans
- Arbitrage - use the vast funds to make profits from price discrepencies e.g on Exchange See SimpleArb.sol
- Leverage - increase exposure e.g earn more with Yield Farmin on protocols like Compound. See FlashloanLeveragedYieldFarm project
- FlashloanLeveragedYieldFarm
- flats
- migrations
- node_modules
- src
- abis
- contracts
- test
- flatten.sh
- truffle.js
- package.json
- .gitignore
- README.md
- yarn.lock
- Mac & Linux
- Have python 2.7 installed Check if installed using command below
python -V
If not installed download from python Python Download version 2.7 related to your system
-
Download Ganache Graphical User Interface (GUI ) from Truffle Framework Site choose related to your system
-
Have node-gyp installed Check if installed using command below
If not installed, install using command below
npm i -g node-gyp
- Windows machine
Ignore Step 7 in the document below (document for bootcamp setup but applies to setup ubuntu environment)
- You may need to Follow the Windows setup steps in this document
- You will need nvm if not laready installed; so you can use specific version node version 14 and above
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
$ source ~/.nvm/nvm.sh
Restart your terminal
- Install node v12.0.0 or versions above e.g node v14.16.0
$ nvm install 14.16.0
$ nvm alias default 14.16.0
$ nvm use default
- Install truffle globally if not installed. Check if installed using
truffle version
If not installed install with below
$ npm install -g truffle
- Ignore if either installed already! If opting to use ganache-cli vs Ganache GUI, install ganache-cli globally. Note that ganache-cli rus on port 8545 and ganache-gui runs on port 7545 as placced in truffle-config.js. Check if ganache-cli installed first with
ganache-cli --version
If not installed install with below
$ npm install -g ganache-cli
$ ganache-cli
Run ganache-cli in different terminal and keep running when compiling,testing, migrating, running app etc
- Install yarn if not installed. Check if installed using
yarn --version
If not installed install with below
$ npm install --global yarn
- Enter project directory and install dependancies
$ cd nft_collectibles_masterclass
$ yarn install
Make sure you are in project directory
$ cd flash_loan_masterclass_examples
- Run Ganache Fork Go to Infura.io create a new project and copy the Project ID Replace with your infura project id in ganache command below and leave running ganache-cli -p 7545 -f https://mainnet.infura.io/v3/ See example below, make sure you use your own id instead of 8888888888888888888888888888888
$ ganache-cli -p 7545 -f https://mainnet.infura.io/v3/8888888888888888888888888888888
- Run the test that will show example flashloan and leveraged yield farming compound and repay Open a new terminal and run
$ truffle test
If you have problems with test e.g archived state, rpc etc, you may need to restart your ganache running fork To reset and run again, you will need to restart the terminal with ganache and rerun the fork