This project provides a liquidation bot and indexer for the Tezfin markets, it exposes api to get liquidity for all users that is updated at specific intervals and also optionally can run a liquidation bot for a particular market.
The bot can liquidate undercollateralized users by repaying a particular asset(if the user has any borrow in that asset), the configuration for the liquidating asset(asset the bot will repay) is present in the config/
dir inside the testnet.json
and mainnet.json
files respectively for testnet and mainnet config. The valid liquidating assets that are supported include the markets that TezFin supports for eg. ETH
, BTC
, USD
, XTZ
etc. If the liquidatingAsset
field in the config is left empty ""
then the bot will not run any liquidations and only run the indexer.
You must make sure that the account(private key) used in the bot has sufficient XTZ
for gas fees and sufficient amount of the liquidating asset available to perform the liquidations.
- Install dependencies (needs node v18+)
npm i
- Start the bot using the following command:
PRIVATE_KEY=<PRIVATE KEY> NETWORK=<TEZOS NETOWRK> npm run start
The env variables needed to run the indexer are :
- PRIVATE KEY : your private key used to update interest params before calculating liquidity
- NETWORK : Tezos network to run the bot on, support values are
mainnet
andtestnet
The indexer runs a server on port 8888
by default but you can configure the api server to run on different port using env vcar PORT
. To access the indexer data hit the /
root path and it will return the liquidity data for all the users and the block number at which the liquidity was calculated.