ssv-liquidator
v0.0.8
Published
CLI to work with SSV Network liquidation flow, liquidate and earn SSV tokens in SSV Network.
Downloads
8
Readme
SSV Network Liquidator
The SSV Liquidator node executes liquidations on accounts that do not hold enough balance to pay for their operational fees
The liquidator node performs 2 main processes:
- Syncing network contract data Every minute the liquidator node pulls recent balance-determining events for the SSV networks contract and maps all of the network's accounts on the node level to calculate the potential block for liquidation for each account in the network
- Liquidating accounts Once the potential liquidation block is reached the liquidator node will call the liquidate() function in the network contract, if the node was the first to successfully pass the transaction the account will be liquidated and its SSV collateral will be sent to the wallet address which performed the liquidation
Requirements
ETH1 Node and other parameters
In order to be able to fetch all the operators and their status from the contract and react on different events
you need to specify an ETH1 Node URI. If you want to work with a production environment then you must specify eth.infra.com
as the --node-url
parameter for the CLI. As alternative you can set it up in .env
file as the NODE_URL
. Examples below for both scenarios.
If you want to play with the testnet you can register in alchemyapi.io
. Once registered the URL will look like:
https://eth-goerli.alchemyapi.io/v2/<your-token-here>
Review yarn cli --help
output and .env.example
file for all of the parameters required for liquidator to work.
Node JS
This installation requires NodeJS on your machine. You can download it here.
Installation
git clone https://github.com/bloxapp/ssv-liquidator.git
cd ssv-liquidator
yarn install
Running the CLI
Option 1: Running with CLI arguments
Help on available CLI actions:
yarn cli --help
Input parameters: node-url (n) = ETH1 node url private-key (pk) = Account private key ssv-network-address (c) = Contract Network Address ssv-network-views-address (c) = Contract Network Views Address gas-price (g) = Gas price, default: low ssv-token-address = The contract address for the SSV token hide-table = Hide/show realtime table node-rate-limit = concurrent requests limit (optional, by default: 10) max-visible-blocks = Max block range to display active clusters (optional, by default: 50000)
yarn cli --node-url=eth.infra.com --private-key=a70478942bf... --ssv-network-address=0x425890f2a5g... --ssv-network-views-address=0x425890f2a5g... --gas-price=slow --ssv-token-address=0x425890f2a5g84hw94...
Example of running the CLI with the minimum requirements:
yarn cli --private-key=a70478942bf...
Option 2: Using an env file
Copy the .env.example
file to .env
and update .env
with your parameters.
Example content below:
NODE_URL=eth.infra.com
SSV_NETWORK_ADDRESS=0x425890f2a5g...
SSV_NETWORK_VIEWS_ADDRESS=0x425890f2a5g...
SSV_TOKEN_ADDRESS=0x425890f2a5g84hw94...
ACCOUNT_PRIVATE_KEY=a70478942bf...
GAS_PRICE=medium
HIDE_TABLE=false
MAX_VISIBLE_BLOCKS=50000
If you saved all the parameters in the .env
file you can run:
yarn cli
Development
Run CLI as TypeScript executable
yarn cli
Lint
yarn lint
Restart syncer to sync blocks from the beginning (Clear the database file)
rm data/local.db
Testing
- TODO
Authors
Troubleshooting
Getting
ERR_OSSL_EVP_UNSUPPORTED
error. As a fast solution you can run liquidator as following:NODE_OPTIONS=--openssl-legacy-provider yarn cli ...
Or as alternative you can save this line:
export NODE_OPTIONS=--openssl-legacy-provider
in your~/.bashrc
or~/.zshrc
, and then runsource ~/.bashrc
orsource ~/.zshrc
. Then you will be able to runyarn cli ...
as usual.If you want to fix OpenSSL issue in common, follow recommendations: NodeJS v17.0.0 OpenSSL Recommendations
License
MIT License