Skip to content

feat(common): enforce strictly increasing MarginThresholds in validate() (#78) - #1135

Closed
jeffrey-graham wants to merge 1 commit into
DevTobis:mainfrom
jeffrey-graham:feat/margin-thresholds-validate-78
Closed

jeffrey-graham wants to merge 1 commit into
DevTobis:mainfrom
jeffrey-graham:feat/margin-thresholds-validate-78

Conversation

@jeffrey-graham

Copy link
Copy Markdown

Closes #78

Summary

  • Updates MarginThresholds::validate(&self) in contracts/common/src/margin.rs to enforce 0 < warning_bps < margin_call_bps < liquidation_bps <= 10_000 (MAX_LIQUIDATION_BPS = 10_000).
  • Verifies that pledge-vault, credit-line, and repo-dvp call thresholds.validate() on configure_asset.
  • Adds unit tests in ballast-common, pledge-vault, credit-line, and repo-dvp covering valid, zero, equal, reversed, and > 10_000 threshold configurations.

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.

Add MarginThresholds validation to ballast-common and use it from configure paths

1 participant