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
File tree
2 files changed
+868
-379
lines changed- cadence
- contracts
- tests
2 files changed
+868
-379
lines changed
0 commit comments