Git Product home page Git Product logo

liquidatable-accounts-feed's Introduction

Liquidatable Accounts Feed

This implements a service that listens to Solana updates of Mango related accounts and checks if they are liquidatable. If they are, it notifies connected clients about it.

Its purpose is to hand potentially liquidatable accounts to a Mango liquidator like https://github.com/blockworks-foundation/liquidator-v3.

It is a separate service because computing account health is around two orders of magnitude faster this way.

Architecture

Data flows into this service through

  • Solana JSON RPC PubSub websocket streams, for slot and account updates
  • Solana JSON RPC getProgramAccounts requests, for snapshots

The service models the current bank state for relevant accounts, checks their health and sends interesting data back out to all clients that connected to its websocket server.

All data resides in memory. The service does not write to disk.

Building

Use a release build (cargo build --release) for production.

Rust 1.59.0 can build this project. 1.57.0 is reported to work too.

Users report that the dependencies libclang-dev libudev-dev pkg-config must be installed.

This is x86_64 only right now. aarch64 is not a supported target.

Running

Run liquidatable-accounts-feed myconfig.toml. The service is supposed to run until aborted. Please report any panics or early exits as issues.

Configuration

Check example-config.toml.

Note that you will need to configure an RPC server that allows websocket connections as well as getProgramAccounts RPC calls.

Output

Websocket messages look like this (without the comments):

{
  "jsonrpc": "2.0",
  // "candidate" is sent each time an account is looked at
  // "candidateStart" is sent the first time account health is below threshold
  // "candidateStop" is send when a candidate's health is above threshold again
  "method": "candidate",
  "params": {
    "account": "DopjuzaqPURVDy3DQhffGa1YZ9maMe5StGY1aXfJAymk",
    // the being_liquidated flag on the account
    "being_liquidated": false,
    // assets divided by liabilities; <1.0 means liquidatable
    "health_fraction": 1.0000339686978705,
    // weighted sum of assets
    "assets": 48741,
    // weighted sum of liabilities
    "liabilities": 48740
  }
}

liquidatable-accounts-feed's People

Contributors

ckamm avatar

Stargazers

 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  avatar  avatar

liquidatable-accounts-feed's Issues

switchboard-utils issue when compiling for aarch64

Hey guys,

I've been trying to compile for aarch64 without success due to error regarding switchboard-utils.

error[E0080]: evaluation of constant value failed
  --> /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/switchboard-utils-0.1.32/src/lib.rs:19:18
   |
19 | #[derive(Default,AsBytes,FromBytes,Clone,Debug)]
   |                  ^^^^^^^ attempt to divide `1_usize` by zero
   |
   = note: this error originates in the derive macro `AsBytes` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0080`.
error: could not compile `switchboard-utils` due to previous error
warning: build failed, waiting for other jobs to finish...
^[ error: build failed

No trouble on x86 though.

I tried forcing a later version of switchboard-utils which compiled but bricked other dependencies. Known issue? Suggestions for a solution?

Best regards,
shjort

Document building instructions and release binaries

I had to try a few versions before reaching one that would build

rustup default 1.57.0

Also had to install dependencies libclang-dev libudev-dev pkg-config

Would be good to have the final binary released on Github

illegal hardware instruction on Mac M1

It was working fine before the latest code since I pulled the latest code and had to run
cargo build --release
to rebuild and when run
./target/release/liquidatable-accounts-feed myconfig.toml
I see this issue
zsh: illegal hardware instruction

I'm working on an M1 one, I had not met this issue before pulling the latest code.

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.