Skip to content

Commit ea857fc

Browse files
committed
fix: bug fixes
1 parent 45ce8c5 commit ea857fc

File tree

5 files changed

+4405
-6718
lines changed

5 files changed

+4405
-6718
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ config.local.yaml
2929
.eslintcache
3030
.eslint.local.json
3131
*.generated.ts
32-
32+
config.yaml
3333
# Optimistic output
3434
/output

README.md

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This repository contains a bot that monitors one or more Safe addresses for crit
66
- **Signing Transactions:** Monitors who signs the transactions and how many signatures have been collected.
77
- **Executing Transactions:** Sends alerts when a transaction is executed.
88

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.
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.
1010

1111
Real-time alerts are sent to a configured Telegram channel for immediate notification.
1212

@@ -51,6 +51,49 @@ docker run -v $(pwd)/config.yaml:/app/config.yaml ghcr.io/gearbox-protocol/safe-
5151
4. Once the bot is created, BotFather will provide you with an HTTP API token (e.g., `123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11`).
5252
5. Copy this token and use it as the value for `telegramBotToken` in your `config.yaml`.
5353

54+
### Getting a Telegram Channel ID
55+
56+
1. Create a new channel or group in Telegram.
57+
2. Invite your bot to the channel.
58+
3. Send a message to the channel.
59+
4. Use getUpdates (Testing Locally or Anywhere You Can Send HTTP Requests)
60+
61+
- Make a call to the [getUpdates](https://core.telegram.org/bots/api#getupdates) endpoint of the Bot API using your bot token. For example: https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
62+
63+
The response is a JSON that contains “messages,” “channel_posts,” “callback_query,” or similar objects, depending on how your bot receives interactions.
64+
65+
5. Parse the JSON
66+
67+
- Look for the `"chat"` object inside each message (e.g., `"message"` or `"edited_message"`).
68+
- The `"chat": { "id": ... }` field is the chat ID. For example, a response might look like:
69+
70+
```json
71+
{
72+
"ok": true,
73+
"result": [
74+
{
75+
"update_id": 123456789,
76+
"message": {
77+
"message_id": 12,
78+
"from": {
79+
...
80+
},
81+
"chat": {
82+
"id": 987654321,
83+
"first_name": "John",
84+
"type": "private"
85+
},
86+
"date": 1643212345,
87+
"text": "Hello"
88+
}
89+
}
90+
]
91+
}
92+
```
93+
94+
In this snippet, 987654321 is the telegramChannelId.
95+
.
96+
5497
### Running via Docker
5598

5699
Run the Docker container with your config file mounted using the following command:
@@ -67,4 +110,4 @@ This project is distributed under the MIT License.
67110

68111
## Disclaimer
69112

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.
113+
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.

src/SafeWatcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class SafeWatcher {
124124
detailed.operation !== 0;
125125

126126
await this.#notificationSender?.notify({
127-
type: isMalicious ? "created" : "malicious",
127+
type: isMalicious ? "malicious" : "created",
128128
chainPrefix: this.#prefix,
129129
safe: this.#safe,
130130
tx: detailed,

src/notifications/Telegram.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const ACTIONS: Record<EventType, string> = {
99
created: "created",
1010
updated: "updated",
1111
executed: "executed",
12-
malicious: "created malicious",
12+
malicious: "ALERT! ACTION REQUIRED: MALICIOUS TRANSACTION DETECTED!",
1313
};
1414

1515
const NETWORKS: Record<string, string> = {

0 commit comments

Comments
 (0)