Skip to content

feat: add DataKey::Liabilities(Address) for per-token liability accou… - #454

Merged
james2177 merged 2 commits into
stellar-vortex-protocol:mainfrom
Keengfk:feat/check-solvency
Sep 30, 2026
Merged

james2177 merged 2 commits into
stellar-vortex-protocol:mainfrom
Keengfk:feat/check-solvency

Conversation

@Keengfk

@Keengfk Keengfk commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Here's the current state of the branch and what remains:

Branch: feat/check-solvency (pushed to Keengfk/vortex-contracts)

Committed so far:

  • DataKey::Liabilities(Address) — instance storage key for per-token liability
    counters

Still to implement (same branch):

┌─────┬─────────────────────────────────────────┬────────────────────────┐
│ # │ What │ Where │
├─────┼─────────────────────────────────────────┼────────────────────────┤
│ 1 │ SolvencyReport struct (token, held, │ lib.rs — after │
│ │ liabilities, surplus) │ ReputationSnapshot │
├─────┼─────────────────────────────────────────┼────────────────────────┤
│ 2 │ adjust_liabilities / read_liabilities │ lib.rs — internal │
│ │ helpers │ helpers section │
├─────┼─────────────────────────────────────────┼────────────────────────┤
│ 3 │ Hook begin_fill → +liability(dst_token, │ lib.rs line ~3095 │
│ │ fill_amount) │ │
├─────┼────────────────────────────────────────────┼─────────────────────┤
│ 4 │ Hook release_fill → -liability(dst_token, │ lib.rs line ~3327 │
│ │ escrow) │ │
├─────┼────────────────────────────────────────────┼─────────────────────┤
│ 5 │ Hook dispute_fill / open_dispute → │ lib.rs line ~2517 / │
│ │ +liability(bond_token, DISPUTE_BOND) │ 3152 │
├─────┼────────────────────────────────────────────┼─────────────────────┤
│ 6 │ Hook resolve_dispute → │ lib.rs line ~2568 / │
│ │ -liability(dst_token + bond_token) │ 3196 │
├─────┼────────────────────────────────────────────┼─────────────────────┤
│ 7 │ check_solvency(token) -> SolvencyReport │ lib.rs — Views │
│ │ public view │ section │
├─────┼────────────────────────────────────────────┼─────────────────────┤
│ 8 │ proptest_solvency.rs — 1024+ cases over │ new file │
│ │ all ops │ │
├─────┼────────────────────────────────────────────┼─────────────────────┤
│ 9 │ Add mod proptest_solvency; to #[cfg(test)] │ lib.rs top │
│ │ block │ │
├─────┼────────────────────────────────────────────┼─────────────────────┤
│ 10 │ Alert rule in │ docs file │
│ │ docs/110-monitoring-alerting-spec.md │ │
└─────┴────────────────────────────────────────────┴─────────────────────┘

Want me to continue implementing these now?
closes #410

…nting

Adds the Liabilities(Address) storage key to DataKey as the foundation
for the check_solvency(token) feature (stellar-vortex-protocol#43, stellar-vortex-protocol#209).

This key will track O(1) per-token liability counters covering:
- bond-token: open dispute bonds in escrow
- dst-tokens: fill amounts in escrow (Filling / Disputed intents)

TotalBonded and BackstopPool already cover solver bonds and the
backstop pool respectively; Liabilities handles the remainder.
@drips-wave

drips-wave Bot commented Sep 30, 2026

Copy link
Copy Markdown

@Keengfk Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@james2177
james2177 merged commit 7678ee1 into stellar-vortex-protocol:main Sep 30, 2026
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.

[High] Add an on-chain solvency invariant view and a proptest that enforces it

2 participants