Giter Club home page Giter Club logo

anchor-borrow-bot's Introduction

Anchor Borrow / Repay bot

The main goal of this bot is to avoid being liquidated due to the price volatility of bLuna, by repaying part of your debt when the LTV is too high.

⚠ī¸ You will need to use your private key to let the bot create and sign transactions. We highly recommend to create a dedicated wallet and we decline all responsibility if you lose any money.


How it Works?

The bot will fetch your current LTV every X seconds (10 per default).

If your LTV is higher than LTV_LIMIT (43% per default), the bot will try to repay the sum needed to make your LTV back at LTV_SAFE (35% per default).

  1. We verify the balance of your wallet to see if you have enough money to repay;
  2. We verify the balance of your deposit to see if you can withdraw from it to repay;
  3. We verify if you have any unclaimed reward that we can claim and sell to repay;
  4. 🚧 We verify if you have any token stake in governance that we can unstake and sell to repay (#3).

ℹī¸ If we need to claim any rewards, we will sell only the required amount and stake in governance the rest of your token.

If your LTV is lower than LTV_BORROW (30% per default), the bot will borrow more to reach the LTV_SAFE (35% per default)`, then it will deposit the amount borrowed.


Installation

You will need to have Node.js installed on your system to run this bot. We highly recommend you to use volta.sh or nvm to manage your Node.js version.

ℹī¸ The bot has been tested with Node.js 16.2.0.

Once you have node and npm accessible in your terminal's path, you will need to do the following:

  1. Clone the repository;
  2. Install its dependencies (npm install);
  3. Copy the .env.example file to .env and fill all values (cp .env.example .env);
  4. Run the bot with npm run start.

ℹī¸ We recommend using a tool like pm2 to run the bot in a background process.


Setup Telegram Notification

This bot will notify you via a Telegram Bot for any transactions.

You need to create your Telegram Bot to activate this feature. It can be quickly done via the Telegram application. Once you have your token and your chat_id you can define those variables inside the .env file.

ℹī¸ The chat_id is your user ID. You can have it when sending /getid to IDBot.


Testing

If you would like to try the bot before running in production, you may want to use the Terra Testnet. You can add fake money to your Testnet Wallet using https://faucet.terra.money/.

We also provide a dry-run option to not execute any transactions and only notify you (#6).

anchor-borrow-bot's People

Contributors

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