Giter VIP home page Giter VIP logo

simple-flash-loan's Introduction

Simple Flash Loan Project

This project demonstrates how to create a simple flash loan contract using the Aave protocol on the Sepolia Ethereum testnet.

Overview

Flash loans are a type of uncollateralized loan that must be borrowed and repaid within the same transaction. They are primarily used for arbitrage, collateral swaps, and other advanced trading strategies. This project utilizes Aave's flash loan feature to perform such operations.

Step-by-Step Guide

This is my first attempt at testing a flash loan on the Aave platform using Solidity. I followed the QuickNode guide, which uses the Polygon Mumbai network. However, I preferred the Ethereum Sepolia testnet because I have previous experience with it and it better suits my needs.

Prerequisites

  • An Ethereum wallet (e.g., MetaMask)
  • Sepolia Ethereum testnet ETH (for deploying and interacting with contracts). You can get some from the Sepolia Faucet.
  • QuickNode account (optional, for accessing the Ethereum node)
  • Aave testnet addresses can be found here.

Deployment and Interaction

  1. Writing and Deploying the Contract:

    • Use Remix IDE with the environment set to "Injected Provider - MetaMask."
    • Deploy the contract on the Aave PoolAddressesProvider with the address 0x012bAC54348C0E635dCAc9D5FB99f06F24136C9A.
    • Ensure you have some Sepolia ETH for transaction fees.
  2. Obtaining Test Tokens:

  3. Funding the Contract:

    • Transfer at least 1 USDC to your deployed contract by copying its address and making the transfer.
  4. Executing the Flash Loan:

    • In Remix IDE, call the fn_RequestFlashLoan function.
    • Pass the USDC Testnet Mintable ERC20 Aave address 0x94a9D9AC8a22534E3FaCa9F4e7F2E2cf85d5E4C8 in _token.
    • Pass 10000000 in _amount.
    • Press "transact" to execute the flash loan.

Using Hardhat

I used Hardhat in this repository to manage dependencies and compile the SimpleFlashLoan.sol contract, as VS Code couldn't resolve the import files.

  1. Install Dependencies:

    npm init -y
    npx hardhat init
    npm install @aave/core-v3
    
    

simple-flash-loan's People

Contributors

sdrasai avatar

Stargazers

 avatar

Watchers

 avatar

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.