The watcher
The hard part of an alert is not sending it. It is not sending it.
A row that falls out of range fails silently. No transaction reverts, no balance drops, nothing asks for attention — it simply stops paying until the owner happens to look. Nothing else on this chain tells anyone, and the nearest comparable product shows a count inside its own app, visible only to someone who already opened it, which is precisely the person who does not need telling.
A scheduled job runs every five minutes, compares each watched row against the chain, and sends only on a change of state. The last known state is stored in a column; delivery happens on the transition and nowhere else. A row that sits out of range for a week produces one message, not two thousand.
That restraint is the entire feature. Anything that notifies on every check means twelve messages an hour for an unchanged condition, the user mutes it within a day, and the message that mattered gets muted along with it.
The correction worth recording is the threshold for "approaching an edge". The first design fired when the price came within five percent of a bound — and any row narrower than about ten percent is always within five percent of one of its own edges, including when the price sits dead centre. A flat threshold would have fired forever on exactly the tight rows it was meant to protect. It is now the smaller of five percent and a quarter of the row’s own half-width.
Delivery failures are isolated. One dead webhook is retried up to three times and then marked failed, visibly, while every other subscription in the same run goes out normally. The attempt count is a column rather than a count of rows, because counting rows would leave a duplicate event in the history for every retry.
How it was checked
- Seven consecutive runs against staged chain state: baseline sends nothing, the transition sends exactly one per subscription, three further runs send nothing while the state holds, the return sends one, the run after sends nothing.
- Six rejected sign-in cases: another domain inside the signature, a signature older than ten minutes, an altered message, a message signed by one address and claimed for another, a tampered token, and an expired one.
- Confirmed the scheduled endpoint is closed without the correct secret rather than open.
- Still outstanding: every test above used staged state. A real transition has not yet been witnessed end to end.
Deliberately left out
- No notification on every check. Covered above — it is the same as no notification at all, one day later.
- No separate scheduling service. The job runs on the same hosting as the app; another deploy target was not worth the load.