feat: add DataKey::Liabilities(Address) for per-token liability accou… - #454
Merged
james2177 merged 2 commits intoSep 30, 2026
Merged
Conversation
…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.
|
@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! 🚀 |
# Conflicts: # intent_settlement/src/lib.rs
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.
Here's the current state of the branch and what remains:
Branch: feat/check-solvency (pushed to Keengfk/vortex-contracts)
Committed so far:
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