reap3rGrim / Flashloan_Aave_V3

Simple Contract for implementing flash loans on Aave V3 Protocol
1 stars 0 forks source link

How would I get DAI to my account for testnet? #1

Closed Sirtsu55 closed 2 years ago

Sirtsu55 commented 2 years ago

Honestly, there is nothing documented on this that I could find. How would I get the DAI to call AddTokensForPremium function in the code?

reap3rGrim commented 2 years ago

My apologies for not making that clear. This was just a personal project to be frank and I didn't expect people to use it. I'll be sure to add that up

However, the way I got the testnet DAI was by simply going to app.aave.com and then connecting my wallet, then replacing some testnet Goerli ETH for DAI. You can also refer to this page.

My apologies again, I'll be sure to document it in the next commit.

A side note though, Flashloan.sol was working for me only when I took a Flash Loan with an amount of 1. There are just some errors at higher amounts which I'll be sure to fix in the future. This code was just for gaining understanding of how it works and is meant to be very basic. Let me know if you need more help.

I recommend to try in remix first.

I'll work on the documentation. Let me know if the code is functional.

Sirtsu55 commented 2 years ago

Hey, thanks for updating the readme! The code is functional now and I just wanted to say this is probably the best guide to executing a flashloan for beginners right now on the internet. There are lots of guides for V1 or V2 but this is easily the best and basic introduction to flashloans.

Cheers!

reap3rGrim commented 2 years ago

Thanks for the feedback, I'll be sure to make it even better.

reap3rGrim commented 2 years ago

Hey, can you check out FLASHLOAN.md, it explains the entire concept in depth. I've tried to be thorough as I know there's not much sources, especially for the Aave V3 and the modern protocols.

It should be enough to help you understand the concept.

Just a question though, would you be interested in a similar implementation for liquidations and arbritrage with the Flash Loans?

Sirtsu55 commented 2 years ago

I read through FLASHLOAN.md and I think it is comprehensive to get started with Flashloans on AAVE V3. It also gives a good understanding to the code. Nice work!

And to answer your question: Liquidations would be a nice addition and I would be interested in it.

There are abundant resources on making an arbitrage contract and it is easy to implement the same logic with flashloans, so IMO it isn't necessary, but if you have time to invest in this, then go ahead.

reap3rGrim commented 2 years ago

Lastly, I understand we have stretched this issue a bit too long but I understand it's not always convenient to use the aave webpage for borrowing testnet DAI, it may be convenient for small amounts, however for large amounts you may want to do this programmatically.

There is a lovely way to do this which is in my Blockchain Freecodecamp Repo for Aave.

This code is also explained by Patrick Collins in a lovely way, check it out.

You can clone my repo or Patrick's, both are functional and if you fill out the necessary env variables, it does work as expected.

Happy hacking!