Giter Club home page Giter Club logo

aave-flashloan-keepr's Introduction

AAVE Liquidation Bot & Flashloans.

  1. Get all Loans via Borrow Events
const _loans = await LendingPool.getPastEvents("Borrow", {
        filter: {},
        fromBlock: 0,
        toBlock: 'latest'
});

// Get  _resrve , _user & _amount from every loans log
let {_reserve, _user,_amount,_referral, timestamp} = _borrowEvent.returnValues;
  1. Call Lendingpool.getUserAccountData method with _user parameter
    let _loanData = await getUserAccountData(_user).call(); 
  1. Get HealthFactor value
let healthFactorBN = new BigNumber(healthFactor).dividedBy(10 ** 18); 
if (healthFactorBN.isLessThanOrEqualTo(1)) {
    _unsafeLoans.push(_loanData); // Collect Unsafe loans 
}
  1. Call LendingPool liquidationCall() function (if you have assets in your wallaet account)

Or

  1. Call LendingPool flashLoan() get instant loanand liquidate without providing capital. // See contracts/LiquidationWithFlashLoans.sol

Forking Block From Mainnet to Ganache

https://medium.com/@samajammin/how-to-interact-with-ethereums-mainnet-in-a-development-environment-with-ganache-3d8649df0876

ganache-cli --fork https://mainnet.infura.io/v3/{infura_project_id}@{block_number}

ganache-cli --fork https://mainnet.infura.io/v3/716a47f6015f4235aa0b8b36e8280334@14310756  -u 0x4CfaAc23D3e08C0B747449efA72756e61E7A5416

ganache-cli --fork https://kovan.infura.io/v3/716a47f6015f4235aa0b8b36e8280334  --unlock 0x4CfaAc23D3e08C0B747449efA72756e61E7A5416

Run Parity Node.

--light Have a limitation , cant fetch logs more than 1000 blocks. parity --chain=kovan --ws-apis="eth,net,web3,personal,web3,pubsub,parity,parity_pubsub" --jsonrpc-apis=all

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.