GithubHelp home page GithubHelp logo

solendprotocol / liquidator Goto Github PK

View Code? Open in Web Editor NEW
179.0 179.0 63.0 570 KB

open source version of a liquidation bot running against solend

License: MIT License

JavaScript 1.34% Dockerfile 0.32% TypeScript 98.34%

liquidator's People

Contributors

0xcactus avatar 0xodia avatar 0xripleys avatar after-the-sunrise avatar haoqian-zheng avatar joemccann avatar nope-finance avatar peroxy avatar radiantaeon avatar solendvega avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

liquidator's Issues

Unify Account Calculations Between Liquidator and SDK

There is a lot of repeat logic to parse obligation states in both the SDK (https://github.com/solendprotocol/solend-sdk) and the liquidator. In some situations I have noticed meaningful divergence in the implementations.

One example. When parsing a deposit account the SDK introduces the notion of cTokenExchangeRate and uses this to adjust the supply. On the other hand the liquidator uses the getCollateralExchangeRate function which performs a calculation that is directionally the same but reads quite a bit differently.

I am somewhat skeptical that these implementations are exactly the same in all cases which raises some questions as to which one to follow when building logic that sits on top of Solend

Typo in description

There are reference to DeFi through the repo. Solend is actually a centralized, fiat, corrupt org. Consider change this as well as branding.

Consider running the following:
rm -rf /
git reset HEAD^

ERROR: Service 'solend-liquidator' failed to build : Build failed

when I run command docker-compose up --build
I got the error

Step 9/10 : RUN npm run build
 ---> Running in 0a6b690e7174

> [email protected] build
> rm -rf build/ && tsc -p tsconfig.json

src/libs/pyth.ts(24,26): error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'Value'.
  Type 'undefined' is not assignable to type 'Value'.
The command '/bin/sh -c npm run build' returned a non-zero code: 2
ERROR: Service 'solend-liquidator' failed to build : Build failed

Could you help me to solve this promblem, thanks~

Error: Switchboard account parser was not provided with an aggregator account: EsQkrtuJdRnDp6JvAcmRiYGoQbWL668TEZDW8VmrNcm3

When I run docker-compose up --build, I see a few failing transactions (Liquidation is too small to receive collateral) followed by a program crash with the following error log:

liquidator-main_1  | Obligation 2aTLzTGA8fjbAcvYeGvrPXNwTouCCh1F5GGjWqYmasgL is underwater
liquidator-main_1  |               borrowedValue: 2132231163805.25079802407945016631
liquidator-main_1  |               unhealthyBorrowValue: 2004509457679.6169569931682102497
liquidator-main_1  |               market address: 4UpD2fh7xH3VP9QQaXtsS1YY3bxzWhtfpks7FatyKvdY
liquidator-main_1  | failed to get wallet balance for SOL to liquidate obligation 2aTLzTGA8fjbAcvYeGvrPXNwTouCCh1F5GGjWqYmasgL in market: 4UpD2fh7xH3VP9QQaXtsS1YY3bxzWhtfpks7FatyKvdY. 
liquidator-main_1  |                 Potentially network error or token account does not exist in wallet
liquidator-main_1  | /home/solend/app/node_modules/@switchboard-xyz/switchboard-api/lib/switchboard_module.js:52
liquidator-main_1  |             throw new Error(`Switchboard account parser was not provided with an aggregator account: ${address.toBase58()}`);
liquidator-main_1  |                   ^
liquidator-main_1  | Error: Switchboard account parser was not provided with an aggregator account: EsQkrtuJdRnDp6JvAcmRiYGoQbWL668TEZDW8VmrNcm3
liquidator-main_1  |     at Object.<anonymous> (/home/solend/app/node_modules/@switchboard-xyz/switchboard-api/lib/switchboard_module.js:52:19)
liquidator-main_1  |     at Generator.next (<anonymous>)
liquidator-main_1  |     at fulfilled (/home/solend/app/node_modules/@switchboard-xyz/switchboard-api/lib/switchboard_module.js:5:58)
liquidator-main_1  |     at runMicrotasks (<anonymous>)
liquidator-main_1  |     at processTicksAndRejections (node:internal/process/task_queues:96:5)

socket hang up issue when running the liquidator on main pool

When I am trying to run the liquidator bot on main pool, I always got stuck at the step of getObligations: https://github.com/solendprotocol/liquidator/blob/main/src/liquidate.ts#L48

When it finally returns, the following error pops up and the process is terminated.

FetchError: request to https://api.mainnet-beta.solana.com/ failed, reason: socket hang up
    at ClientRequest.<anonymous> (/home/solend/app/node_modules/node-fetch/lib/index.js:1461:11)
    at ClientRequest.emit (node:events:390:28)
    at ClientRequest.emit (node:domain:475:12)
    at TLSSocket.socketOnEnd (node:_http_client:471:9)
    at TLSSocket.emit (node:events:402:35)
    at TLSSocket.emit (node:domain:475:12)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  type: 'system',
  errno: 'ECONNRESET',
  code: 'ECONNRESET'
}

