Skip to content

fix(3jane): align monitoring with live protocol state - #351

Merged
spalen0 merged 2 commits into
mainfrom
codex/fix-3jane-monitoring-consistency
Sep 11, 2026
Merged

fix(3jane): align monitoring with live protocol state#351
spalen0 merged 2 commits into
mainfrom
codex/fix-3jane-monitoring-consistency

Conversation

@tapired

@tapired tapired commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Combine junior-buffer and overcollateralization monitoring into one USD3 protection signal with mathematically equivalent thresholds.
  • Derive borrower grace and delinquency windows from live ProtocolConfig values instead of Envio snapshots.
  • Display the governed debt cap in waUSDC shares and include its USDC equivalent at the current conversion rate.

Why

The independent 15% junior-buffer threshold contradicted the existing 111% overcollateralization threshold and caused an alert while the corresponding OC check was healthy. A single protection check now presents both equivalent views of the same ratio.

Borrower timing must follow current protocol configuration. Envio remains the source of borrower state, while live grace and delinquency periods are read at the same Ethereum block used for the rest of the monitoring snapshot.

The debt cap returned by the contract is denominated in waUSDC shares. Labeling it directly as USD understated the effective cap, so the monitor now reports both its native unit and current USDC equivalent.

Verification

  • uv run --extra dev ruff check protocols/3jane/main.py tests/test_3jane.py
  • uv run --extra dev pytest -q (867 passed, 6 skipped, 5 subtests passed)
  • Live dry run with Telegram and cache writes disabled: 112.53% OC / 11.13% junior buffer, live 1-day grace / 97-day delinquency periods, 63.37M waUSDC debt cap / $75.09M USDC equivalent, and zero alerts.

@tapired
tapired requested a review from spalen0 September 9, 2026 15:06
The borrower default-watch dedupe key embedded snapshot.default_at, which
is derived from the live GRACE_PERIOD / DELINQUENCY_PERIOD values read from
ProtocolConfig. Any governance change to either period shifts default_at
for every borrower, invalidating all stored markers and re-sending the
delinquent/14d/7d/3d/1d/default milestones already delivered.

Key on market/borrower/cycle/bucket instead: the cycle id already scopes
the key to one obligation, and the milestone ladder is what we dedupe on.
This matches what the README already documented ("deduped per
borrower/cycle/default milestone").

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DCu8DmaNeuzuPTdtofofjW
@spalen0
spalen0 merged commit 4b6aa41 into main Sep 11, 2026
3 checks passed
@spalen0
spalen0 deleted the codex/fix-3jane-monitoring-consistency branch September 11, 2026 08:50
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.

2 participants