Skip to content

docs: add comprehensive NatSpec for redeemRatio and withdrawal formula#80

Open
Tranquil-Flow wants to merge 1 commit intodevfrom
29-risk-ratio-natspec
Open

docs: add comprehensive NatSpec for redeemRatio and withdrawal formula#80
Tranquil-Flow wants to merge 1 commit intodevfrom
29-risk-ratio-natspec

Conversation

@Tranquil-Flow
Copy link
Copy Markdown

Summary

Adds detailed NatSpec documentation for the redeemRatio mechanism and withdrawal formula — the core economic math of Safety Net.

Changes

  • ISafetyNet.sol: Expanded redeemRatio param docs — multiplier semantics, valid range (1-22), formula
  • SafetyNet.sol:
    • MINIMUM_REDEEM_RATIO / MAXIMUM_REDEEM_RATIO: Expanded NatSpec explaining the ratio caps
    • _withdraw(): 24-line NatSpec with step-by-step formula and worked example
    • _getDailyWithdrawableAmount(): 18-line NatSpec with numbered formula steps

Testing

1 new test test_RedeemRatioFormulaVerification — creates a Safety Net with redeemRatio=5, verifies:

  • Initial deposit → 5x withdrawable balance
  • Epoch deposit → 5x additional withdrawable
  • 1-day withdrawal = exact computed amount (1,666,666,666,666,666,666 wei)

All 98 tests pass.

Closes #29

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.

Develop a Context-Aware Risk Ratio Formula for Breadfunds Use Cases

1 participant