Add threshold alerts and oracle relay example#66
Merged
Miracle656 merged 1 commit intoMay 30, 2026
Merged
Conversation
Summary: - Extracted threshold alert matching and webhook delivery into a small shared alerts module. - Added a minimal Soroban oracle contract example plus a Node relay that polls Lens and pushes prices periodically. - Documented the relay example and added a convenience script. Closes Miracle656#64 Closes Miracle656#65
|
@ALIPHATICHYD Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Miracle656
approved these changes
May 30, 2026
Owner
Miracle656
left a comment
There was a problem hiding this comment.
Both halves are well-executed.
Threshold alert extraction
crossesThresholdis edge-triggered (prev < threshold && current ≥ threshold forabove), not level-triggered — that's the right semantics so a price sitting above the threshold doesn't spam alerts every poll.deliverJsonWithRetriescorrectly differentiates 4xx (no retry — won't ever succeed) from network failures and 5xx (retry up to 3 attempts with2^(attempt−1)·1sbackoff). 10 s timeout per attempt.- HMAC over
JSON.stringify(payload)withX-Lens-Signaturematches the existing Lens convention. webhookDispatcher.tsgoing −70/+4 confirms the extraction is clean — no logic forked.
Oracle relay example
- Contract (
set_price/get_price+DataKey::Pricein instance storage) is the minimum-viable shape; perfect for a docs example. (For production you'd wanti128 + scaleinstead ofString, but starting simple is the right call here.) relay.tsis a complete reference: configurable env, polls Lens REST/price/{a}/{b}, simulates → assembles → signs → submits via Soroban RPC. The--onceflag in the help text is a nice touch for cron-style use.- README explains the wiring.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Closes #64
Closes #65