Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.

Commit

Permalink
first commit of open-source liquidator
Browse files Browse the repository at this point in the history
  • Loading branch information
0xCactus committed Aug 23, 2021
1 parent 97849a2 commit 91bd116
Show file tree
Hide file tree
Showing 29 changed files with 23,890 additions and 2 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
76 changes: 76 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'airbnb-typescript',
'plugin:@typescript-eslint/eslint-recommended',
],
env: {
node: true,
jest: true,
es6: true,
},
parserOptions: {
project: ['./tsconfig.eslint.json', './tsconfig.json'],
ecmaVersion: 2015,
sourceType: 'module',
tsconfigRootDir: __dirname,
},
rules: {
'no-shadow': 'off',
'jest/no-focused-tests': 0,
'class-methods-use-this': 0,
'no-use-before-define': 0,
'no-await-in-loop': 0,
'no-underscore-dangle': 0,
'no-trailing-spaces': ['error', { ignoreComments: true }],
'import/prefer-default-export': 0,
'global-require': 'warn',
'no-restricted-imports': [
'error',
{
patterns: ['..*'],
},
],
'@typescript-eslint/no-var-requires': 'warn',
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-use-before-define': 0,
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'variableLike',
custom: {
regex: '^([Aa]ny|[Nn]umber|[Ss]tring|[Bb]oolean|[Uu]ndefined)$',
match: false,
},
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{
selector: 'typeLike',
custom: {
regex: '^([Aa]ny|[Nn]umber|[Ss]tring|[Bb]oolean|[Uu]ndefined)$',
match: false,
},
format: ['PascalCase'],
},
],
'max-len': 'off',
'no-console': 'off',
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.d.ts', '.ts', '.tsx'],
moduleDirectory: ['node_modules', 'src'],
paths: 'src',
},
},
// silence dumb react warning
react: { version: '999.999.999' },
},
};
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# generated
**/node_modules

# production
/build

# misc
id.json
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:16-alpine3.11


# Create Directory for the Container
RUN mkdir -p /home/solend/app
WORKDIR /home/solend/app

# Increase heap size
ENV NODE_OPTIONS=--max_old_space_size=4096

# Only copy the package.json file to work directory
COPY package.json ./
# Install all Packages
RUN npm install

# Copy all other source code to work directory
COPY src /home/solend/app/src
COPY tsconfig.json /home/solend/app
RUN npm run build

# Start
CMD ["npm", "start"]
51 changes: 49 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,49 @@
# solend-liquidator-bot
open source version of a liquidation bot running against solend
# Solend-liquidator-bot

open-source version of a liquidation bot running against Solend

## Overview

The Solend liquidator bot identifies underwater obligations to liquidate. Solend awards liquidators a 5% bonus on each liquidation. See [Solend params](https://docs.solend.fi/protocol/parameters) for the most up-to-date parameters on each asset. This repo is intended as a starting point for the Solend community to build liquidator bots.

## Usage

1. Install [docker-compose](https://docs.docker.com/compose/install/)
2. Verify you have docker-compose installed by running the following

```
docker-compose --version
```

3. Update [file system wallet](https://docs.solana.com/wallet-guide/file-system-wallet) path in docker-compose.yaml.

```
version: "3.1"
services:
# The application image
solend-liquidator:
restart: unless-stopped
build:
context: .
dockerfile: Dockerfile
environment:
- NETWORK=mainnet # solana network e.g mainnet, devnet
- THROTTLE=600 # Throttle not avoid rate limiting
secrets:
- keypair # secret to encrypte wallet details in container
secrets:
keypair:
file: <PATH TO KEYPAIR WALLET THAT WILL BE LIQUIDATING UNDERWATER OBLIGATIONS>
```

4. Build and run service

```
docker-compose up --build
```

## Support

PRs to improve this repo are welcomed! If you need help setting up your liquidator bot, feel free to post your questions in liquidator channel within [Solend's discord server](https://discord.gg/exscEFpB7s).
18 changes: 18 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: "3.1"

services:
# The application image
solend-liquidator:
restart: unless-stopped
build:
context: .
dockerfile: Dockerfile
environment:
- NETWORK=mainnet # solana network e.g mainnet, devnet
- THROTTLE=700 # Throttle not avoid rate limiting
secrets:
- keypair # secret to encrypte wallet details in container

secrets:
keypair:
file: ./id.json
Loading

0 comments on commit 91bd116

Please sign in to comment.