Skip to content

feat(ethena): remove LlamaRisk backing check (API decommissioned) - #332

Merged
spalen0 merged 3 commits into
mainfrom
ethena-remove-llamarisk
Aug 2, 2026
Merged

feat(ethena): remove LlamaRisk backing check (API decommissioned)#332
spalen0 merged 3 commits into
mainfrom
ethena-remove-llamarisk

Conversation

@spalen0

@spalen0 spalen0 commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two related changes to the Ethena monitor:

  1. Remove the LlamaRisk backing check — its API was decommissioned.
  2. Restore on-chain USDe supply validation — decoupled from LlamaRisk, so the fix in (1) doesn't cost us the on-chain anchor.

1. LlamaRisk removal

GET https://api.llamarisk.com/protocols/ethena/overview/all/?format=json has returned HTTP 404 for 4 days, so llama_risk_check was firing [ethena] ⚠️ [LlamaRisk] Failed to fetch backing data on every run. The host now only serves aave-v4 routes (/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(), the LlamaRiskData/ChainMetrics dataclasses, the LLAMARISK_* constants, and the main() 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() (single totalSupply() call via ChainManager), wired into ethena_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 returns None on failure and never blocks the backing check.

Testing

  • LlamaRisk API confirmed dead: all /protocols/ethena/... paths 404; OpenAPI lists only health + aave-v4.
  • Live dry-run (real on-chain call): ratio 1.0167; on-chain supply matches API supply to 0.0000%, no alert.
  • Forced a 0.63% supply divergence → MEDIUM alert fires as expected.
  • ruff / mypy clean (only the pre-existing fetch_json Any-return); tests/test_monitoring_config.py 9/9.

Docs

protocols/ethena/README.md and monitoring.yaml updated — LlamaRisk sections removed, on-chain supply-consistency monitor documented.

🤖 Generated with Claude Code

spalen0 and others added 3 commits August 2, 2026 10:25
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>
@spalen0
spalen0 merged commit c377436 into main Aug 2, 2026
3 checks passed
@spalen0
spalen0 deleted the ethena-remove-llamarisk branch August 2, 2026 09:59
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.

1 participant