Skip to content

feat(morpho): group V2 pending alerts and improve cap formatting#322

Merged
spalen0 merged 1 commit into
mainfrom
feat/morpho-v2-cap-alert-formatting
Jul 24, 2026
Merged

feat(morpho): group V2 pending alerts and improve cap formatting#322
spalen0 merged 1 commit into
mainfrom
feat/morpho-v2-cap-alert-formatting

Conversation

@spalen0

@spalen0 spalen0 commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

What

Two improvements to the Morpho VaultV2 governance monitor, driven by these example alerts:

⚠️ ⏳ V2 Steakhouse Prime USDC on KATANA
📥 Submitted: increaseRelativeCap(collateral token 0x9893…19a7 → cap 1000000000000000000)
...
⚠️ ⏳ V2 Steakhouse Prime USDC on KATANA
📥 Submitted: increaseRelativeCap(market weETH/vbUSDC → cap 1000.00B vbUSDC)

1. Group per-vault pending alerts into one message

A batched multicall submit previously fired one Telegram message per operation. _diff_pending now collects all newly-submitted timelocked operations for a vault and sends a single grouped alert. When every op shares the same execution time and tx (the multicall case), those are shown once in the footer; otherwise they render per-op. Single-op alerts keep their original format.

2. Better cap-setter rendering

  • Collateral tokens link by symbol — e.g. collateral token [weETH](https://katanascan.com/address/0x9893…19a7), via a new assetByAddress fetch in _shared.py, falling back to the bare-address link when the symbol can't be resolved.
  • Relative caps render as percentagesincreaseRelativeCap values are WAD ratios (1e18 = 100%), not token amounts. Both example alerts are actually 1e18 = 100%; the market one was mis-rendered as 1000.00B vbUSDC. Now both the collateral-token and market paths show cap 100.0000%. Absolute caps keep token-amount formatting.

Result:

increaseRelativeCap(collateral token [weETH](katanascan/…) → cap 100.0000%)
increaseRelativeCap(market [weETH/vbUSDC](morpho/…) → cap 100.0000%)

Notes

  • Absolute caps on a collateral-token id still show the raw value: an absolute cap is denominated in the vault's underlying asset (not the collateral token), which the decoder doesn't have in scope. Not present in the example alerts.
  • fetch_asset_metadata is an uncached GraphQL call per collateral-token cap during rendering — consistent with the existing fetch_market_metadata pattern.

Testing

  • Added tests: grouped multi-op alert (shared footer), single-op format, collateral-token symbol link + relative-cap percentage, symbol-unresolved fallback, and the market relative-cap percentage path.
  • uv run pytest tests/ → 671 passed, 4 skipped. ruff check/format clean.

🤖 Generated with Claude Code

Group all newly-submitted timelocked operations for the same V2 vault
into a single Telegram message instead of one per operation (a batched
multicall submit previously produced N separate alerts).

Improve cap-setter rendering:
- Link collateral tokens by resolved symbol, e.g. [weETH](katanascan/...)
  via a new assetByAddress fetch, falling back to the bare address link.
- Render relative caps (increaseRelativeCap) as percentages (WAD ratio,
  1e18 = 100%) instead of a misleading token amount, for both the
  collateral-token and market id paths. Absolute caps keep token-amount
  formatting.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@spalen0
spalen0 marked this pull request as ready for review July 24, 2026 15:37
@spalen0
spalen0 merged commit 68779ab into main Jul 24, 2026
5 of 6 checks passed
@spalen0
spalen0 deleted the feat/morpho-v2-cap-alert-formatting branch July 24, 2026 15:38
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