Giter Club home page Giter Club logo

flashloan_aave_v3's Introduction

Implementing a simple flash loan

Code has been tested only on Remix

Using Remix:


For implementing a simple flash loan, Flashloan.sol in remix should be enough. There are hardhat modules here, as in the future this is planned to be implemented through hardhat.

Modify the execute operation in the Flashloan.sol accordingly


Full Walkthrough of the Code is in the FLASHLOAN.md

Steps to follow for taking a Flash Loan:

  1. Go to Remix, an online IDE for solidity
  2. Create a new file and paste the code in Flashloan.sol
  3. Use the injected Web 3 provider and connect to metamask
  4. Deploy the contract with the address of Addresses Provider in the your respective testnet. Refer to the Testnet Addresses
  5. Set your respective token for which the flash loan is to be taken.
  6. Get some testnet tokens

    (For getting testnet tokens, the easiest way is to simply go to app.aave.com and taking the required amount)

  7. Check the premium fees using the FlashloanPremiumFees function.
  8. Deposit the premium fees in the contract.

    Errors at this step, currently resolving, if you simply want to understand flash loans this may not be necessary at the moment)

  9. Check the flag to see it's at false. If not, use the reset flag to reset the flag to 0.
  10. Select an amount of 1 for the flash loan(use a low amount at the moment, if you wish to scale the solution kindly open an issue and I'll be sure to update the code accordingly)
  11. Execute the Flash Loan by calling the flash loan function. If the flash loan executed successfully the flag will be set to true.

Note: At the moment I made no attempts to scale the contract to try to fix the error encountered during token depositing. However, if you happen to be interested in this, raise an issue and I'll update the code accordingly.


Errors Encountered:


References:

flashloan_aave_v3's People

Contributors

reap3rgrim avatar

Stargazers

 avatar

Watchers

 avatar

flashloan_aave_v3's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.