Full Code of mrdavey/ez-flashloan for AI

master cdc56ae08a79 cached
17 files
21.4 KB
5.6k tokens
1 requests
Download .txt
Repository: mrdavey/ez-flashloan
Branch: master
Commit: cdc56ae08a79
Files: 17
Total size: 21.4 KB

Directory structure:
gitextract_r6cswwvm/

├── .gitattributes
├── .gitignore
├── LICENSE
├── README.MD
├── contracts/
│   ├── Flashloan.sol
│   ├── Migrations.sol
│   ├── aave/
│   │   ├── EthAddressLib.sol
│   │   ├── FlashLoanReceiverBase.sol
│   │   ├── IFlashLoanReceiver.sol
│   │   ├── ILendingPool.sol
│   │   └── ILendingPoolAddressesProvider.sol
│   └── utils/
│       └── Withdrawable.sol
├── env
├── migrations/
│   ├── 1_initial_migration.js
│   └── 2_deploy_ezflashloan.js
├── package.json
└── truffle-config.js

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitattributes
================================================
# Auto detect text files and perform LF normalization
* text=auto


================================================
FILE: .gitignore
================================================
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Client
client/


================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2020 David Truong

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: README.MD
================================================
# EZ-Flashloan
## This repo has been deprecated, in favor of the official [Flash Loans Truffle Box](https://github.com/aave/flashloan-box)

---

A barebones solidity (^0.5.15) template for Aave's flashloans

### Join our #development channel on the [Aave Discord](https://discord.gg/fVaDMqT)

