gawd-coder / Aave-Flashloan

Used Aave Flash Loan Brownie Mix

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uses:

  1. Leveraged Arbitrage
  2. Swapping collateral out of loaned positions, without having to repay the debt of the loaned position

Flash loan - borrow the money and repay it back in the exact same transaction. Lender takes a small fees for providing this i.e. premium and a little bit of gas fees

Aave Flash Loan Brownie Mix - https://github.com/PatrickAlphaC/aave-flashloan-mix

This Brownie mix comes with everything you need to start developing on flash loans.

This mix is configured for use with Ganache on a forked mainnet.

If you're unfamiliar with environment variables you can just add all these commands to your .env file and run source .env when you're done.

If using metamask, you'll have to add a 0x to the start of your private key

Aave is the go to platform for borrowing and lending

We will deploy this on Kovan testnet and hence don't need Ganache CLI, but If you do want to test locally then go ahead with that setup.

Main code => FlashloanV2.sol under contracts folder

Here we will write a flash loan for some WETH. After adding all credentials in your .env file simply run this from terminal source .env

We will require some WETH to pay the premium / fee of the flash loan

In the get_weth.py we will deposit one testnet ETH to get one KETH or testnet Ether for Kovan

Wrapped ETH, or WETH, is a token that represents ETH 1:1 and conforms to the ERC20 token standard. By conforming to ERC20, it allows for increased functionality across any application that handles ERC20 tokens. You can always convert your WETH to ETH 1:1 and vice versa.

Screenshot 2021-12-31 at 6 39 11 PM

Deploying our flashoan contract

Through this flashloan we simply borrowed 1 WETH, got AAVE interest bearing token in return and then gave back that 1 WETH + some fees to AAVE

Screenshot 2021-12-31 at 6 39 49 PM

Screenshot 2021-12-31 at 6 40 17 PM

Screenshot 2021-12-31 at 6 40 29 PM

About

Used Aave Flash Loan Brownie Mix

License:GNU Affero General Public License v3.0


Languages

Language:Solidity 78.7%Language:Python 20.8%Language:Shell 0.5%