Commit 74a98a3
committed
feat: Implement receipt-based accounting to eliminate double-counting vulnerability class
- Add DepositReceipt and BorrowReceipt resource types
- Refactor InternalPosition to use receipt resources instead of mutable InternalBalance
- Update PositionView to use separate creditBalances/debitBalances dictionaries
- Update healthFactor(), maxWithdraw(), buildPositionView(), quoteLiquidation()
- Remove legacy InternalBalance struct with recordDeposit/recordWithdrawal methods
- All 47 tests passing
This refactoring ensures double-counting bugs cannot occur as the receipt
resource IS the record - there is no separate ledger to get out of sync.1 parent 5da5a4f commit 74a98a3
2 files changed
Lines changed: 868 additions & 379 deletions
0 commit comments