## Prerequisite
 - Basic knowledge of Solidity
 - Basic knowledge of Truffle
 - Basic knowledge of Javascript
 - An [Infura](https://infura.io/) account and API key

## Flashing
1. In `Flashloan.sol`, code your logic into the `executeOperation()` function
2. When ready, call `flashloan()` on your contract
3. Important: your contract **must** have enough funds of whatever asset you are borrowing to payback the flashloan fee.
4. If not deploying on mainnet, then change the `addressProvider` in `./aave/FlashLoanReceiverBase.sol` to the relevant address

## Set up for 'simple' flash lending
If you do not need to work across protocols, such as simple flash loan testing, then the following instructions apply.

1. Clone this repo and in the cloned repo directory, install the necessary dependencies :
    ```
    npm install
    ```
2. In `truffle-config.js`, add the details of the [network you wish to use](https://www.trufflesuite.com/docs/truffle/reference/configuration), e.g. Ropsten. 
 - Important: make sure you are using an ethereum account that has enough ETH and token assets to pay back the loan. This is your `deployment account`
 - Rename `env` file to `.env` and include your infura key and `deployment account`'s private key (don't commit this file to Git!)
3. In `Flashloan.sol`, line 31, change the asset address to the [relevant asset address](https://docs.aave.com/developers/developing-on-aave/deployed-contract-instances) for the network you chose.
4. In `./aave/FlashLoanReceiverBase.sol`, change the `addressProvider` to the [relevant LendingPoolAddressesProvider](https://docs.aave.com/developers/developing-on-aave/deployed-contract-instances) for the network you chose.
5. In a terminal window in your repo directory, replace `NAME_OF_YOUR_NETWORK` with the network name from step 2 and run:
    ```
    truffle console --network NAME_OF_YOUR_NETWORK
    ```
6. You are now connected to the network you chose. In the same terminal window:
    ```
    migrate --reset
    ```
7. Your contract is now deployed on the network you chose. Call your contract's flashloan function within the _truffle console_ with:
    ```
    let f = await Flashloan.deployed()
    await f.flashloan()
    ```
    Be patient as your transaction gets processed and mined.

8. If your implementation is correct, then the transaction will succeed. If it fails/reverts, a reason will be given.
    - if you didn't make any changes to this template and just deployed it, then the call to `f.flashloan()` will fail as the **contract** is not funded with any DAI, so cannot make the flashloan repayment (which includes the amount borrowed + a fee). Solve this by getting DAI (or the relevant asset) and transferring it to your **contract**.

## Set up for cross protocol flash lending
If you are working across protocols, such as using the flash loaned amount on another #DeFi protocol, sometimes it is easier to fork mainnet and use each protocol's production contracts and production ERC20 tokens.

1. Clone this repo and in the cloned repo directory, install the necessary dependencies :
    ```
    npm install
    ```
2. (Install and) Run [Ganache](https://www.trufflesuite.com/ganache), preferably the [CLI version](https://github.com/trufflesuite/ganache-cli)
3. In `truffle-config.js`, ensure the details for the development network match up with your running Ganache instance
4. To minimise set up steps with Aave's lending pools, use Ganache's fork feature. This will 'fork' mainnet into your Ganache instance.
    Open terminal, replace `YOUR_INFURA_KEY` in the following and run:
    ```
    ganache-cli --fork https://mainnet.infura.io/v3/YOUR_INFURA_KEY -i 1
    ``` 
5. In a new terminal window in your repo directory, run:
    ```
    truffle console
    ```
6. Migrate your Flashloan contract to your instance of Ganache with:
    ```
    migrate --reset
    ```
7. Your contract is now deployed on your local Ganache, which is mirroring mainnet. Call your contract's flashloan function within the _truffle console_ with:
    ```
    let f = await Flashloan.deployed()
    await f.flashloan()
    ```
    Be patient as your ganache instance works its magic.

8. If your implementation is correct, then the transaction will succeed. If it fails/reverts, a reason will be given.
    - if you didn't make any changes to this template and just deployed it, then the call to `f.flashloan()` will fail as the **contract** is not funded with any DAI, so cannot make the flashloan repayment (which includes the amount borrowed + a fee). Solve this by getting DAI (or the relevant asset) and transferring it to your **contract**.


## Known issues
 - If you are using Ganache to fork a network, then you may have issues with the blockchain archive state every 30 minutes. This is due to your node provider (i.e. Infura) only allowing free users access to 30 minutes of archive state. To solve this, upgrade to a paid plan, or simply restart your ganache instance and redploy your contracts.


## Debugging transactions
### Truffle Debugger
1. Get the transaction hash of a recent transaction from the Ganache-cli terminal window. E.g. `0xfda3855a8bc93e66aaac14c50baccfd83e9665f13a7b4cc57b4bc0f010831720` (the transaction hash must be valid for the network you are currently using)
2. In the `truffle console` window, replace `INSERT_THE_TRANSACTION_HASH` with your transaction hash:
    ```
    debug INSERT_THE_TRANSACTION_HASH
    ```
3. When the debugger has started, the available commands are shown. The important commands to remember are `n` for next step and `v` to print the current variables and values.
    - In the terminal window, press the `n` key to navigate to the next step that the compiler executed.
    - If you are within a function and want to check the values used, press `v`.
    - To quit the debugger, press `q` or `CTRL+C`.

    #### Unable to debug executeOperation()
    The Truffle debugger does not work too well with proxy / complex calls. You may find that the Truffle debugger returns an error such as:
    ```
    TypeError: Cannot read property 'version' of undefined
    at ...
    ```
    - In this case you can try calling your `executeOperation()` function directly, instead of having Aave's `LendingPool` contract invoke the function. This will allow you to debug the function directly, however you will need to supply the relevant parameters (e.g. `_amount`, `_fee`, `_reserve`, etc).
    - Alternatively, see the below 'Testnet Debugging' section

### Testnet Debugging
If your contracts are deployed to a testnet (or even mainnet), you can use a service such as [Tenderly](https://tenderly.co/) to debug your transactions. You will get access to all the debugging features of Truffle Debugger + many more.

## Making it mainnet ready
Before deploying to mainnet:
 - If doing arbitrage and taking profits, hardcode your profit taking address or set it as a variable in the contract

## Deploying to mainnet
1. Rename `env` file to `.env` and include your infura key and deployment wallet private key (don't commit this file to Git!)
2. In `truffle-config.js`, uncomment the `mainnet` section under networks.
3. Deploy to mainnet with `truffle migrate --network mainnet`

## More information
 - [Official documentation](https://docs.aave.com/developers/tutorials/performing-a-flash-loan): For more details on performing a flash loan.
 - [Contract addresses](https://docs.aave.com/developers/developing-on-aave/deployed-contract-instances): For a list of all the asset and contract address on mainnet and the testnets.


================================================
FILE: contracts/Flashloan.sol
================================================
pragma solidity ^0.5.15;

import "./aave/FlashLoanReceiverBase.sol";
import "./aave/ILendingPoolAddressesProvider.sol";
import "./aave/ILendingPool.sol";

contract Flashloan is FlashLoanReceiverBase {

    function executeOperation(
        address _reserve,
        uint256 _amount,
        uint256 _fee,
        bytes calldata _params
    )
        external
    {
        require(_amount <= getBalanceInternal(address(this), _reserve), "Invalid balance, was the flashLoan successful?");

        //
        // do your thing here
        //

        // Time to transfer the funds back
        uint totalDebt = _amount.add(_fee);
        transferFundsBackToPoolInternal(_reserve, totalDebt);
    }

    function flashloan() public onlyOwner {
        bytes memory data = "";
        uint amount = 1 ether;
        address asset = address(0x6B175474E89094C44Da98b954EedeAC495271d0F); // mainnet DAI, for more asset addresses, see: https://docs.aave.com/developers/developing-on-aave/deployed-contract-instances

        ILendingPool lendingPool = ILendingPool(addressesProvider.getLendingPool());
        lendingPool.flashLoan(address(this), asset, amount, data);
    }
}


================================================
FILE: contracts/Migrations.sol
================================================
// This file is part of Truffle suite and helps keep track of your deployments

pragma solidity >=0.4.21 <0.7.0;

contract Migrations {
  address public owner;
  uint public last_completed_migration;

  constructor() public {
    owner = msg.sender;
  }

  modifier restricted() {
    if (msg.sender == owner) _;
  }

  function setCompleted(uint completed) public restricted {
    last_completed_migration = completed;
  }
}


================================================
FILE: contracts/aave/EthAddressLib.sol
================================================
// Original: https://github.com/aave/aave-protocol/blob/master/contracts/libraries/EthAddressLib.sol

pragma solidity ^0.5.0;

library EthAddressLib {

    /**
    * @dev returns the address used within the protocol to identify ETH
    * @return the address assigned to ETH
     */
    function ethAddress() internal pure returns(address) {
        return 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; // Represents ETH: https://docs.aave.com/developers/developing-on-aave/deployed-contract-instances#reserves-assets
    }
}

================================================
FILE: contracts/aave/FlashLoanReceiverBase.sol
================================================
// Original: https://github.com/aave/aave-protocol/blob/master/contracts/flashloan/base/FlashLoanReceiverBase.sol

pragma solidity ^0.5.0;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./IFlashLoanReceiver.sol";
import "./ILendingPoolAddressesProvider.sol";
import "./EthAddressLib.sol";
import "../utils/Withdrawable.sol";

contract FlashLoanReceiverBase is IFlashLoanReceiver, Withdrawable {

    using SafeERC20 for IERC20;
    using SafeMath for uint256;

    // See https://docs.aave.com/developers/developing-on-aave/deployed-contract-instances. This address should not change once deployed.
    // The below address is for mainnet lending pool address provider
    ILendingPoolAddressesProvider public constant addressesProvider = ILendingPoolAddressesProvider(0x24a42fD28C976A61Df5D00D0599C34c4f90748c8);

    function () external payable { }

    function transferFundsBackToPoolInternal(address _reserve, uint256 _amount) internal {
        address payable core = addressesProvider.getLendingPoolCore();
        transferInternal(core, _reserve, _amount);
    }

    function transferInternal(address payable _destination, address _reserve, uint256 _amount) internal {
        if(_reserve == EthAddressLib.ethAddress()) {
            //solium-disable-next-line
            _destination.call.value(_amount)("");
            return;
        }
        IERC20(_reserve).safeTransfer(_destination, _amount);
    }

    function getBalanceInternal(address _target, address _reserve) internal view returns(uint256) {
        if(_reserve == EthAddressLib.ethAddress()) {
            return _target.balance;
        }
        return IERC20(_reserve).balanceOf(_target);
    }
}


================================================
FILE: contracts/aave/IFlashLoanReceiver.sol
================================================
// Original: https://github.com/aave/aave-protocol/blob/master/contracts/flashloan/interfaces/IFlashLoanReceiver.sol

pragma solidity ^0.5.0;

/**
* @title IFlashLoanReceiver interface
* @notice Interface for the Aave fee IFlashLoanReceiver.
* @author Aave
* @dev implement this interface to develop a flashloan-compatible flashLoanReceiver contract
**/
interface IFlashLoanReceiver {
    function executeOperation(address _reserve, uint256 _amount, uint256 _fee, bytes calldata _params) external;
}

================================================
FILE: contracts/aave/ILendingPool.sol
================================================
// Original: https://github.com/aave/aave-protocol/blob/master/contracts/lendingpool/LendingPool.sol

pragma solidity ^0.5.0;

interface ILendingPool {
  function addressesProvider () external view returns ( address );
  function deposit ( address _reserve, uint256 _amount, uint16 _referralCode ) external payable;
  function redeemUnderlying ( address _reserve, address _user, uint256 _amount ) external;
  function borrow ( address _reserve, uint256 _amount, uint256 _interestRateMode, uint16 _referralCode ) external;
  function repay ( address _reserve, uint256 _amount, address _onBehalfOf ) external payable;
  function swapBorrowRateMode ( address _reserve ) external;
  function rebalanceFixedBorrowRate ( address _reserve, address _user ) external;
  function setUserUseReserveAsCollateral ( address _reserve, bool _useAsCollateral ) external;
  function liquidationCall ( address _collateral, address _reserve, address _user, uint256 _purchaseAmount, bool _receiveAToken ) external payable;
  function flashLoan ( address _receiver, address _reserve, uint256 _amount, bytes calldata _params ) external;
  function getReserveConfigurationData ( address _reserve ) external view returns ( uint256 ltv, uint256 liquidationThreshold, uint256 liquidationDiscount, address interestRateStrategyAddress, bool usageAsCollateralEnabled, bool borrowingEnabled, bool fixedBorrowRateEnabled, bool isActive );
  function getReserveData ( address _reserve ) external view returns ( uint256 totalLiquidity, uint256 availableLiquidity, uint256 totalBorrowsFixed, uint256 totalBorrowsVariable, uint256 liquidityRate, uint256 variableBorrowRate, uint256 fixedBorrowRate, uint256 averageFixedBorrowRate, uint256 utilizationRate, uint256 liquidityIndex, uint256 variableBorrowIndex, address aTokenAddress, uint40 lastUpdateTimestamp );
  function getUserAccountData ( address _user ) external view returns ( uint256 totalLiquidityETH, uint256 totalCollateralETH, uint256 totalBorrowsETH, uint256 availableBorrowsETH, uint256 currentLiquidationThreshold, uint256 ltv, uint256 healthFactor );
  function getUserReserveData ( address _reserve, address _user ) external view returns ( uint256 currentATokenBalance, uint256 currentUnderlyingBalance, uint256 currentBorrowBalance, uint256 principalBorrowBalance, uint256 borrowRateMode, uint256 borrowRate, uint256 liquidityRate, uint256 originationFee, uint256 variableBorrowIndex, uint256 lastUpdateTimestamp, bool usageAsCollateralEnabled );
  function getReserves () external view;
}

================================================
FILE: contracts/aave/ILendingPoolAddressesProvider.sol
================================================
// Original: https://github.com/aave/aave-protocol/blob/master/contracts/interfaces/ILendingPoolAddressesProvider.sol

pragma solidity ^0.5.0;

/**
@title ILendingPoolAddressesProvider interface
@notice provides the interface to fetch the LendingPoolCore address
 */

contract ILendingPoolAddressesProvider {

    function getLendingPool() public view returns (address);
    function setLendingPoolImpl(address _pool) public;

    function getLendingPoolCore() public view returns (address payable);
    function setLendingPoolCoreImpl(address _lendingPoolCore) public;

    function getLendingPoolConfigurator() public view returns (address);
    function setLendingPoolConfiguratorImpl(address _configurator) public;

    function getLendingPoolDataProvider() public view returns (address);
    function setLendingPoolDataProviderImpl(address _provider) public;

    function getLendingPoolParametersProvider() public view returns (address);
    function setLendingPoolParametersProviderImpl(address _parametersProvider) public;

    function getTokenDistributor() public view returns (address);
    function setTokenDistributor(address _tokenDistributor) public;

    function getFeeProvider() public view returns (address);
    function setFeeProviderImpl(address _feeProvider) public;

    function getLendingPoolLiquidationManager() public view returns (address);
    function setLendingPoolLiquidationManager(address _manager) public;

    function getLendingPoolManager() public view returns (address);
    function setLendingPoolManager(address _lendingPoolManager) public;

    function getPriceOracle() public view returns (address);
    function setPriceOracle(address _priceOracle) public;

    function getLendingRateOracle() public view returns (address);
    function setLendingRateOracle(address _lendingRateOracle) public;

}

================================================
FILE: contracts/utils/Withdrawable.sol
================================================
pragma solidity >=0.4.24;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/ownership/Ownable.sol";

contract Withdrawable is Ownable {
    using SafeERC20 for ERC20;
    address constant ETHER = address(0);

    event LogWithdraw(
        address indexed _from,
        address indexed _assetAddress,
        uint amount
    );

    /**
     * @dev Withdraw asset.
     * @param _assetAddress Asset to be withdrawn.
     */
    function withdraw(address _assetAddress) public onlyOwner {
        uint assetBalance;
        if (_assetAddress == ETHER) {
            address self = address(this); // workaround for a possible solidity bug
            assetBalance = self.balance;
            msg.sender.transfer(assetBalance);
        } else {
            assetBalance = ERC20(_assetAddress).balanceOf(address(this));
            ERC20(_assetAddress).safeTransfer(msg.sender, assetBalance);
        }
        emit LogWithdraw(msg.sender, _assetAddress, assetBalance);
    }

}


================================================
FILE: env
================================================
INFURA_API_KEY = YOUR_INFURA_KEY
KEY = YOUR_ACCOUNT_KEY_FOR_MAINNET_DEPLOYMENT

================================================
FILE: migrations/1_initial_migration.js
================================================
const Migrations = artifacts.require("Migrations");

module.exports = function(deployer) {
  deployer.deploy(Migrations);
};


================================================
FILE: migrations/2_deploy_ezflashloan.js
================================================
let Flashloan = artifacts.require("Flashloan")

module.exports = async function (deployer) {
    try {
        await deployer.deploy(Flashloan)
    } catch (e) {
        console.log(`Error in migration: ${e.message}`)
    }
}

================================================
FILE: package.json
================================================
{
  "dependencies": {
    "@openzeppelin/contracts": "^2.5.0",
    "@truffle/hdwallet-provider": "^1.0.33",
    "dotenv": "^8.2.0"
  },
  "devDependencies": {
    "truffle": "^5.1.14"
  }
}


================================================
FILE: truffle-config.js
================================================
const path = require("path");
const HDWalletProvider = require("@truffle/hdwallet-provider")
require("dotenv").config()

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // to customize your Truffle configuration!
  contracts_build_directory: path.join(__dirname, "client/src/contracts"),
  networks: {
    development: {
      host: "127.0.0.1",
      port: 8545,
      // gas: 20000000,
      network_id: "*",
      skipDryRun: true
    },
    // mainnet: {
    //   provider: new HDWalletProvider(process.env.KEY, "https://mainnet.infura.io/" + process.env.INFURA_API_KEY),
    //   network_id: 1,
    //   gas: 5000000,
    //   gasPrice: 5000000000 // 5 Gwei
    // }
  },
  compilers: {
    solc: {
      version: "0.5.16",
      settings: {
        evmVersion: "constantinople"
      }
    }
  }
}
Download .txt
gitextract_r6cswwvm/

├── .gitattributes
├── .gitignore
├── LICENSE
├── README.MD
├── contracts/
│   ├── Flashloan.sol
│   ├── Migrations.sol
│   ├── aave/
│   │   ├── EthAddressLib.sol
│   │   ├── FlashLoanReceiverBase.sol
│   │   ├── IFlashLoanReceiver.sol
│   │   ├── ILendingPool.sol
│   │   └── ILendingPoolAddressesProvider.sol
│   └── utils/
│       └── Withdrawable.sol
├── env
├── migrations/
│   ├── 1_initial_migration.js
│   └── 2_deploy_ezflashloan.js
├── package.json
└── truffle-config.js
Condensed preview — 17 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (23K chars).
[
  {
    "path": ".gitattributes",
    "chars": 66,
    "preview": "# Auto detect text files and perform LF normalization\n* text=auto\n"
  },
  {
    "path": ".gitignore",
    "chars": 1628,
    "preview": "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n\n# Diagnostic reports (https://nodejs."
  },
  {
    "path": "LICENSE",
    "chars": 1069,
    "preview": "MIT License\n\nCopyright (c) 2020 David Truong\n\nPermission is hereby granted, free of charge, to any person obtaining a co"
  },
  {
    "path": "README.MD",
    "chars": 7861,
    "preview": "# EZ-Flashloan\n## This repo has been deprecated, in favor of the official [Flash Loans Truffle Box](https://github.com/a"
  },
  {
    "path": "contracts/Flashloan.sol",
    "chars": 1171,
    "preview": "pragma solidity ^0.5.15;\n\nimport \"./aave/FlashLoanReceiverBase.sol\";\nimport \"./aave/ILendingPoolAddressesProvider.sol\";\n"
  },
  {
    "path": "contracts/Migrations.sol",
    "chars": 426,
    "preview": "// This file is part of Truffle suite and helps keep track of your deployments\n\npragma solidity >=0.4.21 <0.7.0;\n\ncontra"
  },
  {
    "path": "contracts/aave/EthAddressLib.sol",
    "chars": 522,
    "preview": "// Original: https://github.com/aave/aave-protocol/blob/master/contracts/libraries/EthAddressLib.sol\n\npragma solidity ^0"
  },
  {
    "path": "contracts/aave/FlashLoanReceiverBase.sol",
    "chars": 1810,
    "preview": "// Original: https://github.com/aave/aave-protocol/blob/master/contracts/flashloan/base/FlashLoanReceiverBase.sol\n\npragm"
  },
  {
    "path": "contracts/aave/IFlashLoanReceiver.sol",
    "chars": 499,
    "preview": "// Original: https://github.com/aave/aave-protocol/blob/master/contracts/flashloan/interfaces/IFlashLoanReceiver.sol\n\npr"
  },
  {
    "path": "contracts/aave/ILendingPool.sol",
    "chars": 2521,
    "preview": "// Original: https://github.com/aave/aave-protocol/blob/master/contracts/lendingpool/LendingPool.sol\n\npragma solidity ^0"
  },
  {
    "path": "contracts/aave/ILendingPoolAddressesProvider.sol",
    "chars": 1843,
    "preview": "// Original: https://github.com/aave/aave-protocol/blob/master/contracts/interfaces/ILendingPoolAddressesProvider.sol\n\np"
  },
  {
    "path": "contracts/utils/Withdrawable.sol",
    "chars": 1075,
    "preview": "pragma solidity >=0.4.24;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"@openzeppelin/contracts/token"
  },
  {
    "path": "env",
    "chars": 78,
    "preview": "INFURA_API_KEY = YOUR_INFURA_KEY\nKEY = YOUR_ACCOUNT_KEY_FOR_MAINNET_DEPLOYMENT"
  },
  {
    "path": "migrations/1_initial_migration.js",
    "chars": 125,
    "preview": "const Migrations = artifacts.require(\"Migrations\");\n\nmodule.exports = function(deployer) {\n  deployer.deploy(Migrations)"
  },
  {
    "path": "migrations/2_deploy_ezflashloan.js",
    "chars": 225,
    "preview": "let Flashloan = artifacts.require(\"Flashloan\")\n\nmodule.exports = async function (deployer) {\n    try {\n        await dep"
  },
  {
    "path": "package.json",
    "chars": 190,
    "preview": "{\n  \"dependencies\": {\n    \"@openzeppelin/contracts\": \"^2.5.0\",\n    \"@truffle/hdwallet-provider\": \"^1.0.33\",\n    \"dotenv\""
  },
  {
    "path": "truffle-config.js",
    "chars": 844,
    "preview": "const path = require(\"path\");\nconst HDWalletProvider = require(\"@truffle/hdwallet-provider\")\nrequire(\"dotenv\").config()\n"
  }
]

About this extraction

This page contains the full source code of the mrdavey/ez-flashloan GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 17 files (21.4 KB), approximately 5.6k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!