feat(ethena): remove LlamaRisk backing check (API decommissioned) - #332
Merged
Conversation
LlamaRisk decommissioned its Ethena transparency endpoint (api.llamarisk.com/protocols/ethena/overview/all/) — it has returned HTTP 404 for the last 4 days, so llama_risk_check has been firing "[LlamaRisk] Failed to fetch backing data" on every run. The host now only serves aave-v4 routes (/v1/aave-v4/...); there is no replacement Ethena path. Remove the LlamaRisk check and everything only it used: - llama_risk_check(), get_llamarisk_data(), get_tokens_supply() - LlamaRiskData / ChainMetrics dataclasses - LLAMARISK_URL / LLAMARISK_SOURCE and the now-unused web3/abi imports - the main() fan-out wrapper (single check runs directly again) The Ethena transparency check (with the reserve-fund fix) is unaffected and remains the sole backing check. README and monitoring.yaml updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Restore on-chain USDe supply validation, decoupled from the removed LlamaRisk check. Previously get_tokens_supply() only served llama_risk_check and was dropped with it, leaving the backing ratio's denominator fully dependent on Ethena's off-chain API with no on-chain anchor. Add get_usde_onchain_supply() (single totalSupply() call via ChainManager) and, at the end of ethena_backing_check, compare it to the API supply. A MEDIUM alert fires if they diverge by more than SUPPLY_DIFF_TRIGGER (0.5%), catching a misreporting API. The API figure stays the ratio denominator; the on-chain read is a tripwire and never blocks the check (returns None on failure). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The supply-consistency cross-check previously only logged and returned when get_usde_onchain_supply() failed (RPC down, provider missing, totalSupply() revert), so the advertised On-Chain Supply Consistency monitor would stop running silently. Send an operational error before skipping, matching the backing-data fetch path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Two related changes to the Ethena monitor:
1. LlamaRisk removal
GET https://api.llamarisk.com/protocols/ethena/overview/all/?format=jsonhas returned HTTP 404 for 4 days, sollama_risk_checkwas firing[ethena] ⚠️ [LlamaRisk] Failed to fetch backing dataon every run. The host now only servesaave-v4routes (/v1/aave-v4/...); its OpenAPI spec has no Ethena path and no replacement.Removed the check and everything only it used:
llama_risk_check(),get_llamarisk_data(),get_tokens_supply(), theLlamaRiskData/ChainMetricsdataclasses, theLLAMARISK_*constants, and themain()fan-out (single check runs directly again).2. On-chain supply cross-check (restored)
The old on-chain
totalSupply()reader only served the LlamaRisk check, so it was dropped with it — leaving the backing ratio's denominator fully dependent on Ethena's off-chain API with no on-chain anchor.Restored as
get_usde_onchain_supply()(singletotalSupply()call viaChainManager), wired intoethena_backing_check: the API supply figure stays the ratio denominator, but is now compared against on-chain ground truth, firing a MEDIUM alert if they diverge by >0.5% (SUPPLY_DIFF_TRIGGER). The on-chain read is a tripwire only — it returnsNoneon failure and never blocks the backing check.Testing
/protocols/ethena/...paths 404; OpenAPI lists onlyhealth+aave-v4.ruff/mypyclean (only the pre-existingfetch_jsonAny-return);tests/test_monitoring_config.py9/9.Docs
protocols/ethena/README.mdandmonitoring.yamlupdated — LlamaRisk sections removed, on-chain supply-consistency monitor documented.🤖 Generated with Claude Code