|
1 | | - |
| 1 | +# Safe Watcher |
2 | 2 |
|
3 | | -# Safe watcher |
| 3 | +This repository contains a bot that monitors one or more Safe addresses for critical activities throughout the entire transaction lifecycle: |
4 | 4 |
|
5 | | -This repository contains simple app that watches safe multisig and notifies about various events: |
| 5 | +- **Adding Transactions:** Detects when new transactions are created in the Safe. |
| 6 | +- **Signing Transactions:** Monitors who signs the transactions and how many signatures have been collected. |
| 7 | +- **Executing Transactions:** Sends alerts when a transaction is executed. |
6 | 8 |
|
7 | | -- New transaction has been proposed (with some checks about suspicious transactions) |
8 | | -- Transaction has been signed by one of the signers |
9 | | -- Transaction has been executed |
| 9 | +Additionally, the bot watches for any suspicious `delegateCall`. If a `delegateCall` is directed to an address other than the trusted `MultiSend` contract, the bot immediately flags it, helping to prevent attacks similar to the Bybit hack. |
| 10 | + |
| 11 | +Real-time alerts are sent to a configured Telegram channel for immediate notification. |
10 | 12 |
|
11 | 13 | ## Usage |
12 | 14 |
|
13 | | -Create config.yaml file with settings. See [config.example.yaml](config.example.yaml) and [schema.ts](src/config/schema.ts) for the reference. |
| 15 | +To get started, create a `config.yaml` file with your settings. Refer to [config.example.yaml](config.example.yaml) and [schema.ts](src/config/schema.ts) for guidance. |
| 16 | + |
| 17 | +Run the Docker container with your config file mounted: |
| 18 | + |
| 19 | +```bash |
| 20 | +docker run -v $(pwd)/config.yaml:/app/config.yaml ghcr.io/gearbox-protocol/safe-watcher:latest |
| 21 | +``` |
| 22 | + |
| 23 | +## Configuration |
| 24 | + |
| 25 | +1. Create a `config.yaml` file in your local directory. You can look at [config.example.yaml](config.example.yaml) and [schema.ts](src/config/schema.ts) for details. Here is an example structure: |
| 26 | + |
| 27 | + ```yaml |
| 28 | + telegramBotToken: "xxxx" |
| 29 | + telegramChannelId: "-1111" |
| 30 | + safeAddresses: |
| 31 | + - "eth:0x11111" |
| 32 | + signers: |
| 33 | + "0x22222": "alice" |
| 34 | + "0x33333": "bob" |
| 35 | + ``` |
| 36 | +
|
| 37 | + - **telegramBotToken:** Your Telegram Bot API token (instructions below). |
| 38 | + - **telegramChannelId:** The ID of the channel or group where alerts will be posted. |
| 39 | + - **safeAddresses:** One or more Safe addresses to monitor, prefixed by the network identifier (e.g., `eth:` for the Ethereum mainnet). |
| 40 | + - **signers:** A mapping of addresses to descriptive names (useful for labeling owners in alerts). |
14 | 41 |
|
15 | | -Run docker container with config.yaml file mounted to /app/config.yaml |
| 42 | +2. Ensure that `config.yaml` is in the same directory where you plan to run the Docker container. |
| 43 | + |
| 44 | +### Getting a Telegram Bot Token |
| 45 | + |
| 46 | +1. Open the Telegram app and start a chat with `@BotFather`. |
| 47 | +2. Type `/start` if you haven't used BotFather before. |
| 48 | +3. Send the command `/newbot` and follow the prompts: |
| 49 | + - Provide a name for your bot (display name). |
| 50 | + - Provide a username for your bot (it must end in "bot", e.g., `MySafeNotifierBot`). |
| 51 | +4. Once the bot is created, BotFather will provide you with an HTTP API token (e.g., `123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11`). |
| 52 | +5. Copy this token and use it as the value for `telegramBotToken` in your `config.yaml`. |
| 53 | + |
| 54 | +### Running via Docker |
| 55 | + |
| 56 | +Run the Docker container with your config file mounted using the following command: |
16 | 57 |
|
17 | 58 | ```bash |
18 | | -docker run -v $(pwd)/config.local.yaml:/app/config.yaml ghcr.io/gearbox-protocol/safe-watcher:latest |
| 59 | +docker run -v $(pwd)/config.yaml:/app/config.yaml ghcr.io/gearbox-protocol/safe-watcher:latest |
19 | 60 | ``` |
| 61 | + |
| 62 | +The bot will start and immediately begin monitoring the specified Safe addresses. Any relevant changes or suspicious `delegateCall` attempts will be sent to your Telegram channel. |
| 63 | + |
| 64 | +## License |
| 65 | + |
| 66 | +This project is distributed under the MIT License. |
| 67 | + |
| 68 | +## Disclaimer |
| 69 | + |
| 70 | +This software is provided "as is," without warranties or guarantees of any kind. Use it at your own risk. The maintainers and contributors are not liable for any damages or losses arising from its use. Always exercise caution and follow best security practices when managing crypto assets. |
0 commit comments