Skip to content

feat: add deposit credit rollover for excess deposits#76

Open
Tranquil-Flow wants to merge 1 commit intodevfrom
54-deposit-credit-rollover
Open

feat: add deposit credit rollover for excess deposits#76
Tranquil-Flow wants to merge 1 commit intodevfrom
54-deposit-credit-rollover

Conversation

@Tranquil-Flow
Copy link
Copy Markdown

Summary

When a member deposits more than their fixedDeposit dues, the excess rolls over as credit for future epochs instead of reverting with ExceedsDepositAmount.

Changes

  • New mapping: memberDepositCredit[id][member] — tracks excess deposit credit
  • New view: getMemberDepositCredit(id, member)
  • Modified _deposit():
    • Auto-applies existing credit toward current epoch dues
    • Stores excess above fixedDeposit as credit (no more revert)
    • memberWithdrawableBalance only increases for effective deposits + consumed credit
  • Modified decommission(): Returns stored credit to members alongside withdrawable balance
  • Updated fuzz tests: SafetyNetFuzz_DepositWithdraw adapted for new credit behavior
  • Updated unit tests: ExceedsDepositAmount expectations replaced with credit assertions

Testing

5 new tests: credit accumulation, auto-consumption, partial consumption, excess handling, decommission return. All 102 tests pass.

Closes #54

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.

Should we carry excess deposits to next epoch(s)?

1 participant