A Telegram bot designed to monitor the health factor of a Silo account and send notifications when the health factor falls below a user-defined threshold. The bot offers various flows for users to interact, manage, and configure notifications effectively.
Here’s a summary of the main commands that users can use with the bot:
/start: Start the bot and see available options. /watch: Add a new position to track based on a Silo account. /manage: Manage your active subscriptions. /help: Access help information for bot usage. /example: View an example of the notification the bot sends when a health factor alert is triggered.
- Sends a welcome message with an overview of the bot's available commands.
- Provides basic instructions on how to get started using the bot.
- Prompts users to enter an account address to monitor.
- Displays the available positions for the entered address.
- Allows users to select a position to track.
- Requests a health factor threshold from the user to trigger notifications.
- Lets the user choose a chat (private or group) for receiving health factor notifications.
- Confirms successful subscription creation.
- Lists all of the user's active subscriptions.
- Allows the user to select and manage individual subscriptions, with the following options:
- Pause/Resume the subscription.
- Unsubscribe from the subscription.
- Change settings, such as:
- Health factor notification threshold.
- Preferred language.
- Notification interval.
- Provides global management actions:
- Pause all subscriptions.
- Restart all subscriptions.
- Unsubscribe from all subscriptions.
- Displays general help and usage information.
- Provides detailed help for specific commands upon request.
- Sends an example notification message to show users what to expect.
- Sends alerts when the health factor of a tracked position falls below the user-defined threshold.
- Notifications include options to:
- View position details.
- Add collateral.
- Repay debt.
- Manage subscription settings.
- Configurable cooldown period between notifications to prevent spamming in case of rapid health factor drops.
- Users can configure which chat (individual or group) will receive the notifications, enhancing usability for both personal and team scenarios.
- Clone the repository:
git clone https://github.com/bleu/silo-hf-monitor.git
- Navigate to the project directory:
cd silo-hf-monitor
- Install dependencies (we use pnpm as the package manager):
pnpm install
- Export environment variables, e.g:
export DATABASE_PRIVATE_URL=postgres://postgres:postgres@localhost:5432 export TELEGRAM_BOT_TOKEN=... export TELEGRAM_WEBHOOK_URL=... export PONDER_RPC_URL_MAINNET=... export PONDER_RPC_URL_OPTIMISM=... export PONDER_RPC_URL_ARBITRUM=... export PONDER_RPC_URL_BASE=...
The project uses PostgreSQL as the database, which you can run via Docker. Use the provided docker-compose.yml
file to set up the PostgreSQL service:
Start Docker Compose:
docker-compose up -d
This will start a PostgreSQL container with the name silo-hc-monitor-postgres
. The database will be accessible at localhost:5432
with the credentials defined in the compose file.
Ensure the database is running correctly by checking the container status:
docker ps
The database is now ready to store the subscriptions and health factor monitoring data.
The project has several services to run concurrently during development: the notifier, indexer, bot, and the Ponder process. You can use the predefined pnpm
scripts for these tasks.
To run all services (Ponder, Bot, Notifier, and Indexer) simultaneously during development, use the dev:all
script:
pnpm dev:all
This uses concurrently
to run all the services in parallel, allowing you to work on multiple components of the project seamlessly.
Ponder: pnpm dev
Telegram Bot: pnpm dev:bot
Indexer: pnpm dev:indexer
Notifier: pnpm dev:notifier
.
For any database schema updates, you can run migrations for the bot service as follows:
pnpm migrate:bot
To ensure the code follows standard conventions and is free from type errors, you can run:
pnpm lint
pnpm typecheck
This project is licensed under the MIT License - see the LICENSE file for details.