/java-defi-bot

java-defi-bot is an application that aims to do beneficial actions for the DeFi ecosystem while earning a profit for the user

Primary LanguageJavaMIT LicenseMIT

java-defi-bot License: MIT Build Status Coverage

java-defi-bot is an application that aims to do beneficial actions on the Ethereum blockchain for the DeFi ecosystem while earning a profit for the user. These actions include maintaining the DAI peg, providing liquidity and liquidating undercollateralized assets.

Getting started

Prerequisites

    $ echo $JAVA_HOME
    C:\Program Files\Java\jdk-14.0.1
    $ mvn -version
    Apache Maven 3.6.3

Installing

  • mvn install

Configuration

  • Update the configuration file ./config.properties
infuraProjectId=
password=
wallet=
transactionsRequireConfirmation=true
playSoundOnTransaction=true
uniswapBuyProfitPercentage=0.5
uniswapSellProfitPercentage=0.5
minimumEthereumReserveUpperLimit=0.20
minimumEthereumReserveLowerLimit=0.10
minimumEthereumNecessaryForSale=1.0
minimumDaiNecessaryForSaleAndLending=250.0
minimumFlipAuctionProfit=50.0
minimumGasPrice=1000000000
maximumGasPrice=30000000000
testProperty=true

Make sure to never commit your config.properties file!

  • Make git stop tracking your config file git update-index --skip-worktree ./config.properties
  • Make git start tracking your config file again git update-index --no-skip-worktree ./config.properties

Compile

  • mvn clean compile assembly:single

Running the tests

  • All Tests mvn clean test
  • Unit Tests mvn clean test -DskipITs
  • Integration Tests mvn clean failsafe:integration-test

Run

  • Either just run it in the IDE of your choice
  • or execute the compiled application java -jar java-defi-bot-0.1-jar-with-dependencies.jar and make sure it has access to the config.properties file

Logs

You will find the logs in ./logs.

Current features

  • sells DAI, if DAI > $1.00 on Oasis oasis.checkIfSellDaiIsProfitableThenDoIt(balances);
  • buys DAI, if DAI < $1.00 on Oasis oasis.checkIfBuyDaiIsProfitableThenDoIt(balances);
  • sells DAI, if DAI > $1.00 on Uniswap uniswap.checkIfSellDaiIsProfitableThenDoIt(balances);
  • buys DAI, if DAI < $1.00 on Uniswap uniswap.checkIfBuyDaiIsProfitableThenDoIt(balances);
  • earns interest on Compound, if there has been no market action for a while compoundDai.lendDai(balances);
  • bids on flip auctions, if the auctions offer cheaper ETHflipper.checkIfThereAreProfitableFlipAuctions(balances);

Contribute

Feel free to open merge requests.

Developer Guide

License

This project is licensed under the MIT License - see the LICENSE file for details