Skip to content

Add threshold alerts and oracle relay example#66

Merged
Miracle656 merged 1 commit into
Miracle656:mainfrom
ALIPHATICHYD:feature/64-65-threshold-alerts-oracle-relay
May 30, 2026
Merged

Add threshold alerts and oracle relay example#66
Miracle656 merged 1 commit into
Miracle656:mainfrom
ALIPHATICHYD:feature/64-65-threshold-alerts-oracle-relay

Conversation

@ALIPHATICHYD
Copy link
Copy Markdown
Contributor

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 #64
Closes #65

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
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@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! 🚀

Learn more about application limits

Copy link
Copy Markdown
Owner

@Miracle656 Miracle656 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both halves are well-executed.

Threshold alert extraction

  • crossesThreshold is edge-triggered (prev < threshold && current ≥ threshold for above), not level-triggered — that's the right semantics so a price sitting above the threshold doesn't spam alerts every poll.
  • deliverJsonWithRetries correctly differentiates 4xx (no retry — won't ever succeed) from network failures and 5xx (retry up to 3 attempts with 2^(attempt−1)·1s backoff). 10 s timeout per attempt.
  • HMAC over JSON.stringify(payload) with X-Lens-Signature matches the existing Lens convention.
  • webhookDispatcher.ts going −70/+4 confirms the extraction is clean — no logic forked.

Oracle relay example

  • Contract (set_price / get_price + DataKey::Price in instance storage) is the minimum-viable shape; perfect for a docs example. (For production you'd want i128 + scale instead of String, but starting simple is the right call here.)
  • relay.ts is a complete reference: configurable env, polls Lens REST /price/{a}/{b}, simulates → assembles → signs → submits via Soroban RPC. The --once flag in the help text is a nice touch for cron-style use.
  • README explains the wiring.

Merging. Closes #64, #65.

@Miracle656 Miracle656 merged commit 79e06aa into Miracle656:main May 30, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Price-feed-into-Soroban oracle relay Threshold alerts (server-pushed)

2 participants