Skip to content

Commit 7cd1c57

Browse files
d-carmoshahnami
andauthored
chore: Adding Optimism network samples (#132)
* Adding Optimist network samples * Carlo update * Fixes to the examples * Fixes to the examples * Moved network examples * Cargo update * Cargo update * chore: Move examples to isolated folder * fix: Link to examples folder * docs: Add examples to docs project structure * Carmo update * chore: Cargo update * docs: Adds documentation on script * chore: Cargo update --------- Co-authored-by: shahnami <[email protected]>
1 parent b14f060 commit 7cd1c57

35 files changed

+256
-53
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ data/**/*.json
2222

2323
# Ignore actual config files but not examples
2424
config/**/*.json
25-
!config/**/*.json.example
25+
!examples/config/**/*.json
2626

2727
# Ignore .env files
2828
.env

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ openzeppelin-monitor/
142142
├── docs/ # Documentation
143143
├── scripts/ # Utility scripts
144144
├── cmd/ # Metrics and monitoring
145+
├── examples/ # Example configuration files
145146
└── ... other root files (Cargo.toml, README.md, etc.)
146147
```
147148

config/filters/.keep

Whitespace-only changes.

config/monitors/.keep

Whitespace-only changes.

config/networks/.keep

Whitespace-only changes.

config/triggers/.keep

Whitespace-only changes.

config/triggers/scripts/.keep

Whitespace-only changes.

docs/modules/ROOT/pages/index.adoc

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ openzeppelin-monitor/
135135
├── docs/ # Documentation
136136
├── scripts/ # Utility scripts
137137
├── cmd/ # Metrics and monitoring
138+
├── examples/ # Example configuration files
138139
└── ... other root files (Cargo.toml, README.md, etc.)
139140
```
140141

@@ -357,25 +358,25 @@ This table lists the environment variables and their default values.
357358
| Port to use for metrics server.
358359
|===
359360

360-
* Copy and configure example files:
361+
* Copy and configure some example files:
361362

362363
[source,bash]
363364
----
364365
# EVM Configuration
365-
cp config/monitors/evm_transfer_usdc.json.example config/monitors/evm_transfer_usdc.json
366-
cp config/networks/ethereum_mainnet.json.example config/networks/ethereum_mainnet.json
366+
cp examples/config/monitors/evm_transfer_usdc.json config/monitors/evm_transfer_usdc.json
367+
cp examples/config/networks/ethereum_mainnet.json config/networks/ethereum_mainnet.json
367368
368369
# Stellar Configuration
369-
cp config/monitors/stellar_transfer_usdc.json.example config/monitors/stellar_transfer_usdc.json
370-
cp config/networks/stellar_mainnet.json.example config/networks/stellar_mainnet.json
370+
cp examples/config/monitors/stellar_swap_dex.json config/monitors/stellar_swap_dex.json
371+
cp examples/config/networks/stellar_mainnet.json config/networks/stellar_mainnet.json
371372
372373
# Notification Configuration
373-
cp config/triggers/email_notifications.json.example config/triggers/email_notifications.json
374-
cp config/triggers/slack_notifications.json.example config/triggers/slack_notifications.json
375-
cp config/triggers/discord_notifications.json.example config/triggers/discord_notifications.json
376-
cp config/triggers/telegram_notifications.json.example config/triggers/telegram_notifications.json
377-
cp config/triggers/webhook_notifications.json.example config/triggers/webhook_notifications.json
378-
cp config/triggers/script_notifications.json.example config/triggers/script_notifications.json
374+
cp examples/config/triggers/slack_notifications.json config/triggers/slack_notifications.json
375+
cp examples/config/triggers/email_notifications.json config/triggers/email_notifications.json
376+
377+
# Filter Configuration
378+
cp examples/config/filters/evm_filter_block_number.sh config/filters/evm_filter_block_number.sh
379+
cp examples/config/filters/stellar_filter_block_number.sh config/filters/stellar_filter_block_number.sh
379380
----
380381

381382
== Data Storage Configuration
@@ -1111,6 +1112,25 @@ For more information about custom scripts, see xref:scripts.adoc[Custom Scripts
11111112

11121113
=== Testing your configuration
11131114

1115+
==== Network Configuration
1116+
The `validate_network_config.sh` script helps ensure your network configuration is properly set up and operational. The script:
1117+
1118+
* Tests the health of all configured RPC endpoints
1119+
* Validates connectivity using network-specific methods
1120+
* Provides clear visual feedback for each endpoint
1121+
1122+
[source,bash]
1123+
----
1124+
# Test default networks directory (/config/networks/)
1125+
./scripts/validate_network_config.sh
1126+
1127+
# Test a specific configuration directory
1128+
./scripts/validate_network_config.sh -f /path/to/configs
1129+
----
1130+
1131+
TIP: Run this script when setting up new networks, before deploying configuration changes, or when troubleshooting connectivity issues.
1132+
1133+
==== Monitor Configuration
11141134
The monitor can be tested in two modes:
11151135

11161136
==== 1. Latest Block Mode

docs/modules/ROOT/pages/quickstart.adoc

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ Create the Ethereum mainnet network configuration:
150150

151151
[source,bash]
152152
----
153-
cp config/networks/ethereum_mainnet.json.example config/networks/ethereum_mainnet.json
153+
cp examples/config/networks/ethereum_mainnet.json config/networks/ethereum_mainnet.json
154154
----
155155

156-
The link:https://github.com/OpenZeppelin/openzeppelin-monitor/blob/main/config/networks/ethereum_mainnet.json.example[default configuration^] should work, but you may want to update the RPC URL to your preferred provider.
156+
The link:https://github.com/OpenZeppelin/openzeppelin-monitor/blob/main/examples/config/networks/ethereum_mainnet.json[default configuration^] should work, but you may want to update the RPC URL to your preferred provider.
157157

158158
[source,json]
159159
----
@@ -183,10 +183,11 @@ Create the USDC transfer monitor configuration:
183183

184184
[source,bash]
185185
----
186-
cp config/monitors/evm_transfer_usdc.json.example config/monitors/evm_transfer_usdc.json
186+
cp examples/config/monitors/evm_transfer_usdc.json config/monitors/evm_transfer_usdc.json
187+
cp examples/config/filters/evm_filter_block_number.sh config/filters/evm_filter_block_number.sh
187188
----
188189

189-
This link:https://github.com/OpenZeppelin/openzeppelin-monitor/blob/main/config/monitors/evm_transfer_usdc.json.example[configuration^] monitors USDC transfers over 10,000 USDC. You can customize the notification channels by modifying the `triggers` array.
190+
This link:https://github.com/OpenZeppelin/openzeppelin-monitor/blob/main/examples/config/monitors/evm_transfer_usdc.json[configuration^] monitors USDC transfers over 10,000 USDC. You can customize the notification channels by modifying the `triggers` array.
190191

191192
[source,json]
192193
----
@@ -264,10 +265,10 @@ Remove the `trigger_conditions` array to disable additional filtering.
264265

265266
[source,bash]
266267
----
267-
cp config/triggers/slack_notifications.json.example config/triggers/slack_notifications.json
268+
cp examples/config/triggers/slack_notifications.json config/triggers/slack_notifications.json
268269
----
269270

270-
Update the webhook URL in the link:https://github.com/OpenZeppelin/openzeppelin-monitor/blob/main/config/triggers/slack_notifications.json.example[configuration^].
271+
Update the webhook URL in the link:https://github.com/OpenZeppelin/openzeppelin-monitor/blob/main/examples/config/triggers/slack_notifications.json[configuration^].
271272

272273
[source,json]
273274
----
@@ -290,10 +291,10 @@ Update the webhook URL in the link:https://github.com/OpenZeppelin/openzeppelin-
290291

291292
[source,bash]
292293
----
293-
cp config/triggers/email_notifications.json.example config/triggers/email_notifications.json
294+
cp examples/config/triggers/email_notifications.json config/triggers/email_notifications.json
294295
----
295296

296-
Update the SMTP settings in the link:https://github.com/OpenZeppelin/openzeppelin-monitor/blob/main/config/triggers/email_notifications.json.example[configuration^].
297+
Update the SMTP settings in the link:https://github.com/OpenZeppelin/openzeppelin-monitor/blob/main/examples/config/triggers/email_notifications.json[configuration^].
297298

298299
[source,json]
299300
----
@@ -347,7 +348,7 @@ The monitor will now:
347348
* Adjust the transfer threshold by modifying the `expression` value.
348349
* Monitor additional ERC20 tokens by creating new monitor configurations.
349350
* xref:index.adoc#testing_your_configuration[Test the Monitor] configuration against a block number
350-
* Explore other examples in the link:https://github.com/OpenZeppelin/openzeppelin-monitor/tree/main/config/monitors[`config/monitors` directory].
351+
* Explore other examples in the link:https://github.com/OpenZeppelin/openzeppelin-monitor/tree/main/examples/config/monitors[`examples/config/monitors` directory].
351352

352353
=== Monitoring Dex Swaps (Stellar):
353354

@@ -357,10 +358,10 @@ Create the Stellar mainnet network configuration:
357358

358359
[source,bash]
359360
----
360-
cp config/networks/stellar_mainnet.json.example config/networks/stellar_mainnet.json
361+
cp examples/config/networks/examples/stellar_mainnet.json config/networks/stellar_mainnet.json
361362
----
362363

363-
The link:https://github.com/OpenZeppelin/openzeppelin-monitor/blob/main/config/networks/stellar_mainnet.json.example[default configuration^] should work, but you may want to update the RPC URL to your preferred provider.
364+
The link:https://github.com/OpenZeppelin/openzeppelin-monitor/blob/main/examples/config/networks/stellar_mainnet.json[default configuration^] should work, but you may want to update the RPC URL to your preferred provider.
364365

365366
[source,json]
366367
----
@@ -390,10 +391,11 @@ Create the large swap monitor configuration:
390391

391392
[source,bash]
392393
----
393-
cp config/monitors/stellar_swap_dex.json.example config/monitors/stellar_swap_dex.json
394+
cp examples/config/monitors/stellar_swap_dex.json config/monitors/stellar_swap_dex.json
395+
cp examples/config/filters/stellar_filter_block_number.sh config/filters/stellar_filter_block_number.sh
394396
----
395397

396-
This link:https://github.com/OpenZeppelin/openzeppelin-monitor/blob/main/config/monitors/stellar_swap_dex.json.example[configuration^] monitors large swaps of over 1,000,000,000 tokens. You can customize the notification channels by modifying the `triggers` array.
398+
This link:https://github.com/OpenZeppelin/openzeppelin-monitor/blob/main/examples/config/monitors/stellar_swap_dex.json[configuration^] monitors large swaps of over 1,000,000,000 tokens. You can customize the notification channels by modifying the `triggers` array.
397399

398400
[source,json]
399401
----
@@ -448,10 +450,10 @@ Remove the `trigger_conditions` array to disable additional filtering.
448450

449451
[source,bash]
450452
----
451-
cp config/triggers/slack_notifications.json.example config/triggers/slack_notifications.json
453+
cp examples/config/triggers/slack_notifications.json config/triggers/slack_notifications.json
452454
----
453455

454-
Update the webhook URL in the link:https://github.com/OpenZeppelin/openzeppelin-monitor/blob/main/config/triggers/slack_notifications.json.example[configuration^].
456+
Update the webhook URL in the link:https://github.com/OpenZeppelin/openzeppelin-monitor/blob/main/examples/config/triggers/slack_notifications.json[configuration^].
455457

456458
[source,json]
457459
----
@@ -497,4 +499,4 @@ The monitor will now:
497499
* Adjust the swap threshold by modifying the `expression` value.
498500
* Monitor additional dex swaps by creating new monitor configurations.
499501
* xref:index.adoc#testing_your_configuration[Test the Monitor] configuration against a block number
500-
* Explore other examples in the link:https://github.com/OpenZeppelin/openzeppelin-monitor/tree/main/config/monitors[`config/monitors` directory].
502+
* Explore other examples in the link:https://github.com/OpenZeppelin/openzeppelin-monitor/tree/main/examples/config/monitors[`examples/config/monitors` directory].

0 commit comments

Comments
 (0)