lidofinance / maker-risks-bot

Prometheus exporter of positions health on Maker protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Maker collaterals monitoring bot

Prometheus exporter which parses loans data from Maker protocol and calculate risks distribution based on collateral to loan ratio, see zones definition below.

Run

docker compose

  • Create a .env file from .env.example and fill in the required variables.
  • Execute command:
docker compose up -d bot

docker

  • Create a .env file from .env.example and fill in the required variables.
  • Build image:
docker build -t maker-risks-bot .
  • Run container:
docker run -d -P --env-file ./.env maker-risks-bot

dev

  • Expose environment variables presented at .env.example.
  • Install dependencies via poetry:
poetry install
  • Execute command:
python src/main.py

Zones definition

Risk zones defined as a ranges of collateral to loan ration

Zone > <
A 2.50
B+ 1.75 2.50
B 1.50 1.75
B- 1.25 1.50
C 1.10 1.25
D 1.00 1.10
Liquidation 0 1.00

The most important exposed metrics

  • {}_collateral_percentage{ilk=<ilk>, zone=<zone>} is computed percent of collaterals in the given zone
  • {}_processing_finished_seconds{ilk=<ilk> is timestamp of the last metrics update
  • {}_bot_last_block_num is the last block parser results was updated against
  • {}_eth_latest_block_num is the latest block available for the parser

Visualisation

Pre-built grafana dashboards available in the ./grafana directory. To run locally use docker-compose file as a reference.

Release flow

To create new release:

  1. Merge all changes to the master branch
  2. Navigate to Repo => Actions
  3. Run action "Prepare release" action against master branch
  4. When action execution is finished, navigate to Repo => Pull requests
  5. Find pull request named "chore(release): X.X.X" review and merge it with "Rebase and merge" (or "Squash and merge")
  6. After merge release action will be triggered automatically
  7. Navigate to Repo => Actions and see last actions logs for further details

About

Prometheus exporter of positions health on Maker protocol


Languages

Language:Python 94.6%Language:Dockerfile 5.4%