Giter Site home page Giter Site logo

ayushvaidya / yield-liquidator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yieldprotocol/yield-liquidator

0.0 1.0 0.0 246 KB

Utility for force-closing undercollateralized Yield Protocol loans and participating in dutch auctions with liquidity sourced by Uniswap flash loans

Rust 98.05% Solidity 1.95%

yield-liquidator's Introduction

Yield Protocol Liquidator

Liquidates undercollateralized fyDAI-ETH positions using Uniswap V2 as a capital source.

This liquidator altruistically calls the Liquidations.liquidate function for any position that is underwater, trigerring an auction for that position. It then tries to participate in the auction by flashloaning funds from Uniswap, if there's enough profit to be made.

CLI

Usage: ./yield-liquidator [OPTIONS]

Optional arguments:
  -h, --help
  -c, --config CONFIG      path to json file with the contract addresses
  -u, --url URL            the Ethereum node endpoint (HTTP or WS) (default: http://localhost:8545)
  -p, --private-key PRIVATE-KEY
                           path to your private key
  -i, --interval INTERVAL  polling interval (ms) (default: 1000)
  -f, --file FILE          the file to be used for persistence (default: data.json)
  -m, --min-profit MIN-PROFIT
                           the minimum profit per liquidation (default: 0)

Your contracts' --config file should be in the following format where Uniswap is the UniswapV2 WETH/DAI pair and Flash is the Flashloan contract.

{
   "Controller" : "0xd160C973a098608e2D7d6E43C64Eee48766800D1",
   "Liquidations" : "0xbC0200F0AAD7C1c0bBB1CC7885E1e796DFFac3e0",
   "Uniswap": "0xbC0200F0AAD7C1c0bBB1CC7885E1e796DFFac3e0",
   "Flash": "0xbC0200F0AAD7C1c0bBB1CC7885E1e796DFFac3e0"
}

The --private-key must not have a 0x prefix. Set the interval to 15s for mainnet.

Building and Running

# Build in release mode
cargo build --release

# Run it with 
./target/release/yield-liquidator \
    --config ./addrs.json \
    --private-key ./private_key \
    --url http://localhost:8545 \
    --interval 7000 \
    --file state.json \

How it Works

On each block:

  1. Bumps the gas price of all of our pending transactions
  2. Updates our dataset of borrowers debt health & liquidation auctions with the new block's data
  3. Trigger the auction for any undercollateralized borrowers
  4. Try participating in any auctions which are worth buying

Take this liquidator for a spin by running it in a test environment.

yield-liquidator's People

Contributors

gakonst 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.