Conversation
Add centralized depeg monitoring using Redstone fundamental oracles where available (LBTC, cUSD) and DefiLlama market pricing as fallback for weETH, ezETH, rsETH, pufETH, osETH, rswETH, mETH and stablecoins. Oracle-based assets alert on any depeg (below 0.998). DefiLlama-based assets alert on 2%+ depeg (below 0.98). LRT alerts route to a single "lrt" channel with token symbol. Closes #196 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| STABLES_PROTOCOL = "stables" | ||
|
|
||
| # Oracle threshold: any meaningful depeg from fundamental oracle is critical | ||
| ORACLE_DEPEG_THRESHOLD = Decimal("0.998") |
There was a problem hiding this comment.
The README/Tenderly docs below say the cUSD alert threshold is 0.9998, but the implementation is using a shared 0.998 threshold for both LBTC and cUSD. On today's oracle read, cUSD was 0.99975473, which is below the documented Tenderly threshold but would not alert here. If cUSD is supposed to be treated as "any depeg is CRITICAL", this likely needs a per-asset threshold (or at least a stricter stable-specific oracle threshold).
| continue | ||
|
|
||
| if asset.underlying == "ETH": | ||
| ratio = price / eth_price |
There was a problem hiding this comment.
The fallback LRT path is using price / ETH_price as the depeg ratio, but the README just above documents fundamental exchange rates around 1.07-1.09 ETH for weETH/ezETH/rsETH/pufETH. That means a real several-percent depeg from fundamental can still stay above 0.98 and never alert here. For example, weETH at 1.03 ETH would be ~5.5% below a 1.09 fundamental, but this code would treat it as healthy. This needs a per-asset fair-value baseline (or off-chain fundamental feed), not a flat 1 ETH reference.
| # --------------------------------------------------------------------------- | ||
| DEFILLAMA_STABLES: list[DefiLlamaAsset] = [ | ||
| DefiLlamaAsset("FDUSD", "ethereum:0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409", "USD", STABLES_PROTOCOL), | ||
| DefiLlamaAsset("deUSD", "ethereum:0x15700B564Ca08D9439C58cA5053166E8317aa138", "USD", STABLES_PROTOCOL), |
There was a problem hiding this comment.
I dry-ran getCurrentPrices() against this exact key on 2026-04-22 and DefiLlama did not return a coin entry for ethereum:0x15700B564Ca08D9439C58cA5053166E8317aa138. Because missing prices are only logged and skipped, the PR currently advertises deUSD coverage without any alerting path if the asset disappears from the response. We should either fix the key/data source or escalate when a configured asset has no price so coverage failures are visible.
|
Review summary from local validation: Main findings are in the inline comments, but there are a few non-diff gaps that still block calling the test plan complete:
What I validated locally on 2026-04-22:
So the code path executes, but the monitor is still missing workflow wiring, secret plumbing, and the correctness fixes called out inline before I’d treat the PR as ready. |
|
Pushed cUSD threshold — fixed. LRT ratio vs flat 1 ETH — fixed. deUSD silent skip — fixed. Missing DefiLlama prices now fire one MEDIUM alert per channel ( Workflow wiring — fixed. Added Telegram env vars — fixed with one pushback:
Extra call-out not in review: USD0++ is a ~4-year locked bond that legitimately trades at a discount; a flat 0.98 threshold would have alerted constantly (your dry-run caught it at 0.9561). Gave it a per-asset Automated tests — not added in this pass; the monitor is mostly declarative config + a DefiLlama/RPC call. Happy to add a small unit test covering the deviation math + missing-price alert if you'd like a follow-up. |
Address PR review feedback: - Oracle threshold is now per-asset; cUSD uses 0.9998 to match the documented Tenderly alert (was 0.998, so cUSD=0.99975 slipped through). - DefiLlamaAsset now carries fair_value and threshold so accruing LRTs are checked against their accrued ETH rate instead of a flat 1:1 peg. USD0++ gets a looser 0.90 floor because it's a 4-year bond that legitimately trades at a discount. - Missing DefiLlama prices now raise a MEDIUM alert (e.g. deUSD on the dry-run date) so coverage failures are visible. - Wire prices/main.py into the hourly workflow and add TELEGRAM_BOT_TOKEN_LRT/STABLES plus TELEGRAM_CHAT_ID_STABLES to _run-monitoring.yml; update .env.example accordingly. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Summary
prices/module for depeg monitoring of LRTs and stablecoinslrtprotocol channel with token symbol identificationOracle Research Findings
0xb415...bc810x9a5a...434aCloses #196
Test plan
prices/main.pyto appropriate GitHub Actions workflowTELEGRAM_BOT_TOKEN_LRT/TELEGRAM_CHAT_ID_LRTandTELEGRAM_BOT_TOKEN_STABLES/TELEGRAM_CHAT_ID_STABLESsecrets🤖 Generated with Claude Code