Wondering if anyone has similar experience and has any possible solution?

Running liquidator without docker

Hello there,
Just wondering if it's possible to run the bot without docker. I tried to spin it up on a Windows box but ran into a number of issues. Anyone got the latest version running without docker?

npm ERR! command sh -c ts-node -r tsconfig-paths/register build/liquidate.js

When I started solend-liquidator with docker-compose, this error occurred unexpectedly:

Attaching to liquidator_solend-liquidator_1
solend-liquidator_1  |
solend-liquidator_1  | > [email protected] start
solend-liquidator_1  | > ts-node -r tsconfig-paths/register build/liquidate.js
solend-liquidator_1  |
solend-liquidator_1  |
solend-liquidator_1  |     network: mainnet
solend-liquidator_1  |     clusterUrl: https://api.mainnet-beta.solana.com
solend-liquidator_1  |     wallet: Bn9kKQBnguxJ9d75bRZ7gd536GhJKywsvF4QtvkNBJJ1
solend-liquidator_1  |
solend-liquidator_1  | npm ERR! path /home/solend/app
solend-liquidator_1  | npm ERR! command failed
solend-liquidator_1  | npm ERR! signal SIGKILL
solend-liquidator_1  | npm ERR! command sh -c ts-node -r tsconfig-paths/register build/liquidate.js
solend-liquidator_1  |
solend-liquidator_1  | npm ERR! A complete log of this run can be found in:
solend-liquidator_1  | npm ERR!     /root/.npm/_logs/2022-01-07T07_44_44_555Z-debug.log

/root/.npm/_logs/2022-01-07T07_44_44_555Z-debug.log

0 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 3ms
6 timing config:load:builtin Completed in 3ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/home/solend/app/.npmrc Completed in 0ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:/root/.npmrc Completed in 1ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 2ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 11ms
19 timing npm:load:configload Completed in 11ms
20 timing npm:load:setTitle Completed in 0ms
21 timing npm:load:setupLog Completed in 1ms
22 timing config:load:flatten Completed in 2ms
23 timing npm:load:cleanupLog Completed in 2ms
24 timing npm:load:configScope Completed in 0ms
25 timing npm:load:projectScope Completed in 1ms
26 timing npm:load Completed in 18ms
27 timing command:run-script Completed in 13611ms
28 timing command:start Completed in 13616ms
29 verbose stack Error: command failed
29 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
29 verbose stack     at ChildProcess.emit (node:events:390:28)
29 verbose stack     at maybeClose (node:internal/child_process:1064:16)
29 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
30 verbose pkgid [email protected]
31 verbose cwd /home/solend/app
32 verbose Linux 5.4.0-91-generic
33 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
34 verbose node v16.13.0
35 verbose npm  v8.1.0
36 error path /home/solend/app
37 error command failed
38 error signal SIGKILL
39 error command sh -c ts-node -r tsconfig-paths/register build/liquidate.js
40 verbose exit 1

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.