Skip to content

Conversation

@jordanschalm
Copy link
Member

@jordanschalm jordanschalm commented Jan 16, 2026

This PR improves documentation and adds TODOs.

(PS: Claude didn't write these comments, it only helped move them from another branch.)

jordanschalm and others added 3 commits January 16, 2026 09:25
This change introduces the _borrowOrCreateReserveVault helper function from the jord/liquidation branch, which simplifies reserve vault access patterns in the codebase.

Changes:
- Add _borrowOrCreateReserveVault helper to create reserves on-demand
- Use helper in liquidateRepayForSeize for debt reserve deposits
- Use helper in internalRepay for debt reserve deposits
- Remove redundant reserve creation in liquidateViaDex (handled by internal functions)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit adds comprehensive documentation improvements and TODO comments throughout the codebase to better track technical debt and clarify functionality.

Changes:
- Enhanced InternalPosition field documentation (targetHealth, minHealth, maxHealth)
- Added TODO comments to setDrawDownSink and setTopUpSource
- Improved InterestCurve interface documentation with parameter descriptions
- Enhanced TokenState totalCreditBalance and totalDebitBalance documentation
- Added blank line after balance update helpers comment block
- Added TODO comments to unused functions (updateCreditBalance, updateDebitBalance)
- Updated updateInterestIndices comment
- Added TODO for InterestCurve abstraction improvement
- Enhanced PositionView struct documentation for balances and snapshots fields
- Added TODO comments to healthFactor and maxWithdraw functions
- Added documentation TODOs to helper functions (computeAdjustedBalancesAfterWithdrawal, computeRequiredDepositForHealth, computeAvailableWithdrawal)
- Added permission system TODO to createPosition
- Added refactoring TODOs to large functions (depositAndPush, withdrawAndPull)
- Enhanced rebalancePosition documentation with detailed behavior description
- Added TODO for MOET type enforcement in rebalance logic

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Remove modifications to liquidateRepayForSeize, liquidateViaDex, and internalRepay as these functions will be removed in the future.

Changes reverted:
- liquidateRepayForSeize: Restore inline reserve creation for both seizeType and debtType
- liquidateViaDex: Restore reserve vault creation for both tokens
- internalRepay: Restore inline reserve creation and reference pattern

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@jordanschalm jordanschalm marked this pull request as ready for review January 16, 2026 21:22
@jordanschalm jordanschalm requested a review from a team as a code owner January 16, 2026 21:22
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.

Address logic duplication related to health factor calculation and BalanceSheet construction

2 